Commit 440c598c0f3586d793e73cd9dcd133473b7cfe39
Committed by
Rafael Manzo
1 parent
1e513097
Exists in
colab
and in
4 other branches
Adding translations to controllers
Signed off by: Daniel Alves <danpaulalves@gmail.com>
Showing
8 changed files
with
14 additions
and
14 deletions
Show diff stats
app/controllers/compound_metric_configurations_controller.rb
| @@ -25,7 +25,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -25,7 +25,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 25 | respond_to do |format| | 25 | respond_to do |format| |
| 26 | edit | 26 | edit |
| 27 | if @compound_metric_configuration.update(metric_configuration_params) | 27 | if @compound_metric_configuration.update(metric_configuration_params) |
| 28 | - format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: 'Compound Metric Configuration was successfully updated.' } | 28 | + format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: t('successfully_updated', :record => t('Compound' + @compound_metric_configuration.class.name)) } |
| 29 | format.json { head :no_content } | 29 | format.json { head :no_content } |
| 30 | else | 30 | else |
| 31 | failed_action(format, 'edit') | 31 | failed_action(format, 'edit') |
| @@ -59,7 +59,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | @@ -59,7 +59,7 @@ class CompoundMetricConfigurationsController < BaseMetricConfigurationsControlle | ||
| 59 | #Code extracted from create action | 59 | #Code extracted from create action |
| 60 | def create_and_redir(format) | 60 | def create_and_redir(format) |
| 61 | if @compound_metric_configuration.save | 61 | if @compound_metric_configuration.save |
| 62 | - format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: 'Compound Metric Configuration was successfully created.' } | 62 | + format.html { redirect_to kalibro_configuration_path(@compound_metric_configuration.kalibro_configuration_id), notice: t('successfully_created', :record => t('Compound' + @compound_metric_configuration.class.name)) } |
| 63 | else | 63 | else |
| 64 | failed_action(format, 'new') | 64 | failed_action(format, 'new') |
| 65 | end | 65 | end |
app/controllers/kalibro_configurations_controller.rb
| @@ -80,7 +80,7 @@ class KalibroConfigurationsController < ApplicationController | @@ -80,7 +80,7 @@ class KalibroConfigurationsController < ApplicationController | ||
| 80 | if @kalibro_configuration.save | 80 | if @kalibro_configuration.save |
| 81 | current_user.kalibro_configuration_ownerships.create kalibro_configuration_id: @kalibro_configuration.id | 81 | current_user.kalibro_configuration_ownerships.create kalibro_configuration_id: @kalibro_configuration.id |
| 82 | 82 | ||
| 83 | - format.html { redirect_to kalibro_configuration_path(@kalibro_configuration.id), notice: 'Configuration was successfully created.' } | 83 | + format.html { redirect_to kalibro_configuration_path(@kalibro_configuration.id), notice: t('successfully_created', :record => t(@kalibro_configuration.class.name)) } |
| 84 | format.json { render action: 'show', status: :created, location: @kalibro_configuration } | 84 | format.json { render action: 'show', status: :created, location: @kalibro_configuration } |
| 85 | else | 85 | else |
| 86 | format.html { render action: 'new' } | 86 | format.html { render action: 'new' } |
app/controllers/kalibro_ranges_controller.rb
| @@ -23,7 +23,7 @@ class KalibroRangesController < ApplicationController | @@ -23,7 +23,7 @@ class KalibroRangesController < ApplicationController | ||
| 23 | def destroy | 23 | def destroy |
| 24 | @kalibro_range.destroy | 24 | @kalibro_range.destroy |
| 25 | respond_to do |format| | 25 | respond_to do |format| |
| 26 | - format_metric_configuration_path(format, "Range was successfully destroyed.") | 26 | + format_metric_configuration_path(format, t('successfully_destroyed', :record => t(@kalibro_range.class))) |
| 27 | format.json { head :no_content } | 27 | format.json { head :no_content } |
| 28 | end | 28 | end |
| 29 | end | 29 | end |
| @@ -36,7 +36,7 @@ class KalibroRangesController < ApplicationController | @@ -36,7 +36,7 @@ class KalibroRangesController < ApplicationController | ||
| 36 | respond_to do |format| | 36 | respond_to do |format| |
| 37 | @kalibro_range.metric_configuration_id = @metric_configuration_id | 37 | @kalibro_range.metric_configuration_id = @metric_configuration_id |
| 38 | if @kalibro_range.update(kalibro_range_params) | 38 | if @kalibro_range.update(kalibro_range_params) |
| 39 | - format_metric_configuration_path(format, 'Range was successfully edited.') | 39 | + format_metric_configuration_path(format, t('successfully_updated', :record => t(@kalibro_range.class))) |
| 40 | format.json { head :no_content } | 40 | format.json { head :no_content } |
| 41 | else | 41 | else |
| 42 | failed_action(format, 'edit') | 42 | failed_action(format, 'edit') |
| @@ -53,7 +53,7 @@ class KalibroRangesController < ApplicationController | @@ -53,7 +53,7 @@ class KalibroRangesController < ApplicationController | ||
| 53 | 53 | ||
| 54 | def create_and_redir(format) | 54 | def create_and_redir(format) |
| 55 | if @kalibro_range.save | 55 | if @kalibro_range.save |
| 56 | - format_metric_configuration_path(format, 'Range was successfully created.') | 56 | + format_metric_configuration_path(format, t('successfully_created', :record => t(@kalibro_range.class))) |
| 57 | else | 57 | else |
| 58 | failed_action(format, 'new') | 58 | failed_action(format, 'new') |
| 59 | end | 59 | end |
app/controllers/metric_configurations_controller.rb
| @@ -29,7 +29,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | @@ -29,7 +29,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | ||
| 29 | respond_to do |format| | 29 | respond_to do |format| |
| 30 | @metric_configuration.kalibro_configuration_id = params[:kalibro_configuration_id] | 30 | @metric_configuration.kalibro_configuration_id = params[:kalibro_configuration_id] |
| 31 | if @metric_configuration.update(metric_configuration_params) | 31 | if @metric_configuration.update(metric_configuration_params) |
| 32 | - format.html { redirect_to(kalibro_configuration_path(@metric_configuration.kalibro_configuration_id), notice: 'Metric Configuration was successfully updated.') } | 32 | + format.html { redirect_to(kalibro_configuration_path(@metric_configuration.kalibro_configuration_id), notice: t('successfully_updated', :record => t(metric_configuration.class))) } |
| 33 | format.json { head :no_content } | 33 | format.json { head :no_content } |
| 34 | Rails.cache.delete("#{@metric_configuration.kalibro_configuration_id}_metric_configurations") | 34 | Rails.cache.delete("#{@metric_configuration.kalibro_configuration_id}_metric_configurations") |
| 35 | else | 35 | else |
| @@ -71,7 +71,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | @@ -71,7 +71,7 @@ class MetricConfigurationsController < BaseMetricConfigurationsController | ||
| 71 | #Code extracted from create action | 71 | #Code extracted from create action |
| 72 | def create_and_redir(format) | 72 | def create_and_redir(format) |
| 73 | if @metric_configuration.save | 73 | if @metric_configuration.save |
| 74 | - format.html { redirect_to kalibro_configuration_path(@metric_configuration.kalibro_configuration_id), notice: 'Metric Configuration was successfully created.' } | 74 | + format.html { redirect_to kalibro_configuration_path(@metric_configuration.kalibro_configuration_id), notice: t('successfully_created', :record => t(metric_configuration.class)) } |
| 75 | else | 75 | else |
| 76 | failed_action(format, 'new') | 76 | failed_action(format, 'new') |
| 77 | end | 77 | end |
app/controllers/projects_controller.rb
| @@ -79,7 +79,7 @@ class ProjectsController < ApplicationController | @@ -79,7 +79,7 @@ class ProjectsController < ApplicationController | ||
| 79 | def create_and_redir(format) | 79 | def create_and_redir(format) |
| 80 | if @project.save | 80 | if @project.save |
| 81 | current_user.project_attributes.create(project_id: @project.id) | 81 | current_user.project_attributes.create(project_id: @project.id) |
| 82 | - format.html { redirect_to project_path(@project.id), notice: 'Project was successfully created.' } | 82 | + format.html { redirect_to project_path(@project.id), notice: t('successfully_created', :record => t(@project.class.name)) } |
| 83 | format.json { render action: 'show', status: :created, location: @project } | 83 | format.json { render action: 'show', status: :created, location: @project } |
| 84 | else | 84 | else |
| 85 | format.html { render action: 'new' } | 85 | format.html { render action: 'new' } |
app/controllers/reading_groups_controller.rb
| @@ -71,7 +71,7 @@ class ReadingGroupsController < ApplicationController | @@ -71,7 +71,7 @@ class ReadingGroupsController < ApplicationController | ||
| 71 | if @reading_group.save | 71 | if @reading_group.save |
| 72 | current_user.reading_group_ownerships.create reading_group_id: @reading_group.id | 72 | current_user.reading_group_ownerships.create reading_group_id: @reading_group.id |
| 73 | 73 | ||
| 74 | - format.html { redirect_to reading_group_path(@reading_group.id), notice: 'Reading Group was successfully created.' } | 74 | + format.html { redirect_to reading_group_path(@reading_group.id), notice: t('successfully_created', :record => t(@reading_group.class)) } |
| 75 | format.json { render action: 'show', status: :created, location: @reading_group } | 75 | format.json { render action: 'show', status: :created, location: @reading_group } |
| 76 | else | 76 | else |
| 77 | format.html { render action: 'new' } | 77 | format.html { render action: 'new' } |
app/controllers/readings_controller.rb
| @@ -28,7 +28,7 @@ class ReadingsController < ApplicationController | @@ -28,7 +28,7 @@ class ReadingsController < ApplicationController | ||
| 28 | def update | 28 | def update |
| 29 | respond_to do |format| | 29 | respond_to do |format| |
| 30 | if @reading.update(reading_params) | 30 | if @reading.update(reading_params) |
| 31 | - format.html { redirect_to(reading_group_path(@reading.reading_group_id), notice: 'Reading was successfully updated.') } | 31 | + format.html { redirect_to(reading_group_path(@reading.reading_group_id), notice: t('successfully_updated', :record => t(@reading.class))) } |
| 32 | format.json { head :no_content } | 32 | format.json { head :no_content } |
| 33 | else | 33 | else |
| 34 | failed_action(format, 'edit') | 34 | failed_action(format, 'edit') |
| @@ -63,7 +63,7 @@ class ReadingsController < ApplicationController | @@ -63,7 +63,7 @@ class ReadingsController < ApplicationController | ||
| 63 | # Code extracted from create action | 63 | # Code extracted from create action |
| 64 | def create_and_redir(format) | 64 | def create_and_redir(format) |
| 65 | if @reading.save | 65 | if @reading.save |
| 66 | - format.html { redirect_to reading_group_path(@reading.reading_group_id), notice: 'Reading was successfully created.' } | 66 | + format.html { redirect_to reading_group_path(@reading.reading_group_id), notice: t('successfully_created', :record => t(@reading.class)) } |
| 67 | else | 67 | else |
| 68 | @reading_group_id = params[:reading_group_id] | 68 | @reading_group_id = params[:reading_group_id] |
| 69 | failed_action(format, 'new') | 69 | failed_action(format, 'new') |
app/controllers/repositories_controller.rb
| @@ -43,7 +43,7 @@ class RepositoriesController < ApplicationController | @@ -43,7 +43,7 @@ class RepositoriesController < ApplicationController | ||
| 43 | def update | 43 | def update |
| 44 | respond_to do |format| | 44 | respond_to do |format| |
| 45 | if @repository.update(repository_params) | 45 | if @repository.update(repository_params) |
| 46 | - format.html { redirect_to(project_repository_path(params[:project_id], @repository.id), notice: 'Repository was successfully updated.') } | 46 | + format.html { redirect_to(project_repository_path(params[:project_id], @repository.id), notice: t('successfully_updated', :record => t(@repository.class))) } |
| 47 | format.json { head :no_content } | 47 | format.json { head :no_content } |
| 48 | else | 48 | else |
| 49 | failed_action(format, 'edit') | 49 | failed_action(format, 'edit') |
| @@ -118,7 +118,7 @@ private | @@ -118,7 +118,7 @@ private | ||
| 118 | # Code extracted from create action | 118 | # Code extracted from create action |
| 119 | def create_and_redir(format) | 119 | def create_and_redir(format) |
| 120 | if @repository.save | 120 | if @repository.save |
| 121 | - format.html { redirect_to project_repository_process_path(@repository.project_id, @repository.id), notice: 'Repository was successfully created.' } | 121 | + format.html { redirect_to project_repository_process_path(@repository.project_id, @repository.id), notice: t('successfully_created', :record => t(@repository.class)) } |
| 122 | else | 122 | else |
| 123 | failed_action(format, 'new') | 123 | failed_action(format, 'new') |
| 124 | end | 124 | end |