summaryrefslogtreecommitdiff
path: root/jarmon
diff options
context:
space:
mode:
authorRichard Wall <richard@largo>2011-01-16 20:30:16 +0000
committerRichard Wall <richard@largo>2011-01-16 20:30:16 +0000
commite37aeb47afd8d528c004eed5762287c5c99867e9 (patch)
tree52aa94ef141207970bc24121a916c19367e09b87 /jarmon
parentf7143a7a053c05ac9617d3557f583ce8cf223952 (diff)
position the add new chart button
Diffstat (limited to 'jarmon')
-rw-r--r--jarmon/jarmon.js23
1 files changed, 12 insertions, 11 deletions
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
$('<div/>').append(
$placeholder,
- $('<div/>').append(
+ $('<div/>', {'class': 'tab-controls'}).append(
$('<input/>', {
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();
}
);