card-mod-layout 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 03d108a569f14471991d748ba88c83090cc30390336e5a36d859ebaab663775a
4
- data.tar.gz: e8fe906f01bd1f15118f69e59849aebb2903927cdef484f35a13212c1e04287f
3
+ metadata.gz: 1ec837afb468af7b7cb4e750530af0e9a4969c25790b1d6bd38ae925a911d206
4
+ data.tar.gz: 9a250e05b0c1de8923dc5ec3625293e4f1944dcdd0e7245606da6ed082a6dcc1
5
5
  SHA512:
6
- metadata.gz: 2ee0a3db0692e0691fe903381c9732755f0a227e31196bae13f16e73f36db32e872f932fae46db1ba529f37cbb5ae87052b3e6b3514d34497682e101e67dad7a
7
- data.tar.gz: 905af8235a9e0ac6fa112e255c9e672778b2af24449424a5b1f14cfa2160b0451147ec083ec959b9d320dafb8ee2141bd30a6f85dc73d2272e46aa6e939c30b1
6
+ metadata.gz: 9afc1d38fdd83efd10eebae08ceffee72849209db77a7e48e03808d16cbf60b47bc0c5e780628d9d48df0f693485c9373eda8decdef16cebd6e511a99e178e16
7
+ data.tar.gz: '081c2125e0fd671a18f0f9b0ccf69aedeb3f957cec1281cfb5367974ef153776acc56e7cf90b03e840e97b9dffab586ef0fa5259edf2f2730b4f91bc142681a1'
data/config/admin.yml ADDED
@@ -0,0 +1,10 @@
1
+ settings:
2
+ - layout
3
+ - head
4
+
5
+ cardtypes:
6
+ styling:
7
+ - layout_type
8
+
9
+ views:
10
+ - modal_link
@@ -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
@@ -3,3 +3,11 @@ format :html do
3
3
  wrap_with_nav_item nav_dropdown
4
4
  end
5
5
  end
6
+
7
+ format do
8
+ def nest_item_array
9
+ card.item_cards.map do |item|
10
+ nest_item item, view: :core
11
+ end
12
+ end
13
+ end
@@ -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
@@ -1,6 +1,6 @@
1
1
  require "coderay"
2
2
 
3
- def ok_to_read
3
+ def ok_to_read?
4
4
  true
5
5
  end
6
6
 
@@ -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
 
data/set/self/head.rb CHANGED
@@ -20,6 +20,9 @@ format :html do
20
20
  "Content can't be edited."
21
21
  end
22
22
 
23
+ view :bar_bottom do
24
+ end
25
+
23
26
  def escape_in_main
24
27
  main? ? (h yield) : yield
25
28
  end
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.16.0
4
+ version: 0.17.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: 2023-11-18 00:00:00.000000000 Z
13
+ date: 2024-06-12 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.106.0
21
+ version: 1.107.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.106.0
28
+ version: 1.107.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.16.0
35
+ version: 0.17.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.16.0
42
+ version: 0.17.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.16.0
49
+ version: 0.17.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.16.0
56
+ version: 0.17.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.16.0
63
+ version: 0.17.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.16.0
70
+ version: 0.17.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
@@ -138,14 +140,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
138
140
  requirements:
139
141
  - - ">="
140
142
  - !ruby/object:Gem::Version
141
- version: '2.5'
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.4.10
150
+ rubygems_version: 3.5.10
149
151
  signing_key:
150
152
  specification_version: 4
151
153
  summary: decko layouts