formagic 0.1.0 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/formagic/form.coffee +31 -11
  3. data/app/assets/javascripts/formagic/inputs/checkbox.coffee +1 -0
  4. data/app/assets/javascripts/formagic/inputs/date.coffee +28 -3
  5. data/app/assets/javascripts/formagic/inputs/datetime.coffee +30 -2
  6. data/app/assets/javascripts/formagic/inputs/document.coffee +110 -0
  7. data/app/assets/javascripts/formagic/inputs/documents.coffee +39 -13
  8. data/app/assets/javascripts/formagic/inputs/documents_reorder.coffee +1 -1
  9. data/app/assets/javascripts/formagic/inputs/file.coffee +3 -0
  10. data/app/assets/javascripts/formagic/inputs/html.coffee +1 -0
  11. data/app/assets/javascripts/formagic/inputs/redactor.coffee +1 -0
  12. data/app/assets/javascripts/formagic/inputs/redactor_character.coffee +16 -14
  13. data/app/assets/javascripts/formagic/inputs/select2.coffee +1 -1
  14. data/app/assets/javascripts/formagic/inputs/string.coffee +5 -4
  15. data/app/assets/javascripts/formagic/inputs/text.coffee +4 -3
  16. data/app/assets/javascripts/formagic/inputs/url.coffee +37 -0
  17. data/app/assets/javascripts/formagic.coffee +2 -1
  18. data/app/assets/javascripts/vendor/ace.js +811 -577
  19. data/app/assets/javascripts/vendor/mode-html.js +24 -25
  20. data/app/assets/javascripts/vendor/mode-markdown.js +25 -26
  21. data/app/assets/javascripts/vendor/redactor.table.js +338 -0
  22. data/app/assets/stylesheets/formagic/date.scss +1 -0
  23. data/app/assets/stylesheets/formagic/file.scss +7 -0
  24. data/app/assets/stylesheets/formagic/form.scss +15 -10
  25. data/app/assets/stylesheets/formagic/image.scss +4 -0
  26. data/app/assets/stylesheets/formagic/label.scss +27 -0
  27. data/app/assets/stylesheets/formagic/nested-form.scss +3 -3
  28. data/app/assets/stylesheets/formagic/select2.scss +19 -1
  29. data/app/assets/stylesheets/formagic.scss +2 -1
  30. data/lib/formagic/version.rb +1 -1
  31. metadata +6 -3
  32. /data/app/assets/stylesheets/formagic/{redactor.scss → redactor1.scss} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eaeeb3489a798aafed4d51440ab9fb4d933f9f27
4
- data.tar.gz: c0717929f3661809eeab159d8419b940d38eb5a4
3
+ metadata.gz: 5b03dc0a52060aac37925bb13cfb132af6073841
4
+ data.tar.gz: d7ca3659fc899e73a9eb3eb9c953d8195563c198
5
5
  SHA512:
6
- metadata.gz: e41c4ae09383eed7c534784e4b8896e7938a3171c11dad5adbf282783cdec2089c798b8b1ca2816ec73ede8aade18c1973a055fbaf4790297538badf695ada8f
7
- data.tar.gz: 0d8465bdc12df5d3d1e9d0e39cf57c10881552519899e0a8589cbf9bc1fb75b90dc8c1f2cbba7915b699e79350695f5dd750d48a784718db6aadf182db338f9d
6
+ metadata.gz: d262ebec3c701d80415a780eeda8b336584b5827d985977526fa021fd9e2e1308f9a86f7f412be5db4cf0ebc4ff831a5001134a23b8d8ca41afc7ca9891e5d33
7
+ data.tar.gz: b45ea0148e06c4fbb9d156898a0ed6a09758bda71185b061ed42949a4ba9bb93809f275457ecc74c3aa3a45038270069d11f85fc949b1d73eb9908e157374598
@@ -122,7 +122,7 @@ class @Form
122
122
  inputName = if @config.namePrefix then "#{ @config.namePrefix }[#{ name }]" else "[#{ name }]"
123
123
 
124
124
  # add prefix for nested form inputs
125
- if inputConfig.type == 'form' || inputConfig.type == 'documents'
125
+ if inputConfig.type == 'form' || inputConfig.type == 'documents' || inputConfig.type == 'document'
126
126
  inputConfig.namePrefix = inputName.replace("[#{ name }]", "[#{ name }_attributes]")
127
127
 
128
128
  else
@@ -135,14 +135,20 @@ class @Form
135
135
 
136
136
  _add_nested_form_remove_button: ->
137
137
  if @config.removeButton
138
+
138
139
  # add hidden input to the form
139
- fieldName = '_destroy'
140
- input = @_render_input(fieldName, { type: 'hidden' }, false)
140
+ fieldName = '_destroy'
141
+ input = @_render_input(fieldName, {
142
+ type: 'hidden',
143
+ ignoreOnSubmission: @config.ignoreOnSubmission
144
+ }, false)
145
+
141
146
  @inputs[fieldName] = input
142
- @$el.append input.$el
147
+ @$el.prepend input.$el
148
+
143
149
  # remove button
144
150
  @$removeButton =$ """<a href='#' class='nested-form-delete'>Delete</a>"""
145
- @$el.append @$removeButton
151
+ @$el.prepend @$removeButton
146
152
  @$removeButton.on 'click', (e) =>
147
153
  e.preventDefault()
148
154
  if confirm('Are you sure?')
@@ -181,13 +187,19 @@ class @Form
181
187
  for name, input of form.inputs
182
188
  if input.config.type == 'file' or input.config.type == 'image'
183
189
  file = input.$input.get()[0].files[0]
184
- obj["__FILE__#{ input.name }"] = file
190
+
191
+ if file
192
+ obj["__FILE__#{ input.name }"] = file
193
+
185
194
  if input.isEmpty() then obj[input.removeName()] = 'true'
186
195
 
187
196
  # remove fields with ignoreOnSubmission
188
- for name, input of form.inputs
197
+ for key, input of form.inputs
189
198
  if input.config.ignoreOnSubmission
190
- delete obj[name]
199
+ delete obj[input.name]
200
+
201
+ # for k, v of obj
202
+ # console.log k
191
203
 
192
204
  return obj
193
205
 
@@ -209,9 +221,17 @@ class @Form
209
221
  showValidationErrors: (errors) ->
210
222
  @hideValidationErrors()
211
223
  for inputName, messages of errors
212
- input = @inputs[inputName]
213
- firstMessage = messages[0]
214
- input.showErrorMessage(firstMessage)
224
+ input = @inputs[inputName]
225
+
226
+ # Support nested documents validation errors
227
+ if ! input
228
+ for k, v of @inputs
229
+ if v.name == "[#{ inputName }]"
230
+ input = v
231
+
232
+ if input
233
+ firstMessage = messages[0]
234
+ input.showErrorMessage(firstMessage)
215
235
 
216
236
 
217
237
  hideValidationErrors: ->
@@ -14,6 +14,7 @@ class @InputCheckbox extends InputString
14
14
  @_create_el()
15
15
  @_add_input()
16
16
  @_add_label()
17
+ @_add_disabled()
17
18
 
18
19
  return this
19
20
 
@@ -21,10 +21,17 @@ class @InputDate extends InputString
21
21
 
22
22
  _update_date_label: ->
23
23
  date = @$input.val()
24
- date_formatted = moment(date).format("dddd, MMMM Do, YYYY")
24
+
25
+ if date
26
+ date_formatted = moment(date).format("dddd, MMMM Do, YYYY")
27
+
28
+ else
29
+ date_formatted = "<span class='placeholder'>Pick a date</span>"
30
+
25
31
  @$dateLabel.html(date_formatted)
26
32
 
27
33
 
34
+
28
35
  _add_input: ->
29
36
  @$input =$ "<input type='text' name='#{ @name }' value='#{ @_safe_value() }' class='input-datetime-date' />"
30
37
  @$el.append @$input
@@ -36,6 +43,25 @@ class @InputDate extends InputString
36
43
 
37
44
  @_update_date_label()
38
45
 
46
+ @_add_actions()
47
+
48
+
49
+ _add_actions: ->
50
+ @$actions =$ "<span class='input-actions'></span>"
51
+ @$label.append @$actions
52
+
53
+ @_add_remove_button()
54
+
55
+
56
+ _add_remove_button: ->
57
+ @$removeBtn =$ "<a href='#' class='remove'>Remove</a>"
58
+ @$actions.append @$removeBtn
59
+
60
+ @$removeBtn.on 'click', (e) =>
61
+ e.preventDefault()
62
+ @updateValue('')
63
+ @_update_date_label()
64
+
39
65
 
40
66
  # PUBLIC ================================================
41
67
 
@@ -58,8 +84,7 @@ class @InputDate extends InputString
58
84
 
59
85
  updateValue: (@value) ->
60
86
  @$input.val(@value)
61
- # @TODO: check if required, cause change event might be triggered
62
- #@_update_date_label()
87
+ @_update_date_label()
63
88
 
64
89
 
65
90
  chr.formInputs['date'] = InputDate
@@ -21,6 +21,11 @@ class @InputDatetime extends InputDate
21
21
 
22
22
  _update_value: ->
23
23
  mt = moment(@$inputTime.val(), 'LT')
24
+
25
+ if @$inputDate.val() == '' && ! mt.isValid()
26
+ @$input.val('')
27
+ return
28
+
24
29
  if ! mt.isValid()
25
30
  mt = moment('1:00 pm', 'LT')
26
31
 
@@ -44,7 +49,8 @@ class @InputDatetime extends InputDate
44
49
 
45
50
  _update_date_label: ->
46
51
  m = moment(@$inputDate.val()).utcOffset(@tzOffset)
47
- @$dateLabel.html ( if m.isValid() then m.format('dddd, MMM D, YYYY') else 'Pick a date' )
52
+ label = if m.isValid() then m.format('dddd, MMM D, YYYY') else "<span class='placeholder'>Pick a date</span>"
53
+ @$dateLabel.html label
48
54
 
49
55
 
50
56
  _normalized_value: ->
@@ -52,7 +58,8 @@ class @InputDatetime extends InputDate
52
58
  @tzOffset = @config.timezoneOffset
53
59
  @tzOffset ?= (new Date()).getTimezoneOffset() * -1
54
60
 
55
- @value = moment(@value).utcOffset(@tzOffset).format()
61
+ m = moment(@value).utcOffset(@tzOffset)
62
+ @value = if m.isValid() then m.format() else ''
56
63
 
57
64
 
58
65
  _add_input: ->
@@ -88,6 +95,27 @@ class @InputDatetime extends InputDate
88
95
 
89
96
  @_update_time_input()
90
97
 
98
+ @_add_actions()
99
+
100
+
101
+ _add_actions: ->
102
+ @$actions =$ "<span class='input-actions'></span>"
103
+ @$label.append @$actions
104
+
105
+ @_add_remove_button()
106
+
107
+
108
+ _add_remove_button: ->
109
+ @$removeBtn =$ "<a href='#' class='remove'>Remove</a>"
110
+ @$actions.append @$removeBtn
111
+
112
+ @$removeBtn.on 'click', (e) =>
113
+ e.preventDefault()
114
+ @$inputTime.val('')
115
+ @$inputDate.val('')
116
+ @_update_date_label()
117
+ @_update_value()
118
+
91
119
 
92
120
  # PUBLIC ================================================
93
121
 
@@ -0,0 +1,110 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Author: Alexander Kravets <alex@slatestudio.com>,
3
+ # Slate Studio (http://www.slatestudio.com)
4
+ #
5
+ # Coding Guide:
6
+ # https://github.com/thoughtbot/guides/tree/master/style/coffeescript
7
+ # -----------------------------------------------------------------------------
8
+
9
+ # -----------------------------------------------------------------------------
10
+ # INPUT DOCUMENT
11
+ # -----------------------------------------------------------------------------
12
+ # 1-to-1 relation implementation. This is based on InputDocuments
13
+ # implementation and might require refactor.
14
+ #
15
+ # Public methods:
16
+ # initialize()
17
+ # hash(hash)
18
+ # updateValue(@value)
19
+ # showErrorMessage(message)
20
+ # hideErrorMessage()
21
+ #
22
+ # -----------------------------------------------------------------------------
23
+
24
+ class @InputDocument
25
+ constructor: (@name, @nestedObject, @config, @object) ->
26
+ @forms = []
27
+
28
+ @config.namePrefix ||= name
29
+ @config.removeButton = true
30
+ @config.ignoreOnSubmission ||= false
31
+
32
+ if @config.ignoreOnSubmission
33
+ for key, inputConfig of @config.formSchema
34
+ inputConfig.ignoreOnSubmission = true
35
+
36
+ @_create_el()
37
+
38
+ @_add_label()
39
+ @_add_forms()
40
+
41
+ return this
42
+
43
+
44
+ # PRIVATE ===============================================
45
+
46
+ _create_el: ->
47
+ @$el =$ "<div class='input-stacked nested-forms input-#{ @config.klassName }'>"
48
+
49
+
50
+ _add_label: ->
51
+ @$label =$ "<span class='label'>#{ @config.label }</span>"
52
+ @$errorMessage =$ "<span class='error-message'></span>"
53
+ @$label.append(@$errorMessage)
54
+ @$el.append(@$label)
55
+
56
+
57
+ _add_forms: ->
58
+ @nestedForm = @_render_form(@nestedObject, @config.namePrefix, @config)
59
+
60
+ @$form = @nestedForm.$el
61
+ @$label.after @$form
62
+
63
+
64
+ _render_form: (object, namePrefix, config) ->
65
+ formConfig = $.extend {}, config,
66
+ namePrefix: namePrefix
67
+ rootEl: "<div>"
68
+ removeButton: false
69
+
70
+ form = new Form(object, formConfig)
71
+ return form
72
+
73
+
74
+ # PUBLIC ================================================
75
+
76
+ initialize: ->
77
+ @config.beforeInitialize?(this)
78
+
79
+ @nestedForm.initializePlugins()
80
+
81
+ @config.onInitialize?(this)
82
+
83
+
84
+ hash: (hash={}) ->
85
+ objects = []
86
+ hash[@config.fieldName] = @nestedForm.hash()
87
+ return hash
88
+
89
+
90
+ showErrorMessage: (message) ->
91
+ @$el.addClass 'error'
92
+ @$errorMessage.html(message)
93
+
94
+
95
+ hideErrorMessage: ->
96
+ @$el.removeClass 'error'
97
+ @$errorMessage.html('')
98
+
99
+
100
+ updateValue: (@nestedObject, @object) ->
101
+ for name, value of @nestedObject
102
+ if @nestedForm.inputs[name]
103
+ @nestedForm.inputs[name].updateValue(value, @object)
104
+
105
+
106
+ chr.formInputs['document'] = InputDocument
107
+
108
+
109
+
110
+
@@ -28,11 +28,16 @@ class @InputForm
28
28
  constructor: (@name, @nestedObjects, @config, @object) ->
29
29
  @forms = []
30
30
 
31
- @config.namePrefix ||= name
32
- @config.removeButton = true
33
- @config.formSchema._id = { type: 'hidden', name: 'id' }
31
+ @config.namePrefix ||= name
32
+ @config.removeButton = if @config.disableRemoveDocuments then false else true
33
+ @config.ignoreOnSubmission ||= false
34
+
34
35
  @reorderContainerClass = "nested-forms-#{@config.klassName}"
35
36
 
37
+ if @config.ignoreOnSubmission
38
+ for key, inputConfig of @config.formSchema
39
+ inputConfig.ignoreOnSubmission = true
40
+
36
41
  @_create_el()
37
42
 
38
43
  @_add_label()
@@ -55,7 +60,21 @@ class @InputForm
55
60
  @$el.append(@$label)
56
61
 
57
62
 
63
+ _extend_schema_with: (name, config) ->
64
+ schemaConfig = {}
65
+ schemaConfig[name] = config
66
+ @config.formSchema = $.extend(schemaConfig, @config.formSchema)
67
+
68
+
58
69
  _add_forms: ->
70
+ # add id to schema
71
+ # @NOTE: here we use _id, cause mongosteen returns objects _id, but we should send id for nested documents
72
+ @_extend_schema_with('_id', { type: 'hidden', name: 'id', ignoreOnSubmission: @config.ignoreOnSubmission })
73
+
74
+ # add position to schema
75
+ if @config.sortBy
76
+ @_extend_schema_with(@config.sortBy, { type: 'hidden', ignoreOnSubmission: @config.ignoreOnSubmission })
77
+
59
78
  @$forms =$ "<ul>"
60
79
  @$label.after @$forms
61
80
 
@@ -72,7 +91,6 @@ class @InputForm
72
91
 
73
92
  _sort_nested_objects: ->
74
93
  if @config.sortBy
75
- @config.formSchema[@config.sortBy] = { type: 'hidden' }
76
94
  if @nestedObjects
77
95
  # this is not required but make things a bit easier on the backend
78
96
  # as object don't have to be in a specific order.
@@ -93,10 +111,13 @@ class @InputForm
93
111
 
94
112
 
95
113
  _add_new_button: ->
96
- label = @config.newButtonLabel || "Add"
97
- @$newButton =$ """<a href='#' class='nested-form-new'>#{ label }</a>"""
98
- @$el.append @$newButton
99
- @$newButton.on 'click', (e) => e.preventDefault() ; @addNewForm()
114
+ if ! @config.disableNewDocuments
115
+ label = @config.newButtonLabel || "Add"
116
+
117
+ @$newButton =$ """<a href='#' class='nested-form-new'>#{ label }</a>"""
118
+ @$el.append @$newButton
119
+
120
+ @$newButton.on 'click', (e) => e.preventDefault() ; @addNewForm()
100
121
 
101
122
 
102
123
  # PUBLIC ================================================
@@ -141,11 +162,8 @@ class @InputForm
141
162
  prevForm = _last(@forms)
142
163
  position = if prevForm then prevForm.inputs[@config.sortBy].value + 1 else 1
143
164
 
144
- # @TODO: having an issue here for scenario when no nested object are there for new object
145
- # form.inputs doesn't include sortBy field
146
- console.log @config
147
- console.log @config.sortBy
148
- console.log form.inputs
165
+ # Had a problem here for new documents, but now seems to be resolved by adding
166
+ # _position to schema in constructor (to be removed when stable).
149
167
 
150
168
  form.inputs[@config.sortBy].updateValue(position)
151
169
 
@@ -157,10 +175,18 @@ class @InputForm
157
175
 
158
176
 
159
177
  updateValue: (@nestedObjects, @object) ->
178
+ # New document should update id, also after uploading images form for existing
179
+ # document might change, so we reset all nested forms to reflect these updates.
180
+ # This implementation has some problems with jumping screen when using plugins
181
+ # also it requires complex implementation for data local storage caching.
160
182
  @$forms.remove()
161
183
  @forms = []
162
184
  @_add_forms()
163
185
 
186
+ # Initialize input plugins after update
187
+ for nestedForm in @forms
188
+ nestedForm.initializePlugins()
189
+
164
190
 
165
191
  include(InputForm, inputFormReorder)
166
192
 
@@ -54,7 +54,7 @@
54
54
 
55
55
 
56
56
  _add_form_reorder_button: (form) ->
57
- form.$el.append("""<div class='icon-reorder' data-container-class='#{@reorderContainerClass}'></div>""").addClass('reorderable')
57
+ form.$el.prepend("""<div class='icon-reorder' data-container-class='#{@reorderContainerClass}'></div>""").addClass('reorderable')
58
58
 
59
59
 
60
60
  _find_form_by_target: (el) ->
@@ -20,6 +20,7 @@ class @InputFile extends InputString
20
20
  @_add_input()
21
21
  @_update_state()
22
22
  @_add_required()
23
+ @_add_disabled()
23
24
 
24
25
  return this
25
26
 
@@ -82,8 +83,10 @@ class @InputFile extends InputString
82
83
  if @filename
83
84
  @$el.removeClass('empty')
84
85
  @_update_inputs()
86
+
85
87
  else
86
88
  @$el.addClass('empty')
89
+ @$clearButton.hide()
87
90
 
88
91
 
89
92
  # PUBLIC ================================================
@@ -50,6 +50,7 @@ class @InputHtml extends InputString
50
50
  @editor.$blockScrolling = Infinity
51
51
 
52
52
  @session = @editor.getSession()
53
+ @session.setUseWorker(false)
53
54
  @session.setValue(@$input.val())
54
55
  @session.setUseWrapMode(true)
55
56
  @session.setMode("ace/mode/html")
@@ -12,6 +12,7 @@
12
12
  #
13
13
  # Dependencies:
14
14
  #= require redactor
15
+ #= require vendor/redactor.table
15
16
  #= require vendor/redactor.fixedtoolbar
16
17
  #= require ./redactor_character
17
18
  # -----------------------------------------------------------------------------
@@ -43,20 +43,22 @@ $.fx.speeds.fast = 10
43
43
 
44
44
 
45
45
  _get_default_config: () ->
46
- focus: false
47
- imageFloatMargin: '20px'
48
- buttonSource: true
49
- pastePlainText: true
50
- scrollTarget: chr.module.view.$content
51
- plugins: []
52
- buttons: [ 'html',
53
- 'formatting',
54
- 'bold',
55
- 'italic',
56
- 'deleted',
57
- 'unorderedlist',
58
- 'orderedlist',
59
- 'link' ]
46
+ focus: false
47
+ imageFloatMargin: '20px'
48
+ buttonSource: true
49
+ pastePlainText: true
50
+ replaceDivs: false
51
+ scrollTarget: chr.module.view.$content
52
+ plugins: [ 'table' ]
53
+ buttons: [ 'html'
54
+ 'formatting'
55
+ 'bold'
56
+ 'italic'
57
+ 'deleted'
58
+ 'unorderedlist'
59
+ 'orderedlist'
60
+ 'table'
61
+ 'link' ]
60
62
 
61
63
  # to have caching working we need to trigger 'change' event for textarea
62
64
  # when content got changed in redactor, but skip this when updating value
@@ -20,7 +20,7 @@ class @InputSelect2 extends InputSelect
20
20
  @config.beforeInitialize?(this)
21
21
 
22
22
  # https://select2.github.io/options.html
23
- options = @config.pluginOptions || {}
23
+ options = @config.pluginOptions || { placeholder: @config.placeholder }
24
24
  @$input.select2(options)
25
25
 
26
26
  @config.onInitialize?(this)
@@ -50,10 +50,11 @@ class @InputString
50
50
 
51
51
 
52
52
  _add_label: ->
53
- @$label =$ "<span class='label'>#{ @config.label }</span>"
54
- @$errorMessage =$ "<span class='error-message'></span>"
55
- @$label.append(@$errorMessage)
56
- @$el.append(@$label)
53
+ if @config.label != false
54
+ @$label =$ "<span class='label'>#{ @config.label }</span>"
55
+ @$errorMessage =$ "<span class='error-message'></span>"
56
+ @$label.append(@$errorMessage)
57
+ @$el.append(@$label)
57
58
 
58
59
 
59
60
  _add_input: ->
@@ -36,8 +36,9 @@ class @InputText extends InputString
36
36
  @config.onInitialize?(this)
37
37
 
38
38
 
39
- chr.formInputs['text'] = InputText
40
-
41
-
39
+ updateValue: (@value) ->
40
+ @$input.val(@value)
41
+ @$input.trigger 'keyup'
42
42
 
43
43
 
44
+ chr.formInputs['text'] = InputText
@@ -0,0 +1,37 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Author: Alexander Kravets <alex@slatestudio.com>,
3
+ # Slate Studio (http://www.slatestudio.com)
4
+ #
5
+ # Coding Guide:
6
+ # https://github.com/thoughtbot/guides/tree/master/style/coffeescript
7
+ # -----------------------------------------------------------------------------
8
+
9
+ # -----------------------------------------------------------------------------
10
+ # INPUT URL
11
+ # - depends on Loft character plugin for assets management
12
+ # -----------------------------------------------------------------------------
13
+ class @InputUrl extends InputString
14
+
15
+ _add_choose_button: ->
16
+ @$actions =$ "<span class='input-actions'></span>"
17
+ @$label.append @$actions
18
+
19
+ @$chooseBtn =$ "<a href='#' class='choose'>Choose or upload a file</a>"
20
+ @$actions.append @$chooseBtn
21
+
22
+ @$chooseBtn.on 'click', (e) =>
23
+ e.preventDefault()
24
+
25
+ chr.modules.loft.showModal 'all', false, (objects) =>
26
+ url = objects[0].file.url
27
+ @updateValue(url)
28
+
29
+
30
+ # PUBLIC ================================================
31
+
32
+ initialize: ->
33
+ @_add_choose_button()
34
+ @config.onInitialize?(this)
35
+
36
+
37
+ chr.formInputs['url'] = InputUrl
@@ -19,4 +19,5 @@
19
19
  #= require ./formagic/inputs/redactor
20
20
  #= require ./formagic/inputs/select
21
21
  #= require ./formagic/inputs/select2
22
- #= require ./formagic/inputs/time
22
+ #= require ./formagic/inputs/time
23
+ #= require ./formagic/inputs/url