diff --git a/app/controllers/admin/badges_controller.rb b/app/controllers/admin/badges_controller.rb index a24d82565..035a0f6d3 100644 --- a/app/controllers/admin/badges_controller.rb +++ b/app/controllers/admin/badges_controller.rb @@ -22,7 +22,7 @@ module Admin redirect_to admin_badges_path else flash[:danger] = @badge.errors_as_sentence - render new_admin_badge_path + render :new end end diff --git a/app/controllers/admin/broadcasts_controller.rb b/app/controllers/admin/broadcasts_controller.rb index c30f57566..15d085b37 100644 --- a/app/controllers/admin/broadcasts_controller.rb +++ b/app/controllers/admin/broadcasts_controller.rb @@ -30,7 +30,7 @@ module Admin redirect_to admin_broadcast_path(@broadcast) else flash[:danger] = @broadcast.errors.full_messages.to_sentence - render new_admin_broadcast_path + render :new end end diff --git a/app/controllers/admin/display_ads_controller.rb b/app/controllers/admin/display_ads_controller.rb index ef72d279a..8eab6657c 100644 --- a/app/controllers/admin/display_ads_controller.rb +++ b/app/controllers/admin/display_ads_controller.rb @@ -31,7 +31,7 @@ module Admin redirect_to admin_display_ads_path else flash[:danger] = @display_ad.errors_as_sentence - render new_admin_display_ad_path + render :new end end diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 5f6602ad7..85cb1c62a 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -26,7 +26,7 @@ module Admin redirect_to admin_events_path else flash[:danger] = @event.errors.full_messages - render new_admin_event_path + render :new end end diff --git a/app/controllers/admin/html_variants_controller.rb b/app/controllers/admin/html_variants_controller.rb index 25a041cc2..d0a21da00 100644 --- a/app/controllers/admin/html_variants_controller.rb +++ b/app/controllers/admin/html_variants_controller.rb @@ -43,7 +43,7 @@ module Admin redirect_to admin_html_variants_path(state: "mine") else flash[:danger] = @html_variant.errors_as_sentence - render new_admin_html_variant_path + render :new end end diff --git a/app/controllers/admin/listing_categories_controller.rb b/app/controllers/admin/listing_categories_controller.rb index 33040a5f0..2bf562bad 100644 --- a/app/controllers/admin/listing_categories_controller.rb +++ b/app/controllers/admin/listing_categories_controller.rb @@ -28,7 +28,7 @@ module Admin redirect_to admin_listing_categories_path else flash[:danger] = @listing_category.errors_as_sentence - render new_admin_listing_category_path + render :new end end diff --git a/app/controllers/admin/navigation_links_controller.rb b/app/controllers/admin/navigation_links_controller.rb index 26dee4fe7..941b6a665 100644 --- a/app/controllers/admin/navigation_links_controller.rb +++ b/app/controllers/admin/navigation_links_controller.rb @@ -17,7 +17,7 @@ module Admin else flash[:error] = "Error: #{navigation_link.errors_as_sentence}" end - redirect_to admin_navigation_links_url + redirect_to admin_navigation_links_path end def update @@ -27,7 +27,7 @@ module Admin else flash[:error] = "Error: #{navigation_link.errors_as_sentence}" end - redirect_to admin_navigation_links_url + redirect_to admin_navigation_links_path end def destroy @@ -37,7 +37,7 @@ module Admin else flash[:error] = "Error: #{navigation_link.errors_as_sentence}" end - redirect_to admin_navigation_links_url + redirect_to admin_navigation_links_path end private diff --git a/app/controllers/admin/response_templates_controller.rb b/app/controllers/admin/response_templates_controller.rb index b466a0b8c..83b97d113 100644 --- a/app/controllers/admin/response_templates_controller.rb +++ b/app/controllers/admin/response_templates_controller.rb @@ -26,7 +26,7 @@ module Admin else flash[:danger] = @response_template.errors_as_sentence @response_templates = ResponseTemplate.page(params[:page]).per(50) - render new_admin_response_template_path + render :new end end diff --git a/app/controllers/admin/sponsorships_controller.rb b/app/controllers/admin/sponsorships_controller.rb index c0b9d8a7a..4c4038497 100644 --- a/app/controllers/admin/sponsorships_controller.rb +++ b/app/controllers/admin/sponsorships_controller.rb @@ -28,7 +28,7 @@ module Admin redirect_to admin_sponsorships_path else flash[:danger] = @sponsorship.errors_as_sentence - render new_admin_sponsorship_path + render :new end end diff --git a/app/controllers/admin/tools_controller.rb b/app/controllers/admin/tools_controller.rb index 8dff8898f..b87f78ba2 100644 --- a/app/controllers/admin/tools_controller.rb +++ b/app/controllers/admin/tools_controller.rb @@ -15,10 +15,10 @@ module Admin handle_article_cache "Article ##{params[:bust_article]} was successfully busted" end - redirect_to "/admin/tools" + redirect_to admin_tools_path rescue StandardError => e flash[:danger] = e.message - redirect_to "/admin/tools" + redirect_to admin_tools_path end private diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index e59136763..70a5abd96 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -50,11 +50,11 @@ module AdminHelper # @ridhwana end delete def deduced_controller(request) - request.path.split("/").last + request.path.split("/").fourth end def deduced_scope(request) - request.path.split("/").second_to_last + request.path.split("/").third end def display_name(group_name) diff --git a/app/views/admin/badge_achievements/index.html.erb b/app/views/admin/badge_achievements/index.html.erb index 88c7a5654..3c097d5ab 100644 --- a/app/views/admin/badge_achievements/index.html.erb +++ b/app/views/admin/badge_achievements/index.html.erb @@ -36,7 +36,7 @@ badge image - <%= link_to "Remove", url_for(action: :destroy, id: badge_achievement.id), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %> + <%= link_to "Remove", admin_badge_achievement_path(badge_achievement), class: "crayons-btn crayons-btn--danger", method: :delete, data: { confirm: "Are you sure?" } %> <% end %> diff --git a/app/views/admin/broadcasts/show.html.erb b/app/views/admin/broadcasts/show.html.erb index 248ac9f86..c74cb214f 100644 --- a/app/views/admin/broadcasts/show.html.erb +++ b/app/views/admin/broadcasts/show.html.erb @@ -1,7 +1,7 @@

<%= @broadcast.title %>

- <%= link_to "Destroy", url_for(action: :destroy, id: @broadcast.id), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %> + <%= link_to "Destroy", admin_broadcast_path(@broadcast), class: "btn btn-danger", method: :delete, data: { confirm: "Are you sure?" } %> <%= link_to "Edit", edit_admin_broadcast_path, class: "btn btn-primary" %>
diff --git a/app/views/admin/chat_channels/index.html.erb b/app/views/admin/chat_channels/index.html.erb index 32221eb7b..610fa7511 100644 --- a/app/views/admin/chat_channels/index.html.erb +++ b/app/views/admin/chat_channels/index.html.erb @@ -57,7 +57,7 @@ <% if current_user.any_admin? %> <% if channel.users.count.zero? %> - <%= button_to "Delete Channel", { action: "destroy", id: channel.id }, method: :delete, data: { confirm: "Are you sure?" }, class: "crayons-btn crayons-btn--danger" %> + <%= link_to "Delete Channel", admin_chat_channel_path(channel), class: "crayons-btn crayons-btn--danger", method: :delete, data: { confirm: "Are you sure?" } %> <% else %> Cannot delete a channel with users <% end %> diff --git a/app/views/admin/display_ads/index.html.erb b/app/views/admin/display_ads/index.html.erb index e922ee4ab..409f8d90a 100644 --- a/app/views/admin/display_ads/index.html.erb +++ b/app/views/admin/display_ads/index.html.erb @@ -1,5 +1,5 @@