From 2daad2b8b1490fe6d48d7ebbd2df2bbf256cbeb6 Mon Sep 17 00:00:00 2001 From: cappadona Date: Fri, 15 Jul 2011 13:04:07 +0000 Subject: [PATCH] NIHVIVO-2232 Menu items can now be reordered. Brace yourself. --- webapp/web/js/individual/menuManagement.js | 24 ++----------------- .../body/individual/individual-menu.ftl | 10 +++----- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/webapp/web/js/individual/menuManagement.js b/webapp/web/js/individual/menuManagement.js index 5fd2362e1..ba513a301 100644 --- a/webapp/web/js/individual/menuManagement.js +++ b/webapp/web/js/individual/menuManagement.js @@ -35,16 +35,12 @@ var menuManagement = { this.menuItemsList.sortable({ cursor: 'move', update: function(event, ui) { - alert("Congrats! You just reordered a menu item. (not really)"); - // Once we figure out how the editing will work, we'll call reorderMenuItems - // and get rid of the debug alert. - // menuManagement.reorderMenutItems(event, ui); + menuManagement.reorderMenuItems(event, ui); } }); }, // Reorder menu items. Called after menu item drag-and-drop - // This is all make-believe at the moment. Just an example to demonstrate to Huda how this could work. reorderMenuItems: function(event, ui) { var menuItems = $('li.menuItem').map(function(index, el) { return $(this).data('menuItemUri'); @@ -66,9 +62,7 @@ var menuManagement = { // Set the new position for this element. The only function of this value // is so we can reset an element to its original position in case reordering fails. menuManagement.setPosition(this, pos); - }); - // Set the form rank field value. - $('#rank').val(pos + 1); + }); }, error: function(request, status, error) { // ui is undefined after removal of a menu item. @@ -128,20 +122,6 @@ var menuManagement = { }); return matchingMenuItem; - }, - - // Event listeners - - // Disable drag-n-drop and associated cues if only one menu item remains - // Good chance we won't need this if Huda's able to hook into standard delete for n3 editing (loads confirmation in separate page) - disableMenuItemsDD: function() { - var menuItems = this.menuItemsList.children('li'); - - this.menuItemsList.sortable({ disable: true } ); - - this.menuItemsList.removeClass('dragNdrop'); - - menuItems.removeAttr('title'); } }; diff --git a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl index bb6bab148..36272f98b 100644 --- a/webapp/web/templates/freemarker/body/individual/individual-menu.ftl +++ b/webapp/web/templates/freemarker/body/individual/individual-menu.ftl @@ -15,7 +15,7 @@ <#-- List the menu items --> @@ -37,13 +37,9 @@ ${headScripts.add(' -<#-- Since the individual page can currently be viewed by anonymous users, only invoke sortable if logged in for now - Jim is working on this (see NIHVIVO-2749) --> -<#if editable> - ${scripts.add('')} - \ No newline at end of file +${scripts.add('')} \ No newline at end of file