|
5 | 5 | - parent_route_key = parent_model.model_name.singular_route_key |
6 | 6 | - if params["#{parent_route_key}_id"].present? |
7 | 7 | - parent_object = object.try(parent_route_key) || parent_model.find_by(id: params["#{parent_route_key}_id"]) |
8 | | - - 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}) |
9 | | - - 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}) |
10 | | - - 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)) |
| 8 | + - parent_element = link_to_if(current_user && policy(parent_object).show?, parent_object, parent_object) |
| 9 | + - parent_root_element = link_to_if(current_user && policy(parent_object.class).index?, parent_object.model_name.human(count: :other), parent_object.class) |
| 10 | + - root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), polymorphic_path([parent_object, model])) |
11 | 11 | - if object |
12 | | - - current_element = link_to_if(current_user && policy(object).show?, object, send(:"#{parent_route_key}_#{model.model_name.singular}_path", parent_object, object)) |
| 12 | + - current_element = link_to_if(current_user && policy(object).show?, object, polymorphic_path([parent_object, object])) |
13 | 13 | - else |
14 | | - - root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), {controller: model.model_name.route_key, action: :index}) |
| 14 | + - root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), model) |
15 | 15 | - if object |
16 | | - - current_element = link_to_if(current_user && policy(object).show?, object, {controller: model.model_name.route_key, action: :show, id: object.id}) |
| 16 | + - current_element = link_to_if(current_user && policy(object).show?, object, object) |
17 | 17 | - else |
18 | | - - root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: 2), {controller: model.model_name.route_key, action: :index}) |
| 18 | + - root_element = link_to_if(current_user && policy(model).index?, model.model_name.human(count: :other), model) |
19 | 19 | - if object |
20 | | - - current_element = link_to_if(current_user && policy(object).show?, object, {controller: model.model_name.route_key, action: :show, id: object.id}) |
| 20 | + - current_element = link_to_if(current_user && policy(object).show?, object, object) |
21 | 21 | - if I18n.exists?("shared.#{params[:action]}") |
22 | 22 | - active_action = t("shared.#{params[:action]}", model: model&.model_name&.human) |
23 | 23 | - else |
|
45 | 45 | = current_element |
46 | 46 | - title = "#{object} - #{title}" |
47 | 47 | - else |
48 | | - - title = "#{model.model_name.human(count: 2)} - #{title}" |
| 48 | + - title = "#{model.model_name.human(count: :other)} - #{title}" |
49 | 49 | li.breadcrumb-item.active.small |
50 | 50 | = active_action |
51 | 51 | - content_for :title, title |
0 commit comments