card-mod-format 0.11.4 → 0.11.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/card/path.rb +2 -2
- data/lib/card/path/cast_params.rb +2 -0
- data/set/all/active_card.rb +0 -1
- data/set/all/base.rb +3 -1
- data/set/all/css.rb +0 -1
- data/set/all/csv.rb +2 -1
- data/set/all/export.rb +2 -0
- data/set/all/frame.rb +6 -10
- data/set/all/head.rb +5 -1
- data/set/all/html_content.rb +1 -0
- data/set/all/html_error.rb +19 -4
- data/set/all/html_wrapper.rb +7 -7
- data/set/all/js.rb +0 -1
- data/set/all/json.rb +1 -2
- data/set/all/links.rb +5 -4
- data/set/all/menu.rb +1 -1
- data/set/all/path.rb +1 -0
- data/set/all/rss.rb +3 -2
- data/set/all/text.rb +0 -1
- data/set/type/cardtype.rb +1 -1
- data/set/type/number.rb +4 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7282ec52f287bd080b84b1a539733d85c17f859f1eccd038ff4cd67a1c572d55
|
4
|
+
data.tar.gz: 1b36bb6b8d5b10512774e1dee08f3dd60a79bff24495a569ed91013fd3eacaa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 901b4a5f4458f02650af6ebabb0af3e04deadbc392f3d69a118d29d54d30f3bfd44a0d90e842d45ee72d584a20f015079e7e3d48630e39cbd0e26addd90b057b
|
7
|
+
data.tar.gz: 21c3fb950df2ed3004e9a21048b3a17ea3e66200dca345984e95b9e57672d497afd1ccc1a999af661bc4ca0a2b6200f4ab315a8243f5bfc27f11567298091032
|
data/lib/card/path.rb
CHANGED
@@ -59,7 +59,7 @@ class Card
|
|
59
59
|
name = handle_unknown do
|
60
60
|
opts[:mark] ? Card::Name[opts.delete(:mark)] : @card.name
|
61
61
|
end
|
62
|
-
|
62
|
+
name&.url_key.to_s
|
63
63
|
end
|
64
64
|
|
65
65
|
def markless?
|
@@ -99,7 +99,7 @@ class Card
|
|
99
99
|
|
100
100
|
# no name info will be lost by using url_key
|
101
101
|
def name_standardish? name
|
102
|
-
name.
|
102
|
+
name.url_key == name.tr(" ", "_")
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
@@ -9,6 +9,7 @@ class Card
|
|
9
9
|
|
10
10
|
def cast_path_hash hash, cast_hash=nil
|
11
11
|
return hash unless hash.is_a? Hash
|
12
|
+
|
12
13
|
cast_each_path_hash hash, (cast_hash || self.class.cast_params)
|
13
14
|
hash
|
14
15
|
end
|
@@ -16,6 +17,7 @@ class Card
|
|
16
17
|
def cast_each_path_hash hash, cast_hash
|
17
18
|
hash.each do |key, value|
|
18
19
|
next unless (cast_to = cast_hash[key])
|
20
|
+
|
19
21
|
hash[key] = cast_path_value value, cast_to
|
20
22
|
end
|
21
23
|
end
|
data/set/all/active_card.rb
CHANGED
data/set/all/base.rb
CHANGED
@@ -42,6 +42,7 @@ format do
|
|
42
42
|
|
43
43
|
def specify_type_in_link! opts
|
44
44
|
return if opts[:known] || !voo.type
|
45
|
+
|
45
46
|
opts[:path] = { card: { type: voo.type } }
|
46
47
|
end
|
47
48
|
|
@@ -71,6 +72,7 @@ format do
|
|
71
72
|
|
72
73
|
def structure_card
|
73
74
|
return nil if voo.structure == true
|
75
|
+
|
74
76
|
voo.structure ? Card[voo.structure] : card
|
75
77
|
end
|
76
78
|
|
@@ -104,7 +106,7 @@ format do
|
|
104
106
|
""
|
105
107
|
end
|
106
108
|
|
107
|
-
#
|
109
|
+
# NOTE: content and open_content may look like they should be aliased to
|
108
110
|
# core, but it's important that they render core explicitly so that core view
|
109
111
|
# overrides work. the titled and labeled views below, however, are not
|
110
112
|
# intended for frequent override, so this shortcut is fine.
|
data/set/all/css.rb
CHANGED
data/set/all/csv.rb
CHANGED
@@ -18,7 +18,7 @@ format :csv do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
view :csv_row do
|
21
|
-
array = _render_raw.scan(/\{\{[
|
21
|
+
array = _render_raw.scan(/\{\{[^}]*\}\}/).map do |inc|
|
22
22
|
process_content(inc).strip
|
23
23
|
end
|
24
24
|
|
@@ -69,6 +69,7 @@ format :csv do
|
|
69
69
|
def title_row extra_titles=nil
|
70
70
|
titles = column_titles extra_titles
|
71
71
|
return "" unless titles.present?
|
72
|
+
|
72
73
|
CSV.generate_line titles.map(&:upcase)
|
73
74
|
end
|
74
75
|
|
data/set/all/export.rb
CHANGED
@@ -35,6 +35,7 @@ format :json do
|
|
35
35
|
|
36
36
|
def track_exporting card
|
37
37
|
return unless @exported_keys
|
38
|
+
|
38
39
|
@exported_keys << card.key
|
39
40
|
end
|
40
41
|
|
@@ -52,6 +53,7 @@ format :json do
|
|
52
53
|
def items_for_export
|
53
54
|
nest_chunks.map do |chunk|
|
54
55
|
next if chunk.try :main?
|
56
|
+
|
55
57
|
chunk.referee_card
|
56
58
|
end.compact
|
57
59
|
end
|
data/set/all/frame.rb
CHANGED
@@ -10,9 +10,9 @@ format :html do
|
|
10
10
|
standard_frame(&block)
|
11
11
|
end
|
12
12
|
|
13
|
-
def standard_frame slot=true
|
13
|
+
def standard_frame slot=true, &block
|
14
14
|
with_frame slot do
|
15
|
-
wrap_body
|
15
|
+
wrap_body(&block) if block_given?
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -36,18 +36,14 @@ format :html do
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def frame_and_form action, form_opts={}
|
39
|
+
def frame_and_form action, form_opts={}, &block
|
40
40
|
form_opts ||= {}
|
41
41
|
frame do
|
42
|
-
card_form action, form_opts
|
43
|
-
yield
|
44
|
-
end
|
42
|
+
card_form action, form_opts, &block
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
48
|
-
def panel
|
49
|
-
wrap_with :div, class: classy("d0-card-frame")
|
50
|
-
yield
|
51
|
-
end
|
46
|
+
def panel &block
|
47
|
+
wrap_with :div, class: classy("d0-card-frame"), &block
|
52
48
|
end
|
53
49
|
end
|
data/set/all/head.rb
CHANGED
@@ -42,6 +42,7 @@ format :html do
|
|
42
42
|
|
43
43
|
view :universal_edit_button, unknown: true, denial: :blank, perms: :update do
|
44
44
|
return if card.new?
|
45
|
+
|
45
46
|
tag "link", rel: "alternate", type: "application/x-wiki",
|
46
47
|
title: "Edit this page!", href: path(view: :edit)
|
47
48
|
end
|
@@ -51,6 +52,7 @@ format :html do
|
|
51
52
|
# (but note that machine clearing would need to reset card cache...)
|
52
53
|
view :head_stylesheet, unknown: true, cache: :never, perms: :none do
|
53
54
|
return unless (href = head_stylesheet_path)
|
55
|
+
|
54
56
|
tag "link", href: href, media: "all", rel: "stylesheet", type: "text/css"
|
55
57
|
end
|
56
58
|
|
@@ -82,7 +84,7 @@ format :html do
|
|
82
84
|
if value.is_a? Hash
|
83
85
|
string = "{"
|
84
86
|
value.each { |k, v| string += "#{k}:#{script_variable_to_js v}" }
|
85
|
-
string
|
87
|
+
"#{string}}"
|
86
88
|
else
|
87
89
|
"'#{value}'"
|
88
90
|
end
|
@@ -98,11 +100,13 @@ format :html do
|
|
98
100
|
|
99
101
|
def debug_or_machine_path setting, &block
|
100
102
|
return unless (asset_card = param_or_rule_card setting)
|
103
|
+
|
101
104
|
debug_path(setting, asset_card, &block) || asset_card.machine_output_url
|
102
105
|
end
|
103
106
|
|
104
107
|
def debug_path setting, asset_card
|
105
108
|
return unless params[:debug] == setting.to_s
|
109
|
+
|
106
110
|
yield asset_card
|
107
111
|
end
|
108
112
|
|
data/set/all/html_content.rb
CHANGED
data/set/all/html_error.rb
CHANGED
@@ -52,7 +52,12 @@ format :html do
|
|
52
52
|
view :errors, perms: :none do
|
53
53
|
return if card.errors.empty?
|
54
54
|
|
55
|
-
voo.title = card.name.blank?
|
55
|
+
voo.title = if card.name.blank?
|
56
|
+
"Problems"
|
57
|
+
else
|
58
|
+
t(:format_problems_name,
|
59
|
+
cardname: card.name)
|
60
|
+
end
|
56
61
|
voo.hide! :menu
|
57
62
|
class_up "alert", "card-error-msg"
|
58
63
|
standard_errors voo.title
|
@@ -135,7 +140,7 @@ format :html do
|
|
135
140
|
|
136
141
|
links = [signin_link, signup_link].compact.join " #{t(:format_or)} "
|
137
142
|
wrap_with(:div) do
|
138
|
-
[t(:format_please), links, to_task].join(
|
143
|
+
"#{[t(:format_please), links, to_task].join(' ')}."
|
139
144
|
end
|
140
145
|
end
|
141
146
|
|
@@ -170,7 +175,12 @@ format :html do
|
|
170
175
|
end
|
171
176
|
|
172
177
|
def loud_denial_message
|
173
|
-
to_task =
|
178
|
+
to_task = if @denied_task
|
179
|
+
t(:format_denied_task,
|
180
|
+
denied_task: @denied_task)
|
181
|
+
else
|
182
|
+
t(:format_to_do_that)
|
183
|
+
end
|
174
184
|
|
175
185
|
case
|
176
186
|
when not_denied_task_read?
|
@@ -188,6 +198,11 @@ format :html do
|
|
188
198
|
end
|
189
199
|
|
190
200
|
def to_do_unauthorized_task
|
191
|
-
|
201
|
+
if @denied_task
|
202
|
+
t(:format_denied_task,
|
203
|
+
denied_task: @denied_task)
|
204
|
+
else
|
205
|
+
t(:format_to_do_that)
|
206
|
+
end
|
192
207
|
end
|
193
208
|
end
|
data/set/all/html_wrapper.rb
CHANGED
@@ -76,8 +76,8 @@ format :html do
|
|
76
76
|
opts[:name_context] = initial_context_names.map(&:key) * ","
|
77
77
|
end
|
78
78
|
|
79
|
-
def debug_slot
|
80
|
-
debug_slot? ? debug_slot_wrap
|
79
|
+
def debug_slot &block
|
80
|
+
debug_slot? ? debug_slot_wrap(&block) : yield
|
81
81
|
end
|
82
82
|
|
83
83
|
def debug_slot?
|
@@ -97,13 +97,13 @@ format :html do
|
|
97
97
|
classy list
|
98
98
|
end
|
99
99
|
|
100
|
-
def wrap_body
|
101
|
-
wrap_with(:div, class: body_css_classes)
|
100
|
+
def wrap_body &block
|
101
|
+
wrap_with(:div, class: body_css_classes, &block)
|
102
102
|
end
|
103
103
|
|
104
|
-
def haml_wrap_body
|
104
|
+
def haml_wrap_body &block
|
105
105
|
wrap_body do
|
106
|
-
capture_haml
|
106
|
+
capture_haml(&block)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -150,7 +150,7 @@ format :html do
|
|
150
150
|
def html_escape_except_quotes string
|
151
151
|
# to be used inside single quotes (makes for readable json attributes)
|
152
152
|
string.to_s.gsub(/&/, "&")
|
153
|
-
.gsub(
|
153
|
+
.gsub(/'/, "'")
|
154
154
|
.gsub(/>/, ">")
|
155
155
|
.gsub(/</, "<")
|
156
156
|
end
|
data/set/all/js.rb
CHANGED
data/set/all/json.rb
CHANGED
@@ -48,7 +48,6 @@ format :json do
|
|
48
48
|
{ key: card.key,
|
49
49
|
url_key: card.name.url_key,
|
50
50
|
status: card.state }.tap do |h|
|
51
|
-
|
52
51
|
h[:id] = card.id if h[:status] == :real
|
53
52
|
end
|
54
53
|
end
|
@@ -129,6 +128,7 @@ format :json do
|
|
129
128
|
|
130
129
|
def essentials
|
131
130
|
return {} if card.structure
|
131
|
+
|
132
132
|
{ content: card.db_content }
|
133
133
|
end
|
134
134
|
|
@@ -140,7 +140,6 @@ format :json do
|
|
140
140
|
name: card.name,
|
141
141
|
type: card.type_name,
|
142
142
|
url: path(format: :json) }.tap do |h|
|
143
|
-
|
144
143
|
h[:codename] = card.codename if card.codename
|
145
144
|
end
|
146
145
|
end
|
data/set/all/links.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
RESOURCE_TYPE_REGEXP = /^([a-zA-Z][
|
1
|
+
RESOURCE_TYPE_REGEXP = /^([a-zA-Z][\-+.a-zA-Z\d]*):/
|
2
2
|
|
3
3
|
# The #link_to methods support smart formatting of links in multiple formats.
|
4
4
|
format do
|
@@ -63,10 +63,10 @@ format do
|
|
63
63
|
|
64
64
|
def resource_type resource
|
65
65
|
case resource
|
66
|
-
when /^https
|
66
|
+
when /^https?:/ then "external-link"
|
67
67
|
when %r{^/} then "internal-link"
|
68
|
-
when /^mailto
|
69
|
-
when RESOURCE_TYPE_REGEXP then Regexp.last_match(1)
|
68
|
+
when /^mailto:/ then "email-link"
|
69
|
+
when RESOURCE_TYPE_REGEXP then "#{Regexp.last_match(1)}-link"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
@@ -138,6 +138,7 @@ format :html do
|
|
138
138
|
def interpret_data_opts_to_link_to opts
|
139
139
|
%i[remote method].each do |key|
|
140
140
|
next unless (val = opts.delete key)
|
141
|
+
|
141
142
|
opts["data-#{key}"] = val
|
142
143
|
end
|
143
144
|
end
|
data/set/all/menu.rb
CHANGED
data/set/all/path.rb
CHANGED
data/set/all/rss.rb
CHANGED
@@ -14,6 +14,7 @@ format :rss do
|
|
14
14
|
# FIXME: integrate this with common XML features when it is added
|
15
15
|
view :feed, cache: :never do
|
16
16
|
return "RSS feeds disabled" unless Cardio.config.rss_enabled
|
17
|
+
|
17
18
|
begin
|
18
19
|
@xml.instruct! :xml, version: "1.0", standalone: "yes"
|
19
20
|
@xml.rss version: "2.0",
|
@@ -25,7 +26,7 @@ format :rss do
|
|
25
26
|
render_feed_body
|
26
27
|
end
|
27
28
|
end
|
28
|
-
rescue => e
|
29
|
+
rescue StandardError => e
|
29
30
|
@xml.error "\n\nERROR rendering RSS: #{e.inspect}\n\n #{e.backtrace}"
|
30
31
|
end
|
31
32
|
end
|
@@ -43,7 +44,7 @@ format :rss do
|
|
43
44
|
end
|
44
45
|
|
45
46
|
view :feed_title do
|
46
|
-
Card::Rule.global_setting(:title)
|
47
|
+
"#{Card::Rule.global_setting(:title)} : #{card.name.gsub(/^\*/, '')}"
|
47
48
|
end
|
48
49
|
|
49
50
|
view :feed_item do
|
data/set/all/text.rb
CHANGED
data/set/type/cardtype.rb
CHANGED
@@ -79,7 +79,7 @@ format :html do
|
|
79
79
|
private
|
80
80
|
|
81
81
|
def process_voo_params path_args
|
82
|
-
context = (
|
82
|
+
context = (@parent&.card || card).name
|
83
83
|
Rack::Utils.parse_nested_query(voo.params).each do |key, value|
|
84
84
|
value = value.to_name.absolute(context) if value
|
85
85
|
key = key.to_name.absolute(context)
|
data/set/type/number.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
format :html do
|
3
2
|
def input_type
|
4
3
|
:text_field
|
@@ -6,7 +5,10 @@ format :html do
|
|
6
5
|
end
|
7
6
|
|
8
7
|
event :validate_number, :validate, on: :save do
|
9
|
-
|
8
|
+
unless valid_number?(content)
|
9
|
+
errors.add :content,
|
10
|
+
t(:format_not_numeric, content: content)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
|
12
14
|
def valid_number? string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.5
|
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-05-
|
13
|
+
date: 2021-05-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.101.
|
21
|
+
version: 1.101.5
|
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.101.
|
28
|
+
version: 1.101.5
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-content
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.11.
|
35
|
+
version: 0.11.5
|
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.11.
|
42
|
+
version: 0.11.5
|
43
43
|
description: ''
|
44
44
|
email:
|
45
45
|
- info@decko.org
|