card-mod-format 0.13.4 → 0.14.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/format/html_format.rb +0 -9
- data/lib/card/format/scss_format.rb +18 -0
- data/lib/card/format/yaml_format.rb +16 -0
- data/locales/de.yml +23 -0
- data/locales/en.yml +1 -1
- data/set/all/base.rb +5 -6
- data/set/all/data.rb +110 -0
- data/set/all/error.rb +1 -1
- data/set/all/{html_error → html}/debug_server_error.haml +0 -0
- data/set/all/{html_error.rb → html/error.rb} +4 -3
- data/set/all/{frame.rb → html/frame.rb} +0 -0
- data/set/all/{head.rb → html/head.rb} +1 -1
- data/set/all/{header.rb → html/header.rb} +0 -0
- data/set/all/{header → html}/header_wrap.haml +0 -0
- data/set/all/{html_views → html}/labeled.haml +0 -0
- data/set/all/{menu.rb → html/menu.rb} +0 -0
- data/set/all/{meta_tags.haml → html/meta_tags.haml} +0 -0
- data/set/all/{html_error → html}/not_found.haml +0 -0
- data/set/all/{html_error → html}/server_error.haml +0 -0
- data/set/all/html/show.rb +31 -0
- data/set/all/{html_views.rb → html/views.rb} +3 -6
- data/set/all/{html_wrapper.rb → html/wrap.rb} +0 -0
- data/set/all/{rich_html.rb → html.rb} +9 -0
- data/set/all/json.rb +13 -116
- data/set/all/links.rb +1 -1
- data/set/all/{html_title.rb → title.rb} +0 -0
- data/set/all/yaml.rb +6 -0
- data/set/type/basic.rb +3 -0
- metadata +29 -25
- data/set/all/active_card.rb +0 -5
- data/set/all/export.rb +0 -70
- data/set/all/html_show.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dd1742c8a71de4e306dc775686c546a4e2f4063a70ef8f84697f1b78f055578
|
4
|
+
data.tar.gz: 619d41643aa1096b45d554d1c3d6b04b7ee9b49dbcd1acf14b8cb85c5685e150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8bfc3064d3b517298a744ac8020d02702c6ad808b9d2bcdec95d087122c21bd3070918e99e51513250a082cb2bc2a333df65b40c3ff106365e247e08183f77
|
7
|
+
data.tar.gz: 639a5b55df3c1e846b95eb3cee7e202e9b803060b81abaf1d4b6c6f795de88531199b35178d321098466f530dabf9ec2da1750d317723f5fa133fc9e6df89ff7
|
@@ -19,15 +19,6 @@ class Card
|
|
19
19
|
@focal ||= show_layout? ? main? : depth.zero?
|
20
20
|
end
|
21
21
|
|
22
|
-
def default_nest_view
|
23
|
-
# FIXME: not sure this makes sense as a rule...
|
24
|
-
card.rule(:default_html_view) || :titled
|
25
|
-
end
|
26
|
-
|
27
|
-
def default_item_view
|
28
|
-
:bar
|
29
|
-
end
|
30
|
-
|
31
22
|
def escape_literal literal
|
32
23
|
"<span>#{literal}</span>"
|
33
24
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
class Card
|
4
|
+
class Format
|
5
|
+
# base class for rendering in YAML (Yet Another Markup Language)
|
6
|
+
class YamlFormat < DataFormat
|
7
|
+
register :yaml
|
8
|
+
register :yml
|
9
|
+
aliases["yml"] = "yaml"
|
10
|
+
|
11
|
+
def mime_type
|
12
|
+
"text/x-yaml"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/locales/de.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
de:
|
2
|
+
format_add_card: "%{cardname} hinzufügen"
|
3
|
+
format_bad_address: "404: Ungültige Adresse"
|
4
|
+
format_close: Schließen
|
5
|
+
format_configure_card: "%{cardname} konfigurieren"
|
6
|
+
format_denial: Erlaubnis abgelehnt
|
7
|
+
format_denied_task: to %{denied_task} this
|
8
|
+
format_invalid_json: ungültiges json
|
9
|
+
format_need_permission_task: "Sie brauchen Erlaubnis %{task}."
|
10
|
+
format_not_found_named: Konnte %{cardname} nicht finden.
|
11
|
+
format_not_found_no_name: die angeforderte Karte
|
12
|
+
format_not_numeric: "'%{content}' ist nicht numerisch"
|
13
|
+
format_or: "oder"
|
14
|
+
format_please: Bitte
|
15
|
+
format_problems_name: Probleme mit %{cardname}
|
16
|
+
format_read_only: Wir sind derzeit im Nur-Lese-Modus. Bitte versuchen Sie es später noch einmal.
|
17
|
+
format_server_error: "\nServer Fehler. Ups, entschuldige bitte.\nUm uns den Fehler mitzuteilen und über eine Lösung informiert zu werden,\nerstelle ein Support-Ticket %{ticket_link}\n"
|
18
|
+
format_sorry: Sorry!
|
19
|
+
format_to_do_that: um das zu tun
|
20
|
+
format_toggle_no: "nein"
|
21
|
+
format_toggle_yes: "ja"
|
22
|
+
format_too_deep: Du bist zu tief. (Zu viele verschachtelte Nester aufeinmal)
|
23
|
+
format_unsupported_view: Ansicht (%{view}) wird nicht unterstützt für %{cardname}
|
data/locales/en.yml
CHANGED
@@ -14,7 +14,7 @@ en:
|
|
14
14
|
format_please: Please
|
15
15
|
format_problems_name: Problems with %{cardname}
|
16
16
|
format_read_only: We are currently in read-only mode. Please try again later.
|
17
|
-
format_server_error: "\
|
17
|
+
format_server_error: "\nServer Error. Yuck, sorry about that.\nTo tell us more and follow the fix,\nadd a support ticket at %{ticket_link}\n"
|
18
18
|
format_sorry: Sorry!
|
19
19
|
format_to_do_that: to do that
|
20
20
|
format_toggle_no: "no"
|
data/set/all/base.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
def format opts={}
|
2
|
+
opts = { format: opts.to_sym } if [Symbol, String].member? opts.class
|
3
|
+
Card::Format.new self, opts
|
4
|
+
end
|
5
|
+
|
1
6
|
format do
|
2
7
|
def show view, args
|
3
8
|
view ||= :core
|
@@ -130,10 +135,4 @@ format do
|
|
130
135
|
subformat(item_card)._render_core
|
131
136
|
end.inspect
|
132
137
|
end
|
133
|
-
|
134
|
-
# DEPRECATED
|
135
|
-
view :naked do
|
136
|
-
Rails.logger.info "DEPRECATED: naked view (used with #{card.name} card)"
|
137
|
-
render_core
|
138
|
-
end
|
139
138
|
end
|
data/set/all/data.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
def cast
|
2
|
+
real? ? { id: id } : { name: name, type_id: type_id, content: db_content }
|
3
|
+
end
|
4
|
+
|
5
|
+
def export_hash field_tags: []
|
6
|
+
{ name: export_name,
|
7
|
+
type: export_type,
|
8
|
+
codename: codename,
|
9
|
+
content: export_content,
|
10
|
+
subfields: export_subfields(field_tags) }.compact_blank
|
11
|
+
end
|
12
|
+
|
13
|
+
def export_subfields marks
|
14
|
+
marks.each_with_object({}) do |mark, hash|
|
15
|
+
hash[mark] = [name, mark].card&.export_content
|
16
|
+
end.compact_blank
|
17
|
+
end
|
18
|
+
|
19
|
+
def export_type
|
20
|
+
type_name.codename_or_string
|
21
|
+
end
|
22
|
+
|
23
|
+
def export_name
|
24
|
+
simple? ? name.s : name.part_names.map(&:codename_or_string)
|
25
|
+
end
|
26
|
+
|
27
|
+
def export_content
|
28
|
+
structure ? nil : db_content
|
29
|
+
end
|
30
|
+
|
31
|
+
format :data do
|
32
|
+
view :export do
|
33
|
+
card.export_hash
|
34
|
+
end
|
35
|
+
|
36
|
+
view :core, unknown: true do
|
37
|
+
card.known? ? render_content : nil
|
38
|
+
end
|
39
|
+
|
40
|
+
view :content do
|
41
|
+
card.content
|
42
|
+
end
|
43
|
+
|
44
|
+
view :nucleus do
|
45
|
+
nucleus
|
46
|
+
end
|
47
|
+
|
48
|
+
# TODO: add simple values for fields
|
49
|
+
view :atom, unknown: true do
|
50
|
+
atom
|
51
|
+
end
|
52
|
+
|
53
|
+
view :molecule do
|
54
|
+
molecule
|
55
|
+
end
|
56
|
+
|
57
|
+
view :ancestors do
|
58
|
+
card.name.ancestors.map do |name|
|
59
|
+
nest name, view: :nucleus
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# minimum needed to re-fetch card
|
64
|
+
view :cast do
|
65
|
+
card.cast
|
66
|
+
end
|
67
|
+
|
68
|
+
# NOCACHE because sometimes item_cards is dynamic.
|
69
|
+
# could be safely cached for non-dynamic lists
|
70
|
+
view :items, cache: :never do
|
71
|
+
listing item_cards, view: (voo_items_view || :atom)
|
72
|
+
end
|
73
|
+
|
74
|
+
view :links do
|
75
|
+
card.link_chunks.map do |chunk|
|
76
|
+
if chunk.referee_name
|
77
|
+
path mark: chunk.referee_name, format: :json
|
78
|
+
else
|
79
|
+
link_to_resource chunk.link_target
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# NOTE: moving these to methods prevents potential caching problems, because other
|
85
|
+
# views manipulate their hashes.
|
86
|
+
def nucleus
|
87
|
+
{ id: card.id,
|
88
|
+
name: card.name,
|
89
|
+
type: card.type_name,
|
90
|
+
url: path(format: :json) }.tap do |h|
|
91
|
+
h[:codename] = card.codename if card.codename
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def atom
|
96
|
+
nucleus.tap do |h|
|
97
|
+
h[:content] = render_content if card.known? && !card.structure
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def molecule
|
102
|
+
atom.merge items: _render_items,
|
103
|
+
links: _render_links,
|
104
|
+
ancestors: _render_ancestors,
|
105
|
+
html_url: path,
|
106
|
+
type: nest(card.type_card, view: :nucleus),
|
107
|
+
created_at: card.created_at,
|
108
|
+
updated_at: card.updated_at
|
109
|
+
end
|
110
|
+
end
|
data/set/all/error.rb
CHANGED
File without changes
|
@@ -21,8 +21,9 @@ format :html do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def unknown_link text
|
24
|
-
|
25
|
-
|
24
|
+
link_to_view :new_in_modal, text,
|
25
|
+
path: (voo.type ? { card: { type: voo.type } } : {}),
|
26
|
+
class: classy("unknown-link")
|
26
27
|
end
|
27
28
|
|
28
29
|
def unknown_icon
|
@@ -63,7 +64,7 @@ format :html do
|
|
63
64
|
standard_errors voo.title
|
64
65
|
end
|
65
66
|
|
66
|
-
view :not_found do
|
67
|
+
view :not_found, cache: :never do
|
67
68
|
voo.hide! :menu
|
68
69
|
voo.title = "Not Found"
|
69
70
|
frame do
|
File without changes
|
@@ -56,7 +56,7 @@ format :html do
|
|
56
56
|
def debug_or_machine_path setting, debug_lambda, machine_path_lambda
|
57
57
|
return unless (asset_card = param_or_rule_card setting)
|
58
58
|
debug_path(setting, asset_card, &debug_lambda) ||
|
59
|
-
machine_path_lambda.call(asset_card.
|
59
|
+
machine_path_lambda.call(asset_card.asset_output_url)
|
60
60
|
end
|
61
61
|
|
62
62
|
def debug_path setting, asset_card
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
format :html do
|
2
|
+
def show view, args
|
3
|
+
content = send show_method, view, args
|
4
|
+
Env.ajax? ? content : wrap_with_html_page(content)
|
5
|
+
end
|
6
|
+
|
7
|
+
wrapper :html_page do
|
8
|
+
<<-HTML.strip_heredoc
|
9
|
+
<!DOCTYPE HTML>
|
10
|
+
<html class="h-100">
|
11
|
+
<head>
|
12
|
+
#{nest card.rule_card(:head), view: :head_content}
|
13
|
+
</head>
|
14
|
+
#{interior}
|
15
|
+
</html>
|
16
|
+
HTML
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def show_without_page_layout view, args
|
22
|
+
@main = true if params[:is_main] || args[:main]
|
23
|
+
args.delete(:layout)
|
24
|
+
view ||= args[:home_view] || default_page_view
|
25
|
+
render! view, args
|
26
|
+
end
|
27
|
+
|
28
|
+
def show_method
|
29
|
+
"show_#{show_layout? ? :with : :without}_page_layout"
|
30
|
+
end
|
31
|
+
end
|
@@ -13,7 +13,7 @@ format :html do
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
before
|
16
|
+
before :content_with_edit_button do
|
17
17
|
prepare_content_slot
|
18
18
|
end
|
19
19
|
|
@@ -64,8 +64,7 @@ format :html do
|
|
64
64
|
[
|
65
65
|
naming { render_header },
|
66
66
|
render_flash,
|
67
|
-
wrap_body { render_titled_content }
|
68
|
-
render_comment_box(optional: :hide)
|
67
|
+
wrap_body { render_titled_content }
|
69
68
|
]
|
70
69
|
end
|
71
70
|
end
|
@@ -91,9 +90,7 @@ format :html do
|
|
91
90
|
toggle_logic
|
92
91
|
@toggle_mode = :open
|
93
92
|
@content_body = true
|
94
|
-
frame
|
95
|
-
[_render_open_content, render_comment_box(optional: :hide)]
|
96
|
-
end
|
93
|
+
frame { _render_open_content }
|
97
94
|
end
|
98
95
|
|
99
96
|
view :closed do
|
File without changes
|
data/set/all/json.rb
CHANGED
@@ -26,24 +26,6 @@ format :json do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def string_with_page_details
|
30
|
-
raw = yield
|
31
|
-
return raw if raw.is_a? String
|
32
|
-
|
33
|
-
stringify page_details(raw)
|
34
|
-
end
|
35
|
-
|
36
|
-
def stringify raw
|
37
|
-
method = params[:compress] ? :generate : :pretty_generate
|
38
|
-
JSON.send method, raw
|
39
|
-
end
|
40
|
-
|
41
|
-
def page_details obj
|
42
|
-
return obj unless obj.is_a? Hash
|
43
|
-
|
44
|
-
obj.merge url: request_url, requested_at: Time.now.to_s
|
45
|
-
end
|
46
|
-
|
47
29
|
view :status, unknown: true, perms: :none do
|
48
30
|
{ key: card.key,
|
49
31
|
url_key: card.name.url_key,
|
@@ -52,116 +34,31 @@ format :json do
|
|
52
34
|
end
|
53
35
|
end
|
54
36
|
|
55
|
-
def request_url
|
56
|
-
controller.request&.original_url || path
|
57
|
-
end
|
58
|
-
|
59
|
-
view :core, unknown: true do
|
60
|
-
card.known? ? render_content : nil
|
61
|
-
end
|
62
|
-
|
63
|
-
view :content do
|
64
|
-
card.content
|
65
|
-
end
|
66
|
-
|
67
|
-
view :nucleus do
|
68
|
-
nucleus
|
69
|
-
end
|
70
|
-
|
71
|
-
# TODO: add simple values for fields
|
72
|
-
view :atom, unknown: true do
|
73
|
-
atom
|
74
|
-
end
|
75
|
-
|
76
|
-
view :molecule do
|
77
|
-
molecule
|
78
|
-
end
|
79
|
-
|
80
37
|
view :page, cache: :never do
|
81
38
|
page_details card: render_atom
|
82
39
|
end
|
83
40
|
|
84
|
-
|
85
|
-
# could be safely cached for non-dynamic lists
|
86
|
-
view :items, cache: :never do
|
87
|
-
listing item_cards, view: (voo_items_view || :atom)
|
88
|
-
end
|
89
|
-
|
90
|
-
view :links do
|
91
|
-
card.link_chunks.map do |chunk|
|
92
|
-
if chunk.referee_name
|
93
|
-
path mark: chunk.referee_name, format: :json
|
94
|
-
else
|
95
|
-
link_to_resource chunk.link_target
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
view :ancestors do
|
101
|
-
card.name.ancestors.map do |name|
|
102
|
-
nest name, view: :nucleus
|
103
|
-
end
|
104
|
-
end
|
41
|
+
private
|
105
42
|
|
106
|
-
|
107
|
-
|
108
|
-
card.cast
|
109
|
-
end
|
110
|
-
|
111
|
-
## DEPRECATED
|
112
|
-
view :marks do
|
113
|
-
{
|
114
|
-
id: card.id,
|
115
|
-
name: card.name,
|
116
|
-
key: card.key,
|
117
|
-
url: path
|
118
|
-
}
|
119
|
-
end
|
120
|
-
|
121
|
-
view :essentials do
|
122
|
-
if voo.show? :marks
|
123
|
-
render_marks.merge(essentials)
|
124
|
-
else
|
125
|
-
essentials
|
126
|
-
end
|
43
|
+
def request_url
|
44
|
+
controller.request&.original_url || path
|
127
45
|
end
|
128
46
|
|
129
|
-
def
|
130
|
-
|
47
|
+
def string_with_page_details
|
48
|
+
raw = yield
|
49
|
+
return raw if raw.is_a? String
|
131
50
|
|
132
|
-
|
51
|
+
stringify page_details(raw)
|
133
52
|
end
|
134
53
|
|
135
|
-
|
136
|
-
|
137
|
-
#
|
138
|
-
def nucleus
|
139
|
-
{ id: card.id,
|
140
|
-
name: card.name,
|
141
|
-
type: card.type_name,
|
142
|
-
url: path(format: :json) }.tap do |h|
|
143
|
-
h[:codename] = card.codename if card.codename
|
144
|
-
end
|
145
|
-
end
|
54
|
+
def page_details obj
|
55
|
+
return obj unless obj.is_a? Hash
|
146
56
|
|
147
|
-
|
148
|
-
nucleus.tap do |h|
|
149
|
-
h[:content] = render_content if card.known? && !card.structure
|
150
|
-
end
|
57
|
+
obj.merge url: request_url, requested_at: Time.now.to_s
|
151
58
|
end
|
152
59
|
|
153
|
-
def
|
154
|
-
|
155
|
-
|
156
|
-
ancestors: _render_ancestors,
|
157
|
-
html_url: path,
|
158
|
-
type: nest(card.type_card, view: :nucleus),
|
159
|
-
created_at: card.created_at,
|
160
|
-
updated_at: card.updated_at
|
60
|
+
def stringify raw
|
61
|
+
method = params[:compress] ? :generate : :pretty_generate
|
62
|
+
JSON.send method, raw
|
161
63
|
end
|
162
64
|
end
|
163
|
-
|
164
|
-
# TODO: perhaps this should be in a general "data" module.
|
165
|
-
def cast
|
166
|
-
real? ? { id: id } : { name: name, type_id: type_id, content: db_content }
|
167
|
-
end
|
data/set/all/links.rb
CHANGED
@@ -95,7 +95,7 @@ format :html do
|
|
95
95
|
opts[:href] ||= path opts.delete(:path)
|
96
96
|
text = raw(text || opts[:href])
|
97
97
|
interpret_data_opts_to_link_to opts
|
98
|
-
|
98
|
+
content_tag :a, text, opts
|
99
99
|
end
|
100
100
|
|
101
101
|
# in HTML, #link_to_card adds special css classes indicated whether a
|
File without changes
|
data/set/all/yaml.rb
ADDED
data/set/type/basic.rb
ADDED
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.
|
4
|
+
version: 0.14.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-12-22 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.
|
21
|
+
version: 1.104.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.104.0
|
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.
|
35
|
+
version: 0.14.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.14.0
|
43
43
|
description: ''
|
44
44
|
email:
|
45
45
|
- info@decko.org
|
@@ -55,44 +55,48 @@ files:
|
|
55
55
|
- lib/card/format/js_format.rb
|
56
56
|
- lib/card/format/json_format.rb
|
57
57
|
- lib/card/format/rss_format.rb
|
58
|
+
- lib/card/format/scss_format.rb
|
58
59
|
- lib/card/format/text_format.rb
|
59
60
|
- lib/card/format/xml_format.rb
|
61
|
+
- lib/card/format/yaml_format.rb
|
60
62
|
- lib/card/path.rb
|
61
63
|
- lib/card/path/cast_params.rb
|
64
|
+
- locales/de.yml
|
62
65
|
- locales/en.yml
|
63
|
-
- set/all/active_card.rb
|
64
66
|
- set/all/base.rb
|
65
67
|
- set/all/content.rb
|
66
68
|
- set/all/css.rb
|
67
69
|
- set/all/csv.rb
|
70
|
+
- set/all/data.rb
|
68
71
|
- set/all/demo.rb
|
69
72
|
- set/all/error.rb
|
70
|
-
- set/all/export.rb
|
71
73
|
- set/all/file.rb
|
72
|
-
- set/all/frame.rb
|
73
74
|
- set/all/haml.rb
|
74
|
-
- set/all/
|
75
|
-
- set/all/
|
76
|
-
- set/all/
|
77
|
-
- set/all/
|
78
|
-
- set/all/
|
79
|
-
- set/all/
|
80
|
-
- set/all/
|
81
|
-
- set/all/
|
82
|
-
- set/all/
|
83
|
-
- set/all/
|
84
|
-
- set/all/
|
85
|
-
- set/all/
|
75
|
+
- set/all/html.rb
|
76
|
+
- set/all/html/debug_server_error.haml
|
77
|
+
- set/all/html/error.rb
|
78
|
+
- set/all/html/frame.rb
|
79
|
+
- set/all/html/head.rb
|
80
|
+
- set/all/html/header.rb
|
81
|
+
- set/all/html/header_wrap.haml
|
82
|
+
- set/all/html/labeled.haml
|
83
|
+
- set/all/html/menu.rb
|
84
|
+
- set/all/html/meta_tags.haml
|
85
|
+
- set/all/html/not_found.haml
|
86
|
+
- set/all/html/server_error.haml
|
87
|
+
- set/all/html/show.rb
|
88
|
+
- set/all/html/views.rb
|
89
|
+
- set/all/html/wrap.rb
|
86
90
|
- set/all/js.rb
|
87
91
|
- set/all/json.rb
|
88
92
|
- set/all/links.rb
|
89
|
-
- set/all/menu.rb
|
90
|
-
- set/all/meta_tags.haml
|
91
93
|
- set/all/path.rb
|
92
|
-
- set/all/rich_html.rb
|
93
94
|
- set/all/rss.rb
|
94
95
|
- set/all/text.rb
|
96
|
+
- set/all/title.rb
|
97
|
+
- set/all/yaml.rb
|
95
98
|
- set/self/home.rb
|
99
|
+
- set/type/basic.rb
|
96
100
|
- set/type/cardtype.rb
|
97
101
|
- set/type/html.rb
|
98
102
|
- set/type/json.rb
|
@@ -126,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
130
|
- !ruby/object:Gem::Version
|
127
131
|
version: '0'
|
128
132
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
133
|
+
rubygems_version: 3.2.15
|
130
134
|
signing_key:
|
131
135
|
specification_version: 4
|
132
136
|
summary: format
|
data/set/all/active_card.rb
DELETED
data/set/all/export.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
format :json do
|
2
|
-
# returns an array of Hashes (each in export_item view)
|
3
|
-
view :export, cache: :never do
|
4
|
-
exporting_uniques do
|
5
|
-
Array.wrap(render_export_item).concat(export_items_in_view(:export)).flatten
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def max_export_depth
|
10
|
-
Env.params[:max_export_depth].present? ? Env.params[:max_export_depth].to_i : 2
|
11
|
-
end
|
12
|
-
|
13
|
-
# returns an array of Hashes (each in export_item view)
|
14
|
-
view :export_items, cache: :never do
|
15
|
-
exporting_uniques do
|
16
|
-
export_items_in_view(:export).flatten
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# returns Hash with the essentials needed to import a card into a new database
|
21
|
-
view :export_item do
|
22
|
-
item = { name: card.name, type: card.type_name, content: card.content }
|
23
|
-
item[:codename] = card.codename if card.codename
|
24
|
-
track_exporting card
|
25
|
-
item
|
26
|
-
end
|
27
|
-
|
28
|
-
def export_items_in_view view
|
29
|
-
within_max_depth do
|
30
|
-
valid_items_for_export.map do |item|
|
31
|
-
nest item, view: view
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def track_exporting card
|
37
|
-
return unless @exported_keys
|
38
|
-
|
39
|
-
@exported_keys << card.key
|
40
|
-
end
|
41
|
-
|
42
|
-
def exporting_uniques
|
43
|
-
@exported_keys ||= inherit(:exported_keys) || ::Set.new
|
44
|
-
yield
|
45
|
-
end
|
46
|
-
|
47
|
-
# prevent recursion
|
48
|
-
def within_max_depth
|
49
|
-
@export_depth ||= inherit(:export_depth).to_i + 1
|
50
|
-
@export_depth > max_export_depth ? [] : yield
|
51
|
-
end
|
52
|
-
|
53
|
-
def items_for_export
|
54
|
-
nest_chunks.map do |chunk|
|
55
|
-
next if chunk.try :main?
|
56
|
-
|
57
|
-
chunk.referee_card
|
58
|
-
end.compact
|
59
|
-
end
|
60
|
-
|
61
|
-
def valid_items_for_export
|
62
|
-
items_for_export.flatten.reject(&:blank?).uniq.find_all do |card|
|
63
|
-
valid_export_card? card
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def valid_export_card? ecard
|
68
|
-
ecard.real? && !@exported_keys.include?(ecard.key)
|
69
|
-
end
|
70
|
-
end
|
data/set/all/html_show.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
format :html do
|
2
|
-
def show view, args
|
3
|
-
capture_the_freak do
|
4
|
-
content = send show_method, view, args
|
5
|
-
show_full_page? ? wrap_with_html_page(content) : content
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def show_method
|
10
|
-
"show_#{show_layout? ? :with : :without}_page_layout"
|
11
|
-
end
|
12
|
-
|
13
|
-
def show_without_page_layout view, args
|
14
|
-
@main = true if params[:is_main] || args[:main]
|
15
|
-
args.delete(:layout)
|
16
|
-
view ||= args[:home_view] || default_page_view
|
17
|
-
render! view, args
|
18
|
-
end
|
19
|
-
|
20
|
-
def show_full_page?
|
21
|
-
!Env.ajax?
|
22
|
-
end
|
23
|
-
|
24
|
-
wrapper :html_page do
|
25
|
-
<<-HTML.strip_heredoc
|
26
|
-
<!DOCTYPE HTML>
|
27
|
-
<html class="h-100">
|
28
|
-
<head>
|
29
|
-
#{head_content}
|
30
|
-
</head>
|
31
|
-
#{interior}
|
32
|
-
</html>
|
33
|
-
HTML
|
34
|
-
end
|
35
|
-
|
36
|
-
def head_content
|
37
|
-
nest card.rule_card(:head), view: :head_content
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
# this is a temporary fix to try to debug a recurring encoding-related error
|
43
|
-
# TODO: remove the following after tracking down wikirate encoding bug
|
44
|
-
def capture_the_freak
|
45
|
-
yield
|
46
|
-
rescue Card::Error::ServerError => e
|
47
|
-
if e.message.match?(/invalid byte sequence/)
|
48
|
-
Card::Lexicon.cache.reset
|
49
|
-
Rails.logger.info "reset name cache to prevent encoding freakiness"
|
50
|
-
end
|
51
|
-
raise e
|
52
|
-
end
|
53
|
-
end
|