minor refactoring of flash messages
This commit is contained in:
@ -17,8 +17,7 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
def render_not_authorized
|
||||
flash[:danger] = t('application.not_authorized')
|
||||
redirect_to(:root)
|
||||
redirect_to(:root, alert: t('application.not_authorized'))
|
||||
end
|
||||
private :render_not_authorized
|
||||
|
||||
|
@ -39,8 +39,7 @@ class InternalUsersController < ApplicationController
|
||||
def deliver_reset_password_instructions
|
||||
if params[:email].present?
|
||||
InternalUser.find_by(email: params[:email]).try(:deliver_reset_password_instructions!)
|
||||
flash[:notice] = t('.success')
|
||||
redirect_to(:root)
|
||||
redirect_to(:root, notice: t('.success'))
|
||||
end
|
||||
end
|
||||
private :deliver_reset_password_instructions
|
||||
@ -77,10 +76,7 @@ class InternalUsersController < ApplicationController
|
||||
end
|
||||
|
||||
def render_forgot_password_form
|
||||
if current_user
|
||||
flash[:warning] = t('shared.already_signed_in')
|
||||
redirect_to(:root)
|
||||
end
|
||||
redirect_to(:root, alert: t('shared.already_signed_in')) if current_user
|
||||
end
|
||||
private :render_forgot_password_form
|
||||
|
||||
|
@ -21,8 +21,7 @@ class SessionsController < ApplicationController
|
||||
set_current_user
|
||||
store_lti_session_data(consumer: @consumer, parameters: params)
|
||||
store_nonce(params[:oauth_nonce])
|
||||
flash[:notice] = I18n.t("sessions.create_through_lti.session_#{lti_outcome_service? ? 'with' : 'without'}_outcome", consumer: @consumer)
|
||||
redirect_to(implement_exercise_path(@exercise))
|
||||
redirect_to(implement_exercise_path(@exercise), notice: t("sessions.create_through_lti.session_#{lti_outcome_service? ? 'with' : 'without'}_outcome", consumer: @consumer))
|
||||
end
|
||||
|
||||
def destroy
|
||||
@ -41,9 +40,6 @@ class SessionsController < ApplicationController
|
||||
end
|
||||
|
||||
def new
|
||||
if current_user
|
||||
flash[:warning] = t('shared.already_signed_in')
|
||||
redirect_to(:root)
|
||||
end
|
||||
redirect_to(:root, alert: t('shared.already_signed_in')) if current_user
|
||||
end
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ module ApplicationHelper
|
||||
def label_column(label)
|
||||
content_tag(:div, class: 'col-sm-3') do
|
||||
content_tag(:strong) do
|
||||
translation_present?("activerecord.attributes.#{label}") ? t("activerecord.attributes.#{label}") : t(label)
|
||||
I18n.translation_present?("activerecord.attributes.#{label}") ? t("activerecord.attributes.#{label}") : t(label)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -60,11 +60,6 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def translation_present?(key)
|
||||
I18n.t(key, default: '').present?
|
||||
end
|
||||
private :translation_present?
|
||||
|
||||
def value_column(value)
|
||||
content_tag(:div, class: 'col-sm-9') do
|
||||
block_given? ? yield : symbol_for(value)
|
||||
|
@ -11,7 +11,7 @@
|
||||
- if object
|
||||
li = link_to(object, send(:"#{model.model_name.singular}_path", object))
|
||||
li.active
|
||||
- if translation_present?("shared.#{params[:action]}")
|
||||
- if I18n.translation_present?("shared.#{params[:action]}")
|
||||
= t("shared.#{params[:action]}")
|
||||
- else
|
||||
= t("#{controller_name}.index.#{params[:action]}")
|
||||
|
Reference in New Issue
Block a user