summaryrefslogtreecommitdiffstats
path: root/pyload/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/web/app')
-rw-r--r--pyload/web/app/index.html17
-rw-r--r--pyload/web/app/scripts/utils/dialogs.js5
-rw-r--r--pyload/web/app/scripts/views/abstract/modalView.js3
-rw-r--r--pyload/web/app/scripts/views/dashboard/dashboardView.js4
-rw-r--r--pyload/web/app/scripts/views/dashboard/filterView.js13
-rw-r--r--pyload/web/app/scripts/views/dashboard/selectionView.js2
-rw-r--r--pyload/web/app/scripts/views/notificationView.js10
-rw-r--r--pyload/web/app/scripts/views/queryModal.js6
-rw-r--r--pyload/web/app/templates/default/notification.html15
9 files changed, 42 insertions, 33 deletions
diff --git a/pyload/web/app/index.html b/pyload/web/app/index.html
index 28584587c..e8e28f4e1 100644
--- a/pyload/web/app/index.html
+++ b/pyload/web/app/index.html
@@ -19,6 +19,15 @@
<!-- endbuild -->
<script type="text/javascript">
+
+ // Use value set by templateEngine or default val
+ function configValue(string, defaultValue) {
+ if (string.indexOf('{{') > -1)
+ return defaultValue;
+
+ return string;
+ }
+
window.dates = {
weeks: ['week', 'weeks'],
days: ['day', 'days'],
@@ -27,13 +36,11 @@
seconds: ['second', 'seconds']
}; // TODO carefully when translating
- // TODO: use configured values
window.hostProtocol = window.location.protocol + '//';
window.hostAddress = window.location.hostname;
- window.hostPort = '8001';
- window.pathPrefix = "/";
-
- window.wsAddress = "ws://%s:7227"; // TODO
+ window.hostPort = configValue('{{web}}', '8001');
+ window.pathPrefix = '/';
+ window.wsAddress = configValue('{{ws}}', 'ws://%s:7227');
require(['config'], function(Config) {
require(['default'], function(App) {
diff --git a/pyload/web/app/scripts/utils/dialogs.js b/pyload/web/app/scripts/utils/dialogs.js
index 4933b7ed2..3ceffc9c3 100644
--- a/pyload/web/app/scripts/utils/dialogs.js
+++ b/pyload/web/app/scripts/utils/dialogs.js
@@ -5,10 +5,9 @@ define(['jquery', 'underscore', 'views/abstract/modalView'], function($, _, Moda
// Shows the confirm dialog for given context
// on success executes func with context
_.confirm = function(template, func, context) {
- template = 'text!tpl/' + template;
+ template = 'hbs!tpl/' + template;
_.requireOnce([template], function(html) {
- var template = _.compile(html);
- var dialog = new Modal(template, _.bind(func, context));
+ var dialog = new Modal(html, _.bind(func, context));
dialog.show();
});
diff --git a/pyload/web/app/scripts/views/abstract/modalView.js b/pyload/web/app/scripts/views/abstract/modalView.js
index 9d1d72869..65bc0a3c8 100644
--- a/pyload/web/app/scripts/views/abstract/modalView.js
+++ b/pyload/web/app/scripts/views/abstract/modalView.js
@@ -25,11 +25,10 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
this.onHideDestroy = true;
}
else
- require(['text!tpl/default/modal.html'], function(template) {
+ require(['hbs!tpl/dialogs/modal'], function(template) {
self.template = template;
});
}
-
},
// TODO: whole modal stuff is not very elegant
diff --git a/pyload/web/app/scripts/views/dashboard/dashboardView.js b/pyload/web/app/scripts/views/dashboard/dashboardView.js
index f305ac2f4..a7779230b 100644
--- a/pyload/web/app/scripts/views/dashboard/dashboardView.js
+++ b/pyload/web/app/scripts/views/dashboard/dashboardView.js
@@ -5,9 +5,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection',
// Renders whole dashboard
return Backbone.Marionette.ItemView.extend({
- // TODO: refactor
- active: $('.breadcrumb .active'),
-
template: template,
events: {
@@ -106,7 +103,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/TreeCollection',
pack.fetch({silent: true, success: function() {
console.log('Package ' + pack.get('pid') + ' loaded');
- self.active.text(pack.get('name'));
self.contentReady(pack.get('files'));
}, failure: function() {
self.failure();
diff --git a/pyload/web/app/scripts/views/dashboard/filterView.js b/pyload/web/app/scripts/views/dashboard/filterView.js
index ceb2a9a6e..79257547c 100644
--- a/pyload/web/app/scripts/views/dashboard/filterView.js
+++ b/pyload/web/app/scripts/views/dashboard/filterView.js
@@ -26,7 +26,8 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac
ui: {
'search': '.search-query',
'stateMenu': '.dropdown-toggle .state',
- 'select': '.btn-check'
+ 'select': '.btn-check',
+ 'name': '.breadcrumb .active'
},
template: template,
@@ -36,11 +37,12 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac
this.state = Api.DownloadState.All;
// Apply the filter before the content is shown
- App.vent.on('dashboard:contentReady', _.bind(this.apply_filter, this));
+ this.listenTo(App.vent, 'dashboard:contentReady', this.apply_filter);
+ this.listenTo(App.vent, 'dashboard:updated', this.updateName);
},
onRender: function() {
- // use our modified method
+ // use our modified method
$.fn.typeahead.Constructor.prototype.show = show;
this.ui.search.typeahead({
minLength: 2,
@@ -127,6 +129,11 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'models/Pac
return true;
},
+ updateName: function() {
+ // TODO
+// this.ui.name.text(App.dashboard.package.get('name'));
+ },
+
toggle_selection: function() {
App.vent.trigger('selection:toggle');
},
diff --git a/pyload/web/app/scripts/views/dashboard/selectionView.js b/pyload/web/app/scripts/views/dashboard/selectionView.js
index f25bf3cca..25b7998df 100644
--- a/pyload/web/app/scripts/views/dashboard/selectionView.js
+++ b/pyload/web/app/scripts/views/dashboard/selectionView.js
@@ -100,7 +100,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/dashboard/select'],
},
trash: function() {
- _.confirm('default/confirmDialog.html', function() {
+ _.confirm('dialogs/confirmDelete', function() {
var pids = [];
// TODO: delete many at once
diff --git a/pyload/web/app/scripts/views/notificationView.js b/pyload/web/app/scripts/views/notificationView.js
index abfcd8079..93d07a0f3 100644
--- a/pyload/web/app/scripts/views/notificationView.js
+++ b/pyload/web/app/scripts/views/notificationView.js
@@ -1,9 +1,9 @@
define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList', 'hbs!tpl/notification'],
- function($, Backbone, _, App, InteractionList, queryModal, template) {
+ function($, Backbone, _, App, InteractionList, template) {
'use strict';
// Renders context actions for selection packages and files
- return Backbone.View.extend({
+ return Backbone.Marionette.ItemView.extend({
// Only view for this area so it's hardcoded
el: '#notification-area',
@@ -23,8 +23,6 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList'
initialize: function() {
this.tasks = new InteractionList();
- this.$el.calculateHeight().height(0);
-
App.vent.on('interaction:added', _.bind(this.onAdd, this));
App.vent.on('interaction:deleted', _.bind(this.onDelete, this));
@@ -42,6 +40,10 @@ define(['jquery', 'backbone', 'underscore', 'app', 'collections/InteractionList'
this.tasks.remove(task);
},
+ onRender: function() {
+ this.$el.calculateHeight().height(0);
+ },
+
render: function() {
// only render when it will be visible
diff --git a/pyload/web/app/scripts/views/queryModal.js b/pyload/web/app/scripts/views/queryModal.js
index 7c6439b49..c748e1657 100644
--- a/pyload/web/app/scripts/views/queryModal.js
+++ b/pyload/web/app/scripts/views/queryModal.js
@@ -1,14 +1,13 @@
-define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inputLoader', 'text!tpl/default/queryDialog.html'],
+define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inputLoader', 'hbs!tpl/dialogs/interactionTask'],
function($, _, App, modalView, load_input, template) {
'use strict';
return modalView.extend({
- // TODO: submit on enter reloads the page sometimes
events: {
'click .btn-success': 'submit',
'submit form': 'submit'
},
- template: _.compile(template),
+ template: template,
// the notificationView
parent: null,
@@ -56,6 +55,7 @@ define(['jquery', 'underscore', 'app', 'views/abstract/modalView', './input/inpu
}});
this.input.clear();
+ return false;
},
onShow: function() {
diff --git a/pyload/web/app/templates/default/notification.html b/pyload/web/app/templates/default/notification.html
index 150b2800a..1b6d21e27 100644
--- a/pyload/web/app/templates/default/notification.html
+++ b/pyload/web/app/templates/default/notification.html
@@ -1,11 +1,10 @@
{{#if queries }}
-<span class="btn-query">
-Queries <span class="badge badge-info">{{ queries }}></span>
-</span>
+ <span class="btn-query">
+ Queries <span class="badge badge-info">{{ queries }}</span>
+ </span>
{{/if}}
{{#if notifications }}
-<span class="btn-notification">
-Notifications <span class="badge badge-success">{{ notifications }}</span>
-</span>
-{{/if}}
-</%if}} \ No newline at end of file
+ <span class="btn-notification">
+ Notifications <span class="badge badge-success">{{ notifications }}</span>
+ </span>
+{{/if}} \ No newline at end of file