glib-web 0.5.3 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/concerns/glib/auth/policy.rb +0 -0
- data/app/controllers/concerns/glib/json/new_dynamic_text.rb +0 -0
- data/app/controllers/concerns/glib/json/traversal.rb +0 -0
- data/app/controllers/concerns/glib/json/ui.rb +7 -0
- data/app/controllers/glib/home_controller.rb +1 -1
- data/app/helpers/glib/app_feature_support_helper.rb +16 -0
- data/app/helpers/glib/dynamic_images_helper.rb +0 -0
- data/app/helpers/glib/dynamic_texts_helper.rb +0 -0
- data/app/helpers/glib/forms_helper.rb +0 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +9 -3
- data/app/helpers/glib/json_ui/action_builder.rb +36 -6
- data/app/helpers/glib/json_ui/action_builder/dialogs.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder/http.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder/sheets.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder/snackbars.rb +0 -0
- data/app/helpers/glib/json_ui/action_builder/windows.rb +1 -0
- data/app/helpers/glib/json_ui/generic_builders.rb +0 -0
- data/app/helpers/glib/json_ui/list_builders.rb +0 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +0 -0
- data/app/helpers/glib/json_ui/page_helper.rb +13 -5
- data/app/helpers/glib/json_ui/response_helper.rb +1 -1
- data/app/helpers/glib/json_ui/split_builders.rb +0 -0
- data/app/helpers/glib/json_ui/styling_helper.rb +22 -0
- data/app/helpers/glib/json_ui/table_builders.rb +0 -0
- data/app/helpers/glib/json_ui/view_builder.rb +16 -16
- data/app/helpers/glib/json_ui/view_builder/banners.rb +0 -0
- data/app/helpers/glib/json_ui/view_builder/fields.rb +9 -1
- data/app/helpers/glib/json_ui/view_builder/panels.rb +2 -0
- data/app/helpers/glib/urls_helper.rb +7 -0
- data/app/models/glib/active_storage/attachment.rb +0 -0
- data/app/models/glib/active_storage/blob.rb +0 -0
- data/app/models/glib/dynamic_text_record.rb +0 -0
- data/app/models/glib/text.rb +0 -0
- data/app/policies/glib/application_policy.rb +27 -30
- data/app/validators/email_typo_validator.rb +0 -0
- data/app/validators/email_validator.rb +0 -0
- data/app/validators/url_validator.rb +0 -0
- data/app/views/app/views/json_ui/vue/renderer.html.erb +0 -0
- data/app/views/json_ui/garage/_nav_menu.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/_dialogs.json.jbuilder +20 -14
- data/app/views/json_ui/garage/actions/_http.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/_reload.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/_sheets.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/_snackbars.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/_timeouts.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/_windows.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/dialogs_oauth_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/actions/index.json.jbuilder +2 -2
- data/app/views/json_ui/garage/forms/_alert_post_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/basic.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/basic_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/checkboxes.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/dynamic_group.json.jbuilder +9 -18
- data/app/views/json_ui/garage/forms/dynamic_select.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/dynamic_select_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/floating_submit.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/generic_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/get_request.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/pickers.json.jbuilder +6 -3
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/selects.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +20 -3
- data/app/views/json_ui/garage/forms/styled_boxes.json.jbuilder +4 -1
- data/app/views/json_ui/garage/forms/submission_flow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_flow_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_indicator.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/submission_indicator_post.json.jbuilder +0 -0
- data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +1 -1
- data/app/views/json_ui/garage/home/blank.json.jbuilder +0 -0
- data/app/views/json_ui/garage/home/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/home/slow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/_infinite_scroll_section.json.jbuilder +15 -5
- data/app/views/json_ui/garage/lists/edit_actions.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/fab.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/infinite_scroll.json.jbuilder +0 -0
- data/app/views/json_ui/garage/lists/templating.json.jbuilder +0 -0
- data/app/views/json_ui/garage/notifications/index.json.jbuilder +0 -43
- data/app/views/json_ui/garage/notifications/web_socket.json.jbuilder +19 -21
- data/app/views/json_ui/garage/pages/flat_centered.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/full_width.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/full_width_height.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/index.json.jbuilder +11 -0
- data/app/views/json_ui/garage/pages/layout.json.jbuilder +12 -13
- data/app/views/json_ui/garage/pages/loading_indicator.json.jbuilder +0 -0
- data/app/views/json_ui/garage/pages/nav_buttons.json.jbuilder +28 -16
- data/app/views/json_ui/garage/pages/nested_scroll.json.jbuilder +40 -0
- data/app/views/json_ui/garage/pages/tab_bar.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/_styled.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/card.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/carousel.json.jbuilder +24 -3
- data/app/views/json_ui/garage/panels/custom.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/flow.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/outlined.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/responsive.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/split.json.jbuilder +0 -0
- data/app/views/json_ui/garage/panels/vertical.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/dynamic_text.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/image.json.jbuilder +0 -0
- data/app/views/json_ui/garage/services/index.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/_autoload_section.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/autoload_all.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/autoload_as_needed.json.jbuilder +39 -0
- data/app/views/json_ui/garage/tables/export_import.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/horizontal_scroll.json.jbuilder +0 -0
- data/app/views/json_ui/garage/tables/index.json.jbuilder +3 -0
- data/app/views/json_ui/garage/tables/layout.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/_chart_data.json.jbuilder +1 -1
- data/app/views/json_ui/garage/views/banners.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/calendar_data.json.jbuilder +23 -27
- data/app/views/json_ui/garage/views/charts.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/icons.json.jbuilder +22 -0
- data/app/views/json_ui/garage/views/images.json.jbuilder +4 -4
- data/app/views/json_ui/garage/views/index.json.jbuilder +3 -3
- data/app/views/json_ui/garage/views/links.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/map_data.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/misc.json.jbuilder +0 -0
- data/app/views/json_ui/garage/views/texts.json.jbuilder +0 -0
- data/config/routes.rb +0 -0
- data/lib/generators/glib/install_generator.rb +0 -0
- data/lib/generators/templates/20191017062519_create_texts.rb +0 -0
- data/lib/generators/templates/20191024063257_add_scope_to_texts.rb +0 -0
- data/lib/generators/templates/20191112095018_add_lang_to_texts.rb +0 -0
- data/lib/generators/templates/20191126071051_create_active_storage_tables.active_storage.rb +0 -0
- data/lib/generators/templates/database.yml +0 -0
- data/lib/generators/templates/dynamic_text.rb +0 -0
- data/lib/glib-web.rb +0 -0
- data/lib/glib/crypt.rb +1 -1
- data/lib/glib/crypt/utils.rb +0 -0
- data/lib/glib/dynamic_text.rb +1 -1
- data/lib/glib/dynamic_text/config.rb +0 -0
- data/lib/glib/engine.rb +0 -0
- data/lib/glib/json_crawler.rb +1 -0
- data/lib/glib/json_crawler/action_crawler.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/action_http.rb +0 -0
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +1 -1
- data/lib/glib/json_crawler/action_crawlers/menu.rb +12 -0
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +1 -1
- data/lib/glib/json_crawler/action_crawlers/windows_open.rb +0 -0
- data/lib/glib/json_crawler/coverage.rb +0 -0
- data/lib/glib/json_crawler/http.rb +7 -4
- data/lib/glib/json_crawler/router.rb +2 -1
- data/lib/glib/test_helpers.rb +4 -4
- data/lib/glib/value.rb +0 -0
- data/lib/glib/version.rb +0 -0
- data/lib/tasks/db.rake +0 -0
- metadata +8 -3
- data/app/views/json_ui/garage/views/carousels.json.jbuilder +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8cb6ba9cc8312e05a50ed1179f7690b3dd985410
|
4
|
+
data.tar.gz: b896cd852f0f42fa7e5a198ff6d3a49f5fca037e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b151098400b68a0eea5271b0d513be08a527fb091668d25769375215d6975d2c71f10268d2303125c156fdba610cf8d6a965b6ec8eb9d3c18a61c32f5fc528f6
|
7
|
+
data.tar.gz: 030e32c03a9d1b4ad9b4141406d367b60de018b6ce7738eab0080ef5327a9b2958b363d84a182663bcaae9df4fa4b8b66554af4cbcc61a738cebc1d7511be292
|
File without changes
|
File without changes
|
File without changes
|
@@ -31,6 +31,13 @@ module Glib::Json::Ui
|
|
31
31
|
@__json_ui_activated
|
32
32
|
end
|
33
33
|
|
34
|
+
def json_ui_lifecycle_prop(name)
|
35
|
+
if (hash = json_transformation_start).is_a?(Hash)
|
36
|
+
hash[name] ||= { 'action' => 'runMultiple', 'childActions' => [] }
|
37
|
+
hash[name]['childActions']
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def __json_ui_start(options)
|
35
42
|
@__json_ui_activated = false
|
36
43
|
@__json_ui_rendering = nil
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Glib
|
2
|
+
module AppFeatureSupportHelper
|
3
|
+
def glib_app_feature_supported?(name, app_version, dictionary)
|
4
|
+
device = (app_device_os || :default).to_sym
|
5
|
+
|
6
|
+
version = dictionary[name.to_sym].try(:[], device)
|
7
|
+
except = dictionary[name.to_sym].try(:[], :except).try(:[], device)
|
8
|
+
|
9
|
+
!version.nil? && (version == :all || glib_app_version_gte(version, app_version)) && (except.nil? || except.to_s != app_version)
|
10
|
+
end
|
11
|
+
|
12
|
+
def glib_app_version_gte(feature_version, app_version)
|
13
|
+
app_version.blank? || Gem::Version.new(app_version) >= Gem::Version.new(feature_version)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -13,7 +13,7 @@ module Glib
|
|
13
13
|
str.slice(0,1).capitalize + str.slice(1..-1)
|
14
14
|
end
|
15
15
|
|
16
|
-
def add_singleton_element
|
16
|
+
def add_singleton_element(type, name, *args)
|
17
17
|
name_components = name.to_s.split('_')
|
18
18
|
json.set! type, "#{name_components.join('/')}" if type
|
19
19
|
args = [yield] if block_given?
|
@@ -22,7 +22,7 @@ module Glib
|
|
22
22
|
"#{self.class.name}::#{name_components.map{ |str| capitalize_first_letter_and_leave_others_alone(str) }.join('::')}".constantize.new(json, @page).props(*args)
|
23
23
|
end
|
24
24
|
|
25
|
-
def add_element_to_array
|
25
|
+
def add_element_to_array(type, name, *args)
|
26
26
|
json.child! do
|
27
27
|
add_singleton_element type, name, *args
|
28
28
|
end
|
@@ -69,6 +69,12 @@ module Glib
|
|
69
69
|
|
70
70
|
private
|
71
71
|
|
72
|
+
def self.any(propName)
|
73
|
+
define_method(propName) do |value|
|
74
|
+
json.set! propName, value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
72
78
|
def self.date(propName)
|
73
79
|
define_method(propName) do |value|
|
74
80
|
json.set! propName, value&.to_date
|
@@ -191,7 +197,7 @@ module Glib
|
|
191
197
|
json.set!(propName) do
|
192
198
|
if name
|
193
199
|
data[:material] ||= {}
|
194
|
-
data[:material][:name] = name
|
200
|
+
data[:material][:name] = name
|
195
201
|
end
|
196
202
|
|
197
203
|
if (material = data[:material])
|
@@ -1,8 +1,18 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonUi
|
3
3
|
class ActionBuilder < AbstractBuilder
|
4
|
-
def
|
5
|
-
|
4
|
+
def initialize(json, page, multiple)
|
5
|
+
super(json, page)
|
6
|
+
|
7
|
+
@multiple = multiple
|
8
|
+
end
|
9
|
+
|
10
|
+
def method_missing(m, *args)
|
11
|
+
if @multiple
|
12
|
+
add_element_to_array_v1 'action', m, *args
|
13
|
+
else
|
14
|
+
add_singleton_element_v1 'action', m, *args
|
15
|
+
end
|
6
16
|
end
|
7
17
|
|
8
18
|
class Action < JsonUiElement
|
@@ -38,19 +48,31 @@ module Glib
|
|
38
48
|
|
39
49
|
### Action definitions
|
40
50
|
|
51
|
+
class RunMultiple < Action
|
52
|
+
def childActions(block)
|
53
|
+
json.childActions do
|
54
|
+
block.call ActionBuilder.new(json, page, true)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
41
59
|
module Forms
|
42
60
|
class Submit < Action
|
43
61
|
end
|
44
|
-
|
45
62
|
end
|
46
63
|
|
47
|
-
# Consider deprecating this. See Data
|
48
64
|
module Auth
|
49
65
|
class SaveCsrfToken < Action
|
50
66
|
string :token
|
51
67
|
action :onSave
|
52
68
|
end
|
69
|
+
end
|
53
70
|
|
71
|
+
module Analytics
|
72
|
+
class LogEvent < Action
|
73
|
+
string :name
|
74
|
+
hash :params
|
75
|
+
end
|
54
76
|
end
|
55
77
|
|
56
78
|
module Timeouts
|
@@ -59,6 +81,10 @@ module Glib
|
|
59
81
|
action :onTimeout
|
60
82
|
end
|
61
83
|
|
84
|
+
# FUTURE
|
85
|
+
class Remove < Action
|
86
|
+
end
|
87
|
+
|
62
88
|
# FUTURE
|
63
89
|
class Clear < Action
|
64
90
|
end
|
@@ -66,11 +92,15 @@ module Glib
|
|
66
92
|
|
67
93
|
# FUTURE
|
68
94
|
module Data
|
69
|
-
class
|
70
|
-
string :
|
95
|
+
class Save < Action
|
96
|
+
string :key
|
97
|
+
string :value
|
71
98
|
action :onSave
|
72
99
|
end
|
73
100
|
|
101
|
+
class Remove < Action
|
102
|
+
end
|
103
|
+
|
74
104
|
class Clear < Action
|
75
105
|
end
|
76
106
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -35,11 +35,16 @@ module Glib
|
|
35
35
|
# json.attributes!
|
36
36
|
# end
|
37
37
|
|
38
|
-
def json_ui_section(json
|
38
|
+
def json_ui_section(json)
|
39
39
|
@__json_ui_section ||= Page.new(json, self)
|
40
40
|
@__json_ui_section.list_section_builder
|
41
41
|
end
|
42
42
|
|
43
|
+
def json_ui_action(json)
|
44
|
+
@__json_ui_section ||= Page.new(json, self)
|
45
|
+
@__json_ui_section.action_builder
|
46
|
+
end
|
47
|
+
|
43
48
|
class Page
|
44
49
|
attr_reader :json, :context, :view_builder, :action_builder, :menu_builder
|
45
50
|
attr_reader :list_section_builder, :table_section_builder, :drawer_content_builder, :split_content_builder
|
@@ -52,7 +57,7 @@ module Glib
|
|
52
57
|
@context = context
|
53
58
|
|
54
59
|
@view_builder = ViewBuilder.new(json, self, true)
|
55
|
-
@action_builder = ActionBuilder.new(json, self)
|
60
|
+
@action_builder = ActionBuilder.new(json, self, false)
|
56
61
|
@menu_builder = MenuBuilder.new(json, self)
|
57
62
|
|
58
63
|
@list_section_builder = ListBuilders::Section.new(json, self, ListBuilders::Template.new(json, self))
|
@@ -99,9 +104,12 @@ module Glib
|
|
99
104
|
# options[:leftItems]&.call @menu_builder
|
100
105
|
# end
|
101
106
|
# json.logoUrl "http://localhost:3000/assets/logo_dark-02d9b6a91fdbf22515da7b921d31367b70696214415f6789d2f90232e4a287b7.svg"
|
102
|
-
|
103
|
-
|
104
|
-
|
107
|
+
|
108
|
+
# json.rightItems do
|
109
|
+
# options[:rightItems]&.call @menu_builder
|
110
|
+
# end
|
111
|
+
|
112
|
+
@view_builder.add_singleton_view('appBar', options)
|
105
113
|
end
|
106
114
|
end
|
107
115
|
|
File without changes
|
@@ -1,6 +1,9 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonUi
|
3
3
|
module StylingHelper
|
4
|
+
|
5
|
+
### Padding
|
6
|
+
|
4
7
|
def glib_json_padding_body
|
5
8
|
{ top: 12, left: 20, right: 20, bottom: 12 }
|
6
9
|
end
|
@@ -9,6 +12,12 @@ module Glib
|
|
9
12
|
{ top: 12, bottom: 12, left: 16, right: 16 }
|
10
13
|
end
|
11
14
|
|
15
|
+
###
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
### Image
|
20
|
+
|
12
21
|
def glib_json_image_standard_url
|
13
22
|
'https://cdn-images-1.medium.com/max/1200/1*Qc0XxYm-qAZL-7tjjlNfrg.png'
|
14
23
|
end
|
@@ -20,6 +29,19 @@ module Glib
|
|
20
29
|
def glib_json_image_blob_key
|
21
30
|
'o6CKzNt67PWnkPdUEnWMt7pr'
|
22
31
|
end
|
32
|
+
|
33
|
+
###
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
### Color
|
38
|
+
|
39
|
+
def glib_color_panel_background
|
40
|
+
'#b3bac2'
|
41
|
+
end
|
42
|
+
|
43
|
+
###
|
44
|
+
|
23
45
|
end
|
24
46
|
end
|
25
47
|
end
|
File without changes
|
@@ -15,6 +15,10 @@ module Glib
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
def add_singleton_view(name, *args)
|
19
|
+
add_singleton_element 'view', name, *args
|
20
|
+
end
|
21
|
+
|
18
22
|
def method_missing(m, *args)
|
19
23
|
add_view m, *args
|
20
24
|
end
|
@@ -152,26 +156,22 @@ module Glib
|
|
152
156
|
block.call page.menu_builder
|
153
157
|
end
|
154
158
|
end
|
159
|
+
end
|
155
160
|
|
156
|
-
|
157
|
-
|
158
|
-
# json.tabButtons do
|
159
|
-
# block.call page.menu_builder
|
160
|
-
# end
|
161
|
-
# end
|
162
|
-
|
163
|
-
# def options(options)
|
164
|
-
# current_url = page.context.request.base_url + page.context.request.fullpath
|
161
|
+
class AppBar < View
|
162
|
+
color :color
|
165
163
|
|
166
|
-
#
|
167
|
-
#
|
168
|
-
#
|
169
|
-
# action.windows_reload url: tab[:url]
|
170
|
-
# end
|
171
|
-
# end
|
164
|
+
# def leftButtons(block)
|
165
|
+
# json.leftButtons do
|
166
|
+
# block.call page.menu_builder
|
172
167
|
# end
|
173
168
|
# end
|
174
169
|
|
170
|
+
def rightButtons(block)
|
171
|
+
json.rightButtons do
|
172
|
+
block.call page.menu_builder
|
173
|
+
end
|
174
|
+
end
|
175
175
|
end
|
176
176
|
|
177
177
|
class Datetime < View
|
@@ -182,4 +182,4 @@ module Glib
|
|
182
182
|
|
183
183
|
end
|
184
184
|
end
|
185
|
-
end
|
185
|
+
end
|
File without changes
|
@@ -103,7 +103,15 @@ class Glib::JsonUi::ViewBuilder
|
|
103
103
|
end
|
104
104
|
|
105
105
|
class Check < Text
|
106
|
-
|
106
|
+
any :uncheckValue
|
107
|
+
any :checkValue
|
108
|
+
|
109
|
+
|
110
|
+
def value(value)
|
111
|
+
@value = value if value != Glib::Value::DEFAULT
|
112
|
+
end
|
113
|
+
|
114
|
+
# Where possible, use value instead of this
|
107
115
|
bool :checked
|
108
116
|
end
|
109
117
|
|
File without changes
|
File without changes
|
File without changes
|
data/app/models/glib/text.rb
CHANGED
File without changes
|
@@ -113,41 +113,17 @@ module Glib
|
|
113
113
|
controller.policy_scope(record.class, policy_scope_class: policy_scope_class)
|
114
114
|
end
|
115
115
|
|
116
|
-
# TODO: Remove. Deprecated
|
117
|
-
private # Used by child
|
118
|
-
def public?
|
119
|
-
true
|
120
|
-
end
|
121
|
-
|
122
|
-
private # Used by child
|
123
|
-
def everyone
|
124
|
-
true
|
125
|
-
end
|
126
|
-
|
127
|
-
# TODO: Deprecate `user()`
|
128
|
-
private # Used by child
|
129
|
-
def current_user
|
130
|
-
user
|
131
|
-
end
|
132
|
-
|
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
|
134
|
-
# private # Used by child
|
135
|
-
# def not_deleted_unless_owner_or_moderator?(&block)
|
136
|
-
# block ||= lambda { |unused_arg| @user.moderator? }
|
137
|
-
# !@record.deleted? || (@user && (@user.id == @record.user_owner_id || block.call(@record)))
|
138
|
-
# end
|
139
|
-
|
140
|
-
# private # Used by child
|
141
|
-
# def not_deleted_unless_moderator?(&block)
|
142
|
-
# block ||= lambda { |unused_arg| @user.moderator? }
|
143
|
-
# !@record.deleted? || (@user && block.call(@record))
|
144
|
-
# end
|
145
|
-
|
146
116
|
public
|
147
117
|
def self.args_builder
|
148
118
|
Proc.new { |controller| [] }
|
149
119
|
end
|
150
120
|
|
121
|
+
# TODO: Remove. Deprecated
|
122
|
+
# private # Used by child
|
123
|
+
# def public?
|
124
|
+
# true
|
125
|
+
# end
|
126
|
+
|
151
127
|
class Scope
|
152
128
|
attr_reader :user, :scope
|
153
129
|
|
@@ -156,9 +132,30 @@ module Glib
|
|
156
132
|
@scope = scope
|
157
133
|
end
|
158
134
|
|
135
|
+
# def current_user
|
136
|
+
# user
|
137
|
+
# end
|
138
|
+
|
139
|
+
# To be overridden
|
159
140
|
def resolve
|
160
141
|
scope.none
|
161
142
|
end
|
162
143
|
end
|
144
|
+
|
145
|
+
private # Used by child
|
146
|
+
def everyone
|
147
|
+
true
|
148
|
+
end
|
149
|
+
|
150
|
+
# def current_user
|
151
|
+
# user
|
152
|
+
# end
|
153
|
+
|
154
|
+
# TODO: Bad pattern. Implement explicit policy parameter instead.
|
155
|
+
# - E.g. can? :destroy, :service_subscription_auto_renewal, { service_subscription: @service_subscription }
|
156
|
+
# - E.g. super class: :service_subscription_auto_renewal, { service_subscription: @service_subscription }
|
157
|
+
def controller_var(name)
|
158
|
+
controller.instance_variable_get(:"@#{name}")
|
159
|
+
end
|
163
160
|
end
|
164
161
|
end
|