From 4b66011d359bdf80b93728d60d468ea4b5760a2e Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Tue, 9 Jan 2018 23:26:32 +0100 Subject: [PATCH 1/4] Use Turbolinks.visit instead of window.location Instead of making a full page reload in cases we want to redirect with javascript we use Turbolinks.visit --- app/assets/javascripts/alchemy/alchemy.dirty.js.coffee | 2 +- app/assets/javascripts/alchemy/alchemy.initializer.js.coffee | 4 ++-- app/views/alchemy/admin/attachments/_filter_bar.html.erb | 2 +- app/views/alchemy/admin/attachments/_replace_button.html.erb | 2 +- app/views/alchemy/admin/attachments/destroy.js.erb | 2 +- app/views/alchemy/admin/pictures/_filter_bar.html.erb | 2 +- app/views/alchemy/admin/resources/_filter_bar.html.erb | 2 +- app/views/alchemy/admin/uploader/_button.html.erb | 2 +- app/views/alchemy/base/permission_denied.js.erb | 2 +- app/views/alchemy/base/redirect.js.erb | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee b/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee index b65e277863..acc2e9b48b 100644 --- a/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +++ b/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee @@ -44,7 +44,7 @@ $.extend Alchemy, $form.submit() else if $(element).is("a") callback = -> - window.location.href = element.pathname + Turbolinks.visit(element.pathname) if Alchemy.isPageDirty() Alchemy.openConfirmDialog Alchemy.t('page_dirty_notice'), title: Alchemy.t('warning') diff --git a/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee b/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee index 2da07f0d97..70e3b0284e 100644 --- a/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +++ b/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee @@ -28,13 +28,13 @@ Alchemy.Initializer = -> $('select#change_locale').on 'change', (e) -> url = window.location.pathname delimiter = if url.match(/\?/) then '&' else '?' - window.location.href = "#{url}#{delimiter}admin_locale=#{$(this).val()}" + Turbolinks.visit "#{url}#{delimiter}admin_locale=#{$(this).val()}" # Site select handler $('select#change_site').on 'change', (e) -> url = window.location.pathname delimiter = if url.match(/\?/) then '&' else '?' - window.location.href = "#{url}#{delimiter}site_id=#{$(this).val()}" + Turbolinks.visit "#{url}#{delimiter}site_id=#{$(this).val()}" # Submit forms of selects with `data-autosubmit="true"` $('select[data-auto-submit="true"]').on 'change', (e) -> diff --git a/app/views/alchemy/admin/attachments/_filter_bar.html.erb b/app/views/alchemy/admin/attachments/_filter_bar.html.erb index c26d0a42bd..b0fec9466a 100644 --- a/app/views/alchemy/admin/attachments/_filter_bar.html.erb +++ b/app/views/alchemy/admin/attachments/_filter_bar.html.erb @@ -22,7 +22,7 @@ } else { Alchemy.pleaseWaitOverlay(); delimiter = url.match(/\?/) ? '&' : '?'; - window.location = url + delimiter + 'file_type=' + encodeURIComponent($this.val()); + Turbolinks.visit(url + delimiter + 'file_type=' + encodeURIComponent($this.val())); } return false; }); diff --git a/app/views/alchemy/admin/attachments/_replace_button.html.erb b/app/views/alchemy/admin/attachments/_replace_button.html.erb index da60f2c2fb..b566d4b54e 100644 --- a/app/views/alchemy/admin/attachments/_replace_button.html.erb +++ b/app/views/alchemy/admin/attachments/_replace_button.html.erb @@ -18,7 +18,7 @@ file_types: '<%= file_types.join("|") %>', complete: function() { Alchemy.pleaseWaitOverlay(); - window.location.href = '<%= redirect_url.html_safe %>'; + Turbolinks.visit('<%= redirect_url.html_safe %>'); } }; Alchemy.Uploader(options); diff --git a/app/views/alchemy/admin/attachments/destroy.js.erb b/app/views/alchemy/admin/attachments/destroy.js.erb index 14bccc7405..6296a81d27 100644 --- a/app/views/alchemy/admin/attachments/destroy.js.erb +++ b/app/views/alchemy/admin/attachments/destroy.js.erb @@ -1 +1 @@ -window.location.href = '<%= @url %>'; +Turbolinks.visit('<%= @url %>'); diff --git a/app/views/alchemy/admin/pictures/_filter_bar.html.erb b/app/views/alchemy/admin/pictures/_filter_bar.html.erb index 0ad4c73253..1b397639f9 100644 --- a/app/views/alchemy/admin/pictures/_filter_bar.html.erb +++ b/app/views/alchemy/admin/pictures/_filter_bar.html.erb @@ -23,7 +23,7 @@ } else { Alchemy.pleaseWaitOverlay(); delimiter = url.match(/\?/) ? '&' : '?'; - window.location = url + delimiter + 'filter=' + $this.val(); + Turbolinks.visit(url + delimiter + 'filter=' + $this.val()); } return false; }); diff --git a/app/views/alchemy/admin/resources/_filter_bar.html.erb b/app/views/alchemy/admin/resources/_filter_bar.html.erb index fda3e6d02c..e3d33f2b4a 100644 --- a/app/views/alchemy/admin/resources/_filter_bar.html.erb +++ b/app/views/alchemy/admin/resources/_filter_bar.html.erb @@ -21,7 +21,7 @@ } else { Alchemy.pleaseWaitOverlay(); delimiter = url.match(/\?/) ? '&' : '?'; - window.location = url + delimiter + 'filter=' + encodeURIComponent($this.val()); + Turbolinks.visit(url + delimiter + 'filter=' + encodeURIComponent($this.val())); } return false; }); diff --git a/app/views/alchemy/admin/uploader/_button.html.erb b/app/views/alchemy/admin/uploader/_button.html.erb index 335fa82ef6..24a75dcc94 100644 --- a/app/views/alchemy/admin/uploader/_button.html.erb +++ b/app/views/alchemy/admin/uploader/_button.html.erb @@ -28,7 +28,7 @@ $.get(url, null, null, 'script'); <% else %> Alchemy.pleaseWaitOverlay(); - window.location.href = url; + Turbolinks.visit(url); <% end %> } }; diff --git a/app/views/alchemy/base/permission_denied.js.erb b/app/views/alchemy/base/permission_denied.js.erb index 9624c840e6..2a573f2f67 100644 --- a/app/views/alchemy/base/permission_denied.js.erb +++ b/app/views/alchemy/base/permission_denied.js.erb @@ -1,3 +1,3 @@ Alchemy.closeCurrentDialog(function() { - window.location.href = '<%= Alchemy.login_path %>'; + Turbolinks.visit('<%= Alchemy.login_path %>'); }); diff --git a/app/views/alchemy/base/redirect.js.erb b/app/views/alchemy/base/redirect.js.erb index 193ca11cbe..9e7ff37b96 100644 --- a/app/views/alchemy/base/redirect.js.erb +++ b/app/views/alchemy/base/redirect.js.erb @@ -2,7 +2,7 @@ var dialog = Alchemy.currentDialog(); var callback = function() { Alchemy.pleaseWaitOverlay(); - window.location.href = '<%= url_for(@redirect_url) %>'; + Turbolinks.visit('<%= url_for(@redirect_url) %>'); }; if (dialog) { Alchemy.closeCurrentDialog(callback); From c11296989bc73293e8ecedd96c4481e34a6084c2 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 10 Jan 2018 08:55:16 +0100 Subject: [PATCH 2/4] Remove pleaseWaitOverlay from GET links All links that are normal GET requests do not need the pleaseWait overlay. This is meant for actions with side effects, aka. POST requests. By removing this we get much snappier navigation in the admin. --- CHANGELOG.md | 1 + app/assets/javascripts/alchemy/alchemy.dirty.js.coffee | 3 +-- .../javascripts/alchemy/alchemy.initializer.js.coffee | 9 +++------ app/helpers/alchemy/admin/base_helper.rb | 2 +- app/helpers/alchemy/admin/tags_helper.rb | 3 +-- app/views/alchemy/admin/attachments/_filter_bar.html.erb | 1 - .../alchemy/admin/attachments/_replace_button.html.erb | 1 - app/views/alchemy/admin/attachments/_tag_list.html.erb | 2 +- app/views/alchemy/admin/pages/index.html.erb | 2 +- app/views/alchemy/admin/pictures/_filter_bar.html.erb | 1 - app/views/alchemy/admin/pictures/_tag_list.html.erb | 2 +- app/views/alchemy/admin/pictures/index.html.erb | 6 +++--- app/views/alchemy/admin/pictures/index.js.erb | 1 - app/views/alchemy/admin/resources/_filter_bar.html.erb | 1 - app/views/alchemy/admin/resources/_tag_list.html.erb | 2 +- app/views/alchemy/admin/resources/index.html.erb | 1 - app/views/alchemy/admin/uploader/_button.html.erb | 1 - app/views/alchemy/base/redirect.js.erb | 1 - 18 files changed, 14 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d0cc22f9a..3df25cdb2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 4.1.0 (unreleased) +* Remove pleaseWait overlay from links with GET requests [#1343](https://github.com/AlchemyCMS/alchemy_cms/pull/1343) by [tvdeyen](https://github.com/tvdeyen) * Removed fixed table headers from admin resource tables [#1339](https://github.com/AlchemyCMS/alchemy_cms/pull/1339) by [tvdeyen](https://github.com/tvdeyen) * Removed Bourbon Sass library [#1339](https://github.com/AlchemyCMS/alchemy_cms/pull/1339) by [tvdeyen](https://github.com/tvdeyen) diff --git a/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee b/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee index acc2e9b48b..0b5989d54d 100644 --- a/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee +++ b/app/assets/javascripts/alchemy/alchemy.dirty.js.coffee @@ -18,7 +18,6 @@ $.extend Alchemy, window.onbeforeunload = @pageUnload pageUnload: -> - Alchemy.pleaseWaitOverlay(false) Alchemy.t('page_dirty_notice') setElementClean: (element) -> @@ -41,6 +40,7 @@ $.extend Alchemy, $form = $("
") $form.append $(element).find("input") $form.appendTo "body" + Alchemy.pleaseWaitOverlay() $form.submit() else if $(element).is("a") callback = -> @@ -52,7 +52,6 @@ $.extend Alchemy, cancel_label: Alchemy.t('cancel') on_ok: -> window.onbeforeunload = undefined - Alchemy.pleaseWaitOverlay() callback() false else diff --git a/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee b/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee index 70e3b0284e..d171c355ab 100644 --- a/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +++ b/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee @@ -15,11 +15,9 @@ Alchemy.Initializer = -> Alchemy.Growler.fade() # Add observer for please wait overlay. - $('.please_wait, #main_navi a, .button_with_label form :submit, .locked_page a, .pagination a') - .not('*[data-alchemy-confirm], .locked_page button') - .click -> - unless Alchemy.isPageDirty() - Alchemy.pleaseWaitOverlay() + $('.please_wait, .button_with_label form :submit') + .not('*[data-alchemy-confirm]') + .click Alchemy.pleaseWaitOverlay # Hack for enabling tab focus for 's styled as button. $('a.button').attr({tabindex: 0}) @@ -38,7 +36,6 @@ Alchemy.Initializer = -> # Submit forms of selects with `data-autosubmit="true"` $('select[data-auto-submit="true"]').on 'change', (e) -> - Alchemy.pleaseWaitOverlay() $(this.form).submit() # Attaches the image loader on all images diff --git a/app/helpers/alchemy/admin/base_helper.rb b/app/helpers/alchemy/admin/base_helper.rb index a0cecffb43..d5a6dd0de7 100644 --- a/app/helpers/alchemy/admin/base_helper.rb +++ b/app/helpers/alchemy/admin/base_helper.rb @@ -267,7 +267,7 @@ def toolbar_button(options = {}) active: false, link_options: {}, dialog_options: {}, - loading_indicator: true + loading_indicator: false }.merge(options.symbolize_keys) button = render( 'alchemy/admin/partials/toolbar_button', diff --git a/app/helpers/alchemy/admin/tags_helper.rb b/app/helpers/alchemy/admin/tags_helper.rb index 1e586fe60f..c2d8686f65 100644 --- a/app/helpers/alchemy/admin/tags_helper.rb +++ b/app/helpers/alchemy/admin/tags_helper.rb @@ -22,8 +22,7 @@ def render_tag_list(class_name) tagged_with: tags_for_filter(current: tag).presence ) ), - remote: request.xhr?, - class: 'please_wait' + remote: request.xhr? ) end end.join.html_safe diff --git a/app/views/alchemy/admin/attachments/_filter_bar.html.erb b/app/views/alchemy/admin/attachments/_filter_bar.html.erb index b0fec9466a..d9df5ccfbf 100644 --- a/app/views/alchemy/admin/attachments/_filter_bar.html.erb +++ b/app/views/alchemy/admin/attachments/_filter_bar.html.erb @@ -20,7 +20,6 @@ if ($this.data('remote') === true) { $.get(url, {file_type: $this.val()}, null, 'script'); } else { - Alchemy.pleaseWaitOverlay(); delimiter = url.match(/\?/) ? '&' : '?'; Turbolinks.visit(url + delimiter + 'file_type=' + encodeURIComponent($this.val())); } diff --git a/app/views/alchemy/admin/attachments/_replace_button.html.erb b/app/views/alchemy/admin/attachments/_replace_button.html.erb index b566d4b54e..9ff3696017 100644 --- a/app/views/alchemy/admin/attachments/_replace_button.html.erb +++ b/app/views/alchemy/admin/attachments/_replace_button.html.erb @@ -17,7 +17,6 @@ selector: '#replace_<%= dom_id(object) %>', file_types: '<%= file_types.join("|") %>', complete: function() { - Alchemy.pleaseWaitOverlay(); Turbolinks.visit('<%= redirect_url.html_safe %>'); } }; diff --git a/app/views/alchemy/admin/attachments/_tag_list.html.erb b/app/views/alchemy/admin/attachments/_tag_list.html.erb index f711d6f496..3fd2b78744 100644 --- a/app/views/alchemy/admin/attachments/_tag_list.html.erb +++ b/app/views/alchemy/admin/attachments/_tag_list.html.erb @@ -9,7 +9,7 @@ render_icon('delete-small') + Alchemy.t('Remove tag filter'), url_for(search_filter_params.except(:tagged_with)), remote: request.xhr?, - class: 'button small with_icon please_wait' + class: 'button small with_icon' ) %> <% end %> <% end %> diff --git a/app/views/alchemy/admin/pages/index.html.erb b/app/views/alchemy/admin/pages/index.html.erb index e06270d115..29ff5d1d6e 100644 --- a/app/views/alchemy/admin/pages/index.html.erb +++ b/app/views/alchemy/admin/pages/index.html.erb @@ -21,7 +21,7 @@ render_icon(:sort), alchemy.sort_admin_pages_path, method: :get, - class: 'icon_button please_wait', + class: 'icon_button', title: Alchemy.t('Sort pages') ) %> diff --git a/app/views/alchemy/admin/pictures/_filter_bar.html.erb b/app/views/alchemy/admin/pictures/_filter_bar.html.erb index 1b397639f9..69bae8b56e 100644 --- a/app/views/alchemy/admin/pictures/_filter_bar.html.erb +++ b/app/views/alchemy/admin/pictures/_filter_bar.html.erb @@ -21,7 +21,6 @@ if ($this.data('remote') === true) { $.get(url, {filter: $this.val()}, null, 'script'); } else { - Alchemy.pleaseWaitOverlay(); delimiter = url.match(/\?/) ? '&' : '?'; Turbolinks.visit(url + delimiter + 'filter=' + $this.val()); } diff --git a/app/views/alchemy/admin/pictures/_tag_list.html.erb b/app/views/alchemy/admin/pictures/_tag_list.html.erb index 55fdd0ec0e..03b2080119 100644 --- a/app/views/alchemy/admin/pictures/_tag_list.html.erb +++ b/app/views/alchemy/admin/pictures/_tag_list.html.erb @@ -9,7 +9,7 @@ render_icon('delete-small') + Alchemy.t('Remove tag filter'), url_for(search_filter_params.except(:tagged_with)), remote: request.xhr?, - class: 'button small with_icon please_wait' + class: 'button small with_icon' ) %> <% end %> <% end %> diff --git a/app/views/alchemy/admin/pictures/index.html.erb b/app/views/alchemy/admin/pictures/index.html.erb index b38bbf2ae4..1104f1c398 100644 --- a/app/views/alchemy/admin/pictures/index.html.erb +++ b/app/views/alchemy/admin/pictures/index.html.erb @@ -16,7 +16,7 @@ render_icon('zoom-out'), alchemy.admin_pictures_path(size: "small", q: params[:q]), title: Alchemy.t(:small_thumbnails), - class: "icon_button please_wait" + class: "icon_button" ) %>
@@ -24,7 +24,7 @@ render_icon('zoom-equal'), alchemy.admin_pictures_path(size: "medium", q: params[:q]), title: Alchemy.t(:medium_thumbnails), - class: "icon_button please_wait" + class: "icon_button" ) %>
@@ -32,7 +32,7 @@ render_icon('zoom-in'), alchemy.admin_pictures_path(size: "large", q: params[:q]), title: Alchemy.t(:big_thumbnails), - class: "icon_button please_wait" + class: "icon_button" ) %>
diff --git a/app/views/alchemy/admin/pictures/index.js.erb b/app/views/alchemy/admin/pictures/index.js.erb index ffa5e7176e..3f9bc0becc 100644 --- a/app/views/alchemy/admin/pictures/index.js.erb +++ b/app/views/alchemy/admin/pictures/index.js.erb @@ -1,3 +1,2 @@ -Alchemy.pleaseWaitOverlay(false); $('#archive_all').html('<%= j render("archive") %>'); $('#filter_bar').replaceWith('<%= j render("filter_bar") %>'); diff --git a/app/views/alchemy/admin/resources/_filter_bar.html.erb b/app/views/alchemy/admin/resources/_filter_bar.html.erb index e3d33f2b4a..6bbb1e1f8e 100644 --- a/app/views/alchemy/admin/resources/_filter_bar.html.erb +++ b/app/views/alchemy/admin/resources/_filter_bar.html.erb @@ -19,7 +19,6 @@ if ($this.data('remote') === true) { $.get(url, {filter: $this.val()}, null, 'script'); } else { - Alchemy.pleaseWaitOverlay(); delimiter = url.match(/\?/) ? '&' : '?'; Turbolinks.visit(url + delimiter + 'filter=' + encodeURIComponent($this.val())); } diff --git a/app/views/alchemy/admin/resources/_tag_list.html.erb b/app/views/alchemy/admin/resources/_tag_list.html.erb index 3a7d696c79..eefbae19d5 100644 --- a/app/views/alchemy/admin/resources/_tag_list.html.erb +++ b/app/views/alchemy/admin/resources/_tag_list.html.erb @@ -9,7 +9,7 @@ render_icon('delete-small') + Alchemy.t('Remove tag filter'), url_for(search_filter_params.except(:tagged_with)), remote: request.xhr?, - class: 'button small with_icon please_wait' + class: 'button small with_icon' ) %> <% end %> diff --git a/app/views/alchemy/admin/resources/index.html.erb b/app/views/alchemy/admin/resources/index.html.erb index 52e215800d..d89028bbae 100644 --- a/app/views/alchemy/admin/resources/index.html.erb +++ b/app/views/alchemy/admin/resources/index.html.erb @@ -20,7 +20,6 @@ label: Alchemy.t(:download_csv), title: Alchemy.t(:download_csv), dialog: false, - loading_indicator: false, if_permitted_to: [:index, resource_model] } ] diff --git a/app/views/alchemy/admin/uploader/_button.html.erb b/app/views/alchemy/admin/uploader/_button.html.erb index 24a75dcc94..1675bc8349 100644 --- a/app/views/alchemy/admin/uploader/_button.html.erb +++ b/app/views/alchemy/admin/uploader/_button.html.erb @@ -27,7 +27,6 @@ <% if local_assigns[:in_dialog] %> $.get(url, null, null, 'script'); <% else %> - Alchemy.pleaseWaitOverlay(); Turbolinks.visit(url); <% end %> } diff --git a/app/views/alchemy/base/redirect.js.erb b/app/views/alchemy/base/redirect.js.erb index 9e7ff37b96..ef09c4c443 100644 --- a/app/views/alchemy/base/redirect.js.erb +++ b/app/views/alchemy/base/redirect.js.erb @@ -1,7 +1,6 @@ (function() { var dialog = Alchemy.currentDialog(); var callback = function() { - Alchemy.pleaseWaitOverlay(); Turbolinks.visit('<%= url_for(@redirect_url) %>'); }; if (dialog) { From f337528eedc44bf18d62361c8e47f65f4cf598a7 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 10 Jan 2018 08:55:39 +0100 Subject: [PATCH 3/4] Remove left over file from picture cache removal --- app/views/alchemy/admin/pictures/flush.js.erb | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 app/views/alchemy/admin/pictures/flush.js.erb diff --git a/app/views/alchemy/admin/pictures/flush.js.erb b/app/views/alchemy/admin/pictures/flush.js.erb deleted file mode 100644 index 2aae5e9533..0000000000 --- a/app/views/alchemy/admin/pictures/flush.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -Alchemy.growl('<%= @notice %>'); -Alchemy.pleaseWaitOverlay(false); From 7d0a29766a04ada54d4632c2d43fb8299db27a14 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Mon, 15 Jan 2018 21:16:27 +0100 Subject: [PATCH 4/4] Remove unused contents controller actions This is a leftover from "available contents" feature removal. --- .../alchemy/admin/contents_controller.rb | 17 ----------------- app/views/alchemy/admin/contents/destroy.js.erb | 4 ---- config/routes.rb | 2 +- .../alchemy/admin/contents_controller_spec.rb | 14 -------------- 4 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 app/views/alchemy/admin/contents/destroy.js.erb diff --git a/app/controllers/alchemy/admin/contents_controller.rb b/app/controllers/alchemy/admin/contents_controller.rb index 4da61ca67c..295496dfda 100644 --- a/app/controllers/alchemy/admin/contents_controller.rb +++ b/app/controllers/alchemy/admin/contents_controller.rb @@ -7,11 +7,6 @@ class ContentsController < Alchemy::Admin::BaseController authorize_resource class: Alchemy::Content - def new - @element = Element.find(params[:element_id]) - @content = @element.contents.build - end - def create @element = Element.find(params[:content][:element_id]) @content = Content.create_from_scratch(@element, content_params) @@ -26,11 +21,6 @@ def create end end - def update - @content = Content.find(params[:id]) - @content.update_essence(content_params) - end - def order Content.transaction do params[:content_ids].each_with_index do |id, idx| @@ -40,13 +30,6 @@ def order @notice = Alchemy.t("Successfully saved content position") end - def destroy - @content = Content.find(params[:id]) - @content_dom_id = @content.dom_id - @notice = Alchemy.t("Successfully deleted content", content: @content.name_for_label) - @content.destroy - end - private def content_params diff --git a/app/views/alchemy/admin/contents/destroy.js.erb b/app/views/alchemy/admin/contents/destroy.js.erb deleted file mode 100644 index caa71ae4b2..0000000000 --- a/app/views/alchemy/admin/contents/destroy.js.erb +++ /dev/null @@ -1,4 +0,0 @@ -$('#<%= @content_dom_id %>').remove(); -Alchemy.growl('<%= j @notice %>'); -Alchemy.reloadPreview(); -Alchemy.pleaseWaitOverlay(false); diff --git a/config/routes.rb b/config/routes.rb index 029d1f577d..b932c72916 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,7 +15,7 @@ end namespace :admin, {path: Alchemy.admin_path, constraints: Alchemy.admin_constraints} do - resources :contents do + resources :contents, only: [:create] do collection do post :order end diff --git a/spec/requests/alchemy/admin/contents_controller_spec.rb b/spec/requests/alchemy/admin/contents_controller_spec.rb index 95c1a37126..8d4f5a8f95 100644 --- a/spec/requests/alchemy/admin/contents_controller_spec.rb +++ b/spec/requests/alchemy/admin/contents_controller_spec.rb @@ -58,20 +58,6 @@ module Alchemy end end - describe '#update' do - let(:content) { create(:alchemy_content) } - - before do - expect(Content).to receive(:find).and_return(content) - end - - it "should update a content via ajax" do - expect { - patch admin_content_path(id: content.id, content: {ingredient: 'Peters Petshop'}, format: :js) - }.to change { content.ingredient }.to 'Peters Petshop' - end - end - describe "#order" do context "with content_ids in params" do let(:element) do