-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Bootstrapping Redirects into concerns
This should alleviate some of CodeClimate's concerns.
- Loading branch information
Showing
4 changed files
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/controllers/concerns/alchemy/admin/language_needed_redirect.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module Alchemy | ||
module Admin | ||
module LanguageNeededRedirect | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
before_action unless: -> { Alchemy::Language.current }, only: :index do | ||
flash[:warning] = Alchemy.t('Please create a language first.') | ||
redirect_to admin_languages_path | ||
end | ||
end | ||
end | ||
end | ||
end |