summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wall <richard@largo>2011-01-09 23:22:19 +0000
committerRichard Wall <richard@largo>2011-01-09 23:22:19 +0000
commitaf306014da4a5c9e363a170cf86a742ffcb87862 (patch)
treec39db7fc412593c309082923e686e317c3a7e851
parent7a08bdc6fbd7400414fb4853de89d0a670daeffd (diff)
Editable tab titles
-rw-r--r--jarmon/jarmon.js29
1 files changed, 27 insertions, 2 deletions
diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js
index b4bd6e4..431e08b 100644
--- a/jarmon/jarmon.js
+++ b/jarmon/jarmon.js
@@ -992,8 +992,6 @@ jarmon.TabbedInterface = function($tpl, recipe) {
}
}
- this.setup();
-
this.newTab('+').append(
$('<form/>').append(
$('<div/>').append(
@@ -1018,6 +1016,33 @@ jarmon.TabbedInterface = function($tpl, recipe) {
);
this.setup();
+
+ $('ul.css-tabs > li > a', $tpl[0]).live(
+ 'dblclick',
+ function(e) {
+ var $originalLink = $(this);
+ var $input = $('<input/>', {
+ type: 'text',
+ name: 'tabTitle',
+ value: $originalLink.text()
+ });
+ $originalLink.replaceWith($input);
+ $input.focus();
+ }
+ );
+
+ $('ul.css-tabs > li > input', $tpl[0]).live(
+ 'blur',
+ {self: this},
+ function(e) {
+ var self = e.data.self;
+ $(this).replaceWith(
+ $('<a/>', {href: ['#', this.value].join('')}).text(this.value)
+ );
+ self.setup();
+ self.$tabBar.data("tabs").click(this.value);
+ }
+ );
};
jarmon.TabbedInterface.prototype.newTab = function(tabName) {