glib-web 0.5.28 → 0.5.29

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: 61751b2891f690ea735f42e83237af9e51ffdc9af197edf99b781130bdc17b9f
4
- data.tar.gz: 0f573d844cb04c3aaecaf3960e8f004a44773e54e68b9badce95196ce9e2098d
3
+ metadata.gz: 7fbacc0893e8f36261c10fcfc5a1dd488d1170c10c4b901f14285a0c64212383
4
+ data.tar.gz: 00ac950fdf253428ec4b3b1eac29d709c817949df290fb97b065b0adb24e0156
5
5
  SHA512:
6
- metadata.gz: ad5eea3ab4348323e71d9e984095aeb219430b3b47cdaaadb9ccff52f1848c320e44c3d0ca91aacca224ad272335bec0407577ae80bd90e0ef581aa70cc16e9e
7
- data.tar.gz: 7889d94a639733b5b833eb08d8f68369186836697dcfb9c1d0baeca7edae41b4c3cb80beb85f7f7c4b303948bc35b0026d033f6e72c9856bffd675aca36ea293
6
+ metadata.gz: 01feace7ab2d3333382d4aed1ef15091fd827c9346270c9393d498330350f32f9559ebbdc577f8c1088eac659cec3c910b99de2b27b64f19810bcbc745049c8a
7
+ data.tar.gz: c83f4a4d8414006746c70e8d692e788d0822ac19cc09964af687dfab1b07992205d69f5c82712fa8ff88c6adbf0b04ad815b40780bf4f0089bb32cc950a34e30
@@ -70,6 +70,8 @@ module Glib
70
70
  end
71
71
 
72
72
  class CreditCard < Action
73
+ string :publicKey
74
+ string :clientSecret
73
75
  action :onSuccess
74
76
  action :onFailure
75
77
  end
@@ -1,18 +1,38 @@
1
1
  class Glib::JsonUi::ActionBuilder
2
2
  module Http
3
- class Post < Action
3
+ class AbstractHttp < Action
4
4
  string :url, cache: true
5
- hash :formData
5
+
6
+ def formData(hash)
7
+ form_data = {}
8
+ hash.each do |key, value|
9
+ flatten_nested_params(form_data, key, value)
10
+ end
11
+ json.formData form_data
12
+ end
13
+
14
+ def flatten_nested_params(form_data, key, value)
15
+ if value.is_a?(Hash)
16
+ value.each do |nested_key, nested_value|
17
+ flatten_nested_params(form_data, "#{key}[#{nested_key}]", nested_value)
18
+ end
19
+ else
20
+ form_data[key] = value
21
+ end
22
+ end
6
23
  end
7
24
 
8
- class Patch < Action
9
- string :url, cache: true
10
- hash :formData
25
+ class Post < AbstractHttp
11
26
  end
12
27
 
13
- class Delete < Action
14
- string :url, cache: true
15
- hash :formData
28
+ class Patch < AbstractHttp
29
+ # string :url, cache: true
30
+ # hash :formData
31
+ end
32
+
33
+ class Delete < AbstractHttp
34
+ # string :url, cache: true
35
+ # hash :formData
16
36
  end
17
37
 
18
38
  end
@@ -217,5 +217,8 @@ class Glib::JsonUi::ViewBuilder
217
217
  string :publicKey
218
218
  end
219
219
 
220
+ class CreditCard < AbstractField
221
+ string :publicKey
222
+ end
220
223
  end
221
224
  end
@@ -97,7 +97,9 @@ class Glib::JsonUi::ViewBuilder
97
97
  end
98
98
 
99
99
  class List < View
100
- hash :ws
100
+ hash :phoenixSocket
101
+ hash :actionCable
102
+
101
103
  hash :nextPage
102
104
  action :onScrollToTop
103
105
  action :onScrollToBottom
@@ -6,7 +6,7 @@ end
6
6
  section.rows builder: ->(template) do
7
7
  template.thumbnail title: 'http/post', onClick: ->(action) do
8
8
  action.auth_saveCsrfToken token: form_authenticity_token, onSave: ->(subaction) do
9
- subaction.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: { 'user[name]' => 'New Joe' }
9
+ subaction.http_post url: json_ui_garage_url(path: 'forms/basic_post'), formData: { user: { name: { first: 'New', last: 'Joe' } } }
10
10
  end
11
11
  end
12
12
 
@@ -5,7 +5,7 @@ liked = params[:liked] == 'true'
5
5
  page = json_ui_page json
6
6
  render "#{@path_prefix}/nav_menu", json: json, page: page
7
7
 
8
- json.ws({
8
+ json.phoenixSocket({
9
9
  "socket" => {
10
10
  "endpoint" => "/socket/websocket",
11
11
  "params" => {
@@ -71,25 +71,6 @@ page.list ws: list_ws, firstSection: ->(section) do
71
71
  end
72
72
 
73
73
  page.footer padding: { top: 12, left: 16, right: 16, bottom: 12 }, childViews: ->(footer) do
74
- # json.ws({
75
- # "socket" => {
76
- # "endpoint" => "/socket/websocket",
77
- # "params" => {
78
- # vsn: '2.0.0',
79
- # token: 'TOKEN'
80
- # }
81
- # },
82
- # # "topic" => "room:30",
83
- # # "event" => "comments_updated",
84
- # "topic" => "links",
85
- # "events" => ["new_link_added"],
86
- # "header" => {
87
- # "user_id" => 2,
88
- # "prev_item_id" => nil,
89
- # "last_item_id" => nil
90
- # }
91
- # })
92
-
93
74
  footer.panels_form width: 'matchParent', url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', padding: glib_json_padding_body, paramNameForFormData: 'formData', onSubmit: ->(action) do
94
75
  json.action "ws/push"
95
76
  json.topic "rooms"
@@ -3,7 +3,7 @@ json.title 'Forms'
3
3
  page = json_ui_page json
4
4
  render "#{@path_prefix}/nav_menu", json: json, page: page
5
5
 
6
- json.ws({
6
+ json.phoenixSocket({
7
7
  "socket" => {
8
8
  "endpoint" => "/socket/websocket",
9
9
  "params" => {
@@ -43,7 +43,7 @@ end, childViews: ->(form) do
43
43
 
44
44
  # TODO: Change this to radio for selecting alert vs reload response
45
45
  form.fields_password name: 'user[password]', width: 'matchParent', label: 'Password'
46
-
46
+
47
47
  form.fields_hidden name: 'baseUrl', width: 'matchParent', value: json_ui_garage_url(path: 'notifications/web_socket')
48
48
 
49
49
  form.panels_split width: 'matchParent', content: ->(split) do
@@ -56,5 +56,5 @@ end, childViews: ->(form) do
56
56
  right.button text: 'Submit', onClick: ->(action) { action.forms_submit }
57
57
  end
58
58
  end
59
-
59
+
60
60
  end
@@ -81,6 +81,9 @@ module Glib
81
81
  end
82
82
 
83
83
  def tear_down
84
+ # NOTE: Experimental, to address issue where sometimes changes don't get saved.
85
+ @logger.flush
86
+
84
87
  @logger.close
85
88
  end
86
89
 
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: 0.5.28
4
+ version: 0.5.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''