diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-07-25 03:51:44 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-07-25 03:51:44 +0200 |
| commit | baace1fa5df46694ddd515dc3bbca59b22df8692 (patch) | |
| tree | 6a8b587ca5d6d38377fe132b02c857f1c4149231 /app/controllers/assets_controller.rb | |
| parent | ed32bc6902ab634451539770bcd910662212e01a (diff) | |
Extract flashes to i18n and stop dispatching on submit labels
Diffstat (limited to 'app/controllers/assets_controller.rb')
| -rw-r--r-- | app/controllers/assets_controller.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/app/controllers/assets_controller.rb b/app/controllers/assets_controller.rb index 7edd9c05..f1c259e3 100644 --- a/app/controllers/assets_controller.rb +++ b/app/controllers/assets_controller.rb | |||
| @@ -49,7 +49,7 @@ class AssetsController < ApplicationController | |||
| 49 | 49 | ||
| 50 | respond_to do |format| | 50 | respond_to do |format| |
| 51 | if @asset.save | 51 | if @asset.save |
| 52 | flash[:notice] = 'Asset was successfully created.' | 52 | flash[:notice] = t("flash.assets.created") |
| 53 | NodeAction.record!(:participants => [@asset], :user => current_user, | 53 | NodeAction.record!(:participants => [@asset], :user => current_user, |
| 54 | :action => "asset_create", | 54 | :action => "asset_create", |
| 55 | :asset_name => @asset.name, | 55 | :asset_name => @asset.name, |
| @@ -72,7 +72,7 @@ class AssetsController < ApplicationController | |||
| 72 | 72 | ||
| 73 | respond_to do |format| | 73 | respond_to do |format| |
| 74 | if @asset.update(asset_params) | 74 | if @asset.update(asset_params) |
| 75 | flash[:notice] = 'Asset was successfully updated.' | 75 | flash[:notice] = t("flash.assets.updated") |
| 76 | format.html { redirect_to(@asset) } | 76 | format.html { redirect_to(@asset) } |
| 77 | format.xml { head :ok } | 77 | format.xml { head :ok } |
| 78 | else | 78 | else |
| @@ -105,14 +105,14 @@ class AssetsController < ApplicationController | |||
| 105 | :headline => params[:headline].present?) | 105 | :headline => params[:headline].present?) |
| 106 | flash[:notice] = | 106 | flash[:notice] = |
| 107 | if result[:attached].zero? | 107 | if result[:attached].zero? |
| 108 | "Asset saved — it was already attached to “#{node.title}”." | 108 | t("flash.assets.already_attached", :title => node.title) |
| 109 | else | 109 | else |
| 110 | "Asset was successfully created and attached to “#{node.title}”." | 110 | t("flash.assets.attached", :title => node.title) |
| 111 | end | 111 | end |
| 112 | case result[:headline] | 112 | case result[:headline] |
| 113 | when :set then flash[:notice] += " It is now the page's headline." | 113 | when :set then flash[:notice] += " " + t("flash.common.now_headline") |
| 114 | when :kept_existing then flash[:headline_kept_path] = node_path(node) | 114 | when :kept_existing then flash[:headline_kept_path] = node_path(node) |
| 115 | when :not_eligible then flash[:error] = "This asset type cannot be a headline." | 115 | when :not_eligible then flash[:error] = t("flash.common.headline_ineligible") |
| 116 | end | 116 | end |
| 117 | rescue LockedByAnotherUser | 117 | rescue LockedByAnotherUser |
| 118 | flash[:locked_by] = node.lock_owner&.login | 118 | flash[:locked_by] = node.lock_owner&.login |
