From 6e0413b2e036b8fff997bcd1d6017681cdd91cfd Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 22 Dec 2012 20:32:58 +0100 Subject: improved modal dialogs, added one for link grabber --- module/web/static/js/views/headerView.js | 44 ++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'module/web/static/js/views/headerView.js') diff --git a/module/web/static/js/views/headerView.js b/module/web/static/js/views/headerView.js index 6a4ac270d..9f7dda044 100644 --- a/module/web/static/js/views/headerView.js +++ b/module/web/static/js/views/headerView.js @@ -1,13 +1,16 @@ -define(['jquery', 'backbone', 'flot'], function($, Backbone){ +define(['jquery', 'backbone', 'flot'], function($, Backbone) { // Renders the header with all information return Backbone.View.extend({ el: 'header', events: { - + 'click .btn-grabber': 'open_grabber' }, + // Will hold the link grabber + grabber: null, + initialize: function() { var totalPoints = 100; @@ -38,21 +41,21 @@ define(['jquery', 'backbone', 'flot'], function($, Backbone){ var updateInterval = 1500; var speedgraph = $.plot(this.$el.find("#speedgraph"), [getRandomData()], { - series:{ - lines:{ show:true, lineWidth:2 }, - shadowSize:0, - color:"#fee247" + series: { + lines: { show: true, lineWidth: 2 }, + shadowSize: 0, + color: "#fee247" }, - xaxis:{ ticks:[], mode:"time" }, - yaxis:{ ticks:[], min:0, autoscaleMargin:0.1 }, - grid:{ - show:true, + xaxis: { ticks: [], mode: "time" }, + yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 }, + grid: { + show: true, // borderColor: "#757575", - borderColor:"white", - borderWidth:1, - labelMargin:0, - axisMargin:0, - minBorderMargin:0 + borderColor: "white", + borderWidth: 1, + labelMargin: 0, + axisMargin: 0, + minBorderMargin: 0 } }); @@ -68,8 +71,17 @@ define(['jquery', 'backbone', 'flot'], function($, Backbone){ }, - render: function() { + }, + + open_grabber: function() { + var self = this; + _.requireOnce(['views/linkGrabberModal'], function(modalView) { + if (self.grabber === null) + self.grabber = new modalView(); + + self.grabber.show(); + }); } }); }); \ No newline at end of file -- cgit v1.2.3