From 841d30bf4eda7a8658433d97b9c9a686c85b6e5a Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sat, 15 Jan 2011 15:34:41 +0000 Subject: decouple the chart coordinator html from the charts under its control. Also lighten the border of input text boxes. --- docs/examples/assets/css/style.css | 5 +++++ docs/examples/index.html | 15 +++++++------- jarmon/jarmon.js | 40 +++++++++++++++++++++++++++++++------- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/docs/examples/assets/css/style.css b/docs/examples/assets/css/style.css index 561b11e..10ecda9 100644 --- a/docs/examples/assets/css/style.css +++ b/docs/examples/assets/css/style.css @@ -75,6 +75,11 @@ input[type=checkbox] { border: none; } +input[type=text] { + padding: 3px; + border: 1px solid #EEE; +} + .notice { border: 1px solid Green; background: #FFDDFF; diff --git a/docs/examples/index.html b/docs/examples/index.html index e561b9e..6acf2b8 100644 --- a/docs/examples/index.html +++ b/docs/examples/index.html @@ -58,14 +58,13 @@
-
-
-

-
-
-
-
- +
+
+

+
+
+
+
diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js index d4f902c..731c06c 100644 --- a/jarmon/jarmon.js +++ b/jarmon/jarmon.js @@ -983,7 +983,7 @@ jarmon.TabbedInterface = function($tpl, recipe) { 'title': 'Add new tab' }).append( $('', {src: 'assets/icons/next.gif'}), - $('').hide() + $('', {'type': 'text'}).hide() ).appendTo(this.$tabBar); this.$tabPanels = $('
', {'class': 'css-panes charts'}).appendTo($tpl); @@ -1030,7 +1030,8 @@ jarmon.TabbedInterface = function($tpl, recipe) { var $originalLink = $(this); var $input = $('', { 'value': $originalLink.text(), - 'name': 'editTabTitle' + 'name': 'editTabTitle', + 'type': 'text' }) $originalLink.replaceWith($input); $input.focus(); @@ -1285,11 +1286,36 @@ jarmon.ChartCoordinator = function(ui, charts) { // When a selection is made on the range timeline, or any of my charts // redraw all the charts. - this.ui.bind("plotselected", function(event, ranges) { - self.ui.find('[name="from_standard"]').val('custom'); - self.setTimeRange(ranges.xaxis.from, ranges.xaxis.to); - self.update(); - }); + $(document).bind( + 'plotselected', + {self: this}, + function(e, ranges) { + var self = e.data.self; + var eventSourceIsMine = false; + + // plotselected event may be from my range selector chart or + if( self.ui.has(e.target) ) { + eventSourceIsMine = true; + } else { + // ...it may come from one of the charts under my supervision + for(var i=0; i 0) { + eventSourceIsMine = true; + break; + } + } + } + + if(eventSourceIsMine) { + // Update the prepared time range select box to value "custom" + self.ui.find('[name="from_standard"]').val('custom'); + + // Update all my charts + self.setTimeRange(ranges.xaxis.from, ranges.xaxis.to); + self.update(); + } + } + ); // Add dhtml calendars to the date input fields this.ui.find(".timerange_control img") -- cgit v1.2.3