@@ -108,9 +108,9 @@ function on_change_category( el ) {
108108
109109``` rb
110110member_action :save , method: [:post ] do
111- render ActiveAdmin ::DynamicFields :: update( resource, params )
112- # render ActiveAdmin::DynamicFields:: update( resource, params, [:published] )
113- # render ActiveAdmin::DynamicFields:: update( resource, params, Article::permit_params )
111+ render ActiveAdmin ::DynamicFields . update(resource, params)
112+ # render ActiveAdmin::DynamicFields. update(resource, params, [:published])
113+ # render ActiveAdmin::DynamicFields. update(resource, params, Article::permit_params)
114114end
115115```
116116
@@ -119,24 +119,24 @@ end
119119``` rb
120120# Edit a string:
121121column :title do |row |
122- div row.title, ActiveAdmin ::DynamicFields :: edit_string( :title , save_admin_article_path( row.id ) )
122+ div row.title, ActiveAdmin ::DynamicFields . edit_string(:title , save_admin_article_path(row.id) )
123123end
124124# Edit a boolean:
125125column :published do |row |
126- status_tag row.published, ActiveAdmin ::DynamicFields :: edit_boolean( :published , save_admin_article_path( row.id ), row.published )
126+ status_tag row.published, ActiveAdmin ::DynamicFields . edit_boolean(:published , save_admin_article_path(row.id), row.published)
127127end
128128# Edit a select ([''] allow to have a blank value):
129129column :author do |row |
130- select ActiveAdmin ::DynamicFields :: edit_select( :author_id , save_admin_article_path( row.id ) ) do
131- options_for_select( [' ' ] + Author .pluck( :name , :id ), row.author_id )
130+ select ActiveAdmin ::DynamicFields . edit_select(:author_id , save_admin_article_path(row.id) ) do
131+ options_for_select([' ' ] + Author .pluck(:name , :id ), row.author_id)
132132 end
133133end
134134```
135135
136- - In * show* config (less useful ):
136+ - In * show* config (inside ` attributes_table ` block ):
137137``` rb
138138row :title do |row |
139- div row.title, ActiveAdmin ::DynamicFields :: edit_string( :title , save_admin_article_path( row.id ) )
139+ div row.title, ActiveAdmin ::DynamicFields . edit_string(:title , save_admin_article_path(row.id) )
140140end
141141```
142142
@@ -150,12 +150,16 @@ Prepare the content dialog - in Active Admin Author config:
150150ActiveAdmin .register Author do
151151 # ...
152152 member_action :dialog do
153- content = ' <dl style="margin: 12px">'
154- [:name , :age , :created_at ].each do |field |
155- content += " <dt>#{ Author .human_attribute_name(field)} :</dt><dd>#{ resource[field] } </dd>"
153+ record = resource
154+ context = Arbre ::Context .new do
155+ dl do
156+ %i[name age created_at] .each do |field |
157+ dt " #{ Author .human_attribute_name(field)} :"
158+ dd record[field]
159+ end
160+ end
156161 end
157- content += ' </dl>'
158- render plain: content
162+ render plain: context
159163 end
160164 # ...
161165end
@@ -170,7 +174,7 @@ ActiveAdmin.register Article do
170174 attributes_table do
171175 # ...
172176 row :author do
173- link_to object.author.name, dialog_admin_author_path( object.author ), title: object.author.name, ' data-df-dialog' : true , ' data-df-icon' : true
177+ link_to object.author.name, dialog_admin_author_path(object.author), title: object.author.name, ' data-df-dialog' : true , ' data-df-icon' : true
174178 end
175179 end
176180 end
@@ -188,7 +192,7 @@ Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8
188192
189193## Contributors
190194
191- - [ Mattia Roccoberton] ( http://blocknot.es ) - creator, maintainer
195+ - [ Mattia Roccoberton] ( http://blocknot.es ) : author
192196
193197## License
194198
0 commit comments