From e37aeb47afd8d528c004eed5762287c5c99867e9 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sun, 16 Jan 2011 20:30:16 +0000 Subject: position the add new chart button --- docs/examples/assets/css/style.css | 9 +++++++++ jarmon/jarmon.js | 23 ++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/examples/assets/css/style.css b/docs/examples/assets/css/style.css index 982398b..e82ec30 100644 --- a/docs/examples/assets/css/style.css +++ b/docs/examples/assets/css/style.css @@ -109,3 +109,12 @@ input[type=text] { float: right; margin: 0; } + +.tab-controls { + width: 790px; + padding: 5px 0 5px 0; + margin: 20px auto 0 auto; + text-align: right; + position: relative; + left: 25px; +} diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js index 0ba2e32..1dda6a8 100644 --- a/jarmon/jarmon.js +++ b/jarmon/jarmon.js @@ -1084,7 +1084,7 @@ jarmon.TabbedInterface.prototype.newTab = function(tabName) { // Add tab panel $('
').append( $placeholder, - $('
').append( + $('
', {'class': 'tab-controls'}).append( $('', { type: 'button', value: 'Add new chart', @@ -1124,15 +1124,6 @@ jarmon.buildTabbedChartUi = function ($chartTemplate, chartRecipes, var charts = jQuery.map( ti.placeholders, function(el, i) { - /* - $('.graph-legend input[name=chart_edit]', this.template[0]).live( - 'click', - {self: this}, - function(e) { - - } - ); - */ var chart = new jarmon.Chart( $chartTemplate.clone().appendTo(el[1]), chartRecipes[el[0]], @@ -1144,7 +1135,17 @@ jarmon.buildTabbedChartUi = function ($chartTemplate, chartRecipes, {chart: chart}, function(e) { var chart = e.data.chart; - new jarmon.ChartEditor($(this).closest('.chart-container').find('.graph-legend'), chart).draw(); + new jarmon.ChartEditor( + chart.template.find('.graph-legend'), chart).draw(); + } + ); + + $('input[name=chart_delete]', el[1][0]).live( + 'click', + {chart: chart}, + function(e) { + var chart = e.data.chart; + chart.template.remove(); } ); -- cgit v1.2.3