fae-rails 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -22
- data/config/deploy.rb +3 -3
- data/docs/customization.md +471 -0
- data/docs/helpers.md +528 -0
- data/docs/index.md +131 -0
- data/docs/javascript.md +21 -0
- data/docs/upgrading.md +28 -0
- data/docs/usage.md +627 -0
- data/lib/fae/version.rb +1 -1
- data/spec/dummy/app/views/pages/home.html.erb +1 -1
- data/vendor/assets/javascripts/chosen.jquery.min.js +2 -0
- data/vendor/assets/javascripts/grinder.js +331 -0
- data/vendor/assets/javascripts/html5shiv-printshiv.js +7 -0
- data/vendor/assets/javascripts/html5shiv.js +4 -0
- data/vendor/assets/javascripts/imagesloaded.pkgd.min.js +7 -0
- data/vendor/assets/javascripts/jquery.daterangepicker.js +1292 -0
- data/vendor/assets/javascripts/jquery.multi-select.js +532 -0
- data/vendor/assets/javascripts/jquery.simplemodal.1.4.4.js +719 -0
- data/vendor/assets/javascripts/jquery.simplemodal.1.4.4.min.js +26 -0
- data/vendor/assets/javascripts/jquery.tablesorter.js +1901 -0
- data/vendor/assets/javascripts/js.cookie.js +139 -0
- data/vendor/assets/javascripts/moment.min.js +7 -0
- data/vendor/assets/javascripts/simplemde.min.js +13 -0
- data/vendor/assets/javascripts/touch_punch.js +11 -0
- data/vendor/assets/stylesheets/chosen-sprite.png +0 -0
- data/vendor/assets/stylesheets/chosen-sprite@2x.png +0 -0
- data/vendor/assets/stylesheets/daterangepicker.css +227 -0
- data/vendor/assets/stylesheets/reset.css +48 -0
- data/vendor/assets/stylesheets/simplemde.min.css +7 -0
- metadata +28 -3
data/docs/helpers.md
ADDED
@@ -0,0 +1,528 @@
|
|
1
|
+
# Helpers
|
2
|
+
|
3
|
+
* [Form Helpers](#form-helpers)
|
4
|
+
* [Nested Form Helpers](#nested-form-helpers)
|
5
|
+
* [View Helpers](#view-helpers)
|
6
|
+
* [Fae Partials](#fae-partials)
|
7
|
+
* [Add-ons](#add-ons)
|
8
|
+
|
9
|
+
---
|
10
|
+
|
11
|
+
# Form Helpers
|
12
|
+
|
13
|
+
Form helpers in Fae use the [simple_form](https://github.com/plataformatec/simple_form) gem as it's base. In most cases options that simple_form accepts can be passed into these helpers directly. The reason why we've established these helpers it to allow for customized options. They also provide a method to directly hook into Fae, so we can push out features and bugfixes.
|
14
|
+
|
15
|
+
## Format
|
16
|
+
|
17
|
+
All form helpers are in the following format:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
fae_method_name(f, attribute, options)
|
21
|
+
```
|
22
|
+
|
23
|
+
| argument | description |
|
24
|
+
| -------- | ----------- |
|
25
|
+
| f | **(required)** The variable simple_form passes through in it's block. The actual variable can vary based on how you setup the view, but `f` is the generated default. |
|
26
|
+
| attribute | **(required)** The attribute the form element is displaying. It's recommended you use symbols over strings. |
|
27
|
+
| options | An optional hash of options to customize the form element. |
|
28
|
+
|
29
|
+
### Global Options
|
30
|
+
|
31
|
+
| option | type | default | description |
|
32
|
+
| ------ | ---- | ------- | ----------- |
|
33
|
+
| label | string | attribute.humanize | the form label |
|
34
|
+
| helper_text | string | | helper text that appears under label |
|
35
|
+
| hint | string | | text that appears in a hint modal (cannot be combined with `dark_hint`) |
|
36
|
+
| dark_hint | string | | text that appears in a dark color scheme (cannot be combined with `hint`) |
|
37
|
+
| markdown | boolean | false | adds markdown GUI toolbar |
|
38
|
+
| markdown_supported | boolean | false | displays support text and hint for markdown |
|
39
|
+
| input_class | string | | a class to add to the input element |
|
40
|
+
| wrapper_class | string | | a class to add to the wrapper element |
|
41
|
+
| validate | boolean | true | triggers `judge` to validate element |
|
42
|
+
|
43
|
+
|
44
|
+
## fae_input
|
45
|
+
|
46
|
+
*attributes only*
|
47
|
+
|
48
|
+
fae_input is the basic input method derived from simple_form's f.input. What it displays will depend on the column type of the attribute. See [simple_form's documentationn](https://github.com/plataformatec/simple_form#available-input-types-and-defaults-for-each-column-type) to learn more.
|
49
|
+
|
50
|
+
|
51
|
+
**Examples**
|
52
|
+
|
53
|
+
An input[type=text] with an added wrapper_class and helper_text:
|
54
|
+
```ruby
|
55
|
+
fae_input f, :first_name, wrapper_class: 'special_wrapper', helper_text: 'No more than 50 characters'
|
56
|
+
```
|
57
|
+
|
58
|
+
A textarea with Fae's built-in markdown hint:
|
59
|
+
```ruby
|
60
|
+
fae_input f, :description, markdown_supported: true
|
61
|
+
```
|
62
|
+
|
63
|
+
## fae_association
|
64
|
+
|
65
|
+
*associations only*
|
66
|
+
|
67
|
+
fae_association is directly derived from simple_form's f.association. Again, the element it renders depends on the association type.
|
68
|
+
|
69
|
+
| option | type | default | description |
|
70
|
+
| ------ | ---- | ------- | ----------- |
|
71
|
+
| collection | array or AR:Relation | AssociationClass.all | an array or ActiveRecord object of items to populate the element |
|
72
|
+
|
73
|
+
**Examples**
|
74
|
+
|
75
|
+
A dropdown listing active people
|
76
|
+
```ruby
|
77
|
+
fae_association f, :people, collection: Person.active
|
78
|
+
```
|
79
|
+
|
80
|
+
## fae_checkbox
|
81
|
+
|
82
|
+
| option | type | default | description |
|
83
|
+
| ------ | ---- | ------- | ----------- |
|
84
|
+
| type | 'stacked' or 'inline' | stacked | determines how multiple checkboxes are displayed |
|
85
|
+
|
86
|
+
**Examples**
|
87
|
+
|
88
|
+
A single attribute checkbox
|
89
|
+
```ruby
|
90
|
+
fae_checkbox f, :active
|
91
|
+
```
|
92
|
+
|
93
|
+
Inline has_many collection of checkboxes
|
94
|
+
```ruby
|
95
|
+
fae_checkbox f, :promos, type: 'inline', collection: Promo.live
|
96
|
+
```
|
97
|
+
|
98
|
+
## fae_radio
|
99
|
+
|
100
|
+
| option | type | default | description |
|
101
|
+
| ------ | ---- | ------- | ----------- |
|
102
|
+
| type | 'stacked' or 'inline' | stacked | determines how multiple checkboxes are displayed |
|
103
|
+
|
104
|
+
**Examples**
|
105
|
+
|
106
|
+
A single attribute radio
|
107
|
+
```ruby
|
108
|
+
fae_radio f, :active, type: 'inline'
|
109
|
+
```
|
110
|
+
|
111
|
+
A belongs_to association
|
112
|
+
```ruby
|
113
|
+
fae_radio f, :wine
|
114
|
+
```
|
115
|
+
|
116
|
+
## fae_pulldown
|
117
|
+
|
118
|
+
| option | type | default | description |
|
119
|
+
| ------ | ---- | ------- | ----------- |
|
120
|
+
| collection | array or AR:Relation | AssociationClass.all | an array or ActiveRecord object of items to populate the element |
|
121
|
+
| size | 'long' or 'short' | long | determines the size of the pulldown |
|
122
|
+
| search | boolean | search is displayed with more than 10 items | determines whether or not to show the search bar |
|
123
|
+
|
124
|
+
**Examples**
|
125
|
+
|
126
|
+
A short pulldown of a belongs_to association
|
127
|
+
```ruby
|
128
|
+
fae_pulldown f, :wine, size: 'short', collection: Wine.order(:name)
|
129
|
+
```
|
130
|
+
|
131
|
+
## fae_multiselect
|
132
|
+
|
133
|
+
*associations only*
|
134
|
+
|
135
|
+
| option | type | default | description |
|
136
|
+
| ------ | ---- | ------- | ----------- |
|
137
|
+
| two_pane | boolean | false | By default this will display a chosen style multiselect, setting this to true will display the 'two pane' style. |
|
138
|
+
|
139
|
+
**Examples**
|
140
|
+
|
141
|
+
A chosen style multiselect with custom label_method
|
142
|
+
```ruby
|
143
|
+
fae_multiselect f, :acclaims, label_method: :publication
|
144
|
+
```
|
145
|
+
|
146
|
+
A two pane style multiselect
|
147
|
+
```ruby
|
148
|
+
fae_multiselect f, :selling_points, two_pane: true
|
149
|
+
```
|
150
|
+
|
151
|
+
## fae_grouped_select
|
152
|
+
|
153
|
+
| option | type | default | description |
|
154
|
+
| ------ | ---- | ------- | ----------- |
|
155
|
+
| collection | array or AR:Relation | AssociationClass.all | an array or ActiveRecord object of items to populate the element |
|
156
|
+
| groups | array of strings | | must be used with labels |
|
157
|
+
| labels | array of strings | | must be used with groups |
|
158
|
+
|
159
|
+
## fae_datepicker
|
160
|
+
|
161
|
+
*attributes only*
|
162
|
+
|
163
|
+
**Examples**
|
164
|
+
|
165
|
+
```ruby
|
166
|
+
fae_datepicker f, :release_date
|
167
|
+
```
|
168
|
+
|
169
|
+
## fae_daterangepicker
|
170
|
+
|
171
|
+
*attributes only*
|
172
|
+
|
173
|
+
The daterangepicker is a little different: instead of a single attribute, it accepts an array of two attributes.
|
174
|
+
|
175
|
+
**Examples**
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
fae_daterange f, [:start_date, :end_date], label: 'Start/End dates'
|
179
|
+
```
|
180
|
+
|
181
|
+
## fae_prefix
|
182
|
+
|
183
|
+
*attributes only*
|
184
|
+
|
185
|
+
| option | type | default | description |
|
186
|
+
| ------ | ---- | ------- | ----------- |
|
187
|
+
| prefix | string | | **(required)** string to appear in prefix box |
|
188
|
+
| icon | boolean | false | determines whether or not to display prefix icon |
|
189
|
+
|
190
|
+
**Examples**
|
191
|
+
|
192
|
+
```ruby
|
193
|
+
fae_prefix f, :price, prefix: '$', placeholder: '50.00'
|
194
|
+
```
|
195
|
+
|
196
|
+
## fae_suffix
|
197
|
+
|
198
|
+
*attributes only*
|
199
|
+
|
200
|
+
| option | type | default | description |
|
201
|
+
| ------ | ---- | ------- | ----------- |
|
202
|
+
| suffix | string | | **(required)** string to appear in suffix box |
|
203
|
+
| icon | boolean | false | determines whether or not to display prefix icon |
|
204
|
+
|
205
|
+
**Examples**
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
fae_suffix f, :weight, suffix: 'lbs'
|
209
|
+
```
|
210
|
+
|
211
|
+
## fae_video_url
|
212
|
+
|
213
|
+
*attributes only*
|
214
|
+
|
215
|
+
This helper is a normal fae_input, but provides a custom helper and hint specific to extracting YouTube IDs.
|
216
|
+
|
217
|
+
**Examples**
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
fae_video_url f, :video_url
|
221
|
+
```
|
222
|
+
|
223
|
+
---
|
224
|
+
|
225
|
+
# Nested Form Helpers
|
226
|
+
|
227
|
+
## fae_image_form
|
228
|
+
|
229
|
+
*Fae::Image association only*
|
230
|
+
|
231
|
+
| option | type | default | description |
|
232
|
+
| ------ | ---- | ------- | ----------- |
|
233
|
+
| label | string | image_name.to_s.humanize | the uploader's label |
|
234
|
+
| helper_text | string | | the uploader's helper text|
|
235
|
+
| alt_label | string | "#{image_label} alt text" | the alt field's label |
|
236
|
+
| alt_helper_text | string | | the alt field's helper text |
|
237
|
+
| caption_label | string | "#{image_label} caption" | the caption field's label |
|
238
|
+
| caption_helper_text | string | | the caption field's helper text |
|
239
|
+
| show_alt | boolean | true | displays the alt field, label and helper text |
|
240
|
+
| show_caption | boolean | false | displays the caption field, label and helper text |
|
241
|
+
| required | boolean | false | adds required validation to the uploader |
|
242
|
+
| attached_as | symbol | image_name.to_s | Sets the `attached_as` atrribute on upload. You'll need to customize this if your `attached_as` condition doesn't match the images associaiton name. |
|
243
|
+
|
244
|
+
**Examples**
|
245
|
+
|
246
|
+
```ruby
|
247
|
+
fae_image_form f, :logo, label: 'Corporate Logo', required: true
|
248
|
+
```
|
249
|
+
|
250
|
+
## fae_file_form
|
251
|
+
|
252
|
+
*Fae::File association only*
|
253
|
+
|
254
|
+
| option | type | default | description |
|
255
|
+
| ------ | ---- | ------- | ----------- |
|
256
|
+
| label | string | file_name.to_s.humanize | the uploader's label |
|
257
|
+
| helper_text | string | | the uploader's helper text|
|
258
|
+
| required | boolean | false | adds required validation to the uploader |
|
259
|
+
|
260
|
+
image_label: nil, alt_label: nil, caption_label: nil, omit: nil, show_thumb: nil, required: nil, helper_text: nil, alt_helper_text: nil, caption_helper_text: nil
|
261
|
+
|
262
|
+
|
263
|
+
**Examples**
|
264
|
+
|
265
|
+
```ruby
|
266
|
+
fae_file_form f, :tasting_notes_pdf, helper_text: 'PDF format only'
|
267
|
+
```
|
268
|
+
|
269
|
+
## fae_content_form
|
270
|
+
|
271
|
+
*Fae::TextField and Fae::TextArea association only*
|
272
|
+
|
273
|
+
| option | type | default | description |
|
274
|
+
| ------ | ---- | ------- | ----------- |
|
275
|
+
| label | string | attribute.to_s.titleize | the fields's label |
|
276
|
+
| helper_text | string | | the field's helper text |
|
277
|
+
| hint | string | | the field's hint text (supports HTML) |
|
278
|
+
| markdown | boolean | false | adds markdown GUI toolbar |
|
279
|
+
| markdown_supported | boolean | false | displays support text and hint for markdown |
|
280
|
+
|
281
|
+
image_label: nil, alt_label: nil, caption_label: nil, omit: nil, show_thumb: nil, required: nil, helper_text: nil, alt_helper_text: nil, caption_helper_text: nil
|
282
|
+
|
283
|
+
|
284
|
+
**Examples**
|
285
|
+
|
286
|
+
```ruby
|
287
|
+
fae_content_form f, :body, markdown: true
|
288
|
+
```
|
289
|
+
|
290
|
+
## fae_filter_form
|
291
|
+
|
292
|
+
Displays the filter form, including the search field, submit and reset buttons. Accepts options and a block.
|
293
|
+
|
294
|
+
| option | type | default | description |
|
295
|
+
|--------|---------|----------------------------------------|-------------|
|
296
|
+
| action | string | "#{@index_path}/filter" | the path the form submits to |
|
297
|
+
| title | string | "Search #{@klass_humanized.pluralize}" | the h2 text in the filter form |
|
298
|
+
| search | boolean | true | displays the search field |
|
299
|
+
| cookie_key | string | false | set your cookie name on the fae_filter_form if you want to persist selected filtered state |
|
300
|
+
|
301
|
+
|
302
|
+
**Examples**
|
303
|
+
|
304
|
+
```slim
|
305
|
+
== fae_filter_form title: 'Search some stuff', search: false do
|
306
|
+
// form elements
|
307
|
+
```
|
308
|
+
|
309
|
+
|
310
|
+
## fae_filter_select(attribute, options)
|
311
|
+
|
312
|
+
Dislays a select tag to be used within a `fae_filter_form`.
|
313
|
+
|
314
|
+
| option | type | default | description |
|
315
|
+
|--------------|-------------------------|--------------------------------|-------------|
|
316
|
+
| label | string | attribute.to_s.titleize | label on select |
|
317
|
+
| collection | ActiveRecord collection | AttributeAsClass.for_fae_index | the collection of AR objects to populate the select options |
|
318
|
+
| label_method | symbol | :fae_display_field | the attribute to use as the label in the select options |
|
319
|
+
| placeholder | string or boolean | "All #{options[:label]}" | the blank value in the select, can be set to false to disable |
|
320
|
+
| options | array | [] | an alternative array of options if the options aren't an ActiveRecord collection |
|
321
|
+
| grouped_options | array | [] | an alternative array of grouped options if the options aren't an ActiveRecord collection |
|
322
|
+
| grouped_by | symbol | | a Fae association on the models in `collection`. The association must have a `fae_display_name` method |
|
323
|
+
|
324
|
+
**Examples**
|
325
|
+
|
326
|
+
```slim
|
327
|
+
== fae_filter_form do
|
328
|
+
== fae_filter_select :group, label: 'Groupings', collection: Groups.for_filters
|
329
|
+
== fae_filter_select :group, label: 'Groupings', collection: Groups.for_filters, grouped_by: :filter
|
330
|
+
```
|
331
|
+
|
332
|
+
---
|
333
|
+
|
334
|
+
# View Helpers
|
335
|
+
|
336
|
+
## fae_date_format
|
337
|
+
|
338
|
+
The fae_date_format and fae_datetime_format helpers format a DateTime object in Fae's preferred method.
|
339
|
+
The default, fae_date_format, formats to 06/23/15.
|
340
|
+
|
341
|
+
```ruby
|
342
|
+
fae_date_format item.updated_at
|
343
|
+
```
|
344
|
+
|
345
|
+
## fae_datetime_format
|
346
|
+
|
347
|
+
You may also use fae_datetime_format for the long date format with time (Jun 23, 2015 4:56pm PDT).
|
348
|
+
|
349
|
+
```ruby
|
350
|
+
fae_datetime_format item.updated_at
|
351
|
+
```
|
352
|
+
|
353
|
+
## fae_toggle
|
354
|
+
|
355
|
+
The fae_toggle helper method takes an AR object and attribute. It then creates the HTML necessary for a working Fae on/off toggle switch.
|
356
|
+
|
357
|
+
```ruby
|
358
|
+
fae_toggle item, :on_prod
|
359
|
+
```
|
360
|
+
|
361
|
+
## fae_clone_button
|
362
|
+
|
363
|
+
You can use fae_clone_button in your list view tables to provide easy access to clone an item. Just pass in the item and the button will clone the object and take you to the newly created object's edit form.
|
364
|
+
|
365
|
+
```ruby
|
366
|
+
fae_clone_button item
|
367
|
+
```
|
368
|
+
|
369
|
+
More info about cloning can be found here: [cloning.md](cloning.md)
|
370
|
+
|
371
|
+
## form_header
|
372
|
+
|
373
|
+
The form_header helper takes an AR object or string to render an `<h1>` based on the action.
|
374
|
+
|
375
|
+
```ruby
|
376
|
+
form_header @user
|
377
|
+
```
|
378
|
+
renders `<h1>Edit User</h1>` on the edit page
|
379
|
+
|
380
|
+
```ruby
|
381
|
+
form_header 'Release'
|
382
|
+
```
|
383
|
+
renders `<h1>New Release</h1>` on the new page
|
384
|
+
|
385
|
+
## require_locals
|
386
|
+
|
387
|
+
The require_locals method is intended to be used at the beginning of any partial that pulls in a local variable from the page that renders it. It takes a Array of strings containing the variables that are required and the local_assigns view helper method.
|
388
|
+
|
389
|
+
If one of the locals aren't set when the partial is called and error will be raised with an informative message.
|
390
|
+
|
391
|
+
```ruby
|
392
|
+
require_locals ['item', 'text'], local_assigns
|
393
|
+
```
|
394
|
+
|
395
|
+
---
|
396
|
+
|
397
|
+
# Fae Partials
|
398
|
+
|
399
|
+
## index_header
|
400
|
+
|
401
|
+
Displays page title, add button and flash messages.
|
402
|
+
|
403
|
+
| option | type | default | description |
|
404
|
+
|-|-|-|-|
|
405
|
+
| nested | boolean | false | converts normal add button to nested add button
|
406
|
+
| title | string | @klass_humanized.pluralize | the page's H1 |
|
407
|
+
| new_button | boolean | true | displays the add button |
|
408
|
+
| button_text | string | "Add #{title.singularize}" | add button text |
|
409
|
+
| csv | boolean | false | adds export to csv button |
|
410
|
+
|
411
|
+
**Examples**
|
412
|
+
|
413
|
+
Standard implementation
|
414
|
+
```ruby
|
415
|
+
render 'fae/shared/index_header'
|
416
|
+
```
|
417
|
+
|
418
|
+
Custom header
|
419
|
+
```ruby
|
420
|
+
render 'fae/shared/index_header', title: 'Something Entirely Different', new_button: false, csv: true
|
421
|
+
```
|
422
|
+
|
423
|
+
## form_header
|
424
|
+
|
425
|
+
Displays breadcrumb links and form title.
|
426
|
+
|
427
|
+
| option | type | description |
|
428
|
+
|--------|------|-------------|
|
429
|
+
| header | ActiveRecord object | **(required)** passed to form_header helper method |
|
430
|
+
| breadcrumb_text | String | passed to form_header helper method, defaults to klass_name.titleize.pluralize |
|
431
|
+
|
432
|
+
**Examples**
|
433
|
+
|
434
|
+
Standard implementation
|
435
|
+
```ruby
|
436
|
+
render 'fae/shared/form_header', header: @item, breadcrumb_text: "Areas of Focus"
|
437
|
+
```
|
438
|
+
|
439
|
+
## form_buttons
|
440
|
+
|
441
|
+
Displays form's save and cancel buttons.
|
442
|
+
|
443
|
+
| option | type | default | description |
|
444
|
+
|-|-|-|-|
|
445
|
+
| save_button_text | string | 'Save Settings' | save button text |
|
446
|
+
| cancel_button_text | string | 'Cancel' | cancel button text |
|
447
|
+
|
448
|
+
**Examples**
|
449
|
+
|
450
|
+
Standard implementation
|
451
|
+
```ruby
|
452
|
+
render 'fae/shared/form_buttons'
|
453
|
+
```
|
454
|
+
|
455
|
+
With custom text
|
456
|
+
```ruby
|
457
|
+
render 'fae/shared/form_buttons', save_button_text: 'Yes!', cancel_button_text: 'Nope :('
|
458
|
+
```
|
459
|
+
|
460
|
+
## nested_table
|
461
|
+
|
462
|
+
The nested table works in tandem with a nested model, typically created by the nested scaffold generator, to display a nested ajax form for creating associated items in the edit form.
|
463
|
+
|
464
|
+
The nested_table should go after the main form ends and should only placed on the edit page (it requires the parent_item to be present to associate new items to).
|
465
|
+
|
466
|
+
| option | type | default | description |
|
467
|
+
|--------|------|---------|-------------|
|
468
|
+
| index | false | boolean | used for nested index forms |
|
469
|
+
| assoc | symbol | | **(required)** the association's name, or the item's name if it's for the index |
|
470
|
+
| parent_item | ActiveRecord object | | **(required)** the item the new objects will be associated to |
|
471
|
+
| cols | array of symbols | [] | an array of attributes to display on the list view, associations will display the `fae_display_field` or a thumbnail if it's a `Fae::Image` |
|
472
|
+
| title | string | assoc.to_s.humanize | the H3 directly above the form |
|
473
|
+
| header | string | title | the section's header |
|
474
|
+
| add_button_text | string | "Add #{title.singularize}" | the add button's text |
|
475
|
+
| ordered | boolean | false | allows list view to be sortable, which is saved to a `position` atttribute |
|
476
|
+
| has_thumb | boolean | false | displays a thumbnail in the list view (only applicable to `Fae::Image`)
|
477
|
+
| edit_column | boolean | false | displays edit link
|
478
|
+
| assoc_name | string | assoc.to_s | the stringified association name, used in the paths, **only update if you know what you're doing** |
|
479
|
+
|
480
|
+
|
481
|
+
**Examples**
|
482
|
+
|
483
|
+
Full Slim implementation with section wrapper and edit page conditional
|
484
|
+
```slim
|
485
|
+
- if params[:action] == 'edit'
|
486
|
+
section.main_content-section
|
487
|
+
= render 'fae/shared/nested_table',
|
488
|
+
assoc: :tasting_notes,
|
489
|
+
parent_item: @item,
|
490
|
+
cols: [:name, :author, :live],
|
491
|
+
ordered: true
|
492
|
+
```
|
493
|
+
|
494
|
+
## recent_changes
|
495
|
+
|
496
|
+
Displays recent changes to an object as logged by [Fae's change tracker](usage.md#markdown-header-change-tracker) in a table. Columns include the change's user, type, updated attributes and datetime.
|
497
|
+
|
498
|
+
This partial is best placed at the bottom of the form and will automatically hide itself in create forms, where there wouldn't be changes to display.
|
499
|
+
|
500
|
+
**Examples**
|
501
|
+
|
502
|
+
Standard implementation
|
503
|
+
```ruby
|
504
|
+
render 'fae/shared/recent_changes'
|
505
|
+
```
|
506
|
+
|
507
|
+
Optionally, you can add a link to it in the form nav:
|
508
|
+
```slim
|
509
|
+
nav.main_content-header-section
|
510
|
+
ul.main_content-header-section-links
|
511
|
+
- if params[:action] == 'edit'
|
512
|
+
li: a href="#recent_changes" Recent Changes
|
513
|
+
```
|
514
|
+
|
515
|
+
---
|
516
|
+
|
517
|
+
# Add-ons
|
518
|
+
|
519
|
+
## Slug generation
|
520
|
+
|
521
|
+
Auto-generate a slug from a field. Only populates if the `slug` input is blank.
|
522
|
+
|
523
|
+
**Examples**
|
524
|
+
|
525
|
+
```slim
|
526
|
+
= fae_input f, :name, input_class: 'slugger'
|
527
|
+
= fae_input f, :slug, helper_text: 'Populated from name'
|
528
|
+
```
|