app/assets/javascripts/roroacms/admin/menu.js in roroacms-0.0.4 vs app/assets/javascripts/roroacms/admin/menu.js in roroacms-0.0.5

- old
+ new

@@ -7,19 +7,32 @@ $.ajax({ type: "POST", url: $('.js-settings').attr('data-site-url') + "admin/menus/save_menu", data: data, dataType: "html", - success: function(data) {} + success: function(data) { + if(data == 'demo'){ + do_demo_alert(); + } else { + do_alert(); + } + } }); }; do_alert = function() { $("#main-content .row > .col-md-12 .alert-wrapper").html("<div class=\"alert alert-success\"><button data-dismiss=\"alert\" class=\"close\" type=\"button\">x</button><strong>Success!</strong> Menu was successfully updated</div>"); $("html,body").animate({ scrollTop: $("#header").offset().top }, "slow"); }; + + do_demo_alert = function(){ + $("#main-content .row > .col-md-12 .alert-wrapper").html("<div class=\"alert alert-danger\"><button data-dismiss=\"alert\" class=\"close\" type=\"button\">x</button><strong>Error!</strong> You are working in demo mode so no CRUD functions will be undertaken</div>"); + $("html,body").animate({ + scrollTop: $("#header").offset().top + }, "slow"); + } build_under_form = function(data, selector) { $.ajax({ type: "POST", url: $('.js-settings').attr('data-site-url') + "admin/menus/ajax_dropbox", data: data, @@ -41,10 +54,9 @@ items: "li", maxLevels: 3 }); $(".update-menu").bind("click", function(e) { do_update_function(); - do_alert(); }); $("ol.sortable").on("click", "i.handler", function() { var container; container = $(" > .item-information", $(this).closest("li")); if (container.hasClass("active")) {