digirati-annotation-redux
Advanced tools
Comparing version 0.2.10 to 0.2.11
@@ -17,5 +17,7 @@ import uuid from 'uuid/v4'; | ||
export function createDraft(input, template) { | ||
var motivation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'tagging'; | ||
return function (dispatch, state) { | ||
var id = uuid(); | ||
dispatch({ type: DRAFT_CREATE, payload: { id: id, input: input, template: template } }); | ||
dispatch({ type: DRAFT_CREATE, payload: { id: id, input: input, template: template, motivation: motivation } }); | ||
dispatch(selectDraft(id)); | ||
@@ -22,0 +24,0 @@ var currentTemplate = getCurrentResourceTemplate(state()); |
@@ -53,7 +53,7 @@ import md5 from 'blueimp-md5'; | ||
export function sendAnnotation(body, target) { | ||
export function sendAnnotation(body, target, motivation) { | ||
return function (dispatch, state) { | ||
dispatch({ type: ELUCIDATE_SEND_ANNOTATION, payload: { annotation: { body: body, target: target } } }); | ||
dispatch({ type: ELUCIDATE_SEND_ANNOTATION, payload: { annotation: { body: body, target: target, motivation: motivation } } }); | ||
var collection = getCollectionId(state()); | ||
return sendAnnotationToServer(collection, body, target).then(function (annotation) { | ||
return sendAnnotationToServer(collection, body, target, motivation).then(function (annotation) { | ||
return dispatch(addElucidateAnnotation(annotation)); | ||
@@ -60,0 +60,0 @@ }); |
@@ -360,3 +360,3 @@ import _regeneratorRuntime from 'babel-runtime/regenerator'; | ||
export function sendAnnotationToServer(server, body, target) { | ||
export function sendAnnotationToServer(server, body, target, motivation) { | ||
return post(server, { | ||
@@ -366,4 +366,5 @@ '@context': CONTEXT, | ||
body: body, | ||
target: target | ||
target: target, | ||
motivation: motivation | ||
}); | ||
} |
@@ -24,2 +24,3 @@ import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; | ||
template: action.payload.template, | ||
motivation: action.payload.motivation, | ||
isPublishing: false, | ||
@@ -26,0 +27,0 @@ isPreviewing: false, |
@@ -38,5 +38,7 @@ 'use strict'; | ||
function createDraft(input, template) { | ||
var motivation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'tagging'; | ||
return function (dispatch, state) { | ||
var id = (0, _v2.default)(); | ||
dispatch({ type: DRAFT_CREATE, payload: { id: id, input: input, template: template } }); | ||
dispatch({ type: DRAFT_CREATE, payload: { id: id, input: input, template: template, motivation: motivation } }); | ||
dispatch(selectDraft(id)); | ||
@@ -43,0 +45,0 @@ var currentTemplate = (0, _resourceTemplateQuery.getCurrentResourceTemplate)(state()); |
@@ -71,7 +71,7 @@ 'use strict'; | ||
function sendAnnotation(body, target) { | ||
function sendAnnotation(body, target, motivation) { | ||
return function (dispatch, state) { | ||
dispatch({ type: ELUCIDATE_SEND_ANNOTATION, payload: { annotation: { body: body, target: target } } }); | ||
dispatch({ type: ELUCIDATE_SEND_ANNOTATION, payload: { annotation: { body: body, target: target, motivation: motivation } } }); | ||
var collection = (0, _elucidateQuery.getCollectionId)(state()); | ||
return (0, _elucidate.sendAnnotationToServer)(collection, body, target).then(function (annotation) { | ||
return (0, _elucidate.sendAnnotationToServer)(collection, body, target, motivation).then(function (annotation) { | ||
return dispatch(addElucidateAnnotation(annotation)); | ||
@@ -78,0 +78,0 @@ }); |
@@ -384,3 +384,3 @@ 'use strict'; | ||
function sendAnnotationToServer(server, body, target) { | ||
function sendAnnotationToServer(server, body, target, motivation) { | ||
return post(server, { | ||
@@ -390,4 +390,5 @@ '@context': CONTEXT, | ||
body: body, | ||
target: target | ||
target: target, | ||
motivation: motivation | ||
}); | ||
} |
@@ -38,2 +38,3 @@ 'use strict'; | ||
template: action.payload.template, | ||
motivation: action.payload.motivation, | ||
isPublishing: false, | ||
@@ -40,0 +41,0 @@ isPreviewing: false, |
{ | ||
"name": "digirati-annotation-redux", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"description": "Describe annotation-redux here", | ||
@@ -17,3 +17,4 @@ "main": "es/index.js", | ||
"test:coverage": "nwb test --coverage", | ||
"test:watch": "nwb test --server" | ||
"test:watch": "nwb test --server", | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -20,0 +21,0 @@ "dependencies": { |
91084
2384