From: Jan Szejko Date: Thu, 24 Mar 2016 15:28:41 +0000 (+0100) Subject: checkbox for cybernauts + checkbox fix in dialog.js X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/291bac0b1569b072f98e7622a64569330a1eb4e2?ds=inline checkbox for cybernauts + checkbox fix in dialog.js --- diff --git a/src/editor/entrypoint.js b/src/editor/entrypoint.js index b723517..ccc3738 100644 --- a/src/editor/entrypoint.js +++ b/src/editor/entrypoint.js @@ -40,8 +40,9 @@ '../../libs/ace/ace': { exports: 'ace' }, - } + }, + urlArgs: "bust=" + (new Date()).getTime() }); requirejs([ diff --git a/src/editor/modules/data/data.js b/src/editor/modules/data/data.js index 0d556a2..6e8ec93 100644 --- a/src/editor/modules/data/data.js +++ b/src/editor/modules/data/data.js @@ -196,6 +196,12 @@ return function(sandbox) { url: sandbox.getConfig().documentSaveUrl(data.document_id), data: formData, success: function(data) { + // ugly! + $.each(sandbox.getConfig().documentSaveForm.fields, function(i, field) { + if (field.name.indexOf('for_cybernauts') !== -1) { + field.checked = event.formData['textsave-for_cybernauts'] === 'on'; + } + }); event.success(); sandbox.publish('savingEnded', 'success', 'remote', data); diff --git a/src/editor/views/dialog/dialog.js b/src/editor/views/dialog/dialog.js index 7d9f775..0e45dd7 100644 --- a/src/editor/views/dialog/dialog.js +++ b/src/editor/views/dialog/dialog.js @@ -70,7 +70,10 @@ define(function(require) { (this.options.fields || []).forEach(function(field) { var widget = view.$('[name=' + field.name +']'); - formData[field.name] = widget.val(); + var widget_type = widget.attr('type'); + if (!(widget_type == 'checkbox' || widget_type == 'radio') || widget.is(':checked')) { + formData[field.name] = widget.val(); + } }); this.trigger('execute', { diff --git a/src/editor/views/dialog/templates/checkbox.html b/src/editor/views/dialog/templates/checkbox.html index a6ad457..8d80d8c 100644 --- a/src/editor/views/dialog/templates/checkbox.html +++ b/src/editor/views/dialog/templates/checkbox.html @@ -1,5 +1,7 @@ -
-
<%= label %>:
- +
+ <%= description %>
\ No newline at end of file