File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
views/fields/select/looks/group Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,11 @@ class ProductDashboard < Administrate::BaseDashboard
2323 price : Field ::Number . with_options ( prefix : "$" , decimals : 2 ) ,
2424 product_meta_tag : Field ::HasOne . with_options ( order : "meta_title" ) ,
2525 release_year : Field ::Select . with_options (
26- collection : -> { ( Time . current . year - 10 ) ..Time . current . year }
26+ collection : -> {
27+ ( ( Time . current . year - 10 ) ..Time . current . year ) . to_a . reverse
28+ . group_by { |year | "'#{ ( year / 10 ) * 10 } s" }
29+ } ,
30+ look : :group
2731 )
2832 }
2933
Original file line number Diff line number Diff line change 1+ < div class ="field-unit__label ">
2+ <%= f . label field . attribute %>
3+ </ div >
4+ < div class ="field-unit__field ">
5+ <%=
6+ f . select (
7+ field . attribute ,
8+ { include_blank : field . include_blank_option } ,
9+ data : { controller : field . html_controller }
10+ ) do
11+ %>
12+ <%= grouped_options_for_select (
13+ field . selectable_options ,
14+ field . data ,
15+ prompt : true
16+ )
17+ %>
18+ <% end %>
19+ </ div >
You can’t perform that action at this time.
0 commit comments