From dfbb7dbeb5551b7b60aa05e59855f628c2e001ea Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 4 Dec 2013 19:45:15 +0100 Subject: password field for linkgrabber --- pyload/web/app/scripts/models/CollectorPackage.js | 4 +++- pyload/web/app/scripts/views/linkgrabber/packageView.js | 11 ++++++++++- pyload/web/app/templates/default/linkgrabber/package.html | 10 ++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) (limited to 'pyload/web/app') diff --git a/pyload/web/app/scripts/models/CollectorPackage.js b/pyload/web/app/scripts/models/CollectorPackage.js index b608b8e18..9582c6af8 100644 --- a/pyload/web/app/scripts/models/CollectorPackage.js +++ b/pyload/web/app/scripts/models/CollectorPackage.js @@ -6,6 +6,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'collection idAttribute: 'name', defaults: { name: 'Unnamed package', + password: null, new_name: null, links: null }, @@ -41,7 +42,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'collection $.ajax(App.apiRequest('addPackage', {name: this.getName(), - links: links}, + links: links, + password: this.get('password')}, {success: function() { self.destroy(); App.vent.trigger('package:added'); diff --git a/pyload/web/app/scripts/views/linkgrabber/packageView.js b/pyload/web/app/scripts/views/linkgrabber/packageView.js index 356d39b4b..a9d04ced6 100644 --- a/pyload/web/app/scripts/views/linkgrabber/packageView.js +++ b/pyload/web/app/scripts/views/linkgrabber/packageView.js @@ -13,7 +13,8 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package' ui: { 'name': '.name', - 'table': 'table' + 'table': 'table', + 'password': '.password' }, events: { @@ -21,6 +22,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package' 'click .name': 'renamePackage', 'keyup .name input': 'saveName', 'click .btn-add': 'addPackage', + 'click .btn-password': 'togglePassword', 'click .btn-delete': 'deletePackage', 'click .btn-mini': 'deleteLink' }, @@ -35,6 +37,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package' addPackage: function(e) { e.stopPropagation(); + this.model.set('password', this.ui.password.val()); this.model.add(); return false; }, @@ -80,6 +83,12 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package' this.expanded ^= true; this.ui.table.toggle(); return false; + }, + + togglePassword: function(e) { + var el = $(e.target); + el.find('i').toggleClass('icon-lock icon-unlock'); + this.ui.password.toggle(); } }); diff --git a/pyload/web/app/templates/default/linkgrabber/package.html b/pyload/web/app/templates/default/linkgrabber/package.html index d5d4c669b..2efdc2b35 100644 --- a/pyload/web/app/templates/default/linkgrabber/package.html +++ b/pyload/web/app/templates/default/linkgrabber/package.html @@ -1,8 +1,14 @@ {{name }} - - -
+   + + + + + + {{#each links}} -- cgit v1.2.3