match exercise stub
[fnpeditor.git] / src / editor / views / dialog / dialog.js
index dff0b6f..0e45dd7 100644 (file)
@@ -28,7 +28,8 @@ define(function(require) {
         show: function() {
             this.setElement(this.template(_.extend({
                 executeButtonText: null,
-                cancelButtonText: null
+                cancelButtonText: null,
+                cssClass: ''
             }, this.options)));
 
             var body = this.$('.modal-body');
@@ -69,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', {
@@ -96,6 +100,10 @@ define(function(require) {
             this.$('.btn, button').toggleClass('disabled', !toggle);
             this.$('textarea').attr('disabled', !toggle);
             this.actionsDisabled = !toggle;
+        },
+        setContentView: function(view) {
+            var body = this.$('.modal-body');
+            body.append(view);
         }
     });