glib-web 0.4.54 → 0.4.56
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/helpers/glib/json_ui/abstract_builder.rb +2 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +6 -2
- data/app/helpers/glib/json_ui/page_helper.rb +18 -0
- data/app/helpers/glib/json_ui/view_builder/panels.rb +0 -1
- data/app/helpers/glib/json_ui/view_builder.rb +5 -5
- data/app/policies/glib/application_policy.rb +6 -0
- data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +1 -1
- data/lib/glib/json_crawler/http.rb +0 -31
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91d807eb158b9a9fb64bb7290c8b1184a70edfca
|
4
|
+
data.tar.gz: 27188e3bedd04275160d5bf5b516acbb75710f7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2d0de117b9f0920fb7469d9d12fde09d1e482733cdde9ea6b4bd9a78a36c7cf1682438a15ff81a1e9fe1ba4c99ad5fe472f0afeb946759b74f542f438859a01
|
7
|
+
data.tar.gz: 27e9ce01d6e2e3c59c332ceb39b8f3c0734e8177a0bd7d2d93259730faf774d63d1ec12d8ea8121adc1c3a9c91be9d744a48e5742d90ee9132ee46f9c0493296
|
@@ -13,10 +13,14 @@ module Glib
|
|
13
13
|
icon :icon
|
14
14
|
action :onClick
|
15
15
|
bool :disabled
|
16
|
-
# color :color
|
17
|
-
# backgroundColor :color
|
18
16
|
singleton_array :styleClass, :styleClasses
|
19
17
|
|
18
|
+
def childItems(block)
|
19
|
+
json.childItems do
|
20
|
+
block.call page.menu_builder
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
20
24
|
def created
|
21
25
|
json.type 'button'
|
22
26
|
end
|
@@ -17,6 +17,24 @@ module Glib
|
|
17
17
|
@__json_ui_page
|
18
18
|
end
|
19
19
|
|
20
|
+
# Use this only if you need to generate json independently from the current `json_ui_page`
|
21
|
+
def json_ui_menu(&block)
|
22
|
+
@__json_ui_menu_page ||= Page.new(Jbuilder.new, self)
|
23
|
+
json = @__json_ui_menu_page.json
|
24
|
+
json.nil!
|
25
|
+
block&.call @__json_ui_menu_page.menu_builder
|
26
|
+
json.attributes!
|
27
|
+
end
|
28
|
+
|
29
|
+
# Use this only if you need to generate json independently from the current `json_ui_page`
|
30
|
+
def json_ui_panel(&block)
|
31
|
+
@__json_ui_panel_page ||= Page.new(Jbuilder.new, self)
|
32
|
+
json = @__json_ui_panel_page.json
|
33
|
+
json.nil!
|
34
|
+
block&.call @__json_ui_panel_page.view_builder
|
35
|
+
json.attributes!
|
36
|
+
end
|
37
|
+
|
20
38
|
class Page
|
21
39
|
attr_reader :json, :context, :view_builder, :action_builder, :menu_builder
|
22
40
|
attr_reader :list_section_builder, :table_section_builder, :drawer_content_builder, :split_content_builder
|
@@ -153,11 +153,11 @@ module Glib
|
|
153
153
|
end
|
154
154
|
|
155
155
|
# Should be deprecated
|
156
|
-
def tabButtons(block)
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
end
|
156
|
+
# def tabButtons(block)
|
157
|
+
# json.tabButtons do
|
158
|
+
# block.call page.menu_builder
|
159
|
+
# end
|
160
|
+
# end
|
161
161
|
|
162
162
|
# def options(options)
|
163
163
|
# current_url = page.context.request.base_url + page.context.request.fullpath
|
@@ -124,6 +124,12 @@ module Glib
|
|
124
124
|
true
|
125
125
|
end
|
126
126
|
|
127
|
+
# TODO: Deprecate `user()`
|
128
|
+
private # Used by child
|
129
|
+
def current_user
|
130
|
+
user
|
131
|
+
end
|
132
|
+
|
127
133
|
# # TODO: Revise because it seems there is no justification for allowing owner to see any of the deleted entities, which include User, Guild, and Post
|
128
134
|
# private # Used by child
|
129
135
|
# def not_deleted_unless_owner_or_moderator?(&block)
|
@@ -4,7 +4,7 @@ json_ui_page json do |page|
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.header childViews: ->(header) do
|
7
|
-
header.tabBar width: 'matchParent', backgroundColor: '#ffca05', color: '#7f561b',
|
7
|
+
header.tabBar width: 'matchParent', backgroundColor: '#ffca05', color: '#7f561b', buttons: ->(menu) do
|
8
8
|
|
9
9
|
['FIRST', 'SECOND', 'THIRD'].each_with_index do |text, index|
|
10
10
|
menu.button text: text, disabled: params[:tab].to_i == index, onClick: ->(action) do
|
@@ -22,37 +22,6 @@ module Glib
|
|
22
22
|
|
23
23
|
def get(url, controller)
|
24
24
|
fetch(:get, url, controller)
|
25
|
-
|
26
|
-
# http_header = {
|
27
|
-
# 'Client-DeviceOS' => user[:device],
|
28
|
-
# 'Client-Version' => user[:version],
|
29
|
-
# }
|
30
|
-
|
31
|
-
# # Allow repeating urls because excluding them makes the test results really hard to analyze.
|
32
|
-
# # if history.include?(url)
|
33
|
-
|
34
|
-
# if url.blank?
|
35
|
-
# nil
|
36
|
-
# else
|
37
|
-
# @context.assert_match URI_REGEXP, url
|
38
|
-
# history << url
|
39
|
-
# @context.get url, params: {}, headers: http_header
|
40
|
-
# response = @context.response
|
41
|
-
# JsonCrawler::Router.log controller, url, response
|
42
|
-
# if (code = response.code.to_i) == 302
|
43
|
-
# redirect_uri = URI(response.headers['Location'])
|
44
|
-
# redirect_uri.query = [redirect_uri.query, "format=json"].compact.join('&')
|
45
|
-
# return get redirect_uri.to_s, controller
|
46
|
-
# else
|
47
|
-
# response_times << response.headers['X-Runtime'].to_f
|
48
|
-
# @context.assert_includes VALID_RESPONSE_CODES, code, "Expected a valid response but was [#{response.code}] #{Rack::Utils::HTTP_STATUS_CODES[response.code.to_i]}:\n#{url}"
|
49
|
-
# if response.content_type == 'application/json'
|
50
|
-
# JSON.parse(response.body)
|
51
|
-
# else
|
52
|
-
# nil
|
53
|
-
# end
|
54
|
-
# end
|
55
|
-
# end
|
56
25
|
end
|
57
26
|
|
58
27
|
def post(url, controller, params)
|