app/views/admin_templates/good/admin/layouts/application.html.erb in kirgudu_base-0.0.3 vs app/views/admin_templates/good/admin/layouts/application.html.erb in kirgudu_base-0.0.4

- old
+ new

@@ -27,14 +27,16 @@ <link rel="stylesheet" href="/assets/kirgudu_base/admin/good/responsive.css" type="text/css"/> <link rel="stylesheet" href="/assets/kirgudu_base/admin/good/jquery.switchButton.css" type="text/css"/> <link rel="stylesheet" href="/assets/kirgudu_base/admin/good/jquery-ui.css" type="text/css"/> + <link rel="stylesheet" href="/assets/kirgudu_base/admin/good/jquery.fancybox.css" type="text/css"/> + <!-- Jquery --> <script src="/assets/kirgudu_base/jquery.js"></script> <!-- Scroll Bar --> <script src="/assets/kirgudu_base/jquery.mCustomScrollbar.concat.min.js"></script> <!-- Circle Chart --> @@ -65,12 +67,12 @@ <script type="text/javascript" src="/assets/kirgudu_base/jquery.json.min.js"></script> <script type="text/javascript" src="/assets/kirgudu_base/dynamicEvents.js"></script> <script type="text/javascript" src="/assets/kirgudu_base/jquery.colorbox.js"></script> + <script type="text/javascript" src="/assets/kirgudu_base/jquery.fancybox.js"></script> - <!-- Sparklines --> <script type="text/javascript"> $(function () { $("#new-orders").sparkline([4, 5, 6, 7, 6, 5, 4, 3, 2, 2, 3, 4], { type: 'bar', @@ -614,11 +616,10 @@ attachAutocomplete(["input[control-type='autocomplete-with-id']"]); attachDatePicker("input.date-picker"); attachChosenSelect("select.chzn-select"); attachSwitchButtons("input[type='checkbox'].switch-button"); - managementAttachDragables("div.items-management-url", "#items-management-tray", "#items-management-gallery"); attachToSortableTray("ul#sorting-management-tray"); attachModalDialogs("a[link-target='modal_dialog']"); @@ -629,19 +630,10 @@ //attachImageUploader(); //attachFileUploader(); attachImagePicker(".image-picker"); - - myNotificationMessages = ['.notifications-info', '.notifications-warning', '.notifications-error', '.notifications-success']; - - notifications_hideAllMessages(); - notifications_showInfo(); - notifications_showError(); - notifications_showSuccess(); - notifications_showWarning(); - } function attachSwitchButtons(selectors) { $.each(normalizeSelectorsToArray(selectors), function (index, sel) { @@ -655,11 +647,19 @@ }); }); }); } + function attachDeleteLinks(selectors){ + $.each(normalizeSelectorsToArray(selectors), function (index, sel) { + $(sel).each(function () { + }); + }); + } + + // Attaching autocomplete_with_id for hidden inputs with selectors // control is rendered in ::KirguduBase::FormBuilder function attachAutocomplete(selectors) { $.each(normalizeSelectorsToArray(selectors), function (index, sel) { @@ -1123,75 +1123,12 @@ }); }); } - function managementAttachDragables(url_css, tray_css, gallery_css) { - var gallery = $(gallery_css); - var tray = $(tray_css); - var management_url_add = $(url_css + "[type='add']").first().attr('href'); - var management_url_remove = $(url_css + "[type='remove']").first().attr('href'); - //alert("URL ADD CSS: " + url_css+"[type='add']\r\nURL ADD: " + management_url_add + "\r\nURL REMOVE: " + management_url_remove); - $("li", gallery).draggable({ - cancel: "a.ui-icon", - revert: "invalid", - cursor: "move", - helper: "clone" - }); - - tray.droppable({ - accept: gallery_css + " > li", - drop: function (event, ui) { - //alert("URL Add: " + management_url_add); - makeAjaxCall(management_url_add, { - method: 'post', - dataType: 'json', - data: {entry_id: ui.draggable.attr('entry-id')}, - success: function (data) { - if (data.status == <%= ::ChupakabraTools::SetManagementResult.id_by_tag("management_ok") %>) { - ui.draggable.fadeOut(function () { - tray.append(ui.draggable); - ui.draggable.fadeIn(); - ui.draggable.append(" --- <a href=\"javascript:managementRemoveItem( '" + management_url_remove + "', '" + tray_css + "', " + ui.draggable.attr('entry-id') + " );\"><%= I18n.t("admin.shared.management.remove_button") %></a>"); - }); - } - else { - showFancyMessage(data.message); - } - }, - error: function () { - showFancyMessage("<%= I18n.t("admin.shared.messages.error_ajax_load") %>"); - } - }); - } - }); - } - - function managementRemoveItem(url, tray_css, entry_id) { - makeAjaxCall(url, { - method: 'post', - dataType: 'json', - data: {entry_id: entry_id }, - success: function (data) { - if (data.status == <%= ::ChupakabraTools::SetManagementResult.id_by_tag("management_ok") %>) { - var tray = $(tray_css); - var item_to_remove = tray.find('li[entry-id = ' + entry_id + ']'); - item_to_remove.fadeOut(); - } - else { - showFancyMessage(data.message); - } - }, - error: function () { - showFancyMessage("<%= I18n.t("admin.shared.messages.error_ajax_load") %>"); - } - }); - } - - // Initialize sortiable on #sortable div function attachToSortableTray(tray_css) { var tray = $(tray_css); tray.sortable(); tray.disableSelection(); @@ -1250,49 +1187,10 @@ } }); return false; } - function notifications_hideAllMessages() { - var messagesHeights = new Array(); // this array will store height for each - for (i = 0; i < myNotificationMessages.length; i++) { - messagesHeights[i] = $(myNotificationMessages[i]).outerHeight(); // fill array - $(myNotificationMessages[i]).css('top', -messagesHeights[i]); //move element outside viewport - } - } - - function notifications_showMessage(type, html_text) { - //hideAllMessages(); - - var message_container = $(type); - if (message_container) { - message_container.remove(); - if (html_text) { - message_container.html(html_text); - } - message_container.appendTo(document.body); - //message_container = $(type); - message_container.addClass('to-remove-before-ajax'); - message_container.animate({top: "0"}, 500); - message_container.slideDown(300).delay(3500).slideUp(500, function () { - message_container.remove(); - }); - } - } - - function notifications_showInfo(html_text) { - notifications_showMessage('.notifications-info', html_text) - } - function notifications_showWarning(html_text) { - notifications_showMessage('.notifications-warning', html_text) - } - function notifications_showError(html_text) { - notifications_showMessage('.notifications-error', html_text) - } - function notifications_showSuccess(html_text) { - notifications_showMessage('.notifications-success', html_text) - } </script> </body>