summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-11 13:14:34 +0200
committerAleksander Machniak <alec@alec.pl>2013-06-11 13:14:34 +0200
commitbba7814efe68de9332e629df2de2f33c985819d1 (patch)
treeb0e0a7710d57102a54dccf6e9d4d3d100266a321
parentc6f0755860b7a08b68375c534d1fae40dbaaf21d (diff)
Simplify list inputs (remove add button)
-rw-r--r--plugins/managesieve/managesieve.js27
-rw-r--r--plugins/managesieve/skins/classic/images/erase.pngbin0 -> 453 bytes
-rw-r--r--plugins/managesieve/skins/classic/images/plus_minus.pngbin570 -> 0 bytes
-rw-r--r--plugins/managesieve/skins/classic/managesieve.css12
-rw-r--r--plugins/managesieve/skins/larry/images/erase.pngbin0 -> 453 bytes
-rw-r--r--plugins/managesieve/skins/larry/images/plus_minus.pngbin570 -> 0 bytes
-rw-r--r--plugins/managesieve/skins/larry/managesieve.css12
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
new file mode 100644
index 000000000..ddd3a9782
--- /dev/null
+++ b/plugins/managesieve/skins/classic/images/erase.png
Binary files 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
--- a/plugins/managesieve/skins/classic/images/plus_minus.png
+++ /dev/null
Binary files 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
--- /dev/null
+++ b/plugins/managesieve/skins/larry/images/erase.png
Binary files 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
--- a/plugins/managesieve/skins/larry/images/plus_minus.png
+++ /dev/null
Binary files 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;
}