summaryrefslogtreecommitdiffstats
path: root/pyload/web
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/web')
-rw-r--r--pyload/web/app/scripts/models/CollectorPackage.js4
-rw-r--r--pyload/web/app/scripts/views/linkgrabber/collectorView.js10
-rw-r--r--pyload/web/app/scripts/views/linkgrabber/modalView.js10
-rw-r--r--pyload/web/app/scripts/views/linkgrabber/packageView.js8
-rw-r--r--pyload/web/app/styles/default/linkgrabber.less15
-rw-r--r--pyload/web/app/templates/default/linkgrabber/package.html6
6 files changed, 46 insertions, 7 deletions
diff --git a/pyload/web/app/scripts/models/CollectorPackage.js b/pyload/web/app/scripts/models/CollectorPackage.js
index 1bba59f67..e5625d7bd 100644
--- a/pyload/web/app/scripts/models/CollectorPackage.js
+++ b/pyload/web/app/scripts/models/CollectorPackage.js
@@ -61,6 +61,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'collection
};
var links = this.get('links');
data.length = links.length;
+ data.size = 0;
data.online = 0;
data.offline = 0;
data.unknown = 0;
@@ -73,6 +74,9 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'collection
data.offline++;
else
data.unknown++;
+
+ if (link.get('size') > 0)
+ data.size += link.get('size');
});
return data;
diff --git a/pyload/web/app/scripts/views/linkgrabber/collectorView.js b/pyload/web/app/scripts/views/linkgrabber/collectorView.js
index d2b43f699..a02023a30 100644
--- a/pyload/web/app/scripts/views/linkgrabber/collectorView.js
+++ b/pyload/web/app/scripts/views/linkgrabber/collectorView.js
@@ -3,6 +3,15 @@ define(['jquery', 'underscore', 'backbone', 'app', './packageView'],
'use strict';
return Backbone.Marionette.CollectionView.extend({
itemView: packageView,
+
+ initialize: function() {
+ this.listenTo(App.vent, 'linkcheck:updated', _.bind(this.onData, this));
+ },
+
+ onData: function(rid, result) {
+ this.updateData({data: result});
+ },
+
updateData: function(result) {
var self = this;
_.each(result.data, function(links, name) {
@@ -16,6 +25,5 @@ define(['jquery', 'underscore', 'backbone', 'app', './packageView'],
pack.updateLinks(links);
});
}
-
});
}); \ No newline at end of file
diff --git a/pyload/web/app/scripts/views/linkgrabber/modalView.js b/pyload/web/app/scripts/views/linkgrabber/modalView.js
index 6e4781ac2..32730658c 100644
--- a/pyload/web/app/scripts/views/linkgrabber/modalView.js
+++ b/pyload/web/app/scripts/views/linkgrabber/modalView.js
@@ -4,6 +4,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v
// Modal dialog for package adding - triggers package:added when package was added
return modalView.extend({
+ className: 'modal linkgrabber',
events: {
'keypress #inputLinks': 'addOnEnter'
},
@@ -16,6 +17,7 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v
initialize: function() {
// Inherit parent events
this.events = _.extend({}, modalView.prototype.events, this.events);
+ this.listenTo(App.vent, 'package:added', _.bind(this.onAdded, this));
},
addOnEnter: function(e) {
@@ -44,6 +46,14 @@ define(['jquery', 'underscore', 'backbone', 'app', 'models/CollectorPackage', 'v
this.$('#inputLinks').val('');
},
+ // Hide when there are no more packages
+ onAdded: function() {
+ if (this.collectorView !== null) {
+ if (this.collectorView.collection.length === 0)
+ this.hide();
+ }
+ },
+
onRender: function() {
// anonymous collection
this.collectorView = new CollectorView({collection: new (Backbone.Collection.extend({
diff --git a/pyload/web/app/scripts/views/linkgrabber/packageView.js b/pyload/web/app/scripts/views/linkgrabber/packageView.js
index 89a307d2f..95c46e3cc 100644
--- a/pyload/web/app/scripts/views/linkgrabber/packageView.js
+++ b/pyload/web/app/scripts/views/linkgrabber/packageView.js
@@ -33,8 +33,10 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package'
return data;
},
- addPackage: function() {
+ addPackage: function(e) {
+ e.stopPropagation();
this.model.add();
+ return false;
},
renamePackage: function() {
@@ -63,9 +65,11 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package'
this.render();
},
- expand: function() {
+ expand: function(e) {
+ e.stopPropagation();
this.expanded ^= true;
this.ui.table.toggle();
+ return false;
}
});
diff --git a/pyload/web/app/styles/default/linkgrabber.less b/pyload/web/app/styles/default/linkgrabber.less
index 39df28276..8ed6d1dc5 100644
--- a/pyload/web/app/styles/default/linkgrabber.less
+++ b/pyload/web/app/styles/default/linkgrabber.less
@@ -1,10 +1,19 @@
+.linkgrabber {
+ width: 700px !important;
+}
+
.prepared-packages {
hr {
margin: 0;
}
- .package > .btn {
- margin-bottom: 3px;
+ .package {
+ margin-bottom: 10px;
+
+ & > .btn {
+ margin-bottom: 3px;
+ }
+
}
.name {
@@ -18,7 +27,7 @@
border: 1px @grey dashed;
}
- &.edit {
+ &.edit {
border: none;
input {
display: inline;
diff --git a/pyload/web/app/templates/default/linkgrabber/package.html b/pyload/web/app/templates/default/linkgrabber/package.html
index cd62e913b..ed699f0d5 100644
--- a/pyload/web/app/templates/default/linkgrabber/package.html
+++ b/pyload/web/app/templates/default/linkgrabber/package.html
@@ -9,6 +9,7 @@
<tr>
<td>{{ name }}</td>
<td><img src="{{ pluginIcon plugin }}"> {{ plugin }}</td>
+ <td>{{formatSize size }}</td>
<td>{{ linkStatus status }}</td>
<td><button class="btn btn-danger btn-mini" data-index={{@index}}><i class="icon-trash"></i></button></td>
</tr>
@@ -16,7 +17,10 @@
</tbody>
</table>
<hr>
-{{ ngettext "%d link" "%d links" length }}:
+{{ ngettext "%d link" "%d links" length }}
+{{#if size}}
+ - {{formatSize size}}
+{{/if}} :
{{#if online}}
<span class="text-success">
{{ online }} {{_ "online" }}