Commit fb28aca8 authored by Roque's avatar Roque

erp5_officejs: code cleanup and refactoring

parent d1b278bb
/*global window, rJS, RSVP, Query, SimpleQuery, ComplexQuery, console */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(function (window, rJS, RSVP, Query, SimpleQuery, ComplexQuery, console) {
"use strict";
// TODO: check if there are other categories that are 'views' and find a less hardcoded way to get this
var view_categorie_list = ["object_view", "object_jio_view", "object_web_view", "object_list"];
// TODO: check if there are other categories that are 'views'
// and find a less hardcoded way to get this
var view_categorie_list = ["object_view", "object_jio_view",
"object_web_view", "object_list"];
function filterViewList(views_dict, app_view, default_view) {
// there must be only one "View" action (title = "View")
// this is for scenarios were the portal type has several "View" (like view, jio_view, custom_view)
// this is for scenarios were the portal type has several "View"
// (like view, jio_view, custom_view)
// priority: app_view ; default_view ; other
var only_view, key,
view_list = Object.keys(views_dict).map(function (key) {
......@@ -48,7 +51,7 @@
}
} catch (e) {
if (e instanceof SyntaxError) {
console.log("Error while parsing configuration settings. Format error maybe?");
console.log("Error parsing configuration settings. Format error?");
console.log("Please check site configuration 'app_allowed_sub_types'");
console.log(e);
formatted_list = [];
......@@ -129,7 +132,9 @@
var path_for_jio_get_list = [], row;
for (row in action_list.data.rows) {
if (action_list.data.rows.hasOwnProperty(row)) {
path_for_jio_get_list.push(gadget.jio_get(action_list.data.rows[row].id));
path_for_jio_get_list.push(gadget.jio_get(action_list
.data.rows[row]
.id));
}
}
return RSVP.all(path_for_jio_get_list);
......@@ -149,17 +154,22 @@
action_type: action_doc.action_type,
parent_portal_type: portal_type
};
if (view_categorie_list.includes(action_settings.action_type)) {
if (view_categorie_list.includes(action_settings
.action_type)) {
action_settings.page = "ojs_local_controller";
action_info_dict.view_list[action_settings.action] = action_settings;
action_info_dict.view_list[action_settings.action] =
action_settings;
} else {
action_settings.page = "handle_action";
action_info_dict.action_list[action_settings.action] = action_settings;
action_info_dict.action_list[action_settings.action] =
action_settings;
}
}
}
}
action_info_dict.view_list = filterViewList(action_info_dict.view_list, app_view, default_view);
action_info_dict.view_list =
filterViewList(action_info_dict.view_list,
app_view, default_view);
return action_info_dict;
});
});
......@@ -189,7 +199,8 @@
return [form_type, child_gadget_url];
})
.declareMethod("getFormDefinition", function (portal_type, action_reference) {
.declareMethod("getFormDefinition", function (portal_type,
action_reference) {
var gadget = this,
query = buildSearchQuery(portal_type, action_reference),
action_type,
......@@ -208,7 +219,8 @@
})
.push(function (data) {
if (data.data.rows.length === 0) {
error = new Error("Can not find action '" + action_reference + "' for portal type '" + portal_type + "'");
error = new Error("Can not find action '" + action_reference +
"' for portal type '" + portal_type + "'");
error.status_code = 400;
throw error;
}
......@@ -218,18 +230,25 @@
action_title = action_result.title;
action_type = action_result.action_type;
if (action_result.action.includes("string:${object_url}")) {
action_result.action = action_result.action.replace("string:${object_url}", portal_skin_folder);
action_result.action = action_result.action
.replace("string:${object_url}", portal_skin_folder);
}
return gadget.jio_get(action_result.action);
})
.push(function (form_result) {
form_definition = form_result.raw_dict._embedded._view._embedded.form_definition;
form_definition.fields_raw_properties = form_result.raw_dict._embedded._view.my_fields_raw_properties["default"];
form_definition._actions = form_result.raw_dict._embedded._view._actions;
//[PATCH] if custom action and anonymous, get _actions field from fields_raw_properties
form_definition = form_result.raw_dict._embedded._view
._embedded.form_definition;
form_definition.fields_raw_properties = form_result.raw_dict
._embedded._view.my_fields_raw_properties["default"];
form_definition._actions = form_result.raw_dict._embedded
._view._actions;
//[PATCH] if custom action and anonymous
// get _actions field from fields_raw_properties
if ("_actions" in form_definition.fields_raw_properties) {
if (!form_definition._actions && action_type === "object_jio_js_script") {
form_definition._actions = form_definition.fields_raw_properties._actions;
if (!form_definition._actions &&
action_type === "object_jio_js_script") {
form_definition._actions = form_definition
.fields_raw_properties._actions;
}
delete form_definition.fields_raw_properties._actions;
}
......@@ -249,8 +268,10 @@
return gadget.getViewAndActionDict(portal_type);
})
.push(function (action_view_dict) {
form_definition.has_more_views = Object.keys(action_view_dict.view_list).length > 1;
form_definition.has_more_actions = Object.keys(action_view_dict.action_list).length > 0;
form_definition.has_more_views =
Object.keys(action_view_dict.view_list).length > 1;
form_definition.has_more_actions =
Object.keys(action_view_dict.action_list).length > 0;
return gadget.getSetting('hide_header_add_button');
})
.push(function (hide_add_button_setting) {
......
/*global document, window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(function (document, window, rJS, RSVP) {
"use strict";
......@@ -23,7 +23,7 @@
default_view,
app_view,
form_definition,
gadget_utils,
gadget_util,
jio_document,
portal_type,
front_page;
......@@ -37,10 +37,11 @@
]);
})
.push(function (result_list) {
gadget_utils = result_list[0];
gadget_util = result_list[0];
app_view = options.action || result_list[1];
default_view = result_list[2];
options.editable = ((result_list[3] == "1") ? true : options.editable);
options.editable = ((result_list[3] == "1") ?
true : options.editable);
return gadget.jio_get(options.jio_key);
})
.push(function (result) {
......@@ -64,19 +65,19 @@
portal_type = parent_portal_type;
}
front_page = portal_type === parent_portal_type;
return gadget_utils.getFormDefinition(portal_type, app_view);
return gadget_util.getFormDefinition(portal_type, app_view);
})
.push(function (result) {
return result;
}, function (error) {
if (error.status_code === 400) {
return gadget_utils.getFormDefinition(portal_type, default_view);
return gadget_util.getFormDefinition(portal_type, default_view);
}
throw error;
})
.push(function (result) {
form_definition = result;
return gadget_utils.getFormInfo(form_definition);
return gadget_util.getFormInfo(form_definition);
})
.push(function (form_info) {
var form_type = form_info[0],
......@@ -102,8 +103,8 @@
this.element.removeChild(this.element.firstChild);
}
this.element.appendChild(fragment);
return gadget.declareGadget("gadget_officejs_form_view.html", {element: fragment,
scope: 'form_view'})
return gadget.declareGadget("gadget_officejs_form_view.html",
{element: fragment, scope: 'form_view'})
.push(function (form_view_gadget) {
return form_view_gadget.render(gadget.state);
});
......@@ -130,7 +131,8 @@
return gadget.notifySubmitting();
})
.push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
return gadget.notifySubmitted({message: 'Data Updated',
status: 'success'});
});
})
......
......@@ -45,6 +45,42 @@
return result;
}
function renderForm(form_definition, context_document) {
var i, j, field_list, field_info, my_element, element_id, rendered_field,
raw_properties = form_definition.fields_raw_properties,
form_json = {
erp5_document: {
"_embedded": {"_view": {}},
"_links": {}
},
form_definition: form_definition
};
for (i = 0; i < form_definition.group_list.length; i += 1) {
field_list = form_definition.group_list[i][1];
for (j = 0; j < field_list.length; j += 1) {
my_element = field_list[j][0];
if (my_element.startsWith("my_")) {
element_id = my_element.replace("my_", "");
} else if (my_element.startsWith("your_")) {
element_id = my_element.replace("your_", "");
} else {
element_id = my_element;
}
if (element_id && raw_properties.hasOwnProperty(my_element)) {
field_info = raw_properties[my_element];
rendered_field = renderField(element_id, field_info,
context_document);
form_json.erp5_document._embedded._view[my_element] =
rendered_field;
}
}
}
form_json.erp5_document._embedded._view._actions =
form_definition._actions;
form_json.erp5_document._links = form_definition._links;
return form_json;
}
rJS(window)
/////////////////////////////////////////////////////////////////
// Acquired methods
......@@ -96,42 +132,6 @@
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("renderForm", function (form_definition, context_document) {
var i, j, fields, field_info, my_element, element_id, rendered_field,
raw_properties = form_definition.fields_raw_properties,
form_json = {
erp5_document: {
"_embedded": {"_view": {}},
"_links": {}
},
form_definition: form_definition
};
for (i = 0; i < form_definition.group_list.length; i += 1) {
fields = form_definition.group_list[i][1];
for (j = 0; j < fields.length; j += 1) {
my_element = fields[j][0];
if (my_element.startsWith("my_")) {
element_id = my_element.replace("my_", "");
} else if (my_element.startsWith("your_")) {
element_id = my_element.replace("your_", "");
} else {
element_id = my_element;
}
if (element_id && raw_properties.hasOwnProperty(my_element)) {
field_info = raw_properties[my_element];
rendered_field = renderField(element_id, field_info,
context_document);
form_json.erp5_document._embedded._view[my_element] =
rendered_field;
}
}
}
form_json.erp5_document._embedded._view._actions =
form_definition._actions;
form_json.erp5_document._links = form_definition._links;
return form_json;
})
.declareMethod("triggerSubmit", function (argument_list) {
return this.getDeclaredGadget('fg')
.push(function (gadget) {
......@@ -152,17 +152,13 @@
.onStateChange(function onStateChange() {
var fragment = document.createElement('div'),
gadget = this,
form_json;
return gadget.renderForm(gadget.state.form_definition, gadget.state.doc)
.push(function (json) {
form_json = json;
form_json = renderForm(gadget.state.form_definition, gadget.state.doc);
while (gadget.element.firstChild) {
gadget.element.removeChild(gadget.element.firstChild);
}
gadget.element.appendChild(fragment);
return gadget.declareGadget(gadget.state.child_gadget_url,
{element: fragment, scope: 'fg'});
})
{element: fragment, scope: 'fg'})
.push(function (form_gadget) {
return gadget.renderSubGadget(gadget.state.options, form_gadget,
form_json);
......
/*global window, window, rJS, jIO, RSVP, document, URLSearchParams, UriTemplate, console */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, jIO, RSVP, document, URLSearchParams, UriTemplate, console) {
/*jslint indent: 2, maxerr: 10, maxlen: 80 */
(function (window, rJS, jIO, RSVP, document, URLSearchParams, UriTemplate,
console) {
"use strict";
// jIO call wrapper for redirection to authentication page if needed
function wrapJioCall(gadget, method_name, argument_list) {
var storage = gadget.state_parameter_dict.jio_storage;
if (storage === undefined) {
return gadget.redirect({command: 'display', options: {page: 'ojs_configurator'}});
return gadget.redirect({command: 'display',
options: {page: 'ojs_configurator'}});
}
return storage[method_name].apply(storage, argument_list)
.push(undefined, function (error) {
......@@ -27,7 +29,8 @@
return gadget.redirect({
command: 'raw',
options: {
url: UriTemplate.parse(regexp.exec(login_page)[1]).expand({came_from: came_from})
url: UriTemplate.parse(regexp.exec(login_page)[1])
.expand({came_from: came_from})
}
});
});
......@@ -50,7 +53,8 @@
}
// User entered wrong password ?
// Notify
return gadget.notifySubmitted({message: 'Unauthorized storage access', status: 'error'})
return gadget.notifySubmitted({message: 'Unauthorized storage access',
status: 'error'})
.push(function () {
return gadget.redirect({command: 'display',
options: {page: 'ojs_configurator'}});
......@@ -61,19 +65,21 @@
}
function processHateoasDict(raw_dict) {
var raw_fields, type, parent, field_key, field_id, return_dict = {};
var raw_field_list, type, parent, field_key, field_id, return_dict = {};
return_dict.raw_dict = raw_dict;
/*jslint nomen: true*/
if (raw_dict.hasOwnProperty("_embedded") && raw_dict._embedded.hasOwnProperty("_view")) {
raw_fields = raw_dict._embedded._view;
if (raw_dict.hasOwnProperty("_embedded") &&
raw_dict._embedded.hasOwnProperty("_view")) {
raw_field_list = raw_dict._embedded._view;
type = raw_dict._links.type.name;
parent = raw_dict._links.parent.name;
return_dict.parent_relative_url = "portal_types/" + parent;
return_dict.portal_type = type;
for (field_key in raw_fields) {
if (raw_fields.hasOwnProperty(field_key)) {
for (field_key in raw_field_list) {
if (raw_field_list.hasOwnProperty(field_key)) {
field_id = "";
if (raw_fields[field_key]["default"] !== undefined && raw_fields[field_key]["default"] !== "") {
if (raw_field_list[field_key]["default"] !== undefined &&
raw_field_list[field_key]["default"] !== "") {
if (field_key.startsWith("my_")) {
field_id = field_key.replace("my_", "");
} else if (field_key.startsWith("your_")) {
......@@ -81,7 +87,7 @@
} else {
field_id = field_key;
}
return_dict[field_id] = raw_fields[field_key]["default"];
return_dict[field_id] = raw_field_list[field_key]["default"];
}
}
}
......@@ -109,7 +115,8 @@
var appcache_storage,
origin_url = window.location.href,
hateoas_script = "hateoas_appcache/ERP5Document_getHateoas",
// TODO manifest should come from gadget.props.cache_file -add script in html body
// TODO manifest should come from gadget.props.cache_file
// add script in html body
manifest = "gadget_officejs_text_editor.configuration",
jio_appchache_options = {
type: "replicate",
......@@ -144,7 +151,8 @@
if (jio_options === undefined) {
return;
}
jio_appchache_options.local_sub_storage = JSON.parse(JSON.stringify(jio_options));
jio_appchache_options.local_sub_storage = JSON.parse(
JSON.stringify(jio_options));
jio_options = {
type: 'dateupdater',
sub_storage: jio_options,
......@@ -173,9 +181,13 @@
for (id in attachment_dict) {
if (attachment_dict.hasOwnProperty(id)) {
if (id.indexOf(hateoas_script) === -1) {
promise_list.push(appcache_storage.getAttachment(origin_url, id));
promise_list.push(appcache_storage
.getAttachment(origin_url, id));
} else {
promise_list.push(appcache_storage.getAttachment(origin_url, id, {"format": "json"}));
promise_list.push(
appcache_storage
.getAttachment(origin_url, id,
{"format": "json"}));
}
configuration_ids_list[i] = id;
i += 1;
......@@ -203,9 +215,12 @@
.push(undefined);
});
}, function (error) {
console.log("Error while appcache-local storage synchronization");
if (error && error.currentTarget && error.currentTarget.status === "401") {
console.log("Unauthorized access to storage, sync cancelled");
console.log("Error while appcache-local " +
"storage synchronization");
if (error && error.currentTarget &&
error.currentTarget.status === "401") {
console.log("Unauthorized access to storage," +
"sync cancelled");
return;
}
throw error;
......
/*global window, rJS, RSVP, Handlebars */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(function (window, rJS, RSVP, Handlebars) {
"use strict";
......@@ -36,23 +36,8 @@
);
}
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("updateHeader", "updateHeader")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("getHTMLElementList", function (element_list) {
var gadget = this,
i = 0,
function getHTMLElementList(gadget, element_list) {
var i = 0,
element_info_list = [],
url_for_parameter_list = [],
element_info,
......@@ -60,8 +45,10 @@
for (key in element_list) {
if (element_list.hasOwnProperty(key)) {
element_info = element_list[key];
url_for_parameter_list.push({ command: 'change', options: element_info });
element_info_list[i] = { reference: element_info.reference, title: element_info.title};
url_for_parameter_list.push({ command: 'change',
options: element_info });
element_info_list[i] = { reference: element_info.reference,
title: element_info.title};
i += 1;
}
}
......@@ -77,7 +64,21 @@
}
return html_element_list;
});
})
}
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("updateHeader", "updateHeader")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("render", function (options) {
var gadget = this,
......@@ -98,15 +99,15 @@
.push(function (gadget_utils) {
// TODO views are also listed here
// should views be handled in another gadget like "..tab_office.js" ?
return gadget_utils.getViewAndActionDict(portal_type, options.jio_key);
return gadget_utils.getViewAndActionDict(portal_type,
options.jio_key);
})
.push(function (action_info_dict) {
return RSVP.all([
gadget.getHTMLElementList(action_info_dict.view_list),
gadget.getHTMLElementList(action_info_dict.action_list)
getHTMLElementList(gadget, action_info_dict.view_list),
getHTMLElementList(gadget, action_info_dict.action_list)
]);
})
// check other lists like clone or delete? NO. For now, they will be actions
.push(function (all_html_elements) {
return RSVP.all([
renderLinkList(gadget, "Views", "eye", all_html_elements[0]),
......@@ -115,7 +116,8 @@
})
.push(function (translated_html_link_list) {
gadget.element.innerHTML = translated_html_link_list.join("\n");
return gadget.getUrlFor({command: 'change', options: {page: undefined}});
return gadget.getUrlFor({command: 'change',
options: {page: undefined}});
})
.push(function (back_url) {
return gadget.updateHeader({
......
/*global window, document, rJS */
/*jslint nomen: true, indent: 2, maxerr: 13 */
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(function (window, document, rJS) {
"use strict";
......@@ -8,12 +8,6 @@
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("jio_get", "jio_get")
.declareAcquiredMethod("jio_allDocs", "jio_allDocs")
.declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("jio_post", "jio_post")
......@@ -22,7 +16,8 @@
// declared methods
/////////////////////////////////////////////////////////////////
.declareMethod("createDocument", function (portal_type, parent_portal_type) {
.declareMethod("createDocument", function (portal_type,
parent_portal_type) {
var gadget = this,
doc = {
title: "Untitled Document",
......@@ -67,9 +62,12 @@
return gadget.jio_get(new_content_action);
})
.push(function (form_result) {
form_definition = form_result.raw_dict._embedded._view._embedded.form_definition;
form_definition.fields_raw_properties = form_result.raw_dict._embedded._view.my_fields_raw_properties["default"];
form_definition._actions = form_result.raw_dict._embedded._view._actions;
form_definition = form_result.raw_dict._embedded._view
._embedded.form_definition;
form_definition.fields_raw_properties = form_result.raw_dict._embedded
._view.my_fields_raw_properties["default"];
form_definition._actions = form_result.raw_dict._embedded
._view._actions;
form_definition.group_list = form_result.raw_dict.group_list;
form_definition.title = "Create Document";
return gadget.changeState({
......@@ -93,15 +91,17 @@
this.element.removeChild(this.element.firstChild);
}
this.element.appendChild(fragment);
return gadget.declareGadget("gadget_officejs_form_view.html", {element: fragment,
scope: 'fg'})
return gadget.declareGadget("gadget_officejs_form_view.html",
{element: fragment, scope: 'fg'})
.push(function (form_view_gadget) {
return form_view_gadget.render(gadget.state);
});
} else {
// if there is only one sub portal type, skip create document dialog rendering
// if there is only one sub portal type
// skip create document dialog rendering
return gadget.createDocument(gadget.state.doc.portal_type[0],
gadget.state.parent_portal_type.replace(/ /g, '_').toLowerCase());
gadget.state.parent_portal_type
.replace(/ /g, '_').toLowerCase());
}
})
......@@ -109,7 +109,8 @@
var gadget = this,
content_dict = options[2];
return gadget.createDocument(content_dict.portal_type,
gadget.state.parent_portal_type.replace(/ /g, '_').toLowerCase());
gadget.state.parent_portal_type
.replace(/ /g, '_').toLowerCase());
});
}(window, document, rJS));
\ No newline at end of file
/*global window, document, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 10, maxlen: 80 */
(function (window, document, rJS, RSVP) {
"use strict";
......@@ -28,7 +28,8 @@
})
.push(function (result) {
parent_portal_type = result[0];
return result[1].getFormDefinition(parent_portal_type, action_reference);
return result[1].getFormDefinition(parent_portal_type,
action_reference);
});
})
......@@ -45,7 +46,9 @@
})
.push(function (result) {
if (result[0] !== undefined) { options.portal_type = result[0]; }
if (result[1] !== undefined) { options.parent_relative_url = result[1]; }
if (result[1] !== undefined) {
options.parent_relative_url = result[1];
}
action_reference = result[2];
gadget_util = result[3];
return gadget.getActionFormDefinition(action_reference);
......@@ -59,10 +62,12 @@
action_gadget_url,
form_type = form_info[0],
child_gadget_url = form_info[1],
//an action form must have a GadgetField called "gadget_field_new_action_js_script"
//an action form must have a GadgetField called
//"gadget_field_new_action_js_script"
//this gadget will point the custom action gadget
valid_action = form_definition.action_type === "object_jio_js_script" &&
form_definition.fields_raw_properties.hasOwnProperty("gadget_field_action_js_script"),
valid_action = form_definition.action_type ===
"object_jio_js_script" && form_definition.fields_raw_properties
.hasOwnProperty("gadget_field_action_js_script"),
state_options = {
doc: {},
action_options: options,
......@@ -73,9 +78,12 @@
valid_action: valid_action
};
if (valid_action) {
action_gadget_url = form_definition.fields_raw_properties.gadget_field_action_js_script.values.gadget_url;
// as custom gadget render is being done here, avoid to child gadget to render it
delete form_definition.fields_raw_properties.gadget_field_action_js_script;
action_gadget_url = form_definition.fields_raw_properties
.gadget_field_action_js_script.values.gadget_url;
// as custom gadget render is being done here
// avoid to child gadget to render it
delete form_definition.fields_raw_properties
.gadget_field_action_js_script;
gadget.element.appendChild(fragment);
return gadget.declareGadget(action_gadget_url, {
scope: "action_field",
......@@ -102,8 +110,8 @@
this.element.removeChild(this.element.firstChild);
}
this.element.appendChild(fragment);
return gadget.declareGadget("gadget_officejs_form_view.html", {element: fragment,
scope: 'fg'})
return gadget.declareGadget("gadget_officejs_form_view.html",
{element: fragment, scope: 'fg'})
.push(function (form_view_gadget) {
return form_view_gadget.render(gadget.state);
});
......@@ -136,7 +144,8 @@
return gadget.notifySubmitting();
})
.push(function () {
return gadget.notifySubmitted({message: 'Data Updated', status: 'success'});
return gadget.notifySubmitted({message: 'Data Updated',
status: 'success'});
})
.push(function () {
return gadget.redirect({
......@@ -148,7 +157,9 @@
});
});
} else {
return gadget.notifySubmitted({message: 'Could not perform this action: configuration error', status: 'fail'});
return gadget.notifySubmitted(
{message: 'Could not perform this action: configuration error',
status: 'fail'});
}
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment