summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/examples/assets/css/style.css9
-rw-r--r--jarmon/jarmon.js23
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
$('<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();
}
);