diff options
author | Git <git@what.cd> | 2012-10-27 08:00:09 +0000 |
---|---|---|
committer | Git <git@what.cd> | 2012-10-27 08:00:09 +0000 |
commit | ac74044ec272101a730c5735b76b5ec8f5df9ca5 (patch) | |
tree | 6e2067111e2d5a3a1e0fcb1f985fec4ff74d8c55 /static/functions/release_sort.js | |
parent | 7d8e070bf839a73e8d2d058feceda42ba7fa0563 (diff) | |
download | Gazelle-ac74044ec272101a730c5735b76b5ec8f5df9ca5.zip Gazelle-ac74044ec272101a730c5735b76b5ec8f5df9ca5.tar.gz Gazelle-ac74044ec272101a730c5735b76b5ec8f5df9ca5.tar.bz2 |
Empty commit
Diffstat (limited to 'static/functions/release_sort.js')
-rw-r--r-- | static/functions/release_sort.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/static/functions/release_sort.js b/static/functions/release_sort.js new file mode 100644 index 0000000..07c81d4 --- /dev/null +++ b/static/functions/release_sort.js @@ -0,0 +1,35 @@ +//Couldn't use an associative array because javascript sorting is stupid http://dev-answers.blogspot.com/2012/03/javascript-object-keys-being-sorted-in.html + +(function($) { + $(document).ready(function() { + serialize(); + $("#sortable").sortable({ + placeholder: "ui-state-highlight", + update: function() { + serialize(); + } + }); + $("#toggle_sortable").click(function () { + $('#sortable_container').slideToggle(function() { + $("#toggle_sortable").text($(this).is(":visible") ? "Collapse" : "Expand"); + }); + }); + }); + function serialize() { + var a = new Array(); + $("#sortable").find("input").each(function (i) { + $(this).unbind("click"); + $(this).click(function() { + var c = $(this).attr("checked") == "checked" ? 1 : 0; + var old_id = $(this).attr("id"); + var new_id = old_id.slice(0, - 1) + c; + $(this).attr("id", new_id); + serialize(); + }); + a.push($(this).attr("id")); + }); + $("#sorthide").val(JSON.stringify(a)); + } +} +(jQuery)); + |