glib-web 0.17.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +6 -0
- data/app/helpers/glib/json_ui/action_builder/http.rb +1 -0
- data/app/helpers/glib/json_ui/page_helper.rb +12 -8
- data/app/helpers/glib/json_ui/view_builder/fields.rb +2 -0
- data/app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder +8 -0
- data/app/views/json_ui/garage/forms/index.json.jbuilder +3 -1
- data/app/views/json_ui/garage/forms/page_update_on_response.json.jbuilder +2 -3
- data/app/views/json_ui/garage/forms/partial_update.json.jbuilder +51 -0
- data/app/views/json_ui/garage/forms/partial_update_response.json.jbuilder +3 -0
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +4 -3
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +1 -0
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80ae3a9683db62d27d22bf05176090b8af70a0782c4d2a0153cb50101fa5adff
|
4
|
+
data.tar.gz: 883174575ec4cbea3a71ff9c78115eefea6b69fee4a8f436788e276ebef7abc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f1e13ac700cea79e5e3d2935fb63ecd4779a3b1cb88be841afc29f055dfa60461146ef2f6f54c96e15483dcc92a3b08bf0bf5a44b9dbfca7634ec38513499bd
|
7
|
+
data.tar.gz: 4355e0719ae9f94d59157012d5750b352e81ede14dc5240d22b613dde3e742f91e296c83c6d4f19bb664253a778c4278794f70c9b1bcbfd68e9f221e9725dec7
|
@@ -29,6 +29,12 @@ class Glib::JsonUi::ActionBuilder
|
|
29
29
|
string :fullscreen # mobile, always
|
30
30
|
length :width
|
31
31
|
|
32
|
+
# def initialize(json, page)
|
33
|
+
# @json = json
|
34
|
+
# page.current_form = nil
|
35
|
+
# @page = page
|
36
|
+
# end
|
37
|
+
|
32
38
|
# Future plan
|
33
39
|
# panels_builder :content, :body, :footer
|
34
40
|
end
|
@@ -64,7 +64,7 @@ module Glib
|
|
64
64
|
end
|
65
65
|
|
66
66
|
class Page
|
67
|
-
attr_reader :json, :context, :view_builder, :action_builder, :menu_builder
|
67
|
+
attr_reader :json, :context, :view_builder, :sview_builder, :action_builder, :menu_builder
|
68
68
|
attr_reader :list_section_builder, :table_section_builder, :drawer_content_builder
|
69
69
|
|
70
70
|
# See Panels::Form
|
@@ -75,6 +75,7 @@ module Glib
|
|
75
75
|
@context = context
|
76
76
|
|
77
77
|
@view_builder = ViewBuilder.new(json, self, true)
|
78
|
+
@sview_builder = ViewBuilder.new(json, self, false)
|
78
79
|
@action_builder = ActionBuilder.new(json, self, false)
|
79
80
|
@menu_builder = MenuBuilder.new(json, self)
|
80
81
|
|
@@ -112,6 +113,9 @@ module Glib
|
|
112
113
|
json.set! name, value
|
113
114
|
end
|
114
115
|
end
|
116
|
+
if options[:body]
|
117
|
+
json.set!(:body) { options[:body].call(sview_builder) }
|
118
|
+
end
|
115
119
|
options[:content]&.call drawer_content_builder
|
116
120
|
end
|
117
121
|
end
|
@@ -175,7 +179,7 @@ module Glib
|
|
175
179
|
|
176
180
|
def form(options = {})
|
177
181
|
form = Glib::JsonUi::ViewBuilder::Panels::Form.new(json, self)
|
178
|
-
form.childViews(->(view_builder) {})
|
182
|
+
form.childViews(->(view_builder) { })
|
179
183
|
panel_options = options.slice!(:url, :method, :local, :onSubmit, :paramNameForFormData, :model)
|
180
184
|
|
181
185
|
json.fullPageForm do
|
@@ -211,18 +215,18 @@ module Glib
|
|
211
215
|
raise "Invalid properties: #{options.keys}" if options.size > 0
|
212
216
|
end
|
213
217
|
|
214
|
-
# def onLoad(options = {})
|
215
|
-
# json.onLoad do
|
216
|
-
# yield @action_builder
|
217
|
-
# end
|
218
|
-
# end
|
219
|
-
|
220
218
|
def on(options = {})
|
221
219
|
if (on_load = options[:load])
|
222
220
|
json.onLoad do
|
223
221
|
on_load.call @action_builder
|
224
222
|
end
|
225
223
|
end
|
224
|
+
|
225
|
+
if (on_refocus = options[:refocus])
|
226
|
+
json.onRefocus do
|
227
|
+
on_refocus.call @action_builder
|
228
|
+
end
|
229
|
+
end
|
226
230
|
end
|
227
231
|
end
|
228
232
|
end
|
@@ -28,7 +28,9 @@ page.list sections: [
|
|
28
28
|
template.thumbnail title: 'Dirty Prompt', onClick: ->(action) do
|
29
29
|
action.windows_open url: json_ui_garage_url(path: 'forms/dirty_prompt')
|
30
30
|
end
|
31
|
-
|
31
|
+
template.thumbnail title: 'Partial Update', onClick: ->(action) do
|
32
|
+
action.windows_open url: json_ui_garage_url(path: 'forms/partial_update')
|
33
|
+
end
|
32
34
|
end
|
33
35
|
end, ->(section) do
|
34
36
|
section.header padding: glib_json_padding_list, childViews: ->(header) do
|
@@ -5,11 +5,10 @@ data = params[:user] || {}
|
|
5
5
|
page = json_ui_page json
|
6
6
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
7
7
|
|
8
|
-
# page.form url: json_ui_garage_url(path: 'forms/get_request'), method: 'get', padding: glib_json_padding_body, childViews: ->(form) do
|
9
8
|
page.scroll childViews: ->(scroll) do
|
10
9
|
scroll.panels_form \
|
11
10
|
width: 'matchParent',
|
12
|
-
url: json_ui_garage_url(path: 'forms/
|
11
|
+
url: json_ui_garage_url(path: 'forms/page_update_on_response'),
|
13
12
|
method: 'get',
|
14
13
|
padding: glib_json_padding_body,
|
15
14
|
childViews: ->(form) do
|
@@ -34,7 +33,7 @@ page.scroll childViews: ->(scroll) do
|
|
34
33
|
|
35
34
|
scroll.panels_form \
|
36
35
|
width: 'matchParent',
|
37
|
-
url: json_ui_garage_url(path: 'forms/
|
36
|
+
url: json_ui_garage_url(path: 'forms/page_update_on_response'),
|
38
37
|
method: 'post',
|
39
38
|
padding: glib_json_padding_body,
|
40
39
|
childViews: ->(form) do
|
@@ -0,0 +1,51 @@
|
|
1
|
+
json.title 'Forms'
|
2
|
+
|
3
|
+
page = json_ui_page json
|
4
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
|
+
|
6
|
+
page.scroll childViews: ->(scroll) do
|
7
|
+
scroll.panels_vertical padding: glib_json_padding_body, childViews: ->(vertical) do
|
8
|
+
scroll.h2 text: 'Partial update'
|
9
|
+
scroll.spacer height: 8
|
10
|
+
scroll.label text: 'The content below will be updated. This is a more efficient alternative to windows_reload.'
|
11
|
+
scroll.spacer height: 8
|
12
|
+
scroll.label text: 'The updated content should be committed to the page history as the user navigates back and forward.'
|
13
|
+
scroll.spacer height: 18
|
14
|
+
scroll.panels_vertical id: 'greeting', childViews: ->(inner) do
|
15
|
+
inner.label text: 'Hello'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
scroll.spacer height: 18
|
20
|
+
scroll.hr width: 'matchParent'
|
21
|
+
|
22
|
+
scroll.panels_form url: json_ui_garage_url(path: 'forms/partial_update_response'), method: 'post', padding: glib_json_padding_body, childViews: ->(form) do
|
23
|
+
scroll.h2 text: 'Update via POST request'
|
24
|
+
scroll.spacer height: 8
|
25
|
+
scroll.fields_text name: 'name', width: 'matchParent', label: 'Name', value: 'Jane'
|
26
|
+
scroll.spacer height: 8
|
27
|
+
scroll.fields_submit text: 'Submit'
|
28
|
+
end
|
29
|
+
|
30
|
+
scroll.spacer height: 18
|
31
|
+
scroll.hr width: 'matchParent'
|
32
|
+
|
33
|
+
scroll.panels_vertical padding: glib_json_padding_body, childViews: ->(vertical) do
|
34
|
+
vertical.h2 text: 'Update via GET request'
|
35
|
+
|
36
|
+
vertical.spacer height: 8
|
37
|
+
vertical.button text: 'Update', onClick: ->(action) do
|
38
|
+
action.http_get url: json_ui_garage_url(path: 'forms/partial_update_response'), formData: { name: 'John' }, historyUrl: json_ui_garage_url(path: 'forms/partial_update', name: 'John')
|
39
|
+
end
|
40
|
+
vertical.spacer height: 18
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
if params[:name].present?
|
46
|
+
page.on load: ->(action) do
|
47
|
+
render "#{@path_prefix}/forms/partial_update_execute", action: action
|
48
|
+
end, refocus: ->(action) do
|
49
|
+
render "#{@path_prefix}/forms/partial_update_execute", action: action
|
50
|
+
end
|
51
|
+
end
|
@@ -20,13 +20,14 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
|
|
20
20
|
json.width 'matchParent'
|
21
21
|
json.label 'Content'
|
22
22
|
json.name 'user[bio]'
|
23
|
-
json.value
|
23
|
+
json.value "<p>Test <img src='{{image1}}'</p>"
|
24
|
+
json.produce 'html'
|
24
25
|
|
25
26
|
json.images do
|
26
27
|
json.child! do
|
27
|
-
json.value
|
28
|
+
json.value 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4'
|
28
29
|
# json.fileTitle "hita i hanom hg.jpg"
|
29
|
-
json.fileUrl
|
30
|
+
json.fileUrl 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100'
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
@@ -8,6 +8,7 @@ module Glib
|
|
8
8
|
if (json = (@http.get args['url'], action, args.except('url'))) && (left_drawer = json['leftDrawer'])
|
9
9
|
crawl left_drawer['header']&.[]('childViews')
|
10
10
|
crawl left_drawer['rows']
|
11
|
+
crawl left_drawer['body']&.[]('childViews')
|
11
12
|
end
|
12
13
|
|
13
14
|
if (on_load = (args.fetch('onLoad', nil)))
|
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.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -144,6 +144,7 @@ files:
|
|
144
144
|
- app/views/json_ui/garage/actions/index.json.jbuilder
|
145
145
|
- app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder
|
146
146
|
- app/views/json_ui/garage/forms/_conditional_banner.json.jbuilder
|
147
|
+
- app/views/json_ui/garage/forms/_partial_update_execute.json.jbuilder
|
147
148
|
- app/views/json_ui/garage/forms/_read_more_text.json.jbuilder
|
148
149
|
- app/views/json_ui/garage/forms/basic.json.jbuilder
|
149
150
|
- app/views/json_ui/garage/forms/basic_post.json.jbuilder
|
@@ -164,6 +165,8 @@ files:
|
|
164
165
|
- app/views/json_ui/garage/forms/online_participant1.json.jbuilder
|
165
166
|
- app/views/json_ui/garage/forms/online_participant2.json.jbuilder
|
166
167
|
- app/views/json_ui/garage/forms/page_update_on_response.json.jbuilder
|
168
|
+
- app/views/json_ui/garage/forms/partial_update.json.jbuilder
|
169
|
+
- app/views/json_ui/garage/forms/partial_update_response.json.jbuilder
|
167
170
|
- app/views/json_ui/garage/forms/payments.json.jbuilder
|
168
171
|
- app/views/json_ui/garage/forms/pickers.json.jbuilder
|
169
172
|
- app/views/json_ui/garage/forms/ratings.json.jbuilder
|