glib-web 8.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34303dceef76e44cc3f0530801993cedc604363504387a232bba9d7da04bd504
4
- data.tar.gz: 772a21344d981cf98557d4dc9685dc437ce26265c2191e1b38d7c9462d280f23
3
+ metadata.gz: 5d088ec6d58820618a3aa36589e438d615e44200e7a0376eddedac20a721d89b
4
+ data.tar.gz: 982bb5e1cefe4f064f95e7c8a8407c0a5fa9562bd205610a7e1a04d29fe64810
5
5
  SHA512:
6
- metadata.gz: d6c73b777a6b8b63e09477dfa73b1370665c875b89217fc858a4eb071f19e7a74e74a6898ea3cd31d4803675308c72be0653a665e418a76fcd43090cbaf2874b
7
- data.tar.gz: 2eb45d0ea0806f6f1a3eacfe7b0d12160a3f5e28d3eccf180cc73b8371fb6ce2ba26e31c0621e3548ec4ac63b64ff706a85de0b9a589ecfebb31e836734d8520
6
+ metadata.gz: 569d870e43d67adccbad29c44293d82fe6a0fd77c4d824e395b7a63d2817a605617a2c64cad62814363cf983f7121ea9c3bf9101231fcffda067c459a62efe50
7
+ data.tar.gz: b51321994361436a14f3bcc646d4c1aa46f126d345e31e2fd9aec5d945271c92fe7fed8e8443bc2b40ccf9a06574b20a6e9b7a42ba1ffe86b324ee6e72f018ab
@@ -27,7 +27,8 @@ module Glib
27
27
  blob.assign_attributes(**blob_args.except(:tagging, :prefix))
28
28
  blob.save!
29
29
 
30
- if blob.service.instance_of?(::ActiveStorage::Service::GlibS3Service)
30
+ # GlibS3Service is only loaded when an app configures it, so referencing the constant breaks Disk-backed apps.
31
+ if blob.service.respond_to?(:tagging=)
31
32
  blob.service.tagging = blob_args[:tagging]
32
33
  end
33
34
 
@@ -609,6 +609,10 @@ class Glib::JsonUi::ViewBuilder
609
609
 
610
610
  # Rich text editor field with WYSIWYG editing.
611
611
  #
612
+ # @deprecated Quill has an unfixed XSS advisory. Use `fields_actionText` for rich text, or
613
+ # `fields_textarea` where users write markdown themselves. See the glib-web-npm
614
+ # `doc/rich_text_migration.md` guide.
615
+ #
612
616
  # Provides a full-featured text editor with formatting options, image uploads,
613
617
  # and @mention support. Can output HTML or Markdown.
614
618
  #
@@ -663,6 +667,16 @@ class Glib::JsonUi::ViewBuilder
663
667
 
664
668
  # Enables debug mode with additional logging.
665
669
  bool :debug
670
+
671
+ # Override
672
+ def created
673
+ super
674
+ # Local only: every render of every richText field would otherwise flood remote logging.
675
+ GLog.local_warn(
676
+ '`fields_richText` is deprecated: use `fields_actionText`, or `fields_textarea` for ' \
677
+ 'markdown input. See doc/rich_text_migration.md in glib-web-npm.'
678
+ )
679
+ end
666
680
  end
667
681
 
668
682
  # Trix editor field that submits the same HTML as Rails' Action Text form helper,
@@ -709,6 +723,28 @@ class Glib::JsonUi::ViewBuilder
709
723
  # @example libraryUrl: media_picks_url(target: 'post_body')
710
724
  string :libraryUrl
711
725
 
726
+ # People offered when the user types `@`. Each item is
727
+ # `{ sgid:, value:, text:, avatar:, group: }`; only `value` is required. An item with an
728
+ # `sgid` is inserted as an Action Text attachment that `has_rich_text` resolves to the
729
+ # record (its model must include `ActionText::Attachable`). When the sgid does not resolve
730
+ # (a plain column, a deleted record), the attachment renders its own `@value` text. An
731
+ # item without an `sgid` is inserted as plain `@value` text.
732
+ # @example mentionList: users.map { |u| { sgid: u.attachable_sgid, value: u.name } }
733
+ array :mentionList
734
+
735
+ # Endpoint searched as the user types after `@` (`GET <url>?term=...`), returning
736
+ # `{ items: [...] }` in the `mentionList` item shape. Replaces filtering `mentionList`.
737
+ # @example mentionUrl: mention_searches_url
738
+ string :mentionUrl
739
+
740
+ # Hides the formatting toolbar, e.g. for a chat input. Keyboard shortcuts (Ctrl/Cmd+B, …)
741
+ # and pasting or dropping files (when uploads are configured) still work.
742
+ bool :hideToolbar
743
+
744
+ # Enter submits the enclosing form and Shift+Enter inserts a line break. While a mention
745
+ # list is open, Enter picks from it instead.
746
+ bool :submitOnEnter
747
+
712
748
  def created
713
749
  super
714
750
  file_upload_error_handler_on_create
@@ -238,8 +238,22 @@ module Glib
238
238
  # An `ActionText::RichText` (a `has_rich_text` attribute), `ActionText::Content`, or the
239
239
  # HTML one of them rendered.
240
240
  def richText(rich_text)
241
- json.set! 'html', rich_text.to_s
241
+ json.set! 'html', ::ActionText::Content.with_renderer(html_renderer) { rich_text.to_s }
242
242
  end
243
+
244
+ private
245
+ # Action Text renders through the current controller by default. Here that is a
246
+ # namespaced JSON controller, so a content attachment (e.g. a mention whose record is
247
+ # gone) would be looked up as `glib/action_text/contents/_content.json` and raise.
248
+ # A host-level HTML renderer resolves partials the way an HTML page would.
249
+ def html_renderer
250
+ request = page.context.request
251
+ ::ApplicationController.renderer.new(
252
+ http_host: request.host_with_port,
253
+ https: request.ssl?,
254
+ script_name: request.script_name
255
+ )
256
+ end
243
257
  end
244
258
 
245
259
  class Label < AbstractText
@@ -6,7 +6,7 @@ page.body(
6
6
  body.panels_responsive(
7
7
  padding: { all: 16 },
8
8
  childViews: ->(res) do
9
- res.fields_richText value: "<p>#{DateTime.current.to_fs(:rfc822)}</p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"
9
+ res.fields_actionText value: "<div>#{DateTime.current.to_fs(:rfc822)}</div><div>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>"
10
10
  res.spacer height: 8
11
11
  res.button(
12
12
  text: 'close',
@@ -0,0 +1,12 @@
1
+ markdown = ReverseMarkdown.convert(html, unknown_tags: :bypass, github_flavored: true).strip
2
+
3
+ view.panels_vertical id: 'action_text_conversion', width: 'matchParent', childViews: ->(panel) do
4
+ panel.h3 text: 'Output HTML (what the field submits)'
5
+ panel.markdown text: "```html\n#{html.strip}\n```"
6
+ panel.spacer height: 8
7
+ panel.h3 text: 'Output Markdown (converted on the server)'
8
+ panel.markdown text: "```markdown\n#{markdown}\n```"
9
+ panel.spacer height: 8
10
+ panel.h3 text: 'Markdown rendered'
11
+ panel.markdown text: markdown
12
+ end
@@ -20,6 +20,29 @@ page.form url: json_ui_garage_url(path: 'forms/action_text_preview'), method: 'p
20
20
  directUploadUrl: glib_direct_uploads_url,
21
21
  blobUrlGenerator: glib_blob_url_generators_url,
22
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')
23
46
  end
24
47
 
25
48
  form.panels_column lg: { cols: 6 }, padding: { left: 10, right: 10 }, childViews: ->(column) do
@@ -0,0 +1,5 @@
1
+ json_ui_response json do |action|
2
+ action.components_replace targetId: 'action_text_conversion', newView: ->(view) do
3
+ render "#{@path_prefix}/forms/action_text_conversion", view: view, html: params.dig(:post, :body).to_s
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ term = User.sanitize_sql_like(params[:term].to_s)
2
+ users = User.where(User.arel_table[:full_name].matches("%#{term}%")).order(:full_name).limit(10)
3
+
4
+ json.items users.map { |user| { sgid: user.attachable_sgid, value: user.full_name } }
@@ -34,17 +34,17 @@ page.scroll childViews: ->(scroll) do
34
34
  end
35
35
  end
36
36
 
37
- form.fields_richText \
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.fields_richText name: 'user[richtext]', value: 'Lorem ipsum dumet...'
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.fields_richText width: 'matchParent', name: 'description', label: 'Desc', placeholder: 'Desc'
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
@@ -437,7 +437,7 @@ page.form \
437
437
  id: 'panel2',
438
438
  width: 'matchParent',
439
439
  childViews: ->(res) do
440
- res.fields_richText name: 'user[loadIf_target4]', width: 'matchParent', value: 'Value 3'
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'
@@ -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: default_plugins,
163
+ plugins: custom_plugins,
162
164
  colors: ['#79AC78', '#3085C3'],
163
165
  legend: { display: false },
164
166
  formatYAxis: true
@@ -4,6 +4,17 @@ page = json_ui_page json
4
4
 
5
5
  render 'json_ui/garage/test_page/header', json: json, page: page
6
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
+
7
18
  page.body(
8
19
  childViews: ->(body) do
9
20
  body.panels_responsive(
@@ -67,7 +78,34 @@ page.body(
67
78
  label: 'Locked',
68
79
  name: 'post[locked]',
69
80
  value: '<div>Cannot be edited.</div>',
70
- readOnly: true
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')
71
109
  )
72
110
 
73
111
  form.spacer height: 12
@@ -81,6 +119,70 @@ page.body(
81
119
  res.panels_vertical id: 'preview', childViews: ->(vertical) do
82
120
  vertical.actionText richText: ActionText::Content.new('<div>Initial <strong>content</strong>.</div>')
83
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
+ )
84
186
  end
85
187
  )
86
188
  end
@@ -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
@@ -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.fields_richText id: 'dirty_rich_text', name: 'user[bio]', width: 'matchParent', label: 'Bio', value: '<p>hello</p>'
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
@@ -52,12 +52,12 @@ page.body childViews: ->(body) do
52
52
 
53
53
  form.panels_vertical width: 'matchParent', id: 'hidden_panel_a', submitWhenNotDisplayed: true, childViews: ->(panel) do
54
54
  panel.label text: 'Panel A'
55
- panel.fields_richText id: 'hidden_text_a', width: 'matchParent', name: 'user[text_a]', value: 'Alpha start', submitWhenNotDisplayed: true
55
+ panel.fields_actionText id: 'hidden_text_a', width: 'matchParent', name: 'user[text_a]', value: '<div>Alpha start</div>', submitWhenNotDisplayed: true
56
56
  end
57
57
 
58
58
  form.panels_vertical width: 'matchParent', id: 'hidden_panel_b', displayed: false, submitWhenNotDisplayed: true, childViews: ->(panel) do
59
59
  panel.label text: 'Panel B'
60
- panel.fields_richText id: 'hidden_text_b', width: 'matchParent', name: 'user[text_b]', value: 'Bravo start', submitWhenNotDisplayed: true
60
+ panel.fields_actionText id: 'hidden_text_b', width: 'matchParent', name: 'user[text_b]', value: '<div>Bravo start</div>', submitWhenNotDisplayed: true
61
61
  panel.fields_upload \
62
62
  id: 'hidden_upload_b',
63
63
  name: 'user[file_b]',
@@ -71,7 +71,7 @@ page.body childViews: ->(body) do
71
71
 
72
72
  form.panels_vertical width: 'matchParent', id: 'hidden_panel_c', displayed: false, submitWhenNotDisplayed: true, childViews: ->(panel) do
73
73
  panel.label text: 'Panel C'
74
- panel.fields_richText id: 'hidden_text_c', width: 'matchParent', name: 'user[text_c]', value: 'Charlie start', submitWhenNotDisplayed: true
74
+ panel.fields_actionText id: 'hidden_text_c', width: 'matchParent', name: 'user[text_c]', value: '<div>Charlie start</div>', submitWhenNotDisplayed: true
75
75
  end
76
76
 
77
77
  form.spacer height: 12
@@ -98,25 +98,6 @@ page.body childViews: ->(body) do
98
98
  end
99
99
  form.spacer height: 12
100
100
 
101
- # An editor replaced in place by new content at the same position:
102
- # the replacement's value must show, not the old value or old typing.
103
- form.panels_vertical width: 'matchParent', id: 'hidden_swap_panel', childViews: ->(panel) do
104
- panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'Before swap',
105
- placeholder: 'Before placeholder', mentionList: ['Alice Before']
106
- end
107
- form.button text: 'Swap to new value', onClick: ->(action) do
108
- action.components_replaceChildren targetId: 'hidden_swap_panel', childViews: ->(panel) do
109
- panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'After swap',
110
- placeholder: 'After placeholder', mentionList: ['Bob After']
111
- end
112
- end
113
- form.button text: 'Swap to same value', onClick: ->(action) do
114
- action.components_replaceChildren targetId: 'hidden_swap_panel', childViews: ->(panel) do
115
- panel.fields_richText width: 'matchParent', name: 'user[swap]', value: 'Before swap',
116
- placeholder: 'Before placeholder', mentionList: ['Alice Before']
117
- end
118
- end
119
-
120
101
  form.spacer height: 20
121
102
  form.fields_submit text: 'Submit'
122
103
  end
@@ -1,6 +1,5 @@
1
1
  default_plugins = {
2
2
  datalabels: {
3
- backgroundColor: 'skyblue',
4
3
  borderRadius: 4,
5
4
  color: 'white',
6
5
  font: {
@@ -10,6 +9,9 @@ default_plugins = {
10
9
  }
11
10
  }
12
11
 
12
+ custom_plugins = default_plugins.deep_dup
13
+ custom_plugins[:datalabels][:backgroundColor] = ['#1E5006', '#E36414']
14
+
13
15
  if params[:data_only].present?
14
16
  json_ui_page json do |page|
15
17
  page.data content: ->(data) do
@@ -54,7 +56,7 @@ else
54
56
  json.points points.map { |k, v| { x: k, y: v, label: v > 5 ? 'Greater than five' : v } }
55
57
  end
56
58
  ],
57
- plugins: default_plugins,
59
+ plugins: custom_plugins,
58
60
  colors: ['#79AC78', '#3085C3'], legend: { display: false }, formatYAxis: true
59
61
 
60
62
  # scroll.spacer height: 20
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glib-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.2.0
4
+ version: 8.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -332,6 +332,7 @@ files:
332
332
  - app/views/json_ui/garage/content/web_panel_a.html.erb
333
333
  - app/views/json_ui/garage/content/web_panel_b.html.erb
334
334
  - app/views/json_ui/garage/empty.json.jbuilder
335
+ - app/views/json_ui/garage/forms/_action_text_conversion.json.jbuilder
335
336
  - app/views/json_ui/garage/forms/_alert_post_all_data.json.jbuilder
336
337
  - app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
337
338
  - app/views/json_ui/garage/forms/_basic_content.json.jbuilder
@@ -340,7 +341,9 @@ files:
340
341
  - app/views/json_ui/garage/forms/_read_more_text.json.jbuilder
341
342
  - app/views/json_ui/garage/forms/action_text.json.jbuilder
342
343
  - app/views/json_ui/garage/forms/action_text_attachment.json.jbuilder
344
+ - app/views/json_ui/garage/forms/action_text_conversion.json.jbuilder
343
345
  - app/views/json_ui/garage/forms/action_text_library.json.jbuilder
346
+ - app/views/json_ui/garage/forms/action_text_mentions.json.jbuilder
344
347
  - app/views/json_ui/garage/forms/action_text_preview.json.jbuilder
345
348
  - app/views/json_ui/garage/forms/basic.json.jbuilder
346
349
  - app/views/json_ui/garage/forms/basic_post.json.jbuilder