editor: dialog - allow for hiding submit/cancel buttons
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 24 Mar 2014 14:51:29 +0000 (15:51 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 28 Mar 2014 15:22:11 +0000 (16:22 +0100)
For a button to show up, its label must be set explicitly.

src/editor/modules/data/data.js
src/editor/views/dialog/dialog.html
src/editor/views/dialog/dialog.js

index 3bb2c2c..540f896 100644 (file)
@@ -175,7 +175,8 @@ return function(sandbox) {
                 dialog = Dialog.create({
                     fields: documentSaveForm.fields,
                     title: gettext('Save Document'),
                 dialog = Dialog.create({
                     fields: documentSaveForm.fields,
                     title: gettext('Save Document'),
-                    executeButtonText: gettext('Save')
+                    executeButtonText: gettext('Save'),
+                    cancelButtonText: gettext('Cancel')
                 });
             
             dialog.on('execute', function(event) {
                 });
             
             dialog.on('execute', function(event) {
@@ -239,7 +240,8 @@ return function(sandbox) {
                 dialog = Dialog.create({
                     fields: documentRestoreForm.fields,
                     title: gettext('Restore Version'),
                 dialog = Dialog.create({
                     fields: documentRestoreForm.fields,
                     title: gettext('Restore Version'),
-                    executeButtonText: gettext('Restore')
+                    executeButtonText: gettext('Restore'),
+                    cancelButtonText: gettext('Cancel')
                 });
 
             dialog.on('execute', function(event) {
                 });
 
             dialog.on('execute', function(event) {
index 80c9fb2..1576831 100644 (file)
@@ -6,7 +6,11 @@
     <div class="modal-body">
     </div>
     <div class="modal-footer">
     <div class="modal-body">
     </div>
     <div class="modal-footer">
-        <a href="#" class="btn btn-info btn-mini execute-btn"><%= executeButtonText %></a>
-        <a href="#" class="btn btn-danger btn-mini cancel-btn"><%= cancelButtonText %></a>
+        <% if(executeButtonText) { %>
+            <a href="#" class="btn btn-info btn-mini execute-btn"><%= executeButtonText %></a>
+        <% } %>
+        <% if(cancelButtonText) { %>
+            <a href="#" class="btn btn-danger btn-mini cancel-btn"><%= cancelButtonText %></a>
+        <% } %>
     </div>
 </div>
\ No newline at end of file
     </div>
 </div>
\ No newline at end of file
index 04d8f74..bad349d 100644 (file)
@@ -1,6 +1,5 @@
 define(function(require) {
 
 define(function(require) {
 
-    /* globals gettext */
     'use strict';
 
     var _ = require('libs/underscore'),
     'use strict';
 
     var _ = require('libs/underscore'),
@@ -27,8 +26,8 @@ define(function(require) {
         },
         show: function() {
             this.setElement(this.template(_.extend({
         },
         show: function() {
             this.setElement(this.template(_.extend({
-                executeButtonText: gettext('Submit'),
-                cancelButtonText: gettext('Cancel')
+                executeButtonText: null,
+                cancelButtonText: null
             }, this.options)));
 
             var body = this.$('.modal-body');
             }, this.options)));
 
             var body = this.$('.modal-body');