|
8 | 8 | - else |
9 | 9 | = wording |
10 | 10 | %ul |
11 | | - - @abstract_model.each_associated_children(object) do |association, child| |
12 | | - %li |
13 | | - - child_config = RailsAdmin.config(child) |
14 | | - = @abstract_model.model.human_attribute_name association.name |
15 | | - - wording = child.send(child_config.object_label_method) |
16 | | - - if child.id && (show_action = action(:show, child_config.abstract_model, child)) |
17 | | - = link_to(wording, url_for(action: show_action.action_name, model_name: child_config.abstract_model.to_param, id: child.id), class: 'pjax') |
18 | | - - else |
19 | | - = wording |
| 11 | + - @abstract_model.each_associated_children(object) do |association, children| |
| 12 | + - humanized_association = @abstract_model.model.human_attribute_name association.name |
| 13 | + - limit = children.count > 12 ? 10 : children.count |
| 14 | + - children.first(limit).each do |child| |
| 15 | + = content_tag_for :li, child do |
| 16 | + - child_config = RailsAdmin.config(child) |
| 17 | + = humanized_association.singularize |
| 18 | + - wording = child.send(child_config.object_label_method) |
| 19 | + - if child.id && (show_action = action(:show, child_config.abstract_model, child)) |
| 20 | + = link_to(wording, url_for(action: show_action.action_name, model_name: child_config.abstract_model.to_param, id: child.id), class: 'pjax') |
| 21 | + - else |
| 22 | + = wording |
| 23 | + - if children.count > limit |
| 24 | + %li= t('admin.misc.more', count: children.count - limit, models_name: humanized_association) |
0 commit comments