editor: openSelect view - expose setInput on the view object
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 25 Mar 2014 13:04:29 +0000 (14:04 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 25 Mar 2014 13:04:29 +0000 (14:04 +0100)
src/editor/views/openSelect/openSelect.js

index cc94854..718a4a0 100644 (file)
@@ -36,11 +36,14 @@ var OpenSelect = Backbone.View.extend({
         this.menu.empty();
         this.toggleHandler(false);
     },
         this.menu.empty();
         this.toggleHandler(false);
     },
-    onSelection: function(e) {
-        var val = $(e.target).text();
+    setInput: function(value) {
         if(this.options.setInput) {
         if(this.options.setInput) {
-            this.options.setInput(this.input, val);
+            this.options.setInput(this.input, value);
         }
         }
+    },
+    onSelection: function(e) {
+        var val = $(e.target).text();
+        this.setInput(val);
         this.trigger('itemSelected', this.input.val());
     }
 });
         this.trigger('itemSelected', this.input.val());
     }
 });