glib-web 8.1.0 → 8.2.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 +4 -4
- data/app/controllers/concerns/glib/json/libs.rb +16 -0
- data/app/controllers/glib/glib_direct_uploads_controller.rb +2 -1
- data/app/helpers/glib/app_feature_support_helper.rb +33 -8
- data/app/helpers/glib/json_ui/view_builder/fields.rb +110 -9
- data/app/helpers/glib/json_ui/view_builder.rb +29 -0
- data/app/jobs/glib/scheduled_job.rb +581 -0
- data/app/jobs/glib/scheduled_job_tick.rb +21 -0
- data/app/models/glib/scheduled_job_run.rb +16 -0
- data/app/views/json_ui/garage/actions/sheet_content.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/_action_text_conversion.json.jbuilder +12 -0
- data/app/views/json_ui/garage/forms/action_text.json.jbuilder +57 -0
- data/app/views/json_ui/garage/forms/action_text_attachment.json.jbuilder +7 -0
- data/app/views/json_ui/garage/forms/action_text_conversion.json.jbuilder +5 -0
- data/app/views/json_ui/garage/forms/action_text_library.json.jbuilder +26 -0
- data/app/views/json_ui/garage/forms/action_text_mentions.json.jbuilder +4 -0
- data/app/views/json_ui/garage/forms/action_text_preview.json.jbuilder +9 -0
- data/app/views/json_ui/garage/forms/dialogs_form.json.jbuilder +10 -10
- data/app/views/json_ui/garage/forms/dirty_prompt.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/index.json.jbuilder +6 -0
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +7 -0
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +1 -1
- data/app/views/json_ui/garage/test_page/_header.json.jbuilder +6 -0
- data/app/views/json_ui/garage/test_page/charts.json.jbuilder +4 -2
- data/app/views/json_ui/garage/test_page/fields_actionText.json.jbuilder +189 -0
- data/app/views/json_ui/garage/test_page/fields_richText.json.jbuilder +45 -1
- data/app/views/json_ui/garage/test_page/fields_sign.json.jbuilder +34 -3
- data/app/views/json_ui/garage/test_page/form_dirty_fields.json.jbuilder +1 -1
- data/app/views/json_ui/garage/test_page/form_dirty_hooks.json.jbuilder +22 -0
- data/app/views/json_ui/garage/test_page/form_hidden_panels.json.jbuilder +105 -0
- data/app/views/json_ui/garage/views/charts.json.jbuilder +4 -2
- data/app/views/layouts/json_ui/renderer.html.erb +11 -1
- data/engines/blog/README.md +172 -0
- data/engines/blog/app/assets/stylesheets/glib/blog/admin.css +855 -0
- data/engines/blog/app/assets/stylesheets/glib/blog/themes/clean.css +816 -0
- data/engines/blog/app/assets/stylesheets/glib/blog/themes/editorial.css +631 -0
- data/engines/blog/app/controllers/concerns/glib/blog/admin/media_listing.rb +27 -0
- data/engines/blog/app/controllers/concerns/glib/blog/pagination.rb +14 -0
- data/engines/blog/app/controllers/glib/blog/admin/application_controller.rb +28 -0
- data/engines/blog/app/controllers/glib/blog/admin/authors_controller.rb +55 -0
- data/engines/blog/app/controllers/glib/blog/admin/categories_controller.rb +53 -0
- data/engines/blog/app/controllers/glib/blog/admin/comment_replies_controller.rb +34 -0
- data/engines/blog/app/controllers/glib/blog/admin/comments_controller.rb +50 -0
- data/engines/blog/app/controllers/glib/blog/admin/dashboards_controller.rb +34 -0
- data/engines/blog/app/controllers/glib/blog/admin/direct_uploads_controller.rb +30 -0
- data/engines/blog/app/controllers/glib/blog/admin/editor_attachments_controller.rb +16 -0
- data/engines/blog/app/controllers/glib/blog/admin/media_item_trashes_controller.rb +43 -0
- data/engines/blog/app/controllers/glib/blog/admin/media_items_controller.rb +61 -0
- data/engines/blog/app/controllers/glib/blog/admin/media_picks_controller.rb +19 -0
- data/engines/blog/app/controllers/glib/blog/admin/post_bulk_actions_controller.rb +33 -0
- data/engines/blog/app/controllers/glib/blog/admin/posts_controller.rb +79 -0
- data/engines/blog/app/controllers/glib/blog/admin/settings_controller.rb +27 -0
- data/engines/blog/app/controllers/glib/blog/admin/tags_controller.rb +46 -0
- data/engines/blog/app/controllers/glib/blog/application_controller.rb +90 -0
- data/engines/blog/app/controllers/glib/blog/authors_controller.rb +15 -0
- data/engines/blog/app/controllers/glib/blog/categories_controller.rb +15 -0
- data/engines/blog/app/controllers/glib/blog/comments_controller.rb +41 -0
- data/engines/blog/app/controllers/glib/blog/posts_controller.rb +47 -0
- data/engines/blog/app/controllers/glib/blog/tags_controller.rb +15 -0
- data/engines/blog/app/helpers/glib/blog/admin_helper.rb +57 -0
- data/engines/blog/app/helpers/glib/blog/comments_helper.rb +16 -0
- data/engines/blog/app/helpers/glib/blog/post_list_helper.rb +26 -0
- data/engines/blog/app/helpers/glib/blog/theme_helper.rb +85 -0
- data/engines/blog/app/jobs/glib/blog/purge_trash_job.rb +13 -0
- data/engines/blog/app/models/concerns/glib/blog/sluggable.rb +72 -0
- data/engines/blog/app/models/concerns/glib/blog/uses_media.rb +35 -0
- data/engines/blog/app/models/glib/blog/application_record.rb +7 -0
- data/engines/blog/app/models/glib/blog/author.rb +47 -0
- data/engines/blog/app/models/glib/blog/category.rb +53 -0
- data/engines/blog/app/models/glib/blog/comment.rb +66 -0
- data/engines/blog/app/models/glib/blog/comment_token.rb +30 -0
- data/engines/blog/app/models/glib/blog/media_item.rb +121 -0
- data/engines/blog/app/models/glib/blog/media_upload.rb +97 -0
- data/engines/blog/app/models/glib/blog/media_usage.rb +10 -0
- data/engines/blog/app/models/glib/blog/post.rb +110 -0
- data/engines/blog/app/models/glib/blog/post_view.rb +24 -0
- data/engines/blog/app/models/glib/blog/setting.rb +55 -0
- data/engines/blog/app/models/glib/blog/slug_redirect.rb +7 -0
- data/engines/blog/app/models/glib/blog/tag.rb +15 -0
- data/engines/blog/app/models/glib/blog/tagging.rb +10 -0
- data/engines/blog/app/policies/glib/blog/admin/author_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/category_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/comment_policy.rb +16 -0
- data/engines/blog/app/policies/glib/blog/admin/comment_reply_policy.rb +12 -0
- data/engines/blog/app/policies/glib/blog/admin/dashboard_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/direct_upload_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/editor_attachment_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/media_item_policy.rb +20 -0
- data/engines/blog/app/policies/glib/blog/admin/media_item_trash_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/media_pick_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/post_bulk_action_policy.rb +12 -0
- data/engines/blog/app/policies/glib/blog/admin/post_policy.rb +16 -0
- data/engines/blog/app/policies/glib/blog/admin/setting_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/admin/tag_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/application_policy.rb +16 -0
- data/engines/blog/app/policies/glib/blog/author_policy.rb +9 -0
- data/engines/blog/app/policies/glib/blog/category_policy.rb +9 -0
- data/engines/blog/app/policies/glib/blog/comment_policy.rb +11 -0
- data/engines/blog/app/policies/glib/blog/post_policy.rb +9 -0
- data/engines/blog/app/policies/glib/blog/tag_policy.rb +9 -0
- data/engines/blog/app/views/glib/blog/admin/_delete_button.json.jbuilder +24 -0
- data/engines/blog/app/views/glib/blog/admin/_nav.json.jbuilder +45 -0
- data/engines/blog/app/views/glib/blog/admin/_status_chip.json.jbuilder +2 -0
- data/engines/blog/app/views/glib/blog/admin/authors/_form.json.jbuilder +17 -0
- data/engines/blog/app/views/glib/blog/admin/authors/edit.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/authors/index.json.jbuilder +50 -0
- data/engines/blog/app/views/glib/blog/admin/authors/new.json.jbuilder +11 -0
- data/engines/blog/app/views/glib/blog/admin/categories/_form.json.jbuilder +13 -0
- data/engines/blog/app/views/glib/blog/admin/categories/edit.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/categories/index.json.jbuilder +68 -0
- data/engines/blog/app/views/glib/blog/admin/categories/new.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/comments/_moderation_buttons.json.jbuilder +35 -0
- data/engines/blog/app/views/glib/blog/admin/comments/index.json.jbuilder +59 -0
- data/engines/blog/app/views/glib/blog/admin/dashboards/show.json.jbuilder +109 -0
- data/engines/blog/app/views/glib/blog/admin/media_item_trashes/index.json.jbuilder +32 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/_rows.json.jbuilder +32 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/edit.json.jbuilder +68 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/index.json.jbuilder +68 -0
- data/engines/blog/app/views/glib/blog/admin/media_items/new.json.jbuilder +18 -0
- data/engines/blog/app/views/glib/blog/admin/media_picks/index.json.jbuilder +29 -0
- data/engines/blog/app/views/glib/blog/admin/posts/_form.json.jbuilder +104 -0
- data/engines/blog/app/views/glib/blog/admin/posts/edit.json.jbuilder +1 -0
- data/engines/blog/app/views/glib/blog/admin/posts/index.json.jbuilder +109 -0
- data/engines/blog/app/views/glib/blog/admin/posts/new.json.jbuilder +1 -0
- data/engines/blog/app/views/glib/blog/admin/settings/edit.json.jbuilder +55 -0
- data/engines/blog/app/views/glib/blog/admin/tags/_form.json.jbuilder +6 -0
- data/engines/blog/app/views/glib/blog/admin/tags/edit.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/admin/tags/index.json.jbuilder +30 -0
- data/engines/blog/app/views/glib/blog/admin/tags/new.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/authors/show.json.jbuilder +4 -0
- data/engines/blog/app/views/glib/blog/categories/show.json.jbuilder +4 -0
- data/engines/blog/app/views/glib/blog/comments/pending.json.jbuilder +7 -0
- data/engines/blog/app/views/glib/blog/media_items/_media_item.html.erb +14 -0
- data/engines/blog/app/views/glib/blog/posts/_comment.json.jbuilder +23 -0
- data/engines/blog/app/views/glib/blog/posts/_comment_form.json.jbuilder +14 -0
- data/engines/blog/app/views/glib/blog/posts/_comments.json.jbuilder +21 -0
- data/engines/blog/app/views/glib/blog/posts/index.json.jbuilder +4 -0
- data/engines/blog/app/views/glib/blog/posts/show.json.jbuilder +5 -0
- data/engines/blog/app/views/glib/blog/shared/errors.json.jbuilder +5 -0
- data/engines/blog/app/views/glib/blog/tags/show.json.jbuilder +3 -0
- data/engines/blog/app/views/glib/blog/themes/_nav_links.json.jbuilder +12 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_brand.json.jbuilder +11 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_card.json.jbuilder +15 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_featured.json.jbuilder +23 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_footer.json.jbuilder +15 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_header.json.jbuilder +9 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_post.json.jbuilder +98 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_post_list.json.jbuilder +40 -0
- data/engines/blog/app/views/glib/blog/themes/clean/_post_rows.json.jbuilder +10 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_footer.json.jbuilder +15 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_header.json.jbuilder +11 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_post.json.jbuilder +62 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_post_list.json.jbuilder +25 -0
- data/engines/blog/app/views/glib/blog/themes/editorial/_post_rows.json.jbuilder +18 -0
- data/engines/blog/config/locales/en.yml +500 -0
- data/engines/blog/config/routes.rb +33 -0
- data/engines/blog/db/migrate/20261103090000_create_glib_blog_tables.rb +70 -0
- data/engines/blog/db/migrate/20261104090000_create_glib_blog_media_tables.rb +44 -0
- data/engines/blog/db/migrate/20261104120000_create_glib_blog_comments.rb +23 -0
- data/engines/blog/db/migrate/20261105090000_add_glib_blog_comment_moderation.rb +16 -0
- data/engines/blog/db/migrate/20261105100000_add_deleted_at_to_glib_blog_posts.rb +6 -0
- data/engines/blog/db/migrate/20261105110000_add_parent_and_default_to_glib_blog_categories.rb +10 -0
- data/engines/blog/db/migrate/20261105120000_create_glib_blog_post_views.rb +13 -0
- data/engines/blog/db/migrate/20261105130000_create_glib_blog_settings.rb +26 -0
- data/engines/blog/db/migrate/20261106090000_add_theme_to_glib_blog_settings.rb +7 -0
- data/engines/blog/lib/tasks/glib_blog_tasks.rake +32 -0
- data/lib/generators/glib/blog/install_generator.rb +44 -0
- data/lib/generators/glib/blog/templates/initializer.rb +22 -0
- data/lib/generators/glib/scheduled_jobs_generator.rb +30 -0
- data/lib/generators/templates/scheduled_jobs/create_glib_scheduled_job_runs.rb +22 -0
- data/lib/glib/blog/engine.rb +20 -0
- data/lib/glib/blog/theme.rb +35 -0
- data/lib/glib/blog.rb +50 -0
- data/lib/glib/engine.rb +17 -0
- data/lib/glib/scheduled_jobs/config.rb +36 -0
- data/lib/glib/scheduled_jobs/loader.rb +98 -0
- data/lib/glib-web.rb +2 -0
- metadata +177 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
|
|
3
|
+
page = json_ui_page json
|
|
4
|
+
|
|
5
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
6
|
+
|
|
7
|
+
initial_content = <<~HTML
|
|
8
|
+
<h1>Action Text</h1>
|
|
9
|
+
<div>This editor submits the same HTML as Rails' <strong>Action Text</strong> form helper, so it can be assigned straight to a has_rich_text attribute.</div>
|
|
10
|
+
<ul><li>Attach or paste a file to upload it.</li><li>Submit to see the rendered content.</li></ul>
|
|
11
|
+
HTML
|
|
12
|
+
|
|
13
|
+
page.form url: json_ui_garage_url(path: 'forms/action_text_preview'), method: 'post', padding: { top: 20, bottom: 20 }, childViews: ->(form) do
|
|
14
|
+
form.panels_column lg: { cols: 6 }, padding: { left: 10, right: 10 }, childViews: ->(column) do
|
|
15
|
+
column.fields_actionText \
|
|
16
|
+
width: 'matchParent',
|
|
17
|
+
label: 'Content',
|
|
18
|
+
name: 'post[content]',
|
|
19
|
+
value: initial_content,
|
|
20
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
21
|
+
blobUrlGenerator: glib_blob_url_generators_url,
|
|
22
|
+
accepts: { fileType: ['image', 'pdf'], maxFileSize: 5000 }
|
|
23
|
+
|
|
24
|
+
column.spacer height: 16
|
|
25
|
+
column.fields_actionText \
|
|
26
|
+
width: 'matchParent',
|
|
27
|
+
label: 'Comment (type @ to mention someone)',
|
|
28
|
+
name: 'post[comment]',
|
|
29
|
+
mentionList: User.all.map { |user| { sgid: user.attachable_sgid, value: user.full_name } }
|
|
30
|
+
|
|
31
|
+
column.spacer height: 16
|
|
32
|
+
column.fields_actionText \
|
|
33
|
+
width: 'matchParent',
|
|
34
|
+
label: 'Reply (mentions searched on the server)',
|
|
35
|
+
name: 'post[reply]',
|
|
36
|
+
mentionUrl: json_ui_garage_url(path: 'forms/action_text_mentions', format: 'json')
|
|
37
|
+
|
|
38
|
+
column.spacer height: 16
|
|
39
|
+
column.fields_actionText \
|
|
40
|
+
width: 'matchParent',
|
|
41
|
+
label: 'Chat-style: no toolbar',
|
|
42
|
+
name: 'post[chat]',
|
|
43
|
+
placeholder: 'Write a message',
|
|
44
|
+
hideToolbar: true,
|
|
45
|
+
mentionUrl: json_ui_garage_url(path: 'forms/action_text_mentions', format: 'json')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
form.panels_column lg: { cols: 6 }, padding: { left: 10, right: 10 }, childViews: ->(column) do
|
|
49
|
+
column.panels_vertical id: 'preview', childViews: ->(inner) do
|
|
50
|
+
inner.actionText richText: ActionText::Content.new(initial_content)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
form.panels_column lg: { cols: 12 }, padding: { top: 10, left: 10, right: 10 }, childViews: ->(column) do
|
|
55
|
+
column.fields_submit text: 'Submit'
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Stands in for an app's attachment endpoint (`fields_actionText attachmentUrl:`): an app would
|
|
2
|
+
# turn the uploaded blob into its own Action Text attachable and answer with its attributes.
|
|
3
|
+
json.sgid "garage-attachment-#{params[:signed_id]}"
|
|
4
|
+
json.url 'https://picsum.photos/id/10/300/200'
|
|
5
|
+
json.contentType 'image/jpeg'
|
|
6
|
+
json.filename 'from-attachment-url.jpg'
|
|
7
|
+
json.previewable true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
json.title 'Insert from library'
|
|
2
|
+
|
|
3
|
+
page = json_ui_page json
|
|
4
|
+
|
|
5
|
+
library = [
|
|
6
|
+
{ sgid: 'garage-library-1', url: 'https://picsum.photos/id/20/300/200', filename: 'desk.jpg' },
|
|
7
|
+
{ sgid: 'garage-library-2', url: 'https://picsum.photos/id/30/300/200', filename: 'mug.jpg' }
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
page.body childViews: ->(body) do
|
|
11
|
+
body.panels_list width: 'matchParent', firstSection: ->(section) do
|
|
12
|
+
section.rows builder: ->(template) do
|
|
13
|
+
library.each do |file|
|
|
14
|
+
template.thumbnail title: file[:filename], imageUrl: file[:url], onClick: ->(action) do
|
|
15
|
+
action.runMultiple childActions: ->(multiple) do
|
|
16
|
+
multiple.components_invoke \
|
|
17
|
+
targetId: params[:target],
|
|
18
|
+
name: 'insertAttachment',
|
|
19
|
+
arguments: file.merge(contentType: 'image/jpeg', previewable: true)
|
|
20
|
+
multiple.dialogs_close
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
content = params.dig(:post, :content).to_s
|
|
2
|
+
|
|
3
|
+
json_ui_response json do |action|
|
|
4
|
+
action.components_replace targetId: 'preview', newView: ->(update) do
|
|
5
|
+
update.panels_vertical childViews: ->(vertical) do
|
|
6
|
+
vertical.actionText richText: ActionText::Content.new(content)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -34,17 +34,17 @@ page.scroll childViews: ->(scroll) do
|
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
form.
|
|
37
|
+
form.fields_actionText \
|
|
38
38
|
name: 'user[description]',
|
|
39
|
-
value:
|
|
40
|
-
This note serves as a reminder regarding the checklist assigned to you. This checklist is crucial for ensuring the safety and well-being of all staff
|
|
41
|
-
|
|
42
|
-
Please review the checklist carefully and ensure that all necessary steps are taken to implement the required safety measures
|
|
43
|
-
|
|
44
|
-
Your attention to detail and proactive approach to safety are greatly appreciated. If you have any questions or require assistance, please don't hesitate to reach out
|
|
45
|
-
|
|
46
|
-
Thank you for your cooperation
|
|
47
|
-
|
|
39
|
+
value: <<~HTML
|
|
40
|
+
<div>This note serves as a reminder regarding the checklist assigned to you. This checklist is crucial for ensuring the safety and well-being of all staff.</div>
|
|
41
|
+
<div><br></div>
|
|
42
|
+
<div>Please review the checklist carefully and ensure that all necessary steps are taken to implement the required safety measures.</div>
|
|
43
|
+
<div><br></div>
|
|
44
|
+
<div>Your attention to detail and proactive approach to safety are greatly appreciated. If you have any questions or require assistance, please don't hesitate to reach out.</div>
|
|
45
|
+
<div><br></div>
|
|
46
|
+
<div>Thank you for your cooperation.</div>
|
|
47
|
+
HTML
|
|
48
48
|
|
|
49
49
|
form.spacer height: 20
|
|
50
50
|
form.button text: 'Submit', onClick: ->(action) { action.forms_submit }
|
|
@@ -55,7 +55,7 @@ page.form \
|
|
|
55
55
|
form.fields_check name: 'user[check][]', checkValue: 'choice2', label: 'choice3', value: 'choice2'
|
|
56
56
|
|
|
57
57
|
form.h3 text: 'Rich text'
|
|
58
|
-
form.
|
|
58
|
+
form.fields_actionText name: 'user[richtext]', value: '<div>Lorem ipsum dumet...</div>'
|
|
59
59
|
|
|
60
60
|
form.spacer height: 24
|
|
61
61
|
form.panels_split width: 'matchParent', content: ->(split) do
|
|
@@ -35,7 +35,7 @@ page.form url: json_ui_garage_url(path: 'forms/generic_post'), method: 'post', p
|
|
|
35
35
|
template.spacer height: 10
|
|
36
36
|
template.fields_hidden name: 'message[error]'
|
|
37
37
|
template.fields_text width: 'matchParent', name: 'question', label: 'Question', placeholder: 'Question'
|
|
38
|
-
template.
|
|
38
|
+
template.fields_actionText width: 'matchParent', name: 'description', label: 'Desc', placeholder: 'Desc'
|
|
39
39
|
|
|
40
40
|
template.panels_responsive id: 'responsive_{{entryIndex}}', childViews: ->(column) do
|
|
41
41
|
column.panels_split width: 'matchParent', content: ->(split) do
|
|
@@ -121,6 +121,12 @@ page.list sections: [
|
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
end
|
|
124
|
+
|
|
125
|
+
section.rows builder: ->(template) do
|
|
126
|
+
template.thumbnail title: 'Action Text Editor', onClick: ->(action) do
|
|
127
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/action_text')
|
|
128
|
+
end
|
|
129
|
+
end
|
|
124
130
|
end, ->(section) do
|
|
125
131
|
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
|
126
132
|
header.h2 text: 'Experimental (not required yet)'
|
|
@@ -69,6 +69,13 @@ page.form \
|
|
|
69
69
|
max: '2018-06-17T00:00',
|
|
70
70
|
value: '2025-01-26T13:49:00.000+05:00',
|
|
71
71
|
time_zone: 'Asia/Taipei' # +8
|
|
72
|
+
form.fields_datetime \
|
|
73
|
+
name: 'user[date_time]',
|
|
74
|
+
width: 'matchParent',
|
|
75
|
+
label: 'Date Time (offset only)',
|
|
76
|
+
min: '2018-06-09T00:00',
|
|
77
|
+
max: '2018-06-17T00:00',
|
|
78
|
+
value: '2025-01-26T13:49:00.000+05:00' # no time_zone: the device-zone fallback
|
|
72
79
|
form.fields_date \
|
|
73
80
|
name: 'user[month]',
|
|
74
81
|
width: 'matchParent',
|
|
@@ -437,7 +437,7 @@ page.form \
|
|
|
437
437
|
id: 'panel2',
|
|
438
438
|
width: 'matchParent',
|
|
439
439
|
childViews: ->(res) do
|
|
440
|
-
res.
|
|
440
|
+
res.fields_actionText name: 'user[loadIf_target4]', width: 'matchParent', value: '<div>Value 3</div>'
|
|
441
441
|
res.spacer height: 4
|
|
442
442
|
res.fields_radioGroup name: 'user[loadIf_target5]', width: 'matchParent', value: 'choice_1', childViews: ->(group) do
|
|
443
443
|
group.fields_radio label: 'Choice 1', value: 'choice_1'
|
|
@@ -22,6 +22,11 @@ nav_groups = {
|
|
|
22
22
|
'Forms' => [
|
|
23
23
|
'auto_validate',
|
|
24
24
|
'dirty_state',
|
|
25
|
+
'form_dirty_hooks',
|
|
26
|
+
'form_dirty_fields',
|
|
27
|
+
'form_dynamic_dirty',
|
|
28
|
+
'form_removed_field',
|
|
29
|
+
'form_removed_field_onload',
|
|
25
30
|
'fields_text',
|
|
26
31
|
'fields_select',
|
|
27
32
|
'fields_dynamicSelect',
|
|
@@ -32,6 +37,7 @@ nav_groups = {
|
|
|
32
37
|
'fields_radio',
|
|
33
38
|
'fields_rating',
|
|
34
39
|
'fields_richText',
|
|
40
|
+
'fields_actionText',
|
|
35
41
|
'fields_sign',
|
|
36
42
|
'fields_stripeToken',
|
|
37
43
|
'fields_stripeExternalAccount',
|
|
@@ -2,7 +2,6 @@ json.title 'Test Page (Charts)'
|
|
|
2
2
|
|
|
3
3
|
default_plugins = {
|
|
4
4
|
datalabels: {
|
|
5
|
-
backgroundColor: 'skyblue',
|
|
6
5
|
borderRadius: 4,
|
|
7
6
|
color: 'white',
|
|
8
7
|
font: {
|
|
@@ -12,6 +11,9 @@ default_plugins = {
|
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
|
|
14
|
+
custom_plugins = default_plugins.deep_dup
|
|
15
|
+
custom_plugins[:datalabels][:backgroundColor] = ['#1E5006', '#E36414']
|
|
16
|
+
|
|
15
17
|
line_series_revenue = [
|
|
16
18
|
-> do
|
|
17
19
|
json.title 'Revenue'
|
|
@@ -158,7 +160,7 @@ page.body childViews: ->(body) do
|
|
|
158
160
|
res.spacer height: 8
|
|
159
161
|
res.charts_line(
|
|
160
162
|
dataSeries: line_series_revenue,
|
|
161
|
-
plugins:
|
|
163
|
+
plugins: custom_plugins,
|
|
162
164
|
colors: ['#79AC78', '#3085C3'],
|
|
163
165
|
legend: { display: false },
|
|
164
166
|
formatYAxis: true
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
json.title 'Test Page (Fields ActionText)'
|
|
2
|
+
|
|
3
|
+
page = json_ui_page json
|
|
4
|
+
|
|
5
|
+
render 'json_ui/garage/test_page/header', json: json, page: page
|
|
6
|
+
|
|
7
|
+
# User includes ActionText::Attachable, so `has_rich_text` resolves each submitted sgid back to
|
|
8
|
+
# its User. Users have no avatar column; a placeholder seeded by id stands in for one.
|
|
9
|
+
user_mentions = User.all.map do |user|
|
|
10
|
+
{
|
|
11
|
+
sgid: user.attachable_sgid,
|
|
12
|
+
value: user.full_name,
|
|
13
|
+
group: user.admin? ? 'Admins' : 'Members',
|
|
14
|
+
avatar: "https://picsum.photos/seed/user-#{user.id}/80/80"
|
|
15
|
+
}
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
page.body(
|
|
19
|
+
childViews: ->(body) do
|
|
20
|
+
body.panels_responsive(
|
|
21
|
+
padding: glib_json_padding_body,
|
|
22
|
+
childViews: ->(res) do
|
|
23
|
+
res.h2 text: 'Fields ActionText'
|
|
24
|
+
res.spacer height: 8
|
|
25
|
+
res.label text: 'Trix editor that submits Action Text HTML, with direct-uploaded attachments.'
|
|
26
|
+
res.spacer height: 12
|
|
27
|
+
|
|
28
|
+
res.panels_form(
|
|
29
|
+
url: json_ui_garage_url(path: 'forms/action_text_preview'),
|
|
30
|
+
method: 'post',
|
|
31
|
+
childViews: ->(form) do
|
|
32
|
+
form.fields_actionText(
|
|
33
|
+
id: 'action_text_main',
|
|
34
|
+
width: 'matchParent',
|
|
35
|
+
label: 'Content',
|
|
36
|
+
name: 'post[content]',
|
|
37
|
+
value: '<div>Initial <strong>content</strong>.</div>',
|
|
38
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
39
|
+
blobUrlGenerator: glib_blob_url_generators_url,
|
|
40
|
+
accepts: { fileType: ['image'], maxFileSize: 5000 },
|
|
41
|
+
onChange: ->(action) do
|
|
42
|
+
action.logics_set targetId: 'action_text_status', data: { text: 'Status: content changed' }
|
|
43
|
+
end
|
|
44
|
+
)
|
|
45
|
+
form.spacer height: 8
|
|
46
|
+
form.label id: 'action_text_status', text: 'Status: idle'
|
|
47
|
+
|
|
48
|
+
form.spacer height: 12
|
|
49
|
+
form.h2 text: 'App attachments and library'
|
|
50
|
+
form.spacer height: 8
|
|
51
|
+
form.fields_actionText(
|
|
52
|
+
id: 'action_text_library',
|
|
53
|
+
width: 'matchParent',
|
|
54
|
+
label: 'Story',
|
|
55
|
+
name: 'post[story]',
|
|
56
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
57
|
+
attachmentUrl: json_ui_garage_url(path: 'forms/action_text_attachment'),
|
|
58
|
+
libraryUrl: json_ui_garage_url(path: 'forms/action_text_library', target: 'action_text_library'),
|
|
59
|
+
accepts: { fileType: ['image'], maxFileSize: 5000 }
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
form.spacer height: 12
|
|
63
|
+
form.h2 text: 'Without uploads'
|
|
64
|
+
form.spacer height: 8
|
|
65
|
+
form.fields_actionText(
|
|
66
|
+
id: 'action_text_no_upload',
|
|
67
|
+
width: 'matchParent',
|
|
68
|
+
label: 'Notes',
|
|
69
|
+
name: 'post[notes]'
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
form.spacer height: 12
|
|
73
|
+
form.h2 text: 'Read only'
|
|
74
|
+
form.spacer height: 8
|
|
75
|
+
form.fields_actionText(
|
|
76
|
+
id: 'action_text_read_only',
|
|
77
|
+
width: 'matchParent',
|
|
78
|
+
label: 'Locked',
|
|
79
|
+
name: 'post[locked]',
|
|
80
|
+
value: '<div>Cannot be edited.</div>',
|
|
81
|
+
readOnly: true,
|
|
82
|
+
mentionList: user_mentions
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
form.spacer height: 12
|
|
86
|
+
form.h2 text: 'Mentions'
|
|
87
|
+
form.spacer height: 8
|
|
88
|
+
form.fields_actionText(
|
|
89
|
+
id: 'action_text_mentions',
|
|
90
|
+
width: 'matchParent',
|
|
91
|
+
label: 'Comment',
|
|
92
|
+
name: 'post[comment]',
|
|
93
|
+
mentionList: user_mentions + [
|
|
94
|
+
# Not a record: checks that a name with markup is inserted as text.
|
|
95
|
+
{ sgid: 'garage-markup', value: '<b>Grace</b>', text: 'Grace Hopper', group: 'Members' },
|
|
96
|
+
{ value: 'everyone', text: 'Everyone', group: 'Members' }
|
|
97
|
+
]
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
form.spacer height: 12
|
|
101
|
+
form.h2 text: 'Mentions from a search endpoint'
|
|
102
|
+
form.spacer height: 8
|
|
103
|
+
form.fields_actionText(
|
|
104
|
+
id: 'action_text_mention_search',
|
|
105
|
+
width: 'matchParent',
|
|
106
|
+
label: 'Reply',
|
|
107
|
+
name: 'post[reply]',
|
|
108
|
+
mentionUrl: json_ui_garage_url(path: 'forms/action_text_mentions', format: 'json')
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
form.spacer height: 12
|
|
112
|
+
form.fields_submit text: 'Submit'
|
|
113
|
+
end
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
res.spacer height: 12
|
|
117
|
+
res.h2 text: 'Rendered'
|
|
118
|
+
res.spacer height: 8
|
|
119
|
+
res.panels_vertical id: 'preview', childViews: ->(vertical) do
|
|
120
|
+
vertical.actionText richText: ActionText::Content.new('<div>Initial <strong>content</strong>.</div>')
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
res.spacer height: 12
|
|
124
|
+
res.hr width: 'matchParent'
|
|
125
|
+
res.spacer height: 12
|
|
126
|
+
|
|
127
|
+
stored_markdown = <<~MARKDOWN
|
|
128
|
+
# Release notes
|
|
129
|
+
This is a **message** with *emphasis* and a [link](https://example.com).
|
|
130
|
+
|
|
131
|
+
- Bullet one
|
|
132
|
+
- Bullet two
|
|
133
|
+
|
|
134
|
+
> Quoted text
|
|
135
|
+
MARKDOWN
|
|
136
|
+
|
|
137
|
+
res.h2 text: 'Markdown and HTML output'
|
|
138
|
+
res.spacer height: 8
|
|
139
|
+
res.p text: "Replaces fields_richText's produce/accept. The field only speaks HTML, so the server converts: " \
|
|
140
|
+
'stored Markdown becomes the HTML value, and the submitted HTML becomes Markdown.'
|
|
141
|
+
res.spacer height: 8
|
|
142
|
+
res.h3 text: 'Stored Markdown (input)'
|
|
143
|
+
res.markdown text: "```markdown\n#{stored_markdown.strip}\n```"
|
|
144
|
+
res.spacer height: 8
|
|
145
|
+
res.panels_form(
|
|
146
|
+
width: 'matchParent',
|
|
147
|
+
url: json_ui_garage_url(path: 'forms/action_text_conversion'),
|
|
148
|
+
method: 'post',
|
|
149
|
+
childViews: ->(form) do
|
|
150
|
+
form.fields_actionText(
|
|
151
|
+
id: 'action_text_markdown',
|
|
152
|
+
width: 'matchParent',
|
|
153
|
+
label: 'Value converted from Markdown on the server',
|
|
154
|
+
name: 'post[body]',
|
|
155
|
+
value: glib_format_markdown(stored_markdown)
|
|
156
|
+
)
|
|
157
|
+
form.spacer height: 8
|
|
158
|
+
form.fields_submit text: 'Convert output'
|
|
159
|
+
end
|
|
160
|
+
)
|
|
161
|
+
res.spacer height: 8
|
|
162
|
+
res.panels_vertical id: 'action_text_conversion', width: 'matchParent', childViews: ->(panel) do
|
|
163
|
+
panel.label text: 'Submit to see the HTML the field produces and its Markdown conversion.'
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
res.spacer height: 12
|
|
167
|
+
res.h2 text: 'Chat input'
|
|
168
|
+
res.spacer height: 8
|
|
169
|
+
res.label text: 'No toolbar, mentions, Enter sends and Shift+Enter adds a line.'
|
|
170
|
+
res.spacer height: 8
|
|
171
|
+
res.panels_form(
|
|
172
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
|
173
|
+
method: 'post',
|
|
174
|
+
childViews: ->(form) do
|
|
175
|
+
form.fields_actionText(
|
|
176
|
+
id: 'action_text_chat',
|
|
177
|
+
width: 'matchParent',
|
|
178
|
+
name: 'user[message]',
|
|
179
|
+
placeholder: 'Write a message',
|
|
180
|
+
hideToolbar: true,
|
|
181
|
+
submitOnEnter: true,
|
|
182
|
+
mentionList: user_mentions
|
|
183
|
+
)
|
|
184
|
+
end
|
|
185
|
+
)
|
|
186
|
+
end
|
|
187
|
+
)
|
|
188
|
+
end
|
|
189
|
+
)
|
|
@@ -12,7 +12,7 @@ page.body(
|
|
|
12
12
|
childViews: ->(res) do
|
|
13
13
|
res.h2 text: 'Fields RichText'
|
|
14
14
|
res.spacer height: 8
|
|
15
|
-
res.label text: 'WYSIWYG editor with markdown or HTML output, mentions, and image uploads.'
|
|
15
|
+
res.label text: 'Deprecated: use fields_actionText (see doc/rich_text_migration.md). WYSIWYG editor with markdown or HTML output, mentions, and image uploads.'
|
|
16
16
|
res.spacer height: 12
|
|
17
17
|
|
|
18
18
|
res.panels_form(
|
|
@@ -208,6 +208,50 @@ Try @mentioning a teammate here.
|
|
|
208
208
|
)
|
|
209
209
|
end
|
|
210
210
|
)
|
|
211
|
+
|
|
212
|
+
res.spacer height: 12
|
|
213
|
+
res.hr width: 'matchParent'
|
|
214
|
+
res.spacer height: 12
|
|
215
|
+
|
|
216
|
+
# An editor replaced in place by new content at the same position: the replacement's
|
|
217
|
+
# value must show, not the old value or old typing. A form of its own, so its dirty
|
|
218
|
+
# state is observable: `swap_ever_dirty` never resets, so a transient blip shows too.
|
|
219
|
+
res.h2 text: 'Replaced in place'
|
|
220
|
+
res.spacer height: 8
|
|
221
|
+
res.label id: 'swap_dirty_state', text: 'Form: pristine'
|
|
222
|
+
res.label id: 'swap_ever_dirty', text: 'Ever dirty: no'
|
|
223
|
+
res.spacer height: 8
|
|
224
|
+
res.panels_form(
|
|
225
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
|
226
|
+
method: 'post',
|
|
227
|
+
onDirty: ->(action) do
|
|
228
|
+
action.runMultiple childActions: ->(multiple) do
|
|
229
|
+
multiple.logics_set targetId: 'swap_dirty_state', data: { text: 'Form: dirty' }
|
|
230
|
+
multiple.logics_set targetId: 'swap_ever_dirty', data: { text: 'Ever dirty: yes' }
|
|
231
|
+
end
|
|
232
|
+
end,
|
|
233
|
+
onPristine: ->(action) do
|
|
234
|
+
action.logics_set targetId: 'swap_dirty_state', data: { text: 'Form: pristine' }
|
|
235
|
+
end,
|
|
236
|
+
childViews: ->(form) do
|
|
237
|
+
form.panels_vertical width: 'matchParent', id: 'rich_text_swap_panel', childViews: ->(panel) do
|
|
238
|
+
panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'Before swap',
|
|
239
|
+
placeholder: 'Before placeholder', mentionList: ['Alice Before']
|
|
240
|
+
end
|
|
241
|
+
form.button text: 'Swap to new value', onClick: ->(action) do
|
|
242
|
+
action.components_replaceChildren targetId: 'rich_text_swap_panel', childViews: ->(panel) do
|
|
243
|
+
panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'After swap',
|
|
244
|
+
placeholder: 'After placeholder', mentionList: ['Bob After']
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
form.button text: 'Swap to same value', onClick: ->(action) do
|
|
248
|
+
action.components_replaceChildren targetId: 'rich_text_swap_panel', childViews: ->(panel) do
|
|
249
|
+
panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'Before swap',
|
|
250
|
+
placeholder: 'Before placeholder', mentionList: ['Alice Before']
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
)
|
|
211
255
|
end
|
|
212
256
|
)
|
|
213
257
|
end
|
|
@@ -182,7 +182,7 @@ page.body(
|
|
|
182
182
|
|
|
183
183
|
form.h2 text: 'Offered saved signature'
|
|
184
184
|
form.spacer height: 8
|
|
185
|
-
form.label text: 'onClick composes a menu on the empty box (popovers_show at the pointer): use the kept signature (
|
|
185
|
+
form.label text: 'onClick composes a menu on the empty box (popovers_show at the pointer): use the kept signature (components_invoke action_setSignature) or open the dialog (components_invoke action_open); draw.saveOption asks whether a fresh drawing should be saved.'
|
|
186
186
|
form.spacer height: 8
|
|
187
187
|
form.fields_sign(
|
|
188
188
|
id: 'signature_offered',
|
|
@@ -200,7 +200,7 @@ page.body(
|
|
|
200
200
|
row.label text: 'Use my saved signature'
|
|
201
201
|
end, onClick: ->(sub) do
|
|
202
202
|
sub.runMultiple childActions: ->(m) do
|
|
203
|
-
m.
|
|
203
|
+
m.components_invoke targetId: 'signature_offered', name: 'action_setSignature', arguments: { value: 'saved-signed-id', fileUrl: preview_data_uri }
|
|
204
204
|
m.popovers_close key: 'menu'
|
|
205
205
|
end
|
|
206
206
|
end
|
|
@@ -221,7 +221,6 @@ page.body(
|
|
|
221
221
|
hint: 'Draw it once. We keep it for next time.',
|
|
222
222
|
placeholder: 'Sign inside the box',
|
|
223
223
|
confirmedHint: 'Keep it, or clear it and sign again.',
|
|
224
|
-
savedSignature: { value: 'saved-signed-id', fileUrl: preview_data_uri },
|
|
225
224
|
saveOption: {
|
|
226
225
|
name: 'user[save_signature_offered]',
|
|
227
226
|
label: 'Save this signature for next time',
|
|
@@ -254,6 +253,38 @@ page.body(
|
|
|
254
253
|
form.hr width: 'matchParent'
|
|
255
254
|
form.spacer height: 12
|
|
256
255
|
|
|
256
|
+
form.h2 text: 'Externally offered saved signature'
|
|
257
|
+
form.spacer height: 8
|
|
258
|
+
form.label text: 'Optional draw.savedSignature: a logics_set write of that id previews its image on the box with no dialog and no upload (distinct from the action, which takes its signature as arguments).'
|
|
259
|
+
form.spacer height: 8
|
|
260
|
+
form.fields_sign(
|
|
261
|
+
id: 'signature_external',
|
|
262
|
+
name: 'user[signature_external]',
|
|
263
|
+
directUploadUrl: glib_direct_uploads_url,
|
|
264
|
+
width: 320,
|
|
265
|
+
height: 160,
|
|
266
|
+
draw: {
|
|
267
|
+
savedSignature: { value: 'external-saved-id', fileUrl: preview_data_uri }
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
form.spacer height: 8
|
|
271
|
+
form.panels_flow(
|
|
272
|
+
innerPadding: { bottom: 0 },
|
|
273
|
+
width: 'matchParent',
|
|
274
|
+
childViews: ->(flow) do
|
|
275
|
+
flow.button(
|
|
276
|
+
text: 'Fill external saved signature',
|
|
277
|
+
onClick: ->(action) do
|
|
278
|
+
action.logics_set targetId: 'signature_external', data: { value: 'external-saved-id' }
|
|
279
|
+
end
|
|
280
|
+
)
|
|
281
|
+
end
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
form.spacer height: 12
|
|
285
|
+
form.hr width: 'matchParent'
|
|
286
|
+
form.spacer height: 12
|
|
287
|
+
|
|
257
288
|
form.h2 text: 'Hints on a blank canvas'
|
|
258
289
|
form.spacer height: 8
|
|
259
290
|
form.fields_sign(
|
|
@@ -140,7 +140,7 @@ page.body childViews: ->(body) do
|
|
|
140
140
|
multiProgressView: { files: [{ name: 'cover.png', signed_id: 'saved-cover', url: 'https://picsum.photos/id/12/100/60' }] }
|
|
141
141
|
form.spacer height: 14
|
|
142
142
|
|
|
143
|
-
form.
|
|
143
|
+
form.fields_actionText id: 'dirty_rich_text', name: 'user[bio]', width: 'matchParent', label: 'Bio', value: '<div>hello</div>'
|
|
144
144
|
form.spacer height: 14
|
|
145
145
|
|
|
146
146
|
# Populated from the URL hash at mount; must be absorbed into the
|
|
@@ -4,6 +4,10 @@ page = json_ui_page json
|
|
|
4
4
|
|
|
5
5
|
render 'json_ui/garage/test_page/header', json: json, page: page
|
|
6
6
|
|
|
7
|
+
# 60x20 ink stand-in for the sign field's offered saved signature (the same
|
|
8
|
+
# fixture image the fields_sign page uses).
|
|
9
|
+
dirty_hooks_signature_uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAUCAYAAADRA14pAAAAoklEQVR4nO2XUQrAIAxDcwjvf9WNfQzG1NFqUt1mwL8a8hBtxfYzYXSAaC1glVJK2RohOXAJdCS4FNgCGw0tA7YAjQCXAHsBoqAPbzpwa3A19OkLpjkjsAL66gmWOTOo0gtvOJXe/VcP9JpH3DvmewBLkdeUKfaLD09xqSaid7bkqilrS57pKHJCYmWq9uFZQD2ZLLkeB49ZQO/qybX+w1/XDujJvn2bufeCAAAAAElFTkSuQmCC'
|
|
10
|
+
|
|
7
11
|
page.body childViews: ->(body) do
|
|
8
12
|
body.panels_form \
|
|
9
13
|
padding: glib_json_padding_body,
|
|
@@ -37,6 +41,24 @@ page.body childViews: ->(body) do
|
|
|
37
41
|
multiProgressView: { files: [] }
|
|
38
42
|
form.spacer height: 14
|
|
39
43
|
|
|
44
|
+
# The sign field's saved-signature action: applying an offered
|
|
45
|
+
# signature (components_invoke action_setSignature) is a user
|
|
46
|
+
# gesture, so it must turn the form dirty and enable the submit -- a
|
|
47
|
+
# logics_set fill of the same id would not (deliberate non-trigger).
|
|
48
|
+
# The signature comes in as action arguments; the field carries no
|
|
49
|
+
# saved signature of its own.
|
|
50
|
+
form.fields_sign \
|
|
51
|
+
name: 'user[saved_signature]',
|
|
52
|
+
id: 'dirty_hooks_sign',
|
|
53
|
+
width: 320,
|
|
54
|
+
height: 160,
|
|
55
|
+
directUploadUrl: glib_direct_uploads_url
|
|
56
|
+
form.spacer height: 8
|
|
57
|
+
form.button text: 'Use saved signature', onClick: ->(action) do
|
|
58
|
+
action.components_invoke targetId: 'dirty_hooks_sign', name: 'action_setSignature', arguments: { value: 'saved-signed-id', fileUrl: dirty_hooks_signature_uri }
|
|
59
|
+
end
|
|
60
|
+
form.spacer height: 14
|
|
61
|
+
|
|
40
62
|
form.fields_submit id: 'dirty_hooks_submit', text: 'Save'
|
|
41
63
|
end
|
|
42
64
|
end
|