Merge pull request #3766 from consul/relative_urls

Use relative URLs where possible
This commit is contained in:
Javier Martín
2019-10-20 18:33:13 +02:00
committed by GitHub
33 changed files with 66 additions and 78 deletions

View File

@@ -5,7 +5,7 @@ class Admin::Poll::ActivePollsController < Admin::Poll::BaseController
def create
if @active_poll.update(active_poll_params)
redirect_to admin_polls_url, notice: t("flash.actions.update.active_poll")
redirect_to admin_polls_path, notice: t("flash.actions.update.active_poll")
else
render :edit
end
@@ -16,7 +16,7 @@ class Admin::Poll::ActivePollsController < Admin::Poll::BaseController
def update
if @active_poll.update(active_poll_params)
redirect_to admin_polls_url, notice: t("flash.actions.update.active_poll")
redirect_to admin_polls_path, notice: t("flash.actions.update.active_poll")
else
render :edit
end

View File

@@ -60,7 +60,7 @@ class Admin::Widget::CardsController < Admin::BaseController
if @card.site_customization_page_id
redirect_to admin_site_customization_page_cards_path(page), notice: notice
else
redirect_to admin_homepage_url, notice: notice
redirect_to admin_homepage_path, notice: notice
end
end

View File

@@ -1,6 +1,4 @@
class CommentsController < ApplicationController
include CustomUrlsHelper
before_action :authenticate_user!, only: :create
before_action :load_commentable, only: :create
before_action :verify_resident_for_commentable!, only: :create
@@ -104,7 +102,7 @@ class CommentsController < ApplicationController
return if current_user.administrator? || current_user.moderator?
if @commentable.respond_to?(:comments_closed?) && @commentable.comments_closed?
redirect_to @commentable, alert: t("comments.comments_closed")
redirect_to polymorphic_hierarchy_path(@commentable), alert: t("comments.comments_closed")
end
end

View File

@@ -4,7 +4,7 @@ module AccessDeniedHandler
included do
rescue_from CanCan::AccessDenied do |exception|
respond_to do |format|
format.html { redirect_to main_app.root_url, alert: exception.message }
format.html { redirect_to main_app.root_path, alert: exception.message }
format.json { render json: { error: exception.message }, status: :forbidden }
end
end

View File

@@ -32,7 +32,7 @@ class Management::UsersController < Management::BaseController
def logout
destroy_session
redirect_to management_root_url, notice: t("management.sessions.signed_out_managed_user")
redirect_to management_root_path, notice: t("management.sessions.signed_out_managed_user")
end
private

View File

@@ -1,6 +1,4 @@
class NotificationsController < ApplicationController
include CustomUrlsHelper
before_action :authenticate_user!
skip_authorization_check

View File

@@ -36,7 +36,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
set_flash_message(:notice, :success, kind: provider.to_s.capitalize) if is_navigational_format?
else
session["devise.#{provider}_data"] = auth
redirect_to new_user_registration_url
redirect_to new_user_registration_path
end
end

View File

@@ -26,7 +26,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
def delete
current_user.erase(erase_params[:erase_reason])
sign_out
redirect_to root_url, notice: t("devise.registrations.destroyed")
redirect_to root_path, notice: t("devise.registrations.destroyed")
end
def success