card-mod-layout 0.11.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/card/layout.rb +6 -5
- data/lib/card/layout/unknown_layout.rb +4 -4
- data/set/abstract/account_dropdown.rb +2 -4
- data/set/all/modal.rb +1 -0
- data/set/all/overlay.rb +7 -10
- data/set/all/process_layout.rb +31 -29
- data/set/all/tabs.rb +1 -0
- data/set/right/head.rb +2 -0
- data/set/self/account_links.rb +3 -3
- data/set/self/foot.rb +0 -1
- data/set/self/head.rb +1 -1
- data/set/type/layout_type.rb +2 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aebbcb41a5e7d109b07b38006e366d18e82873032e0e0032c87fabaaa324144
|
4
|
+
data.tar.gz: 15e513bbbb39276828cd20a8cf5ca21893d43bd92c9fa9a5be09aafcab2bd97c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0caf1aae59a7c90349ebffd38aba724a6c7b2fd73df58681eff1019546b2f7f86ceb28ef764a654f64b2725fbb3764c0243079283963c3831c830dd2babca98c
|
7
|
+
data.tar.gz: 9260c99fcd0fdc641bc1cd5e58f032ca5a867ba0f54cf2d8cfb36c1d180e9ffb5e8e072ea1603129012efef2ddb608e6dbf596e76f6669bd64e117d2461552f9
|
data/lib/card/layout.rb
CHANGED
@@ -7,18 +7,18 @@ class Card
|
|
7
7
|
|
8
8
|
def layout_class layout
|
9
9
|
if layout.respond_to? :call
|
10
|
-
|
10
|
+
ProcLayout
|
11
11
|
elsif card_layout? layout
|
12
|
-
|
12
|
+
CardLayout
|
13
13
|
elsif code_layout? layout
|
14
|
-
|
14
|
+
CodeLayout
|
15
15
|
else
|
16
|
-
|
16
|
+
UnknownLayout
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
def card_layout? name
|
21
|
-
Card.fetch_type_id(name).in? [
|
21
|
+
Card.fetch_type_id(name).in? [LayoutTypeID, HtmlID, BasicID]
|
22
22
|
rescue ArgumentError, Card::Error::CodenameNotFound => _e
|
23
23
|
false
|
24
24
|
end
|
@@ -40,6 +40,7 @@ class Card
|
|
40
40
|
|
41
41
|
def layout_key name
|
42
42
|
return name if name.is_a? Symbol
|
43
|
+
|
43
44
|
name.to_name.key.to_sym
|
44
45
|
end
|
45
46
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
class Card
|
2
2
|
class Layout
|
3
3
|
class UnknownLayout < Layout
|
4
|
+
delegate :t, to: Cardio
|
5
|
+
|
4
6
|
def render
|
5
7
|
@format.output [header, text]
|
6
8
|
end
|
7
9
|
|
8
10
|
def header
|
9
|
-
@format.content_tag :h1,
|
10
|
-
scope: "card-mod-format", name: @layout)
|
11
|
+
@format.content_tag :h1, t(:layout_unknown_layout, name: @layout)
|
11
12
|
end
|
12
13
|
|
13
14
|
def text
|
14
|
-
|
15
|
-
available_layouts: self.class.built_in_layouts)
|
15
|
+
t :layout_available_layouts, available_layouts: self.class.built_in_layouts
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/set/all/modal.rb
CHANGED
data/set/all/overlay.rb
CHANGED
@@ -59,8 +59,7 @@ format :html do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def overlay_delete_button
|
62
|
-
|
63
|
-
delete_button opts
|
62
|
+
delete_button OVERLAY_CLOSE_OPTS.merge(success: {})
|
64
63
|
end
|
65
64
|
|
66
65
|
def overlay_save_and_close_button
|
@@ -80,25 +79,23 @@ format :html do
|
|
80
79
|
header_wrap [title, _render_overlay_menu]
|
81
80
|
end
|
82
81
|
|
83
|
-
def overlay_frame slot=true, header=render_overlay_header, slot_opts=nil
|
82
|
+
def overlay_frame slot=true, header=render_overlay_header, slot_opts=nil, &block
|
84
83
|
slot_opts ||= {}
|
85
84
|
overlay_framer slot, header, slot_opts do
|
86
|
-
wrap_body
|
85
|
+
wrap_body(&block)
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
90
|
-
def haml_overlay_frame slot=true, header=render_overlay_header
|
89
|
+
def haml_overlay_frame slot=true, header=render_overlay_header, &block
|
91
90
|
overlay_framer slot, header, {} do
|
92
|
-
haml_wrap_body
|
91
|
+
haml_wrap_body(&block)
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
96
95
|
private
|
97
96
|
|
98
|
-
def overlay_framer slot, header, slot_opts
|
97
|
+
def overlay_framer slot, header, slot_opts, &block
|
99
98
|
class_up "card-slot", "_overlay"
|
100
|
-
with_frame slot, header, slot_opts
|
101
|
-
yield
|
102
|
-
end
|
99
|
+
with_frame slot, header, slot_opts, &block
|
103
100
|
end
|
104
101
|
end
|
data/set/all/process_layout.rb
CHANGED
@@ -14,13 +14,6 @@ format :html do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def main_render_args view, args
|
18
|
-
args[:view] = view if view
|
19
|
-
args[:main] = true
|
20
|
-
args[:main_view] = true
|
21
|
-
args
|
22
|
-
end
|
23
|
-
|
24
17
|
def page_layout
|
25
18
|
params[:layout] || layout_name_from_rule || :default
|
26
19
|
end
|
@@ -33,28 +26,43 @@ format :html do
|
|
33
26
|
render! view, view_opts.reverse_merge(args)
|
34
27
|
end
|
35
28
|
|
36
|
-
def render_outside_of_layout view, args
|
37
|
-
body = render_with_layout(nil, page_layout, {})
|
38
|
-
modal = render!(view, args)
|
39
|
-
if body.include?("</body>")
|
40
|
-
# a bit hacky
|
41
|
-
# the problem is that the body tag has to be in the layout
|
42
|
-
# so that you can add layout css classes like <body class="right-sidebar">
|
43
|
-
body.sub!("</body>", "#{modal}</body>")
|
44
|
-
else
|
45
|
-
body += modal
|
46
|
-
end
|
47
|
-
body
|
48
|
-
end
|
49
|
-
|
50
29
|
def show_layout?
|
51
30
|
!Env.ajax? || params[:layout]
|
52
31
|
end
|
53
32
|
|
54
33
|
def explicit_modal_wrapper? view
|
55
|
-
return unless view_setting
|
34
|
+
return unless (wrap_view = view_setting :wrap, view)
|
35
|
+
|
36
|
+
(wrapper_names(wrap_view) & %i[modal bridge]).any?
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def main_render_args view, args
|
42
|
+
args[:view] = view if view
|
43
|
+
args[:main] = true
|
44
|
+
args[:main_view] = true
|
45
|
+
args
|
46
|
+
end
|
47
|
+
|
48
|
+
def layout_name_from_rule
|
49
|
+
card.rule_card(:layout)&.try :item_name
|
50
|
+
end
|
51
|
+
|
52
|
+
def render_outside_of_layout view, args
|
53
|
+
body = render_with_layout nil, page_layout, {}
|
54
|
+
body_with_modal body, render!(view, args)
|
55
|
+
end
|
56
56
|
|
57
|
-
|
57
|
+
def body_with_modal body, modal
|
58
|
+
if body.include? "</body>"
|
59
|
+
# a bit hacky
|
60
|
+
# the problem is that the body tag has to be in the layout
|
61
|
+
# so that you can add layout css classes like <body class="right-sidebar">
|
62
|
+
body.sub "</body>", "#{modal}</body>"
|
63
|
+
else
|
64
|
+
body + modal
|
65
|
+
end
|
58
66
|
end
|
59
67
|
|
60
68
|
def wrapper_names wrappers
|
@@ -65,12 +73,6 @@ format :html do
|
|
65
73
|
end
|
66
74
|
end
|
67
75
|
|
68
|
-
def layout_name_from_rule
|
69
|
-
card.rule_card(:layout)&.try :item_name
|
70
|
-
end
|
71
|
-
|
72
|
-
private
|
73
|
-
|
74
76
|
def wrapper_names_from_array wrapper_array
|
75
77
|
wrapper_array.map { |w| w.is_a?(Array) ? w.first : w }
|
76
78
|
end
|
data/set/all/tabs.rb
CHANGED
data/set/right/head.rb
CHANGED
data/set/self/account_links.rb
CHANGED
@@ -24,9 +24,9 @@ format :html do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.link_options opts={}
|
27
|
+
def self.link_options opts={}, &block
|
28
28
|
options = { denial: :blank, cache: :never }.merge opts
|
29
|
-
options[:perms] =
|
29
|
+
options[:perms] = block if block_given?
|
30
30
|
options.clone
|
31
31
|
end
|
32
32
|
|
@@ -80,7 +80,7 @@ format :html do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def account_link_text purpose
|
83
|
-
voo.title ||
|
83
|
+
voo.title || t("account_#{purpose}")
|
84
84
|
end
|
85
85
|
|
86
86
|
def nav_link_class type
|
data/set/self/foot.rb
CHANGED
data/set/self/head.rb
CHANGED
@@ -9,7 +9,7 @@ format :html do
|
|
9
9
|
view :core, cache: :never do
|
10
10
|
escape_in_main do
|
11
11
|
nest root.card, view: :head
|
12
|
-
#
|
12
|
+
# NOTE: that the head tag for each card is different
|
13
13
|
# (different title, different style rules, etc)
|
14
14
|
# so we don't cache the core of *head, but we _do_ cache some
|
15
15
|
# views within each head (see all/head.rb)
|
data/set/type/layout_type.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.12.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: 2021-
|
13
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,42 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.102.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.102.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.12.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.12.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.12.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.12.0
|
57
57
|
description: ''
|
58
58
|
email:
|
59
59
|
- info@decko.org
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
rubygems_version: 3.
|
118
|
+
rubygems_version: 3.2.15
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: decko layouts
|