Replace manual activerecord translations with helpers
This commit is contained in:

committed by
Sebastian Serth

parent
e551c8a699
commit
f8330b39fb
@@ -6,16 +6,16 @@
|
||||
- if params["#{parent_route_key}_id"].present?
|
||||
- parent_object = object.try(parent_route_key) || parent_model.find_by(id: params["#{parent_route_key}_id"])
|
||||
- parent_element = link_to_if(current_user && policy(parent_object).show?, parent_object, {controller: parent_model.model_name.route_key, action: :show, id: parent_object.id})
|
||||
- parent_root_element = link_to_if(current_user && policy(parent_model).index?, parent_model.model_name.human(count: 2), {controller: parent_model.model_name.route_key, action: :index})
|
||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), send(:"#{parent_route_key}_#{model.model_name.route_key}_path", parent_object))
|
||||
- parent_root_element = link_to_if(current_user && policy(parent_model).index?, parent_model.model_name.human(count: :other), {controller: parent_model.model_name.route_key, action: :index})
|
||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), send(:"#{parent_route_key}_#{model.model_name.route_key}_path", parent_object))
|
||||
- if object
|
||||
- current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{parent_route_key}_#{model.model_name.singular}_path", parent_object, object))
|
||||
- else
|
||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), {controller: model.model_name.route_key, action: :index})
|
||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), {controller: model.model_name.route_key, action: :index})
|
||||
- if object
|
||||
- current_element = link_to_if(current_user && policy(object).show?, object, {controller: model.model_name.route_key, action: :show, id: object.id})
|
||||
- else
|
||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), {controller: model.model_name.route_key, action: :index})
|
||||
- root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), {controller: model.model_name.route_key, action: :index})
|
||||
- if object
|
||||
- current_element = link_to_if(current_user && policy(object).show?, object, {controller: model.model_name.route_key, action: :show, id: object.id})
|
||||
- if I18n.exists?("shared.#{params[:action]}")
|
||||
@@ -45,7 +45,7 @@
|
||||
= current_element
|
||||
- title = "#{object} - #{title}"
|
||||
- else
|
||||
- title = "#{model.model_name.human(count: 2)} - #{title}"
|
||||
- title = "#{model.model_name.human(count: :other)} - #{title}"
|
||||
li.breadcrumb-item.active.small
|
||||
= active_action
|
||||
- content_for :title, title
|
||||
|
@@ -10,7 +10,7 @@
|
||||
li = link_to(t('breadcrumbs.rails_admin.show'), rails_admin.dashboard_path, class: 'dropdown-item', 'data-turbolinks': 'false') if policy(%i[admin dashboard]).show?
|
||||
li = link_to(t('breadcrumbs.statistics.show'), statistics_path, class: 'dropdown-item') if policy(:statistics).show?
|
||||
li.dropdown-divider role='separator'
|
||||
= render('navigation_submenu', title: t('activerecord.models.exercise.other'),
|
||||
= render('navigation_submenu', title: Exercise.model_name.human(count: :other),
|
||||
models: [Exercise, ExerciseCollection, ProxyExercise, Tag, Tip, Submission], link: exercises_path, cached: true)
|
||||
= render('navigation_submenu', title: t('navigation.sections.contributors'), models: [InternalUser, ExternalUser, ProgrammingGroup],
|
||||
cached: true)
|
||||
|
@@ -1,2 +1,2 @@
|
||||
- if policy(model).index?
|
||||
li = link_to(model.model_name.human(count: 2), send(:"#{model.model_name.collection}_path"), class: 'dropdown-item')
|
||||
li = link_to(model.model_name.human(count: :other), send(:"#{model.model_name.collection}_path"), class: 'dropdown-item')
|
||||
|
Reference in New Issue
Block a user