summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views/queryModal.js
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-24 15:51:30 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-24 15:51:30 +0100
commit7ca154e613329050885b7c6a799488475266218e (patch)
tree6da18e4565766aee6a3f47f23dd0dfc396fec78e /module/web/static/js/views/queryModal.js
parentimplemented interactions for multi user, show waiting queries on webui (diff)
downloadpyload-7ca154e613329050885b7c6a799488475266218e.tar.xz
enter captchas on webui
Diffstat (limited to 'module/web/static/js/views/queryModal.js')
-rw-r--r--module/web/static/js/views/queryModal.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/module/web/static/js/views/queryModal.js b/module/web/static/js/views/queryModal.js
new file mode 100644
index 000000000..5d1585a0d
--- /dev/null
+++ b/module/web/static/js/views/queryModal.js
@@ -0,0 +1,54 @@
+define(['jquery', 'underscore', 'app', 'views/abstract/modalView', 'text!tpl/default/queryDialog.html'],
+ function($, _, App, modalView, template) {
+ return modalView.extend({
+
+ events: {
+ 'click .btn-success': 'submit',
+ 'submit form': 'submit'
+ },
+
+ model: null,
+ parent: null,
+ template: _.compile(template),
+
+ initialize: function() {
+ // Inherit parent events
+ this.events = _.extend({}, modalView.prototype.events, this.events);
+ },
+
+ renderContent: function() {
+ var data = {
+ title: this.model.get('title'),
+ plugin: this.model.get('plugin'),
+ description: this.model.get('description')
+ };
+
+ if (this.model.isCaptcha()) {
+ var input = this.model.get('input').data;
+ data.captcha = input[0];
+ data.type = input[1];
+ }
+
+ return data;
+ },
+
+ submit: function(e) {
+ e.stopPropagation();
+ // TODO: different input types
+ // TODO: load next task
+
+ this.model.set('result', this.$('input').val());
+ var self = this;
+ this.model.save({success: function() {
+ self.hide();
+ }});
+
+ this.$('input').val('');
+ },
+
+ onShow: function() {
+ this.$('input').focus();
+ }
+
+ });
+ }); \ No newline at end of file