agile_rails 0.0.0.1
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/MIT-LICENSE +20 -0
- data/README.md +285 -0
- data/Rakefile +39 -0
- data/agile_rails.gemspec +36 -0
- data/app/assets/fonts/ibm-plex-sans-300.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-400.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-500.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-600.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-700.woff2 +0 -0
- data/app/assets/fonts/ibm-plex-sans-italic.woff2 +0 -0
- data/app/assets/images/32px.png +0 -0
- data/app/assets/images/throbber.gif +0 -0
- data/app/assets/javascripts/agile/agile.js +1489 -0
- data/app/assets/javascripts/agile/jquery-migrate.js +702 -0
- data/app/assets/javascripts/agile/jquery.bpopup.js +372 -0
- data/app/assets/javascripts/agile/jquery.datetimepicker.js +1353 -0
- data/app/assets/javascripts/agile/jstree.min.js +6 -0
- data/app/assets/javascripts/agile/select-multiple.js +459 -0
- data/app/assets/javascripts/agile/some_scripts.js +33 -0
- data/app/assets/javascripts/agile.js +22 -0
- data/app/assets/javascripts/agile_application.js +22 -0
- data/app/assets/javascripts/agile_editor.js +22 -0
- data/app/assets/stylesheets/agile/agile.css +1882 -0
- data/app/assets/stylesheets/agile/agile_apps.css +149 -0
- data/app/assets/stylesheets/agile/jquery.datetimepicker.css +304 -0
- data/app/assets/stylesheets/agile/jstree.css +1107 -0
- data/app/assets/stylesheets/agile/select-multiple.css +110 -0
- data/app/assets/stylesheets/agile/th-bg.png +0 -0
- data/app/assets/stylesheets/agile/theme.css +49 -0
- data/app/assets/stylesheets/agile.css +21 -0
- data/app/assets/stylesheets/agile_application.css +20 -0
- data/app/assets/stylesheets/agile_editor.css +19 -0
- data/app/controllers/agile_application_controller.rb +735 -0
- data/app/controllers/agile_common_controller.rb +345 -0
- data/app/controllers/agile_controller.rb +977 -0
- data/app/controllers/agile_main_controller.rb +36 -0
- data/app/controls/agile_control.rb +120 -0
- data/app/controls/agile_report.rb +364 -0
- data/app/controls/ar_category_control.rb +39 -0
- data/app/controls/ar_help_control.rb +139 -0
- data/app/controls/ar_image_control.rb +180 -0
- data/app/controls/ar_journal_control.rb +47 -0
- data/app/controls/ar_menu_item_control.rb +55 -0
- data/app/controls/ar_page_control.rb +64 -0
- data/app/controls/ar_poll_result_control.rb +84 -0
- data/app/controls/ar_setup_control.rb +62 -0
- data/app/controls/belongs_to_control.rb +61 -0
- data/app/controls/browse_models_control.rb +98 -0
- data/app/controls/settings_form_control.rb +137 -0
- data/app/forms/agile_help.yml +112 -0
- data/app/forms/agile_menu.yml +140 -0
- data/app/forms/agile_report_defaults.yml +39 -0
- data/app/forms/all_options.yml +810 -0
- data/app/forms/ar_ad.yml +121 -0
- data/app/forms/ar_big_table.yml +60 -0
- data/app/forms/ar_big_table_value.yml +52 -0
- data/app/forms/ar_browse_fields.yml +35 -0
- data/app/forms/ar_browse_models.yml +48 -0
- data/app/forms/ar_category.yml +73 -0
- data/app/forms/ar_category_as_tree.yml +31 -0
- data/app/forms/ar_design.yml +75 -0
- data/app/forms/ar_filter.yml +52 -0
- data/app/forms/ar_folder_permission.yml +56 -0
- data/app/forms/ar_folder_rule.yml +48 -0
- data/app/forms/ar_gallery.yml +55 -0
- data/app/forms/ar_image.yml +126 -0
- data/app/forms/ar_image_search.yml +83 -0
- data/app/forms/ar_journal.yml +76 -0
- data/app/forms/ar_json_ld.yml +56 -0
- data/app/forms/ar_key_value.yml +33 -0
- data/app/forms/ar_key_value_store.yml +33 -0
- data/app/forms/ar_link.yml +60 -0
- data/app/forms/ar_menu.yml +67 -0
- data/app/forms/ar_menu_item.yml +141 -0
- data/app/forms/ar_page.yml +187 -0
- data/app/forms/ar_part.yml +91 -0
- data/app/forms/ar_permission.yml +52 -0
- data/app/forms/ar_permission_rule.yml +40 -0
- data/app/forms/ar_piece.yml +106 -0
- data/app/forms/ar_policy.yml +64 -0
- data/app/forms/ar_policy_rule.yml +42 -0
- data/app/forms/ar_policy_rule_nocms.yml +40 -0
- data/app/forms/ar_poll.yml +118 -0
- data/app/forms/ar_poll_item.yml +78 -0
- data/app/forms/ar_poll_result.yml +88 -0
- data/app/forms/ar_poll_result_export.yml +35 -0
- data/app/forms/ar_removed_url.yml +41 -0
- data/app/forms/ar_role.yml +43 -0
- data/app/forms/ar_seo.yml +32 -0
- data/app/forms/ar_setup.yml +45 -0
- data/app/forms/ar_site.yml +149 -0
- data/app/forms/ar_steps_template.yml +51 -0
- data/app/forms/ar_user.yml +140 -0
- data/app/forms/ar_user_role.yml +57 -0
- data/app/forms/help/dc_category_as_tree.en +4 -0
- data/app/forms/help/dc_category_as_tree.sl +5 -0
- data/app/forms/json_ld_schema.yml +168 -0
- data/app/helpers/agile_application_helper.rb +1162 -0
- data/app/helpers/agile_category_helper.rb +128 -0
- data/app/helpers/agile_common_helper.rb +308 -0
- data/app/helpers/agile_edit_helper.rb +645 -0
- data/app/helpers/agile_helper.rb +509 -0
- data/app/helpers/agile_index_helper.rb +677 -0
- data/app/helpers/ar_image_helper.rb +128 -0
- data/app/models/agile_form_fields/action.rb +61 -0
- data/app/models/agile_form_fields/agile_form_field.rb +322 -0
- data/app/models/agile_form_fields/belongs_to.rb +112 -0
- data/app/models/agile_form_fields/check_box.rb +73 -0
- data/app/models/agile_form_fields/comment.rb +62 -0
- data/app/models/agile_form_fields/date_picker.rb +104 -0
- data/app/models/agile_form_fields/date_select.rb +68 -0
- data/app/models/agile_form_fields/datetime_picker.rb +88 -0
- data/app/models/agile_form_fields/datetime_select.rb +73 -0
- data/app/models/agile_form_fields/file_field.rb +52 -0
- data/app/models/agile_form_fields/file_select.rb +69 -0
- data/app/models/agile_form_fields/hidden_field.rb +51 -0
- data/app/models/agile_form_fields/html_field.rb +69 -0
- data/app/models/agile_form_fields/journal_diff.rb +62 -0
- data/app/models/agile_form_fields/link_to.rb +69 -0
- data/app/models/agile_form_fields/method.rb +66 -0
- data/app/models/agile_form_fields/multitext_autocomplete.rb +215 -0
- data/app/models/agile_form_fields/number_field.rb +92 -0
- data/app/models/agile_form_fields/password_field.rb +63 -0
- data/app/models/agile_form_fields/radio_button.rb +95 -0
- data/app/models/agile_form_fields/readonly.rb +77 -0
- data/app/models/agile_form_fields/select.rb +281 -0
- data/app/models/agile_form_fields/submit_tag.rb +58 -0
- data/app/models/agile_form_fields/text_area.rb +61 -0
- data/app/models/agile_form_fields/text_autocomplete.rb +171 -0
- data/app/models/agile_form_fields/text_field.rb +55 -0
- data/app/models/agile_form_fields/text_with_select.rb +94 -0
- data/app/models/agile_form_fields/tree_select.rb +170 -0
- data/app/models/ar_big_table.rb +82 -0
- data/app/models/ar_big_table_value.rb +53 -0
- data/app/models/ar_category.rb +109 -0
- data/app/models/ar_design.rb +116 -0
- data/app/models/ar_filter.rb +200 -0
- data/app/models/ar_folder_permission.rb +50 -0
- data/app/models/ar_folder_rule.rb +47 -0
- data/app/models/ar_gallery.rb +53 -0
- data/app/models/ar_image.rb +198 -0
- data/app/models/ar_internals.rb +60 -0
- data/app/models/ar_journal.rb +46 -0
- data/app/models/ar_json_ld.rb +131 -0
- data/app/models/ar_key_value_store.rb +128 -0
- data/app/models/ar_link.rb +48 -0
- data/app/models/ar_memory.rb +172 -0
- data/app/models/ar_menu.rb +144 -0
- data/app/models/ar_menu_item.rb +106 -0
- data/app/models/ar_page.rb +74 -0
- data/app/models/ar_part.rb +66 -0
- data/app/models/ar_permission.rb +180 -0
- data/app/models/ar_permission_rule.rb +65 -0
- data/app/models/ar_policy.rb +78 -0
- data/app/models/ar_policy_rule.rb +65 -0
- data/app/models/ar_poll.rb +74 -0
- data/app/models/ar_poll_item.rb +47 -0
- data/app/models/ar_poll_result.rb +38 -0
- data/app/models/ar_removed_url.rb +42 -0
- data/app/models/ar_role.rb +84 -0
- data/app/models/ar_setup.rb +115 -0
- data/app/models/ar_site.rb +68 -0
- data/app/models/ar_temp.rb +150 -0
- data/app/models/ar_user.rb +72 -0
- data/app/models/ar_user_group.rb +38 -0
- data/app/models/ar_user_role.rb +54 -0
- data/app/models/ar_visit.rb +41 -0
- data/app/models/concerns/ar_page_concern.rb +128 -0
- data/app/models/concerns/ar_part_concern.rb +48 -0
- data/app/models/concerns/ar_piece_concern.rb +48 -0
- data/app/models/concerns/ar_policy_rule_concern.rb +87 -0
- data/app/models/concerns/ar_seo_concern.rb +66 -0
- data/app/models/concerns/ar_site_concern.rb +103 -0
- data/app/models/concerns/ar_user_concern.rb +195 -0
- data/app/renderers/agile_common_renderer.rb +93 -0
- data/app/renderers/agile_renderer.rb +59 -0
- data/app/renderers/ar_ad_renderer.rb +219 -0
- data/app/renderers/ar_captcha_renderer.rb +113 -0
- data/app/renderers/ar_common_renderer.rb +90 -0
- data/app/renderers/ar_gallery_renderer.rb +107 -0
- data/app/renderers/ar_menu_renderer.rb +195 -0
- data/app/renderers/ar_page_renderer.rb +147 -0
- data/app/renderers/ar_part_renderer.rb +235 -0
- data/app/renderers/ar_piece_renderer.rb +119 -0
- data/app/renderers/ar_poll_renderer.rb +272 -0
- data/app/views/agile/_edit_stuff.html.erb +57 -0
- data/app/views/agile/_form.html.erb +24 -0
- data/app/views/agile/_result.html.erb +28 -0
- data/app/views/agile/edit.html.erb +13 -0
- data/app/views/agile/error.html.erb +2 -0
- data/app/views/agile/index.html.erb +14 -0
- data/app/views/agile/login.html.erb +19 -0
- data/app/views/agile/new.html.erb +12 -0
- data/app/views/agile_common/_help.html.erb +18 -0
- data/app/views/agile_common/_iframe_edit.html.erb +2 -0
- data/app/views/agile_common/paste_clipboard.html.erb +17 -0
- data/app/views/layouts/agile.html.erb +17 -0
- data/app/views/layouts/content.html.erb +20 -0
- data/app/views/models/dump_models.html.erb +47 -0
- data/config/initializers/kaminari_patch.rb +56 -0
- data/config/locales/agile_de.yml +138 -0
- data/config/locales/agile_en.yml +162 -0
- data/config/locales/agile_sl.yml +163 -0
- data/config/locales/datetimepicker.yml +19 -0
- data/config/locales/de.yml +231 -0
- data/config/locales/en.yml +13 -0
- data/config/locales/kaminari.yml +26 -0
- data/config/locales/models_en.yml +1032 -0
- data/config/locales/models_sl.yml +1065 -0
- data/config/locales/sl.yml +211 -0
- data/db/migrate/20240120160001_add_sessions_table.rb +12 -0
- data/db/migrate/20240120160002_ar_big_table.rb +17 -0
- data/db/migrate/20240120160003_ar_big_table_value.rb +18 -0
- data/db/migrate/20240120160004_ar_category.rb +22 -0
- data/db/migrate/20240120160005_ar_design.rb +20 -0
- data/db/migrate/20240120160006_ar_filter.rb +17 -0
- data/db/migrate/20240120160007_ar_gallery.rb +21 -0
- data/db/migrate/20240120160008_ar_journal.rb +19 -0
- data/db/migrate/20240120160009_ar_key_value_store.rb +11 -0
- data/db/migrate/20240120160010_ar_link.rb +19 -0
- data/db/migrate/20240120160011_ar_memory.rb +8 -0
- data/db/migrate/20240120160012_ar_menu.rb +21 -0
- data/db/migrate/20240120160013_ar_menu_item.rb +28 -0
- data/db/migrate/20240120160014_ar_page.rb +50 -0
- data/db/migrate/20240120160015_ar_part.rb +33 -0
- data/db/migrate/20240120160016_ar_permission.rb +16 -0
- data/db/migrate/20240120160017_ar_permission_rule.rb +17 -0
- data/db/migrate/20240120160018_ar_piece.rb +28 -0
- data/db/migrate/20240120160019_ar_policy.rb +21 -0
- data/db/migrate/20240120160020_ar_policy_rule.rb +18 -0
- data/db/migrate/20240120160021_ar_poll.rb +27 -0
- data/db/migrate/20240120160022_ar_poll_item.rb +23 -0
- data/db/migrate/20240120160023_ar_poll_result.rb +14 -0
- data/db/migrate/20240120160024_ar_removed_url.rb +16 -0
- data/db/migrate/20240120160025_ar_role.rb +17 -0
- data/db/migrate/20240120160026_ar_site.rb +37 -0
- data/db/migrate/20240120160027_ar_temp.rb +11 -0
- data/db/migrate/20240120160028_ar_user.rb +42 -0
- data/db/migrate/20240120160029_ar_user_group.rb +12 -0
- data/db/migrate/20240120160030_ar_user_role.rb +18 -0
- data/db/migrate/20240120160031_ar_visit.rb +15 -0
- data/db/migrate/20240703016001_ar_setup.rb +16 -0
- data/db/migrate/20240703016002_ar_folder_permission.rb +15 -0
- data/db/migrate/20240703016003_ar_folder_rule.rb +14 -0
- data/db/migrate/20250115000001_ar_image.rb +25 -0
- data/lib/agile/configuration.rb +43 -0
- data/lib/agile/engine.rb +29 -0
- data/lib/agile/version.rb +27 -0
- data/lib/agile.rb +282 -0
- data/lib/agile_rails.rb +1 -0
- data/lib/generators/agile/USAGE +11 -0
- data/lib/generators/agile/new_form_generator.rb +369 -0
- data/lib/generators/convert_to_ar/convert_to_ar_generator.rb +158 -0
- data/lib/tasks/agile_db_clone.rake +132 -0
- data/lib/tasks/agile_db_export_to_yaml.rake +37 -0
- data/lib/tasks/agile_db_migrate.rake +35 -0
- metadata +414 -0
@@ -0,0 +1,73 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of check_box AgileRails form field.
|
27
|
+
#
|
28
|
+
# ===Form options:
|
29
|
+
# * +name:+ field name (required)
|
30
|
+
# * +type:+ check_box (required)
|
31
|
+
# * +choices:+ Values check_box separated by comma (1,0) (yes,no)
|
32
|
+
# * +checked_value:+ 1 or yes or approved
|
33
|
+
# * +label:+ displayed right to square field
|
34
|
+
# * +unchecked_value:+ 0 or no or not approved
|
35
|
+
# * +html:+ html options which apply to check_box field (optional)
|
36
|
+
#
|
37
|
+
# Form example:
|
38
|
+
# 30:
|
39
|
+
# name: active
|
40
|
+
# type: check_box
|
41
|
+
# 40:
|
42
|
+
# name: status
|
43
|
+
# type: check_box
|
44
|
+
# choices: yes,no
|
45
|
+
# label: label
|
46
|
+
###########################################################################
|
47
|
+
class CheckBox < AgileFormField
|
48
|
+
|
49
|
+
###########################################################################
|
50
|
+
# Render check_box field html code
|
51
|
+
###########################################################################
|
52
|
+
def render
|
53
|
+
set_initial_value('html','default')
|
54
|
+
# checked flag must be set
|
55
|
+
@yaml['html']['checked'] = !@env.agile_dont?(@yaml['html']['default']) if @yaml['html']['default']
|
56
|
+
# disabled if readonly
|
57
|
+
@yaml['html']['disabled'] = true if @readonly
|
58
|
+
# If choices are present split them to set checked and unchecked value
|
59
|
+
@yaml['checked_value'], @yaml['unchecked_value'] = @yaml['choices'].split(',') if @yaml['choices']
|
60
|
+
@yaml['html'].symbolize_keys!
|
61
|
+
record = record_text_for(@yaml['name'])
|
62
|
+
@html +=
|
63
|
+
if @yaml['checked_value']
|
64
|
+
@env.check_box(record, @yaml['name'], @yaml['html'], @yaml['checked_value'], @yaml['unchecked_value'] || '0')
|
65
|
+
else
|
66
|
+
@env.check_box(record, @yaml['name'], @yaml['html'])
|
67
|
+
end
|
68
|
+
@html += %(<label for="record_#{@yaml['name']}">#{@yaml['label']}</label>) if @yaml['label']
|
69
|
+
self
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of comment AgileRails form field. Comments are text inserted into
|
27
|
+
# form instead of input field.
|
28
|
+
#
|
29
|
+
# ===Form options:
|
30
|
+
# * +text:+ any text. Text will be translated if key is found in translations. (required)
|
31
|
+
# * +type:+ comment (required)
|
32
|
+
# * +caption:+ Caption text written in label place. If set to false comment
|
33
|
+
# will occupy whole row. (required)
|
34
|
+
# * +html:+ Optional html attributes will be added to div surrounding the comment.
|
35
|
+
#
|
36
|
+
# Form example:
|
37
|
+
# 30:
|
38
|
+
# type: comment
|
39
|
+
# text: myapp.comment_text
|
40
|
+
# caption: false
|
41
|
+
# html:
|
42
|
+
# style: 'color: red'
|
43
|
+
# class: some_class
|
44
|
+
# id: some_id
|
45
|
+
###########################################################################
|
46
|
+
class Comment < AgileFormField
|
47
|
+
|
48
|
+
###########################################################################
|
49
|
+
# Render comment field html code
|
50
|
+
###########################################################################
|
51
|
+
def render
|
52
|
+
comment = @yaml['comment'] || @yaml['text']
|
53
|
+
@yaml['html'] ||= {}
|
54
|
+
@yaml['html']['class'] = 'ar-comment ' + @yaml['html']['class'].to_s
|
55
|
+
html = @yaml['html'].map { |k, v| %( #{k}="#{v}") }.join
|
56
|
+
|
57
|
+
@html += %(<div #{html}>#{t(comment, comment).gsub("\n",'<br>')}</div>)
|
58
|
+
self
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of date_picker AgileRails form field with help of jQuery DateTimePicker plugin.
|
27
|
+
#
|
28
|
+
# Since javascript date(time) format differs from ruby date(time) format localization
|
29
|
+
# must be provided in order for date_picker object works as expected. For example:
|
30
|
+
#
|
31
|
+
# en:
|
32
|
+
# datetimepicker:
|
33
|
+
# formats:
|
34
|
+
# date: 'Y/m/d'
|
35
|
+
# datetime: 'Y/m/d H:i'
|
36
|
+
#
|
37
|
+
# sl:
|
38
|
+
# datetimepicker:
|
39
|
+
# formats:
|
40
|
+
# date: 'd.m.Y'
|
41
|
+
# datetime: 'd.m.Y H:i'
|
42
|
+
#
|
43
|
+
# ===Form options:
|
44
|
+
# * +type:+ date_picker (required)
|
45
|
+
# * +name:+ Field name (required)
|
46
|
+
# * +options:+ options which apply to date_picker field. All options can be found here http://xdsoft.net/jqplugins/datetimepicker/ .
|
47
|
+
# Options can be defined in single line like:
|
48
|
+
# * options: 'inline: true,lang: "sl"' or
|
49
|
+
#
|
50
|
+
# * options:
|
51
|
+
# * inline: true
|
52
|
+
# * lang: '"sl"'
|
53
|
+
#
|
54
|
+
# * +html:+ html options which apply to date_picker field (optional)
|
55
|
+
#
|
56
|
+
# Form example:
|
57
|
+
# 10:
|
58
|
+
# name: created
|
59
|
+
# type: date_picker
|
60
|
+
# options: 'inline: true,lang: "sl"'
|
61
|
+
###########################################################################
|
62
|
+
class DatePicker < AgileFormField
|
63
|
+
|
64
|
+
###########################################################################
|
65
|
+
# Render date_picker field html code
|
66
|
+
###########################################################################
|
67
|
+
def render
|
68
|
+
value = @record.try(@yaml['name']) ? I18n.localize(@record[@yaml['name']].to_date) : nil
|
69
|
+
set_initial_value
|
70
|
+
@yaml['html']['size'] ||= @yaml['size'] || 10
|
71
|
+
@yaml['html']['value'] ||= value
|
72
|
+
@yaml['html']['autocomplete'] ||= 'off'
|
73
|
+
@yaml['html']['class'] = @yaml['html']['class'].to_s + ' date-picker'
|
74
|
+
|
75
|
+
options = options_to_hash(@yaml['options'])
|
76
|
+
options['lang'] ||= I18n.locale.to_s
|
77
|
+
options['format'] ||= t('datetimepicker.formats.date')
|
78
|
+
options['timepicker'] = false
|
79
|
+
options['scrollMonth'] ||= false
|
80
|
+
options['scrollInput'] ||= false
|
81
|
+
|
82
|
+
record = record_text_for(@yaml['name'])
|
83
|
+
@html += @env.text_field(record, @yaml['name'], @yaml['html'])
|
84
|
+
@js += %(
|
85
|
+
$(document).ready(function() {
|
86
|
+
$("##{record}_#{@yaml['name']}").datetimepicker({
|
87
|
+
#{hash_to_options(options)}
|
88
|
+
});
|
89
|
+
});
|
90
|
+
) unless @readonly
|
91
|
+
|
92
|
+
self
|
93
|
+
end
|
94
|
+
|
95
|
+
###########################################################################
|
96
|
+
# DatePicker get_data method.
|
97
|
+
###########################################################################
|
98
|
+
def self.get_data(params, name)
|
99
|
+
t = params['record'][name] ? params['record'][name].to_datetime : nil
|
100
|
+
t ? Time.zone.local(t.year, t.month, t.day) : nil
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of date_select AgileRails form field.
|
27
|
+
#
|
28
|
+
# ===Form options:
|
29
|
+
# * +type:+ date_select (required)
|
30
|
+
# * +name:+ Field name (required)
|
31
|
+
# * +options:+ options which apply to date_select field (optional)
|
32
|
+
# * +html:+ html options which apply to password field (optional)
|
33
|
+
#
|
34
|
+
# Form example:
|
35
|
+
# 50:
|
36
|
+
# name: valid_from
|
37
|
+
# type: date_select
|
38
|
+
# options:
|
39
|
+
# include_blank: true
|
40
|
+
# html:
|
41
|
+
# class: my-date-class
|
42
|
+
###########################################################################
|
43
|
+
class DateSelect < AgileFormField
|
44
|
+
|
45
|
+
###########################################################################
|
46
|
+
# Render date_select field html code
|
47
|
+
###########################################################################
|
48
|
+
def render
|
49
|
+
#return ro_standard( @env.agile_format_value(@record[@yaml['name']])) if @readonly
|
50
|
+
#
|
51
|
+
@yaml['options'] ||= {}
|
52
|
+
set_initial_value('options','default')
|
53
|
+
@yaml['options'].symbolize_keys!
|
54
|
+
@yaml['html'].symbolize_keys!
|
55
|
+
record = record_text_for(@yaml['name'])
|
56
|
+
@html += @env.date_select(record, @yaml['name'], @yaml['options'], @yaml['html'])
|
57
|
+
self
|
58
|
+
end
|
59
|
+
|
60
|
+
###########################################################################
|
61
|
+
# DatetimeSelect get_data method.
|
62
|
+
###########################################################################
|
63
|
+
def self.get_data(params, name)
|
64
|
+
DatetimeSelect.get_data(params, name).to_date rescue nil
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of date_time_picker AgileRails form field with help of jQuery DateTimePicker plugin
|
27
|
+
#
|
28
|
+
# ===Form options:
|
29
|
+
# * +type:+ datetime_picker (required)
|
30
|
+
# * +name:+ Field name (required)
|
31
|
+
# * +options:+ options which apply to date_picker field. All options can be found here http://xdsoft.net/jqplugins/datetimepicker/ .
|
32
|
+
# Options can be defined in single line like:
|
33
|
+
# * options: 'step: 15,inline: true,lang: sl' or
|
34
|
+
#
|
35
|
+
# * options:
|
36
|
+
# * step: 15
|
37
|
+
# * inline: true
|
38
|
+
# * lang: sl
|
39
|
+
#
|
40
|
+
# * +html:+ html options which apply to date_time_picker field (optional)
|
41
|
+
#
|
42
|
+
# Form example:
|
43
|
+
# 10:
|
44
|
+
# name: valid_to
|
45
|
+
# type: datetime_picker
|
46
|
+
# options: 'step: 60'
|
47
|
+
###########################################################################
|
48
|
+
class DatetimePicker < AgileFormField
|
49
|
+
|
50
|
+
###########################################################################
|
51
|
+
# Render date_time_picker field html code
|
52
|
+
###########################################################################
|
53
|
+
def render
|
54
|
+
value = @record.try(@yaml['name']) ? I18n.localize(@record[@yaml['name']].localtime) : nil
|
55
|
+
set_initial_value
|
56
|
+
|
57
|
+
@yaml['html']['size'] ||= @yaml['size'] || 14
|
58
|
+
@yaml['html']['value'] ||= value if @record.try(@yaml['name'])
|
59
|
+
@yaml['html']['autocomplete'] ||= 'off'
|
60
|
+
@yaml['html']['class'] = "#{@yaml['html']['class']} date-picker"
|
61
|
+
|
62
|
+
options = options_to_hash(@yaml['options'])
|
63
|
+
options['lang'] ||= I18n.locale.to_s
|
64
|
+
options['format'] ||= t('datetimepicker.formats.datetime')
|
65
|
+
record = record_text_for(@yaml['name'])
|
66
|
+
@html += @env.text_field(record, @yaml['name'], @yaml['html'])
|
67
|
+
@js += %(
|
68
|
+
$(document).ready(function() {
|
69
|
+
$("##{record}_#{@yaml['name']}").datetimepicker({
|
70
|
+
#{hash_to_options(options)}
|
71
|
+
});
|
72
|
+
});
|
73
|
+
) unless @readonly
|
74
|
+
|
75
|
+
self
|
76
|
+
end
|
77
|
+
|
78
|
+
###########################################################################
|
79
|
+
# DateTimePicker get_data method.
|
80
|
+
###########################################################################
|
81
|
+
def self.get_data(params, name)
|
82
|
+
p params,'----------------------------------------------------'
|
83
|
+
t = params['record'][name] ? params['record'][name].to_datetime : nil
|
84
|
+
t ? Time.new(t.year, t.month, t.day, t.hour, t.min) : nil
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
|
26
|
+
###########################################################################
|
27
|
+
# Create datetime_select AgileRails form field
|
28
|
+
#
|
29
|
+
# ===Form options:
|
30
|
+
# * +type:+ datetime_select (required)
|
31
|
+
# * +name:+ Field name (required)
|
32
|
+
# * +options:+ options which apply to date_select field (optional)
|
33
|
+
# * +html:+ html options which apply to password field (optional)
|
34
|
+
#
|
35
|
+
# Form example:
|
36
|
+
# 60:
|
37
|
+
# name: end_time
|
38
|
+
# type: datetime_select
|
39
|
+
# options:
|
40
|
+
# include_blank: true
|
41
|
+
###########################################################################
|
42
|
+
class DatetimeSelect < AgileFormField
|
43
|
+
|
44
|
+
###########################################################################
|
45
|
+
# Render datetime_select field html code
|
46
|
+
###########################################################################
|
47
|
+
def render
|
48
|
+
#return ro_standard( @env.agile_format_value(@record[@yaml['name']])) if @readonly
|
49
|
+
#
|
50
|
+
@yaml['options'] ||= {}
|
51
|
+
set_initial_value('options','default')
|
52
|
+
@yaml['options'].symbolize_keys!
|
53
|
+
@yaml['html'].symbolize_keys!
|
54
|
+
#
|
55
|
+
record = record_text_for(@yaml['name'])
|
56
|
+
@html += @env.datetime_select(record, @yaml['name'], @yaml['options'], @yaml['html'])
|
57
|
+
self
|
58
|
+
end
|
59
|
+
|
60
|
+
####################################################################
|
61
|
+
# DatetimeSelect get_data method.
|
62
|
+
####################################################################
|
63
|
+
def self.get_data(params, name)
|
64
|
+
begin
|
65
|
+
attrs = (1..5).map { |i| params['record']["#{name}(#{i}i)"]}
|
66
|
+
Time.zone.local(*attrs)
|
67
|
+
rescue
|
68
|
+
nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of file_field AgileRails form field.
|
27
|
+
#
|
28
|
+
# ===Form options:
|
29
|
+
# * +type:+ text_field (required)
|
30
|
+
# * +name:+ Field name (required)
|
31
|
+
# * +html:+ html options which apply to text_field field (optional)
|
32
|
+
#
|
33
|
+
# Form example:
|
34
|
+
# 10:
|
35
|
+
# name: title
|
36
|
+
# type: file_field
|
37
|
+
# size: 30
|
38
|
+
###########################################################################
|
39
|
+
class FileField < AgileFormField
|
40
|
+
|
41
|
+
###########################################################################
|
42
|
+
# Render text_field AgileRails form field code
|
43
|
+
###########################################################################
|
44
|
+
def render
|
45
|
+
return self if @readonly
|
46
|
+
|
47
|
+
@html += @env.file_field(nil,@yaml['name'], @yaml['html'])
|
48
|
+
self
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of file_select AgileRails form field.
|
27
|
+
#
|
28
|
+
# FileSelect like HtmlField implements redirection for calling document manager edit field code.
|
29
|
+
# This can be agile_rails_html_editor's elfinder or any other code defined
|
30
|
+
# by ar_site.settings file_select setting.
|
31
|
+
#
|
32
|
+
# Example of ar_site.setting used for agile_rails_html_editor gem.
|
33
|
+
# html_editor: ckeditor
|
34
|
+
# ckeditor:
|
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
|
+
# size: 50
|
44
|
+
###########################################################################
|
45
|
+
class FileSelect < AgileFormField
|
46
|
+
|
47
|
+
###########################################################################
|
48
|
+
# Render file_select AgileRails form field code
|
49
|
+
###########################################################################
|
50
|
+
def render
|
51
|
+
return ro_standard if @readonly
|
52
|
+
# retrieve file_select option from site settings
|
53
|
+
file_select = @env.agile_get_site.params['file_select'] if @env.agile_get_site
|
54
|
+
file_select ||= 'elfinder'
|
55
|
+
klas_string = file_select.camelize
|
56
|
+
|
57
|
+
if AgileFormFields.const_defined?(klas_string)
|
58
|
+
klas = AgileFormFields::const_get(klas_string)
|
59
|
+
o = klas.new(@env, @record, @yaml).render
|
60
|
+
@js += o.js
|
61
|
+
@html += o.html
|
62
|
+
else
|
63
|
+
@html += 'File select component not defined. Check site.settings or include agile_rails_html_editor gem.'
|
64
|
+
end
|
65
|
+
self
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2024+ 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 AgileFormFields
|
24
|
+
|
25
|
+
###########################################################################
|
26
|
+
# Implementation of hidden AgileRails 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 < AgileFormField
|
40
|
+
###########################################################################
|
41
|
+
# Render hidden_field AgileRails form field code
|
42
|
+
###########################################################################
|
43
|
+
def render
|
44
|
+
set_initial_value
|
45
|
+
value = @yaml['html']['value'] ? @yaml['html']['value'] : @record.send(@yaml['name'])
|
46
|
+
record = record_text_for(@yaml['name'])
|
47
|
+
@env.hidden_field(record, @yaml['name'], value: value)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|