card-mod-layout 0.16.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/admin.yml +10 -0
- data/set/abstract/items/options_api.rb +85 -0
- data/set/abstract/items.rb +8 -0
- data/set/all/modal.rb +28 -29
- data/set/all/process_layout.rb +25 -35
- data/set/right/enabled_roles.rb +4 -4
- data/set/right/head.rb +2 -2
- data/set/right/layout.rb +4 -0
- data/set/self/account_links.rb +2 -2
- data/set/self/head.rb +3 -0
- metadata +15 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312f14d0e2d9cff16ea45cd52f0c5912d4a88150bd2b9c2ed9035772d7c36775
|
4
|
+
data.tar.gz: 28e9728f028b3c088ebf45eaf4c94d91a307954a06352e8f6af422c487e547cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f843062447f1586b31c359b929130f9671ad08c0b1ccafa67e793bf734c184aa0eb297490df915e4da353ed12fc80ffcec6afcd4dfa8d443cfe72469cf1860d5
|
7
|
+
data.tar.gz: f7d4d86b5de8757cd09348d163acdfb6c65bc3b6101737b8e1d9d5a8b095b018092babb18f978b2d8068d0b881a15282390a74a00f15a05feffec58d7012ee3b
|
data/config/admin.yml
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# TODO: some of this should be moved to right/options!!
|
2
|
+
# or to type/JSON?
|
3
|
+
|
4
|
+
def options_hash
|
5
|
+
json_options? ? options_card.parse_content : option_hash_from_names
|
6
|
+
end
|
7
|
+
|
8
|
+
def json_options?
|
9
|
+
options_card&.type_id == JsonID
|
10
|
+
end
|
11
|
+
|
12
|
+
def option_hash_from_names
|
13
|
+
option_names.each_with_object({}) do |name, hash|
|
14
|
+
hash[name] = name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def option_names
|
19
|
+
if (selected_options = item_names)
|
20
|
+
(standard_option_names + selected_options).uniq
|
21
|
+
else
|
22
|
+
standard_option_names
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def option_cards
|
27
|
+
option_names.map do |name|
|
28
|
+
Card.fetch name, new: {}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def standard_option_names
|
33
|
+
if json_options?
|
34
|
+
options_hash.values.map(&:to_name)
|
35
|
+
else
|
36
|
+
option_names_from_items
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def option_names_from_items
|
41
|
+
o_card = options_card
|
42
|
+
limit = o_card.try(:default_limit).to_i
|
43
|
+
context_name = right_type? ? nil : name
|
44
|
+
o_card.item_names context: context_name, limit: limit
|
45
|
+
end
|
46
|
+
|
47
|
+
def options_card
|
48
|
+
@options_card ||= rule_card(:content_options) || right_type_options || Card[:all]
|
49
|
+
end
|
50
|
+
|
51
|
+
def options_card_name
|
52
|
+
options_card&.name&.url_key
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def right_type_options
|
58
|
+
Card.fetch [right.name, :type, :by_name] if right_type?
|
59
|
+
end
|
60
|
+
|
61
|
+
def right_type?
|
62
|
+
right&.type_id == CardtypeID
|
63
|
+
end
|
64
|
+
|
65
|
+
format do
|
66
|
+
delegate :options_card, :options_card_name, to: :card
|
67
|
+
end
|
68
|
+
|
69
|
+
format :html do
|
70
|
+
def option_label option_name, id
|
71
|
+
wrap_with :label, class: "form-check-label", for: id do
|
72
|
+
option_label_text option_name
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def option_view
|
77
|
+
@option_view ||= card.rule(:content_option_view) || :smart_label
|
78
|
+
end
|
79
|
+
|
80
|
+
def option_label_text option_name
|
81
|
+
return option_name unless (option_card = Card.fetch option_name)
|
82
|
+
|
83
|
+
nest option_card, view: option_view
|
84
|
+
end
|
85
|
+
end
|
data/set/abstract/items.rb
CHANGED
data/set/all/modal.rb
CHANGED
@@ -16,24 +16,9 @@ format :html do
|
|
16
16
|
""
|
17
17
|
end
|
18
18
|
|
19
|
-
def show_in_modal_link link_text, body
|
20
|
-
link_to_view :modal, link_text, "data-modal-body": body, "data-slotter-mode": "modal"
|
21
|
-
end
|
22
|
-
|
23
|
-
def modal_close_button link_text="Close", opts={}
|
24
|
-
classes = opts.delete(:class)
|
25
|
-
button_opts = opts.merge(MODAL_CLOSE_OPTS)
|
26
|
-
add_class button_opts, classes if classes
|
27
|
-
button_tag link_text, button_opts
|
28
|
-
end
|
29
|
-
|
30
|
-
def modal_submit_button opts={}
|
31
|
-
add_class opts, "submit-button _close-modal"
|
32
|
-
submit_button opts
|
33
|
-
end
|
34
|
-
|
35
19
|
view :modal_menu, unknown: true, wrap: :modal_menu do
|
36
|
-
[
|
20
|
+
[render_close_modal_link,
|
21
|
+
render_pop_out_modal_link(optional: :show)]
|
37
22
|
end
|
38
23
|
|
39
24
|
wrapper :modal_menu, :div, class: "modal-menu _modal-menu ms-auto"
|
@@ -52,6 +37,32 @@ format :html do
|
|
52
37
|
modal_link _render_title, size: voo.size
|
53
38
|
end
|
54
39
|
|
40
|
+
view :close_modal_link, unknown: true do
|
41
|
+
link_to icon_tag(:close), path: "",
|
42
|
+
class: "_close-modal btn-close",
|
43
|
+
"data-bs-dismiss": "modal"
|
44
|
+
end
|
45
|
+
|
46
|
+
view :pop_out_modal_link, unknown: :blank do
|
47
|
+
link_to icon_tag(:modal), path: {}, class: "pop-out-modal btn-close"
|
48
|
+
end
|
49
|
+
|
50
|
+
def show_in_modal_link link_text, body
|
51
|
+
link_to_view :modal, link_text, "data-modal-body": body, "data-slotter-mode": "modal"
|
52
|
+
end
|
53
|
+
|
54
|
+
def modal_close_button link_text="Close", opts={}
|
55
|
+
classes = opts.delete(:class)
|
56
|
+
button_opts = opts.merge(MODAL_CLOSE_OPTS)
|
57
|
+
add_class button_opts, classes if classes
|
58
|
+
button_tag link_text, button_opts
|
59
|
+
end
|
60
|
+
|
61
|
+
def modal_submit_button opts={}
|
62
|
+
add_class opts, "submit-button _close-modal"
|
63
|
+
submit_button opts
|
64
|
+
end
|
65
|
+
|
55
66
|
def modal_link text=nil, opts={}
|
56
67
|
opts = modal_link_opts(opts)
|
57
68
|
opts[:path][:layout] ||= :modal
|
@@ -87,18 +98,6 @@ format :html do
|
|
87
98
|
size.in?(MODAL_SIZE.keys) ? size : cast_modal_option(size)
|
88
99
|
end
|
89
100
|
|
90
|
-
def close_modal_window
|
91
|
-
link_to icon_tag(:close), path: "",
|
92
|
-
class: "_close-modal btn-close",
|
93
|
-
"data-bs-dismiss": "modal"
|
94
|
-
end
|
95
|
-
|
96
|
-
def pop_out_modal_window
|
97
|
-
return unless card.known?
|
98
|
-
|
99
|
-
link_to icon_tag(:modal), path: {}, class: "pop-out-modal btn-close"
|
100
|
-
end
|
101
|
-
|
102
101
|
private
|
103
102
|
|
104
103
|
def normalize_modal_option key, opts
|
data/set/all/process_layout.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
|
+
basket[:cache_seed_names] << %i[all layout]
|
2
|
+
|
1
3
|
format :html do
|
2
|
-
#
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
# for override
|
5
|
+
def layout_for_view _view
|
6
|
+
nil
|
7
|
+
end
|
8
|
+
|
9
|
+
# public for testing
|
10
|
+
def explicit_modal_wrapper? view
|
11
|
+
return unless (wrap_view = view_setting :wrap, view)
|
12
|
+
|
13
|
+
(wrapper_names(wrap_view) & %i[modal board]).any?
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
6
17
|
|
7
18
|
def show_with_page_layout view, args
|
8
19
|
main!
|
@@ -19,35 +30,10 @@ format :html do
|
|
19
30
|
params[:layout] || layout_for_view(view) || layout_name_from_rule || :default
|
20
31
|
end
|
21
32
|
|
22
|
-
|
23
|
-
|
24
|
-
nil
|
25
|
-
end
|
26
|
-
|
27
|
-
def render_with_layout view, layout, args={}
|
28
|
-
view_opts = Layout.main_nest_opts(layout, self)
|
29
|
-
view ||= view_opts.delete(:view) || default_page_view
|
30
|
-
view_opts[:home_view] = view
|
31
|
-
view_opts[:layout] = layout
|
32
|
-
render! view, view_opts.reverse_merge(args)
|
33
|
-
end
|
34
|
-
|
35
|
-
def default_page_view
|
36
|
-
default_nest_view
|
37
|
-
end
|
38
|
-
|
39
|
-
def show_layout?
|
40
|
-
!Env.ajax? || params[:layout]
|
41
|
-
end
|
42
|
-
|
43
|
-
def explicit_modal_wrapper? view
|
44
|
-
return unless (wrap_view = view_setting :wrap, view)
|
45
|
-
|
46
|
-
(wrapper_names(wrap_view) & %i[modal board]).any?
|
33
|
+
def layout_name_from_rule
|
34
|
+
card.rule_card(:layout)&.try :first_name
|
47
35
|
end
|
48
36
|
|
49
|
-
private
|
50
|
-
|
51
37
|
def main_render_args view, args
|
52
38
|
args[:view] = view if view
|
53
39
|
args[:main] = true
|
@@ -55,15 +41,19 @@ format :html do
|
|
55
41
|
args
|
56
42
|
end
|
57
43
|
|
58
|
-
def layout_name_from_rule
|
59
|
-
card.rule_card(:layout)&.try :first_name
|
60
|
-
end
|
61
|
-
|
62
44
|
def render_outside_of_layout view, args
|
63
45
|
body = render_with_layout nil, page_layout(view), {}
|
64
46
|
body_with_modal body, render!(view, args)
|
65
47
|
end
|
66
48
|
|
49
|
+
def render_with_layout view, layout, args={}
|
50
|
+
view_opts = Layout.main_nest_opts(layout, self)
|
51
|
+
view ||= view_opts.delete(:view) || default_page_view
|
52
|
+
view_opts[:home_view] = view
|
53
|
+
view_opts[:layout] = layout
|
54
|
+
render! view, view_opts.reverse_merge(args)
|
55
|
+
end
|
56
|
+
|
67
57
|
def body_with_modal body, modal
|
68
58
|
if body.include? "</body>"
|
69
59
|
# a bit hacky
|
data/set/right/enabled_roles.rb
CHANGED
@@ -2,15 +2,15 @@ include_set Abstract::AccountDropdown
|
|
2
2
|
|
3
3
|
assign_type :session
|
4
4
|
|
5
|
-
def ok_to_read
|
5
|
+
def ok_to_read?
|
6
6
|
true
|
7
7
|
end
|
8
8
|
|
9
|
-
def ok_to_update
|
9
|
+
def ok_to_update?
|
10
10
|
left_id == Auth.current_id
|
11
11
|
end
|
12
12
|
|
13
|
-
def ok_to_create
|
13
|
+
def ok_to_create?
|
14
14
|
left_id == Auth.current_id
|
15
15
|
end
|
16
16
|
|
@@ -26,7 +26,7 @@ event :validate_role_enabling, :validate, on: :save do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
event :clear_roles_cache, :prepare_to_store, before: :store_in_session do
|
29
|
-
clear_roles
|
29
|
+
Auth.current.clear_roles
|
30
30
|
Auth.update_always_cache nil
|
31
31
|
end
|
32
32
|
|
data/set/right/head.rb
CHANGED
data/set/right/layout.rb
CHANGED
data/set/self/account_links.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
include_set Abstract::AccountDropdown
|
2
2
|
|
3
|
-
def ok_to_read
|
3
|
+
def ok_to_read?
|
4
4
|
true
|
5
5
|
end
|
6
6
|
|
@@ -72,7 +72,7 @@ format :html do
|
|
72
72
|
|
73
73
|
def can_disable_roles?
|
74
74
|
Auth.current_roles.size > 1 &&
|
75
|
-
Card::Codename.
|
75
|
+
Card::Codename.exist?(:enabled_roles) # workaround for broken migrations
|
76
76
|
end
|
77
77
|
|
78
78
|
def account_link_text purpose
|
data/set/self/head.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-layout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan McCutchen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,56 +18,56 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.108.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 1.
|
28
|
+
version: 1.108.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-account
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.18.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.18.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: card-mod-session
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.18.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.18.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: card-mod-tabs
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.18.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.18.0
|
71
71
|
description: ''
|
72
72
|
email:
|
73
73
|
- info@decko.org
|
@@ -83,6 +83,7 @@ files:
|
|
83
83
|
- assets/style/layout.scss
|
84
84
|
- assets/style/modal.scss
|
85
85
|
- assets/style/overlay.scss
|
86
|
+
- config/admin.yml
|
86
87
|
- config/locales/de.yml
|
87
88
|
- config/locales/en.yml
|
88
89
|
- data/files/mod_layout_script_asset_output/file.js
|
@@ -96,6 +97,7 @@ files:
|
|
96
97
|
- lib/card/layout/unknown_layout.rb
|
97
98
|
- set/abstract/account_dropdown.rb
|
98
99
|
- set/abstract/items.rb
|
100
|
+
- set/abstract/items/options_api.rb
|
99
101
|
- set/abstract/list.rb
|
100
102
|
- set/all/alert.rb
|
101
103
|
- set/all/layouts.rb
|
@@ -121,7 +123,7 @@ files:
|
|
121
123
|
- set/type/layout_type.rb
|
122
124
|
homepage: https://decko.org
|
123
125
|
licenses:
|
124
|
-
- GPL-3.0
|
126
|
+
- GPL-3.0-or-later
|
125
127
|
metadata:
|
126
128
|
source_code_uri: https://github.com/decko-commons/decko
|
127
129
|
homepage_uri: https://decko.org
|
@@ -138,14 +140,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
140
|
requirements:
|
139
141
|
- - ">="
|
140
142
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
143
|
+
version: '3.0'
|
142
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
145
|
requirements:
|
144
146
|
- - ">="
|
145
147
|
- !ruby/object:Gem::Version
|
146
148
|
version: '0'
|
147
149
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
150
|
+
rubygems_version: 3.5.7
|
149
151
|
signing_key:
|
150
152
|
specification_version: 4
|
151
153
|
summary: decko layouts
|