@@ -108,9 +108,9 @@ function on_change_category( el ) {
108
108
109
109
``` rb
110
110
member_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)
114
114
end
115
115
```
116
116
@@ -119,24 +119,24 @@ end
119
119
``` rb
120
120
# Edit a string:
121
121
column :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) )
123
123
end
124
124
# Edit a boolean:
125
125
column :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)
127
127
end
128
128
# Edit a select ([''] allow to have a blank value):
129
129
column :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)
132
132
end
133
133
end
134
134
```
135
135
136
- - In * show* config (less useful ):
136
+ - In * show* config (inside ` attributes_table ` block ):
137
137
``` rb
138
138
row :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) )
140
140
end
141
141
```
142
142
@@ -150,12 +150,16 @@ Prepare the content dialog - in Active Admin Author config:
150
150
ActiveAdmin .register Author do
151
151
# ...
152
152
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
156
161
end
157
- content += ' </dl>'
158
- render plain: content
162
+ render plain: context
159
163
end
160
164
# ...
161
165
end
@@ -170,7 +174,7 @@ ActiveAdmin.register Article do
170
174
attributes_table do
171
175
# ...
172
176
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
174
178
end
175
179
end
176
180
end
@@ -188,7 +192,7 @@ Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8
188
192
189
193
## Contributors
190
194
191
- - [ Mattia Roccoberton] ( http://blocknot.es ) - creator, maintainer
195
+ - [ Mattia Roccoberton] ( http://blocknot.es ) : author
192
196
193
197
## License
194
198
0 commit comments