diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-18 17:28:38 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-08-18 17:28:38 +0200 |
commit | 28c5883a27ae58ab347fd3d7b9f02ee00a39c4c9 (patch) | |
tree | 8235dbaa88f0a9f610b767ce58916034d045b62d /pyload/web | |
parent | new linkgrabber (diff) | |
download | pyload-28c5883a27ae58ab347fd3d7b9f02ee00a39c4c9.tar.xz |
renaming of packages
Diffstat (limited to 'pyload/web')
4 files changed, 48 insertions, 1 deletions
diff --git a/pyload/web/app/scripts/models/CollectorPackage.js b/pyload/web/app/scripts/models/CollectorPackage.js index 293342440..1bba59f67 100644 --- a/pyload/web/app/scripts/models/CollectorPackage.js +++ b/pyload/web/app/scripts/models/CollectorPackage.js @@ -20,6 +20,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'collection model.trigger('destroy', model, model.collection); }, + // overwrites original name + setName: function(name) { + this.set('new_name', name); + }, + // get the actual name getName: function() { var new_name = this.get('new_name'); diff --git a/pyload/web/app/scripts/views/linkgrabber/packageView.js b/pyload/web/app/scripts/views/linkgrabber/packageView.js index 97d00f722..89a307d2f 100644 --- a/pyload/web/app/scripts/views/linkgrabber/packageView.js +++ b/pyload/web/app/scripts/views/linkgrabber/packageView.js @@ -12,11 +12,14 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package' }, ui: { + 'name': '.name', 'table': 'table' }, events: { 'click .btn-expand': 'expand', + 'click .name': 'renamePackage', + 'keyup .name input': 'saveName', 'click .btn-add': 'addPackage', 'click .btn-delete': 'deletePackage', 'click .btn-mini': 'deleteLink' @@ -34,6 +37,17 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package' this.model.add(); }, + renamePackage: function() { + this.ui.name.addClass('edit'); + this.ui.name.find('input').focus(); + }, + + saveName: function(e) { + if (e.keyCode === 13) { + this.model.setName(this.ui.name.find('input').val()); + } + }, + deletePackage: function() { this.model.destroy(); }, diff --git a/pyload/web/app/styles/default/linkgrabber.less b/pyload/web/app/styles/default/linkgrabber.less index 364c9c420..39df28276 100644 --- a/pyload/web/app/styles/default/linkgrabber.less +++ b/pyload/web/app/styles/default/linkgrabber.less @@ -7,6 +7,30 @@ margin-bottom: 3px; } + .name { + padding: 0 2px; + + input { + display: none; + } + + &:hover { + border: 1px @grey dashed; + } + + &.edit { + border: none; + input { + display: inline; + } + + strong { + display: none; + } + } + + } + img { height: 22px; } diff --git a/pyload/web/app/templates/default/linkgrabber/package.html b/pyload/web/app/templates/default/linkgrabber/package.html index 54f6f4ad1..cd62e913b 100644 --- a/pyload/web/app/templates/default/linkgrabber/package.html +++ b/pyload/web/app/templates/default/linkgrabber/package.html @@ -1,4 +1,8 @@ -<strong>{{ name }}</strong> - <button class="btn btn-small btn-blue btn-expand"><i class="icon-arrow-down"></i> </button> <button class="btn btn-small btn-success btn-add"><i class="icon-plus"></i> </button> <button class="btn btn-small btn-danger btn-delete"><i class="icon-trash"></i> </button> <br> +<span class="name"> + <strong>{{name }}</strong> + <input type="text" value="{{name}}"> +</span> - +<button class="btn btn-small btn-blue btn-expand"><i class="icon-arrow-down"></i> </button> <button class="btn btn-small btn-success btn-add"><i class="icon-plus"></i> </button> <button class="btn btn-small btn-danger btn-delete"><i class="icon-trash"></i> </button> <br> <table class="table table-condensed" {{#unless expanded}}style="display: none"{{/unless}}> <tbody> {{#each links}} |