diff options
| author | two hustlers proj <jules+okfprojz@okfoc.us> | 2015-09-22 19:25:19 -0400 |
|---|---|---|
| committer | two hustlers proj <jules+okfprojz@okfoc.us> | 2015-09-22 19:25:19 -0400 |
| commit | 6b19245d0128311603d66d13c4ac606700e8912d (patch) | |
| tree | cb3ea9337c76eebd2713ca18f8e844e47315a0d1 /themes/okadmin/public/js/app.js | |
| parent | e9fb94cd1f6e73201f0f95afde7c40cc3948ee60 (diff) | |
| parent | 96eccfa594fb2526e50d4f9adfa690ea345a29ff (diff) | |
Merge branch 'twohustlers' of github.com:okfocus/okcms into twohustlers
Diffstat (limited to 'themes/okadmin/public/js/app.js')
| -rw-r--r-- | themes/okadmin/public/js/app.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/themes/okadmin/public/js/app.js b/themes/okadmin/public/js/app.js index 4be0afc..c24605b 100644 --- a/themes/okadmin/public/js/app.js +++ b/themes/okadmin/public/js/app.js @@ -1,5 +1,5 @@ var OKAdmin = function(){ - + // initialize our multi-image uploader with an element and a template $(".group.image-list").each(function(){ var parent = this @@ -79,7 +79,7 @@ var OKAdmin = function(){ // make the region sortable with drag-and-drop $(".media-list ol, .image-list ol").sortable() $(".media-list ol, .image-list ol").disableSelection() - + // populate a video field with info from our url parser var last_url $(".video .url").on("focus", function(){ @@ -201,7 +201,7 @@ var OKAdmin = function(){ }) }) }) - + // delete individual records $("#delete_form").submit(function(e){ if (confirm("Are you sure you want to delete this record?")) { @@ -213,9 +213,9 @@ var OKAdmin = function(){ }) // reorder items in categories - $(".resource-category").on("click", ".edit-btn", function(e) { + $(".resource-category:not(.grouped)").on("click", ".edit-btn", function(e) { e.preventDefault(); - var $parent = $(e.delegateTarget); + var $parent = $(e.delegateTarget) var $editBtn = $parent.find(".edit-btn"); var $cancelBtn = $parent.find(".cancel-btn"); var $saveBtn = $parent.find(".save-btn"); @@ -245,12 +245,14 @@ var OKAdmin = function(){ }); // save new category order - $(".resource-category").on("submit", "form", function(e) { + $(".resource-category.root").on("submit", "form", function(e) { var $parent = $(e.delegateTarget); - $parent.find(".resource-input").each(function(index) { + var $resources = $parent.find(".resource-input") + var length = $resources.length + $resources.each(function(index) { var $input = $(this); var parsed = JSON.parse($input.val()); - parsed.__index = index; + parsed.__index = length - index; $input.val(JSON.stringify(parsed)); }) }); |
