From 4c2564ffacda88ac63df8a98d2835e96ccd806ed Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 27 Feb 2013 13:03:55 +0530 Subject: [PATCH] update EditableContent example --- .../forms/editable_elements/js/example.js | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/examples/forms/editable_elements/js/example.js b/examples/forms/editable_elements/js/example.js index e61e9f56..cc836a87 100644 --- a/examples/forms/editable_elements/js/example.js +++ b/examples/forms/editable_elements/js/example.js @@ -13,23 +13,40 @@ Ox.load('UI', function() { Ox.loop(1, 4, function(i) { Ox.$('') .addClass('label') - .html((i > 1 ? ' ' : '') + 'Editable ' + i + ': ') + .html((i > 1 ? ' ' : '') + 'SPAN #' + i + ': ') .appendTo($box); Ox.EditableContent({ - placeholder: 'Placeholder ' + i, + editing: i == 1, + placeholder: 'Placeholder', tooltip: 'Doubleclick to edit' }) + .bindEvent({ + submit: function(data) { + Ox.print(data.value); + } + }) .appendTo($box); }); Ox.$('
') .addClass('label') - .html('Editable 4:') + .html('DIV') .appendTo($box); Ox.EditableContent({ - placeholder: 'Placeholder 4', - tooltip: 'Doubleclick to edit', - type: 'div' + placeholder: 'Placeholder', + tooltip: function(e) { + var $target = $(e.target); + return $target.is('a') || $target.parents('a').length + ? 'Shift+doubleclick to edit' : 'Doubleclick to edit'; + }, + type: 'div', + value: 'This is a link.' + }) + .css({width: '512px'}) + .bindEvent({ + submit: function(data) { + Ox.print(data.value); + } }) .appendTo($box);