diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-06-11 13:14:34 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-06-11 13:14:34 +0200 |
commit | bba7814efe68de9332e629df2de2f33c985819d1 (patch) | |
tree | b0e0a7710d57102a54dccf6e9d4d3d100266a321 | |
parent | c6f0755860b7a08b68375c534d1fae40dbaaf21d (diff) |
Simplify list inputs (remove add button)
-rw-r--r-- | plugins/managesieve/managesieve.js | 27 | ||||
-rw-r--r-- | plugins/managesieve/skins/classic/images/erase.png | bin | 0 -> 453 bytes | |||
-rw-r--r-- | plugins/managesieve/skins/classic/images/plus_minus.png | bin | 570 -> 0 bytes | |||
-rw-r--r-- | plugins/managesieve/skins/classic/managesieve.css | 12 | ||||
-rw-r--r-- | plugins/managesieve/skins/larry/images/erase.png | bin | 0 -> 453 bytes | |||
-rw-r--r-- | plugins/managesieve/skins/larry/images/plus_minus.png | bin | 570 -> 0 bytes | |||
-rw-r--r-- | plugins/managesieve/skins/larry/managesieve.css | 12 |
7 files changed, 16 insertions, 35 deletions
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 = '<span class="listelement">' - + '<span class="actions"><span class="add"></span><span class="reset"></span></span>' - + '<input type="text"></span>', + + '<span class="reset"></span><input type="text"></span>', 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 Binary files differnew file mode 100644 index 000000000..ddd3a9782 --- /dev/null +++ b/plugins/managesieve/skins/classic/images/erase.png diff --git a/plugins/managesieve/skins/classic/images/plus_minus.png b/plugins/managesieve/skins/classic/images/plus_minus.png Binary files differdeleted file mode 100644 index d92af25c2..000000000 --- a/plugins/managesieve/skins/classic/images/plus_minus.png +++ /dev/null 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 Binary files differnew file mode 100644 index 000000000..ddd3a9782 --- /dev/null +++ b/plugins/managesieve/skins/larry/images/erase.png diff --git a/plugins/managesieve/skins/larry/images/plus_minus.png b/plugins/managesieve/skins/larry/images/plus_minus.png Binary files differdeleted file mode 100644 index d92af25c2..000000000 --- a/plugins/managesieve/skins/larry/images/plus_minus.png +++ /dev/null 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; } |