drg_cms 0.5.52.12 → 0.5.52.16

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 (60) hide show
  1. checksums.yaml +5 -5
  2. data/app/assets/javascripts/drg_cms/drg_cms.js +17 -2
  3. data/app/assets/stylesheets/drg_cms/drg_cms.css +16 -3
  4. data/app/assets/stylesheets/drg_cms/select-multiple.css +1 -1
  5. data/app/controllers/cmsedit_controller.rb +56 -16
  6. data/app/controllers/dc_application_controller.rb +83 -1
  7. data/app/controllers/dc_common_controller.rb +2 -52
  8. data/app/forms/all_options.yml +27 -4
  9. data/app/forms/cms_menu.yml +5 -0
  10. data/app/forms/dc_gallery.yml +53 -0
  11. data/app/forms/dc_link.yml +16 -10
  12. data/app/forms/dc_menu_item.yml +5 -0
  13. data/app/forms/dc_page.yml +1 -2
  14. data/app/forms/dc_removed_url.yml +42 -0
  15. data/app/helpers/cmsedit_helper.rb +63 -22
  16. data/app/helpers/dc_application_helper.rb +35 -11
  17. data/app/helpers/dc_gallery_renderer.rb +94 -0
  18. data/app/helpers/dc_page_renderer.rb +20 -3
  19. data/app/helpers/dc_poll_renderer.rb +6 -7
  20. data/app/models/concerns/dc_page_concern.rb +1 -1
  21. data/app/models/dc_filter.rb +15 -7
  22. data/app/models/dc_gallery.rb +64 -0
  23. data/app/models/dc_link.rb +1 -0
  24. data/app/models/dc_memory.rb +19 -4
  25. data/app/models/dc_page.rb +1 -1
  26. data/app/models/dc_removed_url.rb +54 -0
  27. data/app/models/drgcms_form_fields.rb +5 -1649
  28. data/app/models/drgcms_form_fields/check_box.rb +69 -0
  29. data/app/models/drgcms_form_fields/comment.rb +49 -0
  30. data/app/models/drgcms_form_fields/date_picker.rb +102 -0
  31. data/app/models/drgcms_form_fields/date_select.rb +68 -0
  32. data/app/models/drgcms_form_fields/date_time_picker.rb +87 -0
  33. data/app/models/drgcms_form_fields/datetime_select.rb +73 -0
  34. data/app/models/drgcms_form_fields/drgcms_field.rb +241 -0
  35. data/app/models/drgcms_form_fields/drgcms_form_fields.rb +25 -0
  36. data/app/models/drgcms_form_fields/embedded.rb +84 -0
  37. data/app/models/drgcms_form_fields/file_select.rb +70 -0
  38. data/app/models/drgcms_form_fields/hidden_field.rb +52 -0
  39. data/app/models/drgcms_form_fields/html_field.rb +70 -0
  40. data/app/models/drgcms_form_fields/journal_diff.rb +60 -0
  41. data/app/models/drgcms_form_fields/link_to.rb +69 -0
  42. data/app/models/drgcms_form_fields/multitext_autocomplete.rb +195 -0
  43. data/app/models/drgcms_form_fields/number_field.rb +83 -0
  44. data/app/models/drgcms_form_fields/password_field.rb +62 -0
  45. data/app/models/drgcms_form_fields/readonly.rb +79 -0
  46. data/app/models/drgcms_form_fields/select.rb +164 -0
  47. data/app/models/drgcms_form_fields/submit_tag.rb +58 -0
  48. data/app/models/drgcms_form_fields/text_area.rb +68 -0
  49. data/app/models/drgcms_form_fields/text_autocomplete.rb +143 -0
  50. data/app/models/drgcms_form_fields/text_field.rb +56 -0
  51. data/app/models/drgcms_form_fields/text_with_select.rb +92 -0
  52. data/app/models/drgcms_form_fields/tree_select.rb +150 -0
  53. data/config/locales/drgcms_en.yml +1 -0
  54. data/config/locales/drgcms_sl.yml +2 -1
  55. data/config/locales/models_en.yml +42 -6
  56. data/config/locales/models_sl.yml +38 -3
  57. data/lib/drg_cms.rb +1 -1
  58. data/lib/drg_cms/version.rb +1 -1
  59. data/lib/tasks/dc_cleanup.rake +1 -1
  60. metadata +33 -4
@@ -0,0 +1,241 @@
1
+ #--
2
+ # Copyright (c) 2012+ Damjan Rems
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ ###########################################################################
25
+ # DrgcmsFormFields module contains definitions of classes used for
26
+ # rendering data entry fields on DRG CMS forms.
27
+ #
28
+ # Every data entry field type written in lowercase in form must have its class
29
+ # defined in CamelCase in DrgcmsFormFields module.
30
+ #
31
+ # Each class must have at least render method implemented. All classes can
32
+ # inherit from DrgcmsField class which acts as abstract template class and implements
33
+ # most of surrounding code for creating custom DRG CMS form field.
34
+ #
35
+ # Render method must create html and javascript code which must be
36
+ # saved to internal @html and @js variables. Field code is then retrived by accessing
37
+ # these two internal variables.
38
+ #
39
+ # Example. How the field code is generated in form renderer:
40
+ # klas_string = yaml['type'].camelize
41
+ # if DrgcmsFormFields.const_defined?(klas_string) # check if field type class is defined
42
+ # klas = DrgcmsFormFields.const_get(klas_string)
43
+ # field = klas.new(self, @record, options).render
44
+ # javascript << field.js
45
+ # html << field.html
46
+ # end
47
+ #
48
+ # Example. How to mix DRG CMS field code in Rails views:
49
+ # <div>User:
50
+ # <%=
51
+ # opts = {'name' => 'user', 'eval' => "dc_choices4('dc_user','name')",
52
+ # 'html' => { 'include_blank' => true } }
53
+ # dt = DrgcmsFormFields::Select.new(self, {}, opts).render
54
+ # (dt.html + javascript_tag(dt.js)).html_safe
55
+ # %></div>
56
+ ###########################################################################
57
+ module DrgcmsFormFields
58
+
59
+ ###########################################################################
60
+ # Template method for DRG CMS form field definition. This is abstract class with
61
+ # most of the common code for custom form field already implemented.
62
+ ###########################################################################
63
+ class DrgcmsField
64
+ attr_reader :js
65
+
66
+ ####################################################################
67
+ # DrgcmsField initialization code.
68
+ #
69
+ # Parameters:
70
+ # [parent] Controller object. Controller object from where object is created. Usually self is send.
71
+ # [record] Document object. Document object which holds fields data.
72
+ # [yaml] Hash. Hash object holding field definition data.
73
+ #
74
+ # Returns:
75
+ # Self
76
+ ####################################################################
77
+ def initialize( parent, record, yaml )
78
+ @parent = parent
79
+ @record = record
80
+ @yaml = yaml
81
+ @form = parent.form
82
+ @readonly = (@yaml and @yaml['readonly']) || (@form and @form['readonly'])
83
+ if @yaml['size'] # move size to html element if not already there
84
+ @yaml['html'] ||= {}
85
+ @yaml['html']['size'] ||= @yaml['size']
86
+ end
87
+ @html = ''
88
+ @js = ''
89
+ @css = @yaml['css']
90
+ self
91
+ end
92
+
93
+ ####################################################################
94
+ # Returns html code together with CSS code.
95
+ ####################################################################
96
+ def html
97
+ @html + (@css ? "\n<style type=\"text/css\">#{@css}</style>" : '')
98
+ end
99
+
100
+ ####################################################################
101
+ # Wrapper for i18 t method, with some spice added. If translation is not found English
102
+ # translation value will be returned. And if still not found default value will be returned if passed.
103
+ #
104
+ # Parameters:
105
+ # [key] String. String to be translated into locale.
106
+ # [default] String. Value returned if translation is not found.
107
+ #
108
+ # Example:
109
+ # t('translate.this','Enter text for ....')
110
+ #
111
+ # Returns:
112
+ # String. Translated text.
113
+ ####################################################################
114
+ def t(key, default='')
115
+ c = I18n.t(key)
116
+ if c.match( 'translation missing' )
117
+ c = I18n.t(key, locale: 'en')
118
+ # Still not found. Return default if set
119
+ c = default unless default.blank?
120
+ end
121
+ c
122
+ end
123
+
124
+ ####################################################################
125
+ # Standard code for returning readonly field.
126
+ ####################################################################
127
+ def ro_standard(value=nil)
128
+ value = @record[@yaml['name']] if value.nil? and @record.respond_to?(@yaml['name'])
129
+ @html << (value.blank? ? '' : "<div class='dc-readonly'>#{value}</div>")
130
+ self
131
+ end
132
+
133
+ ####################################################################
134
+ # Set initial value of the field when initial value is set in url parameters..
135
+ #
136
+ # Example: Form has field named picture. Field can be initialized by
137
+ # setting value of param p_picture.
138
+ # params['p_picture'] = '/path/to_picture'
139
+ #
140
+ # When multiple initial values are assigned it is more convinient to assign them
141
+ # through flash object.
142
+ # flash[:record] = {}
143
+ # flash[:record]['picture'] = '/path/to_picture'
144
+ ####################################################################
145
+ def set_initial_value(opt1='html', opt2='value')
146
+ @yaml['html'] ||= {}
147
+ value_send_as = 'p_' + @yaml['name']
148
+ if @parent.params[value_send_as]
149
+ @yaml[opt1][opt2] = @parent.params[value_send_as]
150
+ elsif @parent.flash[:record] and @parent.flash[:record][@yaml['name']]
151
+ @yaml[opt1][opt2] = @parent.flash[:record][@yaml['name']]
152
+ end
153
+ end
154
+
155
+ ####################################################################
156
+ # Returns style html code for DRGForm object if style directive is present in field definition.
157
+ # Otherwiese returns empty string.
158
+ #
159
+ # Style may be defined like:
160
+ # style:
161
+ # height: 400px
162
+ # width: 800px
163
+ # padding: 10px 20px
164
+ #
165
+ # or
166
+ #
167
+ # style: "height:400px; width:800px; padding: 10px 20px;"
168
+ #
169
+ # Style directive may also be defined under html directive.
170
+ # html:
171
+ # style:
172
+ # height: 400px
173
+ # width: 800px
174
+ #
175
+ #
176
+ ####################################################################
177
+ def set_style()
178
+ style = @yaml['html']['style'] || @yaml['style']
179
+ case
180
+ when style.nil? then ''
181
+ when style.class == String then "style=\"#{style}\""
182
+ when style.class == Hash then
183
+ value = style.to_a.inject([]) {|r,v| r << "#{v[0]}: #{v[1]}" }.join(';')
184
+ "style=\"#{value}\""
185
+ else ''
186
+ end
187
+ end
188
+
189
+ ####################################################################
190
+ # Will return ruby hash formated as javascript string which can be used
191
+ # for passing parameters in javascript code.
192
+ #
193
+ # Parameters:
194
+ # [Hash] Hash. Ruby hash parameters.
195
+ #
196
+ # Form example: As used in forms
197
+ # options:
198
+ # height: 400
199
+ # width: 800
200
+ # toolbar: "'basic'"
201
+ #
202
+ # => "height:400, width:800, toolbar:'basic'"
203
+ #
204
+ # Return:
205
+ # String: Options formated as javascript options.
206
+ #
207
+ ####################################################################
208
+ def hash_to_options(hash)
209
+ hash.to_a.inject([]) {|r,v| r << "#{v[0]}: #{v[1]}" }.join(',')
210
+ end
211
+
212
+ ####################################################################
213
+ # Checks if field name exists in document and alters record parameters if necesary.
214
+ # Method was added after fields that do not belong to current edited document
215
+ # were added to forms. Valid nonexisting form field names must start with underscore (_) letter.
216
+ #
217
+ # Return:
218
+ # String: 'record' or '_record' when valid nonexisting field is used
219
+ ####################################################################
220
+ def record_text_for(name)
221
+ (!@record.respond_to?(name) and name[0,1] == '_') ? '_record' : 'record'
222
+ end
223
+
224
+
225
+ ###########################################################################
226
+ # Default get_data method for retrieving data from parameters. Class method is called
227
+ # for every entry field defined on form before field value is saved to database.
228
+ #
229
+ # Parameters:
230
+ # [params] Controllers params object.
231
+ # [name] Field name
232
+ #
233
+ # Most of classes will use this default method which returns params['record'][name].
234
+ # When field data is more complex class should implement its own get_data method.
235
+ ###########################################################################
236
+ def self.get_data(params, name)
237
+ params['record'][name]
238
+ end
239
+
240
+ end
241
+ end
@@ -0,0 +1,25 @@
1
+ #--
2
+ # Copyright (c) 2012+ Damjan Rems
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ module DrgcmsFormFields
25
+ end
@@ -0,0 +1,84 @@
1
+ #--
2
+ # Copyright (c) 2012+ Damjan Rems
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ module DrgcmsFormFields
24
+
25
+ ###########################################################################
26
+ # Implementation of embedded DRG CMS form field.
27
+ #
28
+ # Creates html required to paint embedded object on form.
29
+ #
30
+ # ===Form options:
31
+ # * +name:+ field name (required)
32
+ # * +type:+ embedded (required)
33
+ # * +form_name:+ name of form which will be used for editing
34
+ # * +html:+ html options (optional)
35
+ # * +height:+ height of embedded object in pixels (1000)
36
+ # * +width:+ width of embedded object in pixels (500)
37
+ #
38
+ # Form example:
39
+ # 10:
40
+ # name: dc_parts
41
+ # type: embedded
42
+ # form_name: dc_part
43
+ # html:
44
+ # height: 1000
45
+ ###########################################################################
46
+ class Embedded < DrgcmsField
47
+ ###########################################################################
48
+ # Render embedded field html code
49
+ ###########################################################################
50
+ def render
51
+ #return self if @record.new_record? # would be in error otherwise
52
+ # HTML defaults. Some must be set
53
+ @yaml['html'] ||= {}
54
+ @yaml['html']['height'] ||= 300
55
+ @yaml['html']['width'] ||= '99%'
56
+ # defaults both way
57
+ @yaml['table'] ||= @yaml['form_name'] if @yaml['form_name']
58
+ @yaml['form_name'] ||= @yaml['table'] if @yaml['table']
59
+ #
60
+ html = ''
61
+ @yaml['html'].each {|k,v| html << "#{k}=\"#{v}\" "}
62
+ #
63
+ if @yaml['name'] == @yaml['table']
64
+ tables = @yaml['table']
65
+ ids = @record._id
66
+ else
67
+ tables = @parent.tables.inject('') { |r,v| r << "#{v[1]};" } + @yaml['table']
68
+ ids = @parent.ids.inject('') { |r,v| r << "#{v};" } + @record._id
69
+ end
70
+ opts = { controller: 'cmsedit', action: 'index', ids: ids, table: tables, form_name: @yaml['form_name'],
71
+ field_name: @yaml['name'], iframe: "if_#{@yaml['name']}", readonly: @readonly }
72
+ @html << "<iframe class='iframe_embedded' id='if_#{@yaml['name']}' name='if_#{@yaml['name']}' #{html}></iframe>"
73
+ unless @record.new_record?
74
+ @js << %Q[
75
+ $(document).ready( function() {
76
+ $('#if_#{@yaml['name']}').attr('src', '#{@parent.url_for(opts)}');
77
+ });]
78
+ end
79
+ self
80
+ end
81
+
82
+ end
83
+
84
+ end
@@ -0,0 +1,70 @@
1
+ #--
2
+ # Copyright (c) 2012+ Damjan Rems
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ module DrgcmsFormFields
24
+
25
+ ###########################################################################
26
+ # Implementation of file_select DRG CMS form field.
27
+ #
28
+ # FileSelect like HtmlField implements redirection for calling document manager edit field code.
29
+ # This can be drg_default_html_editor's elfinder or any other code defined
30
+ # by dc_site.settings file_select setting.
31
+ #
32
+ # Example of dc_site.setting used for drg_default_html_editor gem.
33
+ # html_editor: ckeditor
34
+ # ck_editor:
35
+ # config_file: /files/ck_config.js
36
+ # css_file: /files/ck_css.css
37
+ # file_select: elfinder
38
+ #
39
+ # Form example:
40
+ # 60:
41
+ # name: picture
42
+ # type: file_select
43
+ # html:
44
+ # size: 50
45
+ ###########################################################################
46
+ class FileSelect < DrgcmsField
47
+
48
+ ###########################################################################
49
+ # Render file_select field html code
50
+ ###########################################################################
51
+ def render
52
+ return ro_standard if @readonly
53
+ # retrieve html editor from page settings
54
+ selector_string = @parent.dc_get_site.params['file_select'] if @parent.dc_get_site
55
+ selector_string ||= 'elfinder'
56
+ #
57
+ klas_string = selector_string.camelize
58
+ if DrgcmsFormFields.const_defined?(klas_string)
59
+ klas = DrgcmsFormFields::const_get(klas_string)
60
+ o = klas.new(@parent, @record, @yaml).render
61
+ @js << o.js
62
+ @html << o.html
63
+ else
64
+ @html << "File select component not defined. Check site.settings or include drgcms_default_html_editor gem."
65
+ end
66
+ self
67
+ end
68
+
69
+ end
70
+ end
@@ -0,0 +1,52 @@
1
+ #--
2
+ # Copyright (c) 2012+ Damjan Rems
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ module DrgcmsFormFields
24
+
25
+ ###########################################################################
26
+ # Implementation of hidden DRG CMS form field.
27
+ #
28
+ # Will create hidden_field on form.
29
+ #
30
+ # ===Form options:
31
+ # * +name:+ field name
32
+ # * +type:+ hidden_field
33
+ #
34
+ # Form example:
35
+ # 10:
36
+ # name: im_hidden
37
+ # type: hidden_field
38
+ ###########################################################################
39
+ class HiddenField < DrgcmsField
40
+ ###########################################################################
41
+ # Render hidden_field field html code
42
+ ###########################################################################
43
+ def render
44
+ set_initial_value
45
+ value = @yaml['html']['value'] ? @yaml['html']['value'] : @record[@yaml['name']]
46
+ record = record_text_for(@yaml['name'])
47
+ @parent.hidden_field(record, @yaml['name'], value: value)
48
+ end
49
+ end
50
+
51
+
52
+ end