Skip to content

Commit

Permalink
make locale languages not public, remove references to works, add loc…
Browse files Browse the repository at this point in the history
…ale language translations
  • Loading branch information
Cesium-Ice committed Dec 26, 2024
1 parent 3a9fecf commit 1c97a3e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/controllers/locale_languages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class LocaleLanguagesController < ApplicationController
def index
authorize LocaleLanguage
@locale_languages = LocaleLanguage.default_order
end

Expand All @@ -12,7 +13,7 @@ def create
@locale_language = LocaleLanguage.new(language_params)
authorize @locale_language
if @locale_language.save
flash[:notice] = t("languages.successfully_added")
flash[:notice] = t("locale_languages.successfully_added")
redirect_to locale_languages_path
else
render action: "new"
Expand All @@ -29,7 +30,7 @@ def update
authorize @locale_language

if @locale_language.update(permitted_attributes(@locale_language))
flash[:notice] = t("languages.successfully_updated")
flash[:notice] = t("locale_languages.successfully_updated")
redirect_to locale_languages_path
else
render action: "new"
Expand Down
1 change: 0 additions & 1 deletion app/models/locale_language.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class LocaleLanguage < ApplicationRecord
include WorksOwner
validates :short, presence: true
validates :short, uniqueness: true
validates :name, presence: true
Expand Down
1 change: 1 addition & 0 deletions app/policies/locale_language_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ def can_edit_non_abuse_fields?

alias create? new?
alias update? edit?
alias index? edit?
end
3 changes: 3 additions & 0 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ en:
languages:
successfully_added: Language was successfully added.
successfully_updated: Language was successfully updated.
locale_languages:
successfully_added: Locale language was successfully added.
successfully_updated: Locale language was successfully updated.
muted:
users:
create:
Expand Down

0 comments on commit 1c97a3e

Please sign in to comment.