glib-web 3.20.2 → 3.20.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50cd95cb3043e936a17b46b0b3e3a102cbe3faa2894e3b67e53228ac115e2a83
4
- data.tar.gz: c6a7069e1c997a5e0731039dabeb56c926fd452668a41ff75cc4f06ab0379a27
3
+ metadata.gz: '09a9fcb392c01c3befef1f951014fe4934bafea422cb1d5a7f13d2eed5f3e5db'
4
+ data.tar.gz: 21c5e44448d4eaa6b51ff67dfdf8d20234e83cdbfc8f2bfd571c58ee5cbf98cb
5
5
  SHA512:
6
- metadata.gz: 3b9134e80a27875fc0971a9dc05dc2d7e1daea7c9bb156e14a3f5fad294db2f1a831f8ecc48d8e42dd7ff02d3a5d7772bca18cc9bb37f176eebb540dfc86ec6f
7
- data.tar.gz: 844365e90f4a43e1ec06a54a380ac56df052ded036dddfb6fd40b5e747dc5e579cbae07e308cc5a7088c1071ea3ad342687df2c9abe19c923ea70e5c5ae863dc
6
+ metadata.gz: 4420d70795aa12b42bb493cec14553c150740b48864bf7c90a92c4012139109c301721b61d31bba3333ddc85dab39a8a45cac82a0ce0d4b40e285b9e2554319f
7
+ data.tar.gz: bae84a5f666c73f04151cbc47e685335914bcfd527392350f31ba90b1450f18f09d3fd2aca1dc92ae7a9ff1c883e99b31a7403d15f437448f584d22c7927accb
@@ -98,6 +98,15 @@ module Glib
98
98
  # @generic_content_builder = GenericBuilders::Content.new(json, self, @view_builder)
99
99
  end
100
100
 
101
+ def pasteFile(options = {})
102
+ json.pasteFile do
103
+ json.accepts options[:accepts]
104
+ json.directUploadUrl options[:directUploadUrl]
105
+ json.url options[:url]
106
+ json.inputName options[:inputName]
107
+ end
108
+ end
109
+
101
110
  def actionCable(options = {})
102
111
  json.actionCable do
103
112
  if (on_error = options[:onError])
@@ -186,6 +186,7 @@ class Glib::JsonUi::ViewBuilder
186
186
  end
187
187
 
188
188
  class ChipGroup < AbstractField
189
+ string :color
189
190
  array :options
190
191
  bool :multiple
191
192
  end
@@ -320,6 +321,7 @@ class Glib::JsonUi::ViewBuilder
320
321
  string :directUploadUrl
321
322
  string :uploadTitle
322
323
  string :uploadFailedText # deprecated
324
+ action :onFinishUpload
323
325
 
324
326
  required :accepts, :directUploadUrl
325
327
 
@@ -50,7 +50,8 @@ module Glib
50
50
 
51
51
  hash :analytics
52
52
  # hash :tooltip
53
- array :extensions
53
+ array :extensions # deprecated
54
+ hash :dragData
54
55
 
55
56
  def self.component_name
56
57
  @component_name ||= self.name.sub('Glib::JsonUi::ViewBuilder::', '')
@@ -322,6 +323,16 @@ module Glib
322
323
 
323
324
  action :onClick
324
325
  end
326
+
327
+ class TreeView < View
328
+ string :inputName
329
+ string :url
330
+ string :directUploadUrl
331
+ array :accepts
332
+ string :selected
333
+ hash :items
334
+ hash :dropData
335
+ end
325
336
  end
326
337
  end
327
338
  end
@@ -5,9 +5,11 @@ markdown = '## Emphasis' + "\n" +
5
5
  "\n" +
6
6
  '~~Strikethrough~~' + "\n"
7
7
 
8
- options = {
9
- updateExisting: true
10
- }
8
+ options = {}
9
+ if (update_existing = local_assigns[:update_existing])
10
+ options[:updateExisting] = update_existing
11
+ end
12
+
11
13
  action.send "dialogs_#{dialog_mode}", **options, content: ->(dialog) do
12
14
  dialog.body padding: glib_json_padding_body, childViews: ->(body) do
13
15
  body.markdown text: markdown
@@ -8,5 +8,12 @@ page.scroll childViews: ->(scroll) do
8
8
  end
9
9
 
10
10
  page.on load: ->(action) do
11
- render 'json_ui/garage/actions/dialogs_show', json: json, action: action, dialog_mode: :show
11
+ action.timeouts_set interval: 500, onTimeout: ->(subaction) do
12
+ render \
13
+ 'json_ui/garage/actions/dialogs_show',
14
+ json: json,
15
+ action: subaction,
16
+ dialog_mode: :show,
17
+ update_existing: true
18
+ end
12
19
  end
@@ -37,6 +37,8 @@ page.form options.merge(childViews: ->(form) do
37
37
  # placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data: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vDjtWnIOaX4SO+I43hhBO0NOJduds771IkBERAREQEREBERAREQEREBERAREQeFnPm621MvNAbGA0Xe9+l3DjsVYRoRY4tcCHNJBBxBGIV2Lx7bmpCj2lloiaoGkyX8Rw1Z8N++QQeNmDm7dlbIzf8lp/9h+nfcp5cvaX7osMEtYSGwbByCOBnTV9ONEAOv0w2oX3KY7Vl8jqY8KURhA1seNaIMB9+mG1C+5o4rLyDq48KIwgCTseNUAsuVx2IGXtJYYCNbDjWqOBJm3Dsg+mRL1CFoiwZcv3itzyDq48KUWWOAEjj+5IONF0PgbcDu+y0ESxQYREQEREBERAREQEREBERARfTGE4BdDGNbiaoNbYUhN3QfdbQy9penJYZMGbsONao4EmbcO3OiAHX6YbUL7uj+6rLyDq48KURpAEjj+5VQC25XHYgbfrhsWGAjWw41R4J1cOFKoMllyo5IGX6lYYCDN2HdHgkzbh2QGvv0NNqF93RWXkGjce1EaQBJ2Pf1QC25UV2IGXtL90WGAjWw71RwJM24dudEBrr9DTasRDLRIn819PIOrj2ojSAJOx7+qD4iWbce60uYRiF0MBGth3qskkmYw/exByIustacBPlRa3QW4TIPGvyQaEW91nl7QWPw53hBpRbhZydo7p5FZFwQaUXSYDRiSshu1rRLf8APFBoZDJwC2CEAZEzO4LbEde1T9FgESkdb67KoPqJo1HKWxfIZe0lhgIq7DujgSZtw7eiA11+hptQvu6P7qsvIOrj2ojSAJOx7+qAW3KiuxAy9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' }
38
38
 
39
39
  form.spacer height: 16
40
+ form.label text: 'Simple file upload'
41
+ form.spacer height: 8
40
42
  form.fields_multiUpload \
41
43
  name: 'user[multi][]',
42
44
  width: 360,
@@ -48,5 +50,16 @@ page.form options.merge(childViews: ->(form) do
48
50
  { name: 'File (Example)', signed_id: ActiveStorage::Attachment.last&.signed_id }
49
51
  ]
50
52
  form.spacer height: 16
53
+ form.label text: 'File upload with onFinishUpload'
54
+ form.spacer height: 8
55
+ form.fields_multiUpload \
56
+ name: 'user[multi2][]',
57
+ width: 360,
58
+ accepts: { fileType: 'image', maxFileSize: 5000 },
59
+ directUploadUrl: rails_direct_uploads_url,
60
+ uploadTitle: 'Files uploaded:',
61
+ uploadFailedText: '(UPLOAD FAILED)',
62
+ onFinishUpload: ->(action) { action.forms_submit }
63
+ form.spacer height: 16
51
64
  form.fields_submit text: 'Submit'
52
65
  end)
@@ -19,13 +19,19 @@ if room.present?
19
19
  }
20
20
  ],
21
21
  onOpen: ->(action) do
22
- action.labels_set targetId: 'label-1', text: "Room ##{room.upcase}"
22
+ action.components_update targetId: 'label-1', views: ->(view) do
23
+ view.p text: "Room ##{room.upcase}"
24
+ end
23
25
  end,
24
26
  onClose: ->(action) do
25
- action.labels_set targetId: 'label-1', text: "Room ##{room.upcase} (OFF)"
27
+ action.components_update targetId: 'label-1', views: ->(view) do
28
+ view.p text: "Room ##{room.upcase} (OFF)"
29
+ end
26
30
  end,
27
31
  onError: ->(action) do
28
- action.labels_set targetId: 'label-1', text: "Room ##{room.upcase} (ERROR)"
32
+ action.components_update targetId: 'label-1', views: ->(view) do
33
+ view.p text: "Room ##{room.upcase} (ERROR)"
34
+ end
29
35
  end
30
36
  end
31
37
 
@@ -34,6 +34,10 @@ json_ui_page json do |page|
34
34
  action.windows_open url: json_ui_garage_url(path: 'pages/redirect_onload')
35
35
  end
36
36
 
37
+ template.thumbnail title: 'Paste file to page', onClick: ->(action) do
38
+ action.windows_open url: json_ui_garage_url(path: 'pages/paste_file')
39
+ end
40
+
37
41
  template.thumbnail title: 'Custom Style Class', onClick: ->(action) do
38
42
  action.windows_open url: json_ui_garage_url(path: 'pages/custom_style_class')
39
43
  end
@@ -0,0 +1,15 @@
1
+ json.title 'Pages'
2
+
3
+ page = json_ui_page json
4
+
5
+ render "#{@path_prefix}/nav_menu", json: json, page: page
6
+
7
+ page.pasteFile \
8
+ directUploadUrl: rails_direct_uploads_url,
9
+ accepts: { fileType: 'image', maxFileSize: 1000 },
10
+ inputName: 'user',
11
+ url: json_ui_garage_url(path: 'forms/generic_post')
12
+
13
+ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
14
+ scroll.label text: 'Paste image to this page'
15
+ end