From bba7814efe68de9332e629df2de2f33c985819d1 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 11 Jun 2013 13:14:34 +0200 Subject: Simplify list inputs (remove add button) --- plugins/managesieve/managesieve.js | 27 +++++++++------------ plugins/managesieve/skins/classic/images/erase.png | Bin 0 -> 453 bytes .../skins/classic/images/plus_minus.png | Bin 570 -> 0 bytes plugins/managesieve/skins/classic/managesieve.css | 12 ++------- plugins/managesieve/skins/larry/images/erase.png | Bin 0 -> 453 bytes .../managesieve/skins/larry/images/plus_minus.png | Bin 570 -> 0 bytes plugins/managesieve/skins/larry/managesieve.css | 12 ++------- 7 files changed, 16 insertions(+), 35 deletions(-) create mode 100644 plugins/managesieve/skins/classic/images/erase.png delete mode 100644 plugins/managesieve/skins/classic/images/plus_minus.png create mode 100644 plugins/managesieve/skins/larry/images/erase.png delete mode 100644 plugins/managesieve/skins/larry/images/plus_minus.png diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js index 117097ef1..299d4c3c2 100644 --- a/plugins/managesieve/managesieve.js +++ b/plugins/managesieve/managesieve.js @@ -718,32 +718,29 @@ function smart_field_row(value, name, idx, size) { // build row element content var input, content = '' - + '' - + '', + + '', elem = $(content), attrs = {value: value, name: name + '[]'}; if (size) attrs.size = size; - input = $('input', elem).attr(attrs) - .keydown(function(e) { if (e.which == 13) $('span[class="add"]', elem).click(); }); + input = $('input', elem).attr(attrs).keydown(function(e) { + var input = $(this); + // element creation event (on Enter) + if (e.which == 13) { + var name = input.attr('name').replace(/\[\]$/, ''), + dt = (new Date()).getTime(), + elem = smart_field_row('', name, dt, size); - // element creation event - $('span[class="add"]', elem).click(function() { - var span = $(this.parentNode.parentNode), - input = $('input', span), - name = input.attr('name').replace(/\[\]$/, ''), - dt = (new Date()).getTime(), - elem = smart_field_row('', name, dt, size); - - span.after(elem); - $('input', elem).focus(); + input.parent().after(elem); + $('input', elem).focus(); + } }); // element deletion event $('span[class="reset"]', elem).click(function() { - var span = $(this.parentNode.parentNode); + var span = $(this.parentNode); if (span.parent().children().length > 1) span.remove(); diff --git a/plugins/managesieve/skins/classic/images/erase.png b/plugins/managesieve/skins/classic/images/erase.png new file mode 100644 index 000000000..ddd3a9782 Binary files /dev/null and b/plugins/managesieve/skins/classic/images/erase.png differ diff --git a/plugins/managesieve/skins/classic/images/plus_minus.png b/plugins/managesieve/skins/classic/images/plus_minus.png deleted file mode 100644 index d92af25c2..000000000 Binary files a/plugins/managesieve/skins/classic/images/plus_minus.png and /dev/null differ diff --git a/plugins/managesieve/skins/classic/managesieve.css b/plugins/managesieve/skins/classic/managesieve.css index 5305b5242..4907c0e36 100644 --- a/plugins/managesieve/skins/classic/managesieve.css +++ b/plugins/managesieve/skins/classic/managesieve.css @@ -362,20 +362,12 @@ a.button.disabled box-shadow: none; } -.listelement .actions -{ - display: inline-block; - width: 32px; - height: 16px; - background: url(images/plus_minus.png) -1px 0 no-repeat #eee; -} - -.actions .add, -.actions .reset +.listelement .reset { display: inline-block; width: 16px; height: 16px; + background: url(images/erase.png) -1px -1px no-repeat #eee; cursor: pointer; } diff --git a/plugins/managesieve/skins/larry/images/erase.png b/plugins/managesieve/skins/larry/images/erase.png new file mode 100644 index 000000000..ddd3a9782 Binary files /dev/null and b/plugins/managesieve/skins/larry/images/erase.png differ diff --git a/plugins/managesieve/skins/larry/images/plus_minus.png b/plugins/managesieve/skins/larry/images/plus_minus.png deleted file mode 100644 index d92af25c2..000000000 Binary files a/plugins/managesieve/skins/larry/images/plus_minus.png and /dev/null differ diff --git a/plugins/managesieve/skins/larry/managesieve.css b/plugins/managesieve/skins/larry/managesieve.css index 058b6629b..7d28f79c7 100644 --- a/plugins/managesieve/skins/larry/managesieve.css +++ b/plugins/managesieve/skins/larry/managesieve.css @@ -377,20 +377,12 @@ fieldset box-shadow: none; } -.listelement .actions -{ - display: inline-block; - width: 32px; - height: 16px; - background: url(images/plus_minus.png) -1px -1px no-repeat #eee; -} - -.actions .add, -.actions .reset +.listelement .reset { display: inline-block; width: 16px; height: 16px; + background: url(images/erase.png) -1px -1px no-repeat #eee; cursor: pointer; } -- cgit v1.2.3