glib-web 0.5.2 → 0.5.8
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 +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/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 +2 -2
- data/app/helpers/glib/json_ui/action_builder.rb +0 -0
- 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 +5 -0
- data/app/helpers/glib/json_ui/menu_builder.rb +0 -0
- data/app/helpers/glib/json_ui/page_helper.rb +27 -19
- data/app/helpers/glib/json_ui/response_helper.rb +0 -0
- 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 +3 -0
- 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 +21 -12
- 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 +6 -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 +25 -10
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +5 -5
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +10 -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: d3229621ccc977c76e4adc70e1ab7271a76daf08
|
|
4
|
+
data.tar.gz: fa4e7c9f17a1d9c6b6cd770771730e13f583eb7e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2c1cf1ee7207ee7fa8276d6e94df95a6079bc011f429a0d9ca87a1305e4bb7201da04d13cda66de0c5872e7e1604374065dd307144e8e8d3110fcae424d5ae9f
|
|
7
|
+
data.tar.gz: '09fb824243fc37c0cd3ce3d6f0d0b6a85944ab02fa5b88383df8be9ff93394608fc1e0c394b9eadfa7fa51dbd854da3e8cf7ee4ed1da2895cfcdec06509a731e'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -17,22 +17,27 @@ 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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
+
|
|
38
|
+
def json_ui_section(json, &block)
|
|
39
|
+
@__json_ui_section ||= Page.new(json, self)
|
|
40
|
+
@__json_ui_section.list_section_builder
|
|
36
41
|
end
|
|
37
42
|
|
|
38
43
|
class Page
|
|
@@ -94,9 +99,12 @@ module Glib
|
|
|
94
99
|
# options[:leftItems]&.call @menu_builder
|
|
95
100
|
# end
|
|
96
101
|
# json.logoUrl "http://localhost:3000/assets/logo_dark-02d9b6a91fdbf22515da7b921d31367b70696214415f6789d2f90232e4a287b7.svg"
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
|
|
103
|
+
# json.rightItems do
|
|
104
|
+
# options[:rightItems]&.call @menu_builder
|
|
105
|
+
# end
|
|
106
|
+
|
|
107
|
+
@view_builder.add_singleton_view('appBar', options)
|
|
100
108
|
end
|
|
101
109
|
end
|
|
102
110
|
|
|
File without changes
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -79,17 +79,26 @@ section.rows builder: ->(template) do
|
|
|
79
79
|
end
|
|
80
80
|
|
|
81
81
|
template.thumbnail title: 'dialogs/oauth', onClick: ->(action) do
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
action.
|
|
82
|
+
if respond_to?(:user_facebook_omniauth_authorize_url)
|
|
83
|
+
provider = {
|
|
84
|
+
name: 'facebook',
|
|
85
|
+
webRequestUrl: user_facebook_omniauth_authorize_url(format: nil, _render: nil),
|
|
86
|
+
requestUrl: user_facebook_omniauth_authorize_url(format: nil),
|
|
87
|
+
clientId: Devise.omniauth_configs[:facebook].strategy[:client_id],
|
|
88
|
+
permissions: Devise.omniauth_configs[:facebook].strategy[:scope],
|
|
89
|
+
redirectUrl: user_facebook_omniauth_callback_url(format: nil)
|
|
90
|
+
}
|
|
91
|
+
action.dialogs_oauth provider: provider, providerParamName: 'session[oauth_provider]', callbackUrlParamName: 'session[[oauth_callback_url]', onSuccess: ->(subaction) do
|
|
92
|
+
subaction.http_post url: json_ui_garage_url(path: 'actions/dialogs_oauth_post'), formData: {
|
|
93
|
+
authenticity_token: form_authenticity_token
|
|
94
|
+
}
|
|
95
|
+
end
|
|
96
|
+
else
|
|
97
|
+
action.dialogs_alert message: 'To enable this, set up omniauth using devise'
|
|
98
|
+
# E.g.
|
|
99
|
+
# Add `devise :omniauthable, omniauth_providers: %i[facebook]` to user.rb
|
|
100
|
+
# Add `gem 'omniauth-facebook'` to Gemfile
|
|
101
|
+
# Add `config.omniauth :facebook` to devise.rb
|
|
92
102
|
end
|
|
93
103
|
end
|
|
94
|
-
|
|
95
|
-
end
|
|
104
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|