File tree Expand file tree Collapse file tree 3 files changed +5
-14
lines changed
lib/matestack/ui/bootstrap/content/smart_collection Expand file tree Collapse file tree 3 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -201,22 +201,14 @@ def collection_config
201201 rerender_on: " success" ,
202202 columns: {
203203 price_in_euro: {
204- heading: ' Price in €' ,
205- slot: method(:price_in_euro_column_slot ),
206- },
207- self: {
208204 heading: ' Price in € accessed via row object' ,
209- slot: method(:whole_object_column_slot ),
205+ slot: method(:price_in_euro_column_slot ) # slots ALWAYS get the whole row object passed in!
210206 }
211207 }
212208 }
213209end
214210
215- def price_in_euro_column_slot price_in_euro
216- bs_badge price_in_euro # or whatever you want to do with all kinds of components
217- end
218-
219- def whole_object_column_slot order
211+ def price_in_euro_column_slot order
220212 bs_badge order.price_in_euro # or whatever you want to do with all kinds of components
221213end
222214```
Original file line number Diff line number Diff line change @@ -70,8 +70,7 @@ def table_footer
7070 def cell ( data , key , value )
7171 td class : cell_class ( value ) do
7272 if value . is_a? ( Hash ) && value [ :slot ]
73- value [ :slot ] . call ( data . instance_eval ( key . to_s ) ) if value [ :attribute ] . nil?
74- value [ :slot ] . call ( data . instance_eval ( value [ :attribute ] . to_s ) ) if value [ :attribute ] . present?
73+ value [ :slot ] . call ( data )
7574 else
7675 plain cell_text ( data , key , value )
7776 end
Original file line number Diff line number Diff line change 430430 }
431431 end
432432
433- ExamplePage . define_method ( :last_name_slot_rendering ) do |last_name |
434- bs_badge last_name
433+ ExamplePage . define_method ( :last_name_slot_rendering ) do |customer |
434+ bs_badge customer . last_name
435435 end
436436
437437 matestack_render do
You can’t perform that action at this time.
0 commit comments