glib-web 0.5.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.
- checksums.yaml +7 -0
- data/app/controllers/concerns/glib/auth/policy.rb +148 -0
- data/app/controllers/concerns/glib/json/dynamic_text.rb +126 -0
- data/app/controllers/concerns/glib/json/libs.rb +144 -0
- data/app/controllers/concerns/glib/json/new_dynamic_text.rb +122 -0
- data/app/controllers/concerns/glib/json/transformation.rb +11 -0
- data/app/controllers/concerns/glib/json/traversal.rb +85 -0
- data/app/controllers/concerns/glib/json/ui.rb +70 -0
- data/app/controllers/concerns/glib/json/validation.rb +13 -0
- data/app/controllers/glib/home_controller.rb +16 -0
- data/app/helpers/glib/app_feature_support_helper.rb +16 -0
- data/app/helpers/glib/dynamic_images_helper.rb +52 -0
- data/app/helpers/glib/dynamic_texts_helper.rb +42 -0
- data/app/helpers/glib/forms_helper.rb +15 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +281 -0
- data/app/helpers/glib/json_ui/action_builder.rb +81 -0
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +58 -0
- data/app/helpers/glib/json_ui/action_builder/http.rb +19 -0
- data/app/helpers/glib/json_ui/action_builder/sheets.rb +15 -0
- data/app/helpers/glib/json_ui/action_builder/snackbars.rb +41 -0
- data/app/helpers/glib/json_ui/action_builder/windows.rb +25 -0
- data/app/helpers/glib/json_ui/dynamic_field_builders.rb +25 -0
- data/app/helpers/glib/json_ui/generic_builders.rb +28 -0
- data/app/helpers/glib/json_ui/list_builders.rb +87 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +52 -0
- data/app/helpers/glib/json_ui/page_helper.rb +187 -0
- data/app/helpers/glib/json_ui/response_helper.rb +23 -0
- data/app/helpers/glib/json_ui/split_builders.rb +32 -0
- data/app/helpers/glib/json_ui/styling_helper.rb +25 -0
- data/app/helpers/glib/json_ui/table_builders.rb +74 -0
- data/app/helpers/glib/json_ui/view_builder.rb +185 -0
- data/app/helpers/glib/json_ui/view_builder/banners.rb +24 -0
- data/app/helpers/glib/json_ui/view_builder/charts.rb +33 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +213 -0
- data/app/helpers/glib/json_ui/view_builder/panels.rb +219 -0
- data/app/models/glib/active_storage/attachment.rb +9 -0
- data/app/models/glib/active_storage/blob.rb +9 -0
- data/app/models/glib/dynamic_text_record.rb +9 -0
- data/app/models/glib/text.rb +96 -0
- data/app/policies/glib/application_policy.rb +164 -0
- data/app/validators/email_typo_validator.rb +38 -0
- data/app/validators/email_validator.rb +7 -0
- data/app/validators/url_validator.rb +20 -0
- data/app/views/app/views/json_ui/vue/renderer.html.erb +35 -0
- data/app/views/json_ui/garage/_nav_menu.json.jbuilder +71 -0
- data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +104 -0
- data/app/views/json_ui/garage/actions/_http.json.jbuilder +18 -0
- data/app/views/json_ui/garage/actions/_reload.json.jbuilder +17 -0
- data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +19 -0
- data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +33 -0
- data/app/views/json_ui/garage/actions/_timeouts.json.jbuilder +18 -0
- data/app/views/json_ui/garage/actions/_windows.json.jbuilder +24 -0
- data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +6 -0
- data/app/views/json_ui/garage/actions/index.json.jbuilder +23 -0
- data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +7 -0
- data/app/views/json_ui/garage/forms/basic.json.jbuilder +34 -0
- data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +8 -0
- data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +44 -0
- data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +41 -0
- data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +25 -0
- data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +38 -0
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +58 -0
- data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +31 -0
- data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +3 -0
- data/app/views/json_ui/garage/forms/get_request.json.jbuilder +28 -0
- data/app/views/json_ui/garage/forms/index.json.jbuilder +101 -0
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +46 -0
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +40 -0
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +70 -0
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +88 -0
- data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +32 -0
- data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +17 -0
- data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +24 -0
- data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +63 -0
- data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +25 -0
- data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +22 -0
- data/app/views/json_ui/garage/home/blank.json.jbuilder +11 -0
- data/app/views/json_ui/garage/home/index.json.jbuilder +32 -0
- data/app/views/json_ui/garage/home/slow.json.jbuilder +11 -0
- data/app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder +20 -0
- data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +19 -0
- data/app/views/json_ui/garage/lists/fab.json.jbuilder +14 -0
- data/app/views/json_ui/garage/lists/index.json.jbuilder +23 -0
- data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +38 -0
- data/app/views/json_ui/garage/lists/templating.json.jbuilder +35 -0
- data/app/views/json_ui/garage/notifications/index.json.jbuilder +18 -0
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +60 -0
- data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +29 -0
- data/app/views/json_ui/garage/pages/full_width.json.jbuilder +29 -0
- data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +16 -0
- data/app/views/json_ui/garage/pages/index.json.jbuilder +47 -0
- data/app/views/json_ui/garage/pages/layout.json.jbuilder +19 -0
- data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +10 -0
- data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +21 -0
- data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +27 -0
- data/app/views/json_ui/garage/panels/_styled.json.jbuilder +78 -0
- data/app/views/json_ui/garage/panels/card.json.jbuilder +4 -0
- data/app/views/json_ui/garage/panels/carousel.json.jbuilder +16 -0
- data/app/views/json_ui/garage/panels/custom.json.jbuilder +17 -0
- data/app/views/json_ui/garage/panels/flow.json.jbuilder +49 -0
- data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +91 -0
- data/app/views/json_ui/garage/panels/index.json.jbuilder +132 -0
- data/app/views/json_ui/garage/panels/outlined.json.jbuilder +4 -0
- data/app/views/json_ui/garage/panels/responsive.json.jbuilder +88 -0
- data/app/views/json_ui/garage/panels/split.json.jbuilder +183 -0
- data/app/views/json_ui/garage/panels/vertical.json.jbuilder +50 -0
- data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +13 -0
- data/app/views/json_ui/garage/services/image.json.jbuilder +47 -0
- data/app/views/json_ui/garage/services/index.json.jbuilder +17 -0
- data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +13 -0
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +38 -0
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +39 -0
- data/app/views/json_ui/garage/tables/export_import.json.jbuilder +29 -0
- data/app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder +26 -0
- data/app/views/json_ui/garage/tables/index.json.jbuilder +26 -0
- data/app/views/json_ui/garage/tables/layout.json.jbuilder +38 -0
- data/app/views/json_ui/garage/views/_chart_data.json.jbuilder +17 -0
- data/app/views/json_ui/garage/views/banners.json.jbuilder +51 -0
- data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +30 -0
- data/app/views/json_ui/garage/views/carousels.json.jbuilder +37 -0
- data/app/views/json_ui/garage/views/charts.json.jbuilder +115 -0
- data/app/views/json_ui/garage/views/images.json.jbuilder +89 -0
- data/app/views/json_ui/garage/views/index.json.jbuilder +48 -0
- data/app/views/json_ui/garage/views/links.json.jbuilder +70 -0
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +43 -0
- data/app/views/json_ui/garage/views/markdowns.json.jbuilder +41 -0
- data/app/views/json_ui/garage/views/misc.json.jbuilder +34 -0
- data/app/views/json_ui/garage/views/texts.json.jbuilder +41 -0
- data/app/views/layouts/json_ui/renderer.html.erb +32 -0
- data/config/routes.rb +8 -0
- data/lib/generators/glib/install_generator.rb +24 -0
- data/lib/generators/templates/20191017062519_create_texts.rb +12 -0
- data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +7 -0
- data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +7 -0
- data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +27 -0
- data/lib/generators/templates/database.yml +107 -0
- data/lib/generators/templates/dynamic_text.rb +2 -0
- data/lib/glib-web.rb +8 -0
- data/lib/glib/crypt.rb +1 -0
- data/lib/glib/crypt/utils.rb +26 -0
- data/lib/glib/dynamic_text.rb +1 -0
- data/lib/glib/dynamic_text/config.rb +21 -0
- data/lib/glib/engine.rb +7 -0
- data/lib/glib/json_crawler.rb +10 -0
- data/lib/glib/json_crawler/action_crawler.rb +20 -0
- data/lib/glib/json_crawler/action_crawlers/action_http.rb +14 -0
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +48 -0
- data/lib/glib/json_crawler/action_crawlers/menu.rb +12 -0
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +15 -0
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +28 -0
- data/lib/glib/json_crawler/coverage.rb +20 -0
- data/lib/glib/json_crawler/http.rb +120 -0
- data/lib/glib/json_crawler/router.rb +86 -0
- data/lib/glib/test_helpers.rb +40 -0
- data/lib/glib/value.rb +7 -0
- data/lib/glib/version.rb +5 -0
- data/lib/tasks/db.rake +95 -0
- metadata +246 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
json_ui_page json do |page|
|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
5
|
+
|
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
7
|
+
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
|
8
|
+
form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
|
|
9
|
+
|
|
10
|
+
# form.panels_split width: 'matchParent', leftViews: ->(split) do
|
|
11
|
+
# if params[:mode] == 'dialog'
|
|
12
|
+
# split.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
|
13
|
+
# end
|
|
14
|
+
# end, rightViews: ->(split) do
|
|
15
|
+
# split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
16
|
+
# end
|
|
17
|
+
|
|
18
|
+
form.panels_split width: 'matchParent', content: ->(split) do
|
|
19
|
+
split.left childViews: ->(left) do
|
|
20
|
+
if params[:mode] == 'dialog'
|
|
21
|
+
left.button styleClass: 'link', text: 'cancel', onClick: ->(action) { action.dialogs_close }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
split.right childViews: ->(right) do
|
|
25
|
+
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
# , paramNameForFormData: 'formData', onSubmit: ->(action) do
|
|
31
|
+
# action.http_post url: json_ui_garage_url(path: 'forms/generic_post')
|
|
32
|
+
# end
|
|
33
|
+
|
|
34
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
json_ui_page json do |page|
|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
5
|
+
|
|
6
|
+
page.scroll childViews: ->(scroll) do
|
|
7
|
+
|
|
8
|
+
scroll.panels_form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
9
|
+
form.spacer height: 20
|
|
10
|
+
form.h2 text: 'Check Group'
|
|
11
|
+
form.fields_checkGroup name: 'user[skills][]', uncheckValue: 1, childViews: ->(group) do
|
|
12
|
+
form.fields_check value: 2, label: 'Game Development'
|
|
13
|
+
form.fields_check value: 3, label: 'Web Development'
|
|
14
|
+
form.fields_check value: 4, label: 'Mobile Development'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
form.spacer height: 20
|
|
18
|
+
form.h2 text: 'Rating'
|
|
19
|
+
form.spacer height: 6
|
|
20
|
+
form.fields_radioGroup name: 'user[rating1][]', iconOfSelected: 'star', iconOfBeforeSelected: 'star', iconOfAfterSelected: 'star_border', childViews: ->(panel) do
|
|
21
|
+
panel.panels_horizontal childViews: ->(panel) do
|
|
22
|
+
panel.fields_radio value: 1
|
|
23
|
+
panel.fields_radio value: 2
|
|
24
|
+
panel.fields_radio value: 3
|
|
25
|
+
panel.fields_radio value: 4
|
|
26
|
+
panel.fields_radio value: 5
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
form.fields_radioGroup name: 'user[rating2][]', iconOfSelected: 'star', iconOfBeforeSelected: 'star', iconOfAfterSelected: 'star_border', value: 1, childViews: ->(panel) do
|
|
30
|
+
panel.panels_horizontal childViews: ->(panel) do
|
|
31
|
+
panel.fields_radio value: 1
|
|
32
|
+
panel.fields_radio value: 2
|
|
33
|
+
panel.fields_radio value: 3
|
|
34
|
+
panel.fields_radio value: 4
|
|
35
|
+
panel.fields_radio value: 5
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
form.spacer height: 20
|
|
40
|
+
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
json_ui_page json do |page|
|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
5
|
+
|
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
7
|
+
form.h2 text: 'Dynamic Group'
|
|
8
|
+
form.spacer height: 6
|
|
9
|
+
|
|
10
|
+
value = [
|
|
11
|
+
{
|
|
12
|
+
'question': 'Punctuality',
|
|
13
|
+
'type': 'rating',
|
|
14
|
+
'enabled': '1'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
'question': 'Quality of work',
|
|
18
|
+
'type': 'rating'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
'question': 'Satisfied?',
|
|
22
|
+
'type': 'yes_no'
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
form.fields_dynamicGroup width: 'matchParent', name: 'user[evaluation]', value: value, titlePrefix: 'Entry', content: ->(group) do
|
|
27
|
+
group.template padding: { left: 32 }, childViews: ->(template) do
|
|
28
|
+
template.spacer height: 10
|
|
29
|
+
template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
|
|
30
|
+
options = [ :rating, :yes_no ]
|
|
31
|
+
template.fields_select width: 'matchParent', name: 'type', label: 'Answer Type', placeholder: 'Answer Type', options: options.map { |o| { text: o.to_s.humanize, value: o } }
|
|
32
|
+
template.fields_check width: 'matchParent', name: 'enabled', label: 'Enable', checkValue: '1'
|
|
33
|
+
|
|
34
|
+
template.spacer height: 14
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
form.spacer height: 20
|
|
39
|
+
form.fields_submit text: 'Submit'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
json_ui_page json do |page|
|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
5
|
+
|
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
7
|
+
form.h2 text: 'Dynamic Select'
|
|
8
|
+
form.spacer height: 6
|
|
9
|
+
|
|
10
|
+
form.fields_dynamicSelect name: 'user[primary_language]', width: 'matchParent', label: 'Primary Language',
|
|
11
|
+
# value: 'id3',
|
|
12
|
+
selectedOptions: [ { value: 'id3', text: 'Item 3' } ],
|
|
13
|
+
url: json_ui_garage_url(path: 'forms/dynamic_select_data')
|
|
14
|
+
|
|
15
|
+
form.spacer height: 14
|
|
16
|
+
form.fields_dynamicSelect name: 'user[preferred_languages][]', width: 'matchParent', label: 'Preferred Languages',
|
|
17
|
+
# value: ['id3', 'id5'], multiple: true,
|
|
18
|
+
selectedOptions: [ { value: 'id3', text: 'Item 3' }, { value: 'id5', text: 'Item 5' } ],
|
|
19
|
+
url: json_ui_garage_url(path: 'forms/dynamic_select_data'),
|
|
20
|
+
multiple: true
|
|
21
|
+
|
|
22
|
+
form.spacer height: 14
|
|
23
|
+
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
sleep 0.5
|
|
3
|
+
|
|
4
|
+
page = params[:page].to_i
|
|
5
|
+
if page < 2
|
|
6
|
+
json.nextPageUrl json_ui_garage_url(path: 'forms/dynamic_select_data', page: page + 1)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# json.rows do
|
|
10
|
+
|
|
11
|
+
# count_per_page = 20
|
|
12
|
+
# count_per_page.times do |i|
|
|
13
|
+
# json.child! do
|
|
14
|
+
# index = page * count_per_page + i
|
|
15
|
+
# json.template 'thumbnail'
|
|
16
|
+
# json.title "City #{index} (#{params[:q]})"
|
|
17
|
+
# json.subtitle "State #{index}"
|
|
18
|
+
# json.subsubtitle "Country #{index}"
|
|
19
|
+
# json.value "id#{index}"
|
|
20
|
+
# json.text "Item #{index}"
|
|
21
|
+
# end
|
|
22
|
+
# end
|
|
23
|
+
# end
|
|
24
|
+
|
|
25
|
+
section = json_ui_section json
|
|
26
|
+
section.rows builder: ->(row) do
|
|
27
|
+
count_per_page = 20
|
|
28
|
+
count_per_page.times do |i|
|
|
29
|
+
index = page * count_per_page + i
|
|
30
|
+
row.custom title: "City #{index} (#{params[:q]})",
|
|
31
|
+
subtitle: "State #{index}",
|
|
32
|
+
subsubtitle: "Country #{index}",
|
|
33
|
+
extra: {
|
|
34
|
+
value: "id#{index}",
|
|
35
|
+
text: "Item #{index}"
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
options = {
|
|
4
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
|
5
|
+
method: 'post',
|
|
6
|
+
padding: { top: 12, left: 20, right: 20, bottom: 12 }
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
json_ui_page json do |page|
|
|
10
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
11
|
+
|
|
12
|
+
page.form options.merge(childViews: ->(form) do
|
|
13
|
+
rules1 = { fileType: "image/*", maxFileSize: 5000 }
|
|
14
|
+
rules2 = { fileType: "image/*", maxFileSize: 1, fileTypeErrorText: 'Invalid!', maxFileSizeErrorText: 'Too big!' }
|
|
15
|
+
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Landscape Photo', accepts: rules1, directUploadUrl: rails_direct_uploads_url,
|
|
16
|
+
value: 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4',
|
|
17
|
+
fileUrl: 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100',
|
|
18
|
+
fileTitle: '1 month ago',
|
|
19
|
+
placeholderView: { type: 'image', width: 100, height: 75, url: 'https://www.atms.com.au/wp-content/uploads/2019/10/placeholder-1-1024x683.png?x93630' }
|
|
20
|
+
|
|
21
|
+
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Avatar', accepts: rules2, directUploadUrl: rails_direct_uploads_url,
|
|
22
|
+
placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMREBUREhAWFhUWGBcVFRgXFxUVFxcWGRUWFxYVFRUYHSggGB0lHRgVITEhJSkrLi4uGB8zODMtNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOMA3gMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABgcBAwQFAv/EAEAQAAECAwMKAwYEBAYDAAAAAAEAAgMRIQQSMQUGIjJBUWFxgZEHE6FCUnKxwdEUI2LwM4KSskNzg6LC4WOz8f/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwC6XuvCQRj7okcUe27UYoxt4TOKDDG3Knkjm3jeGCMdeoeaOcWmQwQZe6/Qc0a+6Lpx+6PbcqOSNbeF44oMMbcqeSOZeN4YIx1+h5oXEG6MEGXuv0HNGuui6cfuvMytl6zWTXi6XuN039hh1koflPxDe4nyILW/qfpO/pFB6oLDhMLTX0XLbLbChmcSNDZ8T2tPqVUNuy/aY38S0PI3A3W/0tkF5qC4bVnZYsPxLT8Ic71AWgZ72ICXmuP+m/7KpUQWzAzzsQP8Y9Ybx9F0szlsb3TFqhjDWJZ6uAVOogvcR2RR+XEa7bouB+S2B0hdOOHCqoVjiDME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9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' }
|
|
23
|
+
|
|
24
|
+
form.fields_submit text: 'Submit'
|
|
25
|
+
# form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
26
|
+
end)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# json_body_with_form json, nil, nil, options do
|
|
31
|
+
# json.child! do
|
|
32
|
+
# json.view 'fields/file-v1'
|
|
33
|
+
# json.name 'user[photo]'
|
|
34
|
+
# json.width 'matchParent'
|
|
35
|
+
# json.label 'Photo'
|
|
36
|
+
|
|
37
|
+
# json.value 'VALUE_OF_THE_PREVIOUS_IMAGE_WHICH_IS_USEFUL_WHEN_UPDATING_EXISTING_MODEL'
|
|
38
|
+
|
|
39
|
+
# json.accepts "image/*"
|
|
40
|
+
# # json.s3_bucket 'BUCKET_NAME'
|
|
41
|
+
# # json.s3_path_prefix 'uploads/images'
|
|
42
|
+
# json.s3_direct_upload_url rails_direct_uploads_path
|
|
43
|
+
|
|
44
|
+
# # This is for security so we don't have to reveal key/secret in the json api
|
|
45
|
+
# # json.s3_signature_url 'URL_TO_OUR_SERVER_TO_GET_GENERATED_SIGNATURE'
|
|
46
|
+
|
|
47
|
+
# json.file_size_limit 5000 # 5 MB
|
|
48
|
+
# json.file_size_limit_alert_text 'Too big!'
|
|
49
|
+
# end
|
|
50
|
+
|
|
51
|
+
# json.child! do
|
|
52
|
+
# json.view 'button-v1'
|
|
53
|
+
# json.text 'Submit'
|
|
54
|
+
# json.onClick do
|
|
55
|
+
# json.action 'forms/submit-v1'
|
|
56
|
+
# end
|
|
57
|
+
# end
|
|
58
|
+
# end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
# footer = Jbuilder.new do |json|
|
|
4
|
+
# json.padding(top: 12, left: 20, right: 80, bottom: 12)
|
|
5
|
+
# json.backgroundColor '#b3bac2'
|
|
6
|
+
# json.subviews do
|
|
7
|
+
# json.child! do
|
|
8
|
+
# json.view 'label-v1'
|
|
9
|
+
# json.text 'Demonstrates the use Floating Action Button on a form with footer'
|
|
10
|
+
# end
|
|
11
|
+
# end
|
|
12
|
+
# end
|
|
13
|
+
|
|
14
|
+
options = {
|
|
15
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
|
16
|
+
method: 'post',
|
|
17
|
+
padding: { top: 12, left: 20, right: 20, bottom: 12 }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
json_ui_page json do |page|
|
|
21
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
22
|
+
|
|
23
|
+
page.form options.merge(childViews: ->(form) do
|
|
24
|
+
form.label text: 'Demonstrates the use Floating Action Button on a form with footer'
|
|
25
|
+
30.times do |i|
|
|
26
|
+
form.fields_text name: "user[field#{i}]", width: 'matchParent', label: "Field#{i}"
|
|
27
|
+
end
|
|
28
|
+
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
29
|
+
form.fab icon: 'send', onClick: ->(action) { action.forms_submit }
|
|
30
|
+
end)
|
|
31
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
data = params[:user] || {}
|
|
4
|
+
|
|
5
|
+
json_ui_page json do |page|
|
|
6
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
7
|
+
|
|
8
|
+
page.form url: json_ui_garage_url(path: 'forms/get_request'), method: 'get', padding: glib_json_padding_body, childViews: ->(form) do
|
|
9
|
+
# TODO: Potential improvement:
|
|
10
|
+
# Use `reload` behaviour instead of `open` (i.e. don't keep adding URL to history).
|
|
11
|
+
# Probably introduce a flag to panels_form so developer can enable/disable this behaviour.
|
|
12
|
+
form.h3 text: "Hello #{ data[:name] }"
|
|
13
|
+
form.spacer height: 6
|
|
14
|
+
form.label text: 'On the web, upon submit, URL needs to change on the browser'
|
|
15
|
+
form.spacer height: 10
|
|
16
|
+
form.fields_text name: 'user[name]', width: 'matchParent', label: 'Name'
|
|
17
|
+
|
|
18
|
+
# form.panels_split width: 'matchParent', rightViews: ->(split) do
|
|
19
|
+
# split.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
20
|
+
# end
|
|
21
|
+
|
|
22
|
+
form.panels_split width: 'matchParent', content: ->(split) do
|
|
23
|
+
split.right childViews: ->(right) do
|
|
24
|
+
right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
json_ui_page json do |page|
|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page, top_nav: true
|
|
5
|
+
|
|
6
|
+
page.list sections: [
|
|
7
|
+
->(section) do
|
|
8
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
9
|
+
header.h2 text: 'Submission Logics'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
section.rows builder: ->(template) do
|
|
13
|
+
template.thumbnail title: 'Basic Logic', onClick: ->(action) do
|
|
14
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/basic')
|
|
15
|
+
end
|
|
16
|
+
template.thumbnail title: "Submission Flow (timestamp: #{DateTime.current.to_i})", onClick: ->(action) do
|
|
17
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/submission_flow')
|
|
18
|
+
end
|
|
19
|
+
template.thumbnail title: "Submission Indicator", onClick: ->(action) do
|
|
20
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/submission_indicator')
|
|
21
|
+
end
|
|
22
|
+
template.thumbnail title: 'GET Request', onClick: ->(action) do
|
|
23
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/get_request')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end, ->(section) do
|
|
28
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
29
|
+
header.h2 text: 'Form Logics'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
section.rows builder: ->(template) do
|
|
33
|
+
template.thumbnail title: 'Text Validation', onClick: ->(action) do
|
|
34
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/text_validation')
|
|
35
|
+
end
|
|
36
|
+
template.thumbnail title: 'Show/Hide', onClick: ->(action) do
|
|
37
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/show_hide')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
end, ->(section) do
|
|
42
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
43
|
+
header.h2 text: 'Form Fields'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
section.rows builder: ->(template) do
|
|
47
|
+
template.thumbnail title: 'Pickers', onClick: ->(action) do
|
|
48
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/pickers')
|
|
49
|
+
end
|
|
50
|
+
template.thumbnail title: 'Select Fields', onClick: ->(action) do
|
|
51
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/selects')
|
|
52
|
+
end
|
|
53
|
+
template.thumbnail title: 'File Upload', onClick: ->(action) do
|
|
54
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/file_upload')
|
|
55
|
+
end
|
|
56
|
+
template.thumbnail title: 'Floating Submit', onClick: ->(action) do
|
|
57
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/floating_submit')
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end, ->(section) do
|
|
62
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
63
|
+
header.h2 text: 'Styling'
|
|
64
|
+
end
|
|
65
|
+
section.rows builder: ->(template) do
|
|
66
|
+
template.thumbnail title: 'Text Boxes', onClick: ->(action) do
|
|
67
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/styled_boxes')
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end, ->(section) do
|
|
71
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
72
|
+
header.h2 text: 'Web Only'
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
section.rows builder: ->(template) do
|
|
76
|
+
template.thumbnail title: 'Rich Text Editor', onClick: ->(action) do
|
|
77
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/rich_text')
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
81
|
+
end, ->(section) do
|
|
82
|
+
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
83
|
+
header.h2 text: 'Experimental (not required yet)'
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
section.rows builder: ->(template) do
|
|
87
|
+
template.thumbnail title: 'Dynamic Group', onClick: ->(action) do
|
|
88
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/dynamic_group')
|
|
89
|
+
end
|
|
90
|
+
template.thumbnail title: 'Dynamic Select', onClick: ->(action) do
|
|
91
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/dynamic_select')
|
|
92
|
+
end
|
|
93
|
+
template.thumbnail title: 'Checkboxes', onClick: ->(action) do
|
|
94
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/checkboxes')
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
json_ui_page json do |page|
|
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
5
|
+
|
|
6
|
+
page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
|
7
|
+
form.h2 text: 'Radio Group'
|
|
8
|
+
form.spacer height: 6
|
|
9
|
+
form.h4 text: 'Gender'
|
|
10
|
+
form.fields_radioGroup name: 'user[gender]', value: 'F', childViews: ->(group) do
|
|
11
|
+
group.fields_radio value: '', label: 'Unknown'
|
|
12
|
+
group.fields_radio value: 'M', label: 'Male'
|
|
13
|
+
group.fields_radio value: 'F', label: 'Female'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
form.spacer height: 20
|
|
17
|
+
form.h2 text: 'Single Checkbox'
|
|
18
|
+
form.fields_check name: 'user[age_range]', value: '16+', checkValue: '16+', uncheckValue: '0-16', label: 'I am over 16 (has default value)'
|
|
19
|
+
form.fields_check name: 'user[employer]', checkValue: 1, label: 'I am an employer (no default value)'
|
|
20
|
+
form.fields_check name: 'user[enabled]', checkValue: true, label: 'Enable', styleClass: 'switch', value: 'true'
|
|
21
|
+
|
|
22
|
+
form.spacer height: 20
|
|
23
|
+
form.h2 text: 'Date/Time'
|
|
24
|
+
form.spacer height: 6
|
|
25
|
+
form.fields_date name: 'user[date]', width: 'matchParent', label: 'Date', min: '2010-01-01', max: '2012-01-01', value: '2010-02-01'
|
|
26
|
+
form.fields_datetime name: 'user[date_time]', width: 'matchParent', label: 'Date Time', min: '2018-06-09T00:00', max: '2018-06-17T00:00', value: '2018-06-15T19:30'
|
|
27
|
+
|
|
28
|
+
form.spacer height: 20
|
|
29
|
+
form.h2 text: 'Country'
|
|
30
|
+
form.spacer height: 6
|
|
31
|
+
region_field = { name: 'user[city]', label: 'City' }
|
|
32
|
+
form.fields_country name: 'user[country]', width: 'matchParent', label: 'Country', region: region_field
|
|
33
|
+
|
|
34
|
+
form.spacer height: 20
|
|
35
|
+
form.h2 text: 'Map'
|
|
36
|
+
form.spacer height: 6
|
|
37
|
+
form.fields_latLong name: 'user[address]', width: 'matchParent', label: 'Type an address', value: 'Sydney Harbour Bridge',
|
|
38
|
+
latitudeField: { name: 'user[latitude]', label: 'Lat', value: -33.8523063, readOnly: true },
|
|
39
|
+
longitudeField: { name: 'user[longitude]', label: 'Long', value: 151.21078710000006, readOnly: true }
|
|
40
|
+
|
|
41
|
+
form.spacer height: 20
|
|
42
|
+
form.fields_submit text: 'Submit'
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
end
|