summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-07-27 01:16:48 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-07-27 01:16:48 +0200
commit98e83d8ffc9cc31986fb2672140aed005480cddb (patch)
tree271dbca8f1f75d8c7de812e35a8a5af7eb6ea7cc /static
parentf3ce6573eeae4a62ed1fc771de16574e246dbac5 (diff)
downloadkosten-98e83d8ffc9cc31986fb2672140aed005480cddb.tar.gz
kosten-98e83d8ffc9cc31986fb2672140aed005480cddb.tar.bz2
kosten-98e83d8ffc9cc31986fb2672140aed005480cddb.zip
Add category manipulation support
Diffstat (limited to 'static')
-rw-r--r--static/css/style.css4
-rw-r--r--static/images/add.pngbin0 -> 800 bytes
-rw-r--r--static/images/minus.pngbin0 -> 3406 bytes
-rw-r--r--static/images/undo.pngbin0 -> 649 bytes
-rw-r--r--static/js/cats.js39
-rw-r--r--static/js/lib.js6
6 files changed, 49 insertions, 0 deletions
diff --git a/static/css/style.css b/static/css/style.css
index 2ddf6f2..10f2331 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -88,6 +88,10 @@ div.detail > .mark {
cursor: pointer;
}
+ul.arrow {
+ list-style-image: url(../images/closed.png);
+}
+
/* Header */
diff --git a/static/images/add.png b/static/images/add.png
new file mode 100644
index 0000000..b748150
--- /dev/null
+++ b/static/images/add.png
Binary files differ
diff --git a/static/images/minus.png b/static/images/minus.png
new file mode 100644
index 0000000..99b21ce
--- /dev/null
+++ b/static/images/minus.png
Binary files differ
diff --git a/static/images/undo.png b/static/images/undo.png
new file mode 100644
index 0000000..b39d182
--- /dev/null
+++ b/static/images/undo.png
Binary files differ
diff --git a/static/js/cats.js b/static/js/cats.js
new file mode 100644
index 0000000..e65cc28
--- /dev/null
+++ b/static/js/cats.js
@@ -0,0 +1,39 @@
+var counter = 0;
+
+$(document).ready(function(){
+ $("li > span").click(function(){
+ var span = $(this);
+ var img = $("img#add").copy().attr('src', function() { return this.src.replace("add", "undo"); });
+
+ img.click(function(){
+ var input = $(this).prev();
+
+ $(this).remove();
+ input.fadeOut("slow",
+ function() {
+ span.toggle();
+ });
+
+ input.val(span.text());
+ });
+
+ span.toggle();
+ $(this).next().fadeIn("slow", function() {$(this).after(img); });
+ });
+
+ $("img#add").click(function(){
+ var input = $("input#new").copy();
+ var img = $(this).copy().attr('src', function() { return this.src.replace("add", "minus"); });
+ img.click(function() { $(this).parent().fadeOut("slow", function() { $(this).remove(); }) });
+
+ input.attr('name', function() { return this.name + counter; })
+ .removeAttr('style')
+ .insertBefore($(this).parent())
+ .wrap("<li />");
+
+ input.parent().append(img)
+ .hide().fadeIn("slow", function (){ input.focus(); });
+
+ counter = counter + 1;
+ });
+})
diff --git a/static/js/lib.js b/static/js/lib.js
new file mode 100644
index 0000000..43b0dc8
--- /dev/null
+++ b/static/js/lib.js
@@ -0,0 +1,6 @@
+jQuery.fn.extend({
+ // copies an object and removes 'id' and 'class' values
+ copy: function() {
+ return this.clone().removeAttr("id").removeAttr("class");
+ }
+});