summaryrefslogtreecommitdiffstats
path: root/module/web/static/js/views
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/static/js/views')
-rw-r--r--module/web/static/js/views/headerView.js1
-rw-r--r--module/web/static/js/views/modal/modalView.js24
-rw-r--r--module/web/static/js/views/packageView.js23
3 files changed, 29 insertions, 19 deletions
diff --git a/module/web/static/js/views/headerView.js b/module/web/static/js/views/headerView.js
index 0c6447c3e..21b591a3d 100644
--- a/module/web/static/js/views/headerView.js
+++ b/module/web/static/js/views/headerView.js
@@ -9,7 +9,6 @@ define(['jquery', 'backbone', 'flot', 'jqueryui/progressbar'], function($, Backb
},
initialize: function() {
- this.$el.find("#globalprogress").progressbar({ value:37 });
var totalPoints = 100;
var data = [];
diff --git a/module/web/static/js/views/modal/modalView.js b/module/web/static/js/views/modal/modalView.js
index efc0cc3cb..b20aab57d 100644
--- a/module/web/static/js/views/modal/modalView.js
+++ b/module/web/static/js/views/modal/modalView.js
@@ -1,11 +1,14 @@
-define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, _) {
+define(['jquery', 'backbone', 'underscore', 'text!tpl/default/modal.html', 'omniwindow'], function($, Backbone, _, template) {
return Backbone.View.extend({
events: {
-
+ 'click .btn-close': 'hide',
+ 'click .close': 'hide'
},
+ template: _.template(template),
+
dialog: null,
initialize: function() {
@@ -13,16 +16,15 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
},
render: function() {
- this.$el.addClass('modal');
- this.$el.addClass('modal-closed');
- this.$el.append(this.renderContent());
+ this.$el.html(this.template({ content: this.renderContent().html(), header: this.getHeader()}));
+ this.$el.addClass('modal hide');
this.$el.css({opacity: 0, scale: 0.7});
$("body").append(this.el);
this.dialog = this.$el.omniWindow({
overlay: {
selector: '#modal-overlay',
- hideClass: 'modal-closed',
+ hideClass: 'hide',
animations: {
hide: function(subjects, internalCallback) {
subjects.overlay.fadeOut(400, function() {
@@ -35,7 +37,7 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
});
}}},
modal: {
- hideClass: 'modal-closed',
+ hideClass: 'hide',
animations: {
hide: function(subjects, internalCallback) {
subjects.modal.transition({opacity: 'hide', scale: 0.7}, 250, function() {
@@ -53,7 +55,11 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
return this;
},
renderContent: function() {
- return $('<h1>Dialog</h1>');
+ return $('<h1>Content!</h1>');
+ },
+
+ getHeader: function() {
+ return 'Dialog';
},
show: function() {
@@ -61,6 +67,8 @@ define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone,
this.render();
this.dialog.trigger('show');
+
+ // TODO: set focus on first element
},
hide: function() {
diff --git a/module/web/static/js/views/packageView.js b/module/web/static/js/views/packageView.js
index b820b9ba8..171325d1f 100644
--- a/module/web/static/js/views/packageView.js
+++ b/module/web/static/js/views/packageView.js
@@ -1,5 +1,5 @@
-define(['jquery', 'backbone', 'underscore', 'views/fileView', 'views/modal/modalView'],
- function($, Backbone, _, fileView, modalView) {
+define(['jquery', 'backbone', 'underscore', 'views/fileView', 'utils/lazyRequire'],
+ function($, Backbone, _, fileView, lazyLoader) {
// Renders a single package item
return Backbone.View.extend({
@@ -8,10 +8,11 @@ define(['jquery', 'backbone', 'underscore', 'views/fileView', 'views/modal/modal
events: {
'click .load': 'load',
'click .delete': 'delete',
- 'click .show': 'show'
+ 'click .show-dialog': 'show'
},
modal: null,
+ requireOnce: lazyLoader.once(),
initialize: function() {
this.model.on('change', this.render, this);
@@ -22,7 +23,7 @@ define(['jquery', 'backbone', 'underscore', 'views/fileView', 'views/modal/modal
this.$el.html('Package ' + this.model.get('pid') + ': ' + this.model.get('name'));
this.$el.append($('<a class="load" href="#"> Load</a>'));
this.$el.append($('<a class="delete" href="#"> Delete</a>'));
- this.$el.append($('<a class="show" href="#"> Show</a>'));
+ this.$el.append($('<a class="show-dialog" href="#"> Show</a>'));
if (this.model.isLoaded()) {
var ul = $('<ul></ul>');
@@ -47,11 +48,13 @@ define(['jquery', 'backbone', 'underscore', 'views/fileView', 'views/modal/modal
},
show: function() {
- if (this.modal === null)
- this.modal = new modalView();
-
- this.modal.show();
- }
-
+ var self = this;
+ this.requireOnce(['views/modal/modalView'], function(modalView){
+ if (self.modal === null)
+ self.modal = new modalView();
+
+ self.modal.show();
+ });
+ }
});
}); \ No newline at end of file