diff --git a/app/assets/javascripts/basic/orbit_js_1.0.1.js b/app/assets/javascripts/basic/orbit_js_1.0.1.js index efe6fc03..cc59d6d3 100644 --- a/app/assets/javascripts/basic/orbit_js_1.0.1.js +++ b/app/assets/javascripts/basic/orbit_js_1.0.1.js @@ -466,6 +466,15 @@ if($.support.touch) { }(window.jQuery); +var ini = function() { + api = this + api.modal = function(e) { + $('#dialog a.delete-item').attr("href", e); + $('#dialog').modal('show'); + } + +} + // Open Slide function openSlide() { var $openSlide = $('.open-slide'), @@ -521,6 +530,10 @@ function changeStatusHidden() { // Document Ready $(function() { + new ini(); + $('.delete').on('click', function() { + api.modal($(this).attr('rel')); + }) initialState(); $('#login').on('shown', function () { $(document.body).addClass('modalBlur'); diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb index f99245bd..b5c8eca2 100644 --- a/app/helpers/orbit_backend_helper.rb +++ b/app/helpers/orbit_backend_helper.rb @@ -289,7 +289,8 @@ module OrbitBackendHelper end when 'delete' if show_delete_link(object) - content_tag :li, link_to(t(quick[:translation] || :delete_), '#', rel: eval("#{quick[:link]}('#{object.id}')"), class: "delete_link #{quick[:class] || 'text-error'}") + @delete_options = {title: quick[:title], warning: quick[:warning], cancel: quick[:cancel], submit: quick[:submit]} + content_tag :li, link_to(t(quick[:translation] || :delete_), '#', rel: eval("#{quick[:link]}('#{object.id}')"), class: "delete #{quick[:class] || 'text-error'}") end when 'detail' content_tag :li, link_to(t(quick[:translation] || :detail), '#', class: (quick[:class] || "detail-row")) diff --git a/app/views/admin/default_index/_index.html.erb b/app/views/admin/default_index/_index.html.erb index 68e8ddda..1838abb8 100644 --- a/app/views/admin/default_index/_index.html.erb +++ b/app/views/admin/default_index/_index.html.erb @@ -37,20 +37,4 @@ <%= @index_footer %> - - \ No newline at end of file +<%= render 'layouts/delete_modal', delete_options: @delete_options %> \ No newline at end of file diff --git a/app/views/admin/items/index.html.erb b/app/views/admin/items/index.html.erb index 6a2841ca..a494c383 100644 --- a/app/views/admin/items/index.html.erb +++ b/app/views/admin/items/index.html.erb @@ -4,19 +4,7 @@ <%= render 'node_and_children', node: node %> - +<%= render 'layouts/delete_modal' %> \ No newline at end of file diff --git a/app/views/layouts/_delete_modal.html.erb b/app/views/layouts/_delete_modal.html.erb new file mode 100644 index 00000000..d07f6077 --- /dev/null +++ b/app/views/layouts/_delete_modal.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/config/locales/new_ui.en.yml b/config/locales/new_ui.en.yml index 1aca842a..e0e0a0bd 100644 --- a/config/locales/new_ui.en.yml +++ b/config/locales/new_ui.en.yml @@ -12,6 +12,7 @@ en: error: category: Error when creating category tag: Error when creating tag + delete_warning: This action can not be restored, are you sure you want to delete? deselect_all: Deselect all detail: Detail edit_category: Edit Categorie diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb index 2b288254..9680de19 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/index.html.erb @@ -5,6 +5,7 @@ quick_edit_link type: 'detail' quick_edit_link type: 'delete', link: 'panel_announcement_back_end_bulletin_path' + # can have: title, warning, cancel and submit values quick_edit_link type: 'approval', link: 'panel_announcement_back_end_bulletin_approval_preview_path' quick_edit_link type: 'reject_reason'