card 1.109.0 → 1.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/locales/es.yml +2 -3
- data/db/seeds.rb +0 -1
- data/lib/card/auth/current.rb +2 -2
- data/lib/card/auth/permissions.rb +1 -1
- data/lib/card/auth/proxy.rb +3 -3
- data/lib/card/auth/setup.rb +2 -2
- data/lib/card/cache/all.rb +1 -1
- data/lib/card/cache/class_methods.rb +1 -1
- data/lib/card/cache/shared.rb +3 -2
- data/lib/card/codename.rb +1 -0
- data/lib/card/content/chunk.rb +2 -2
- data/lib/card/content/parser.rb +4 -4
- data/lib/card/content.rb +7 -9
- data/lib/card/director/all.rb +4 -4
- data/lib/card/director/card_class.rb +3 -3
- data/lib/card/director/event_delay.rb +2 -2
- data/lib/card/director/phases.rb +2 -2
- data/lib/card/director/store.rb +2 -2
- data/lib/card/env/location_history.rb +15 -16
- data/lib/card/env/support.rb +6 -5
- data/lib/card/error.rb +2 -2
- data/lib/card/fetch/card_class.rb +2 -2
- data/lib/card/format/card_action_view.rb +1 -1
- data/lib/card/format/content.rb +4 -4
- data/lib/card/format/error.rb +12 -2
- data/lib/card/format/method_delegation.rb +4 -4
- data/lib/card/format/nesting/mode.rb +2 -2
- data/lib/card/format/render.rb +59 -54
- data/lib/card/format/wrapper.rb +2 -2
- data/lib/card/lexicon.rb +5 -2
- data/lib/card/model/save_helper/save_helper_helper.rb +2 -2
- data/lib/card/model/save_helper.rb +2 -2
- data/lib/card/name/all/parts.rb +10 -10
- data/lib/card/name/all.rb +4 -2
- data/lib/card/name.rb +3 -3
- data/lib/card/query/card_class.rb +2 -2
- data/lib/card/query/card_query/interpretation.rb +1 -1
- data/lib/card/query/card_query/normalization.rb +1 -1
- data/lib/card/query/card_query/relational_attributes.rb +1 -1
- data/lib/card/query/card_query/run.rb +5 -1
- data/lib/card/query/card_query.rb +2 -1
- data/lib/card/query/sql_statement/where.rb +1 -1
- data/lib/card/query/sql_statement.rb +7 -1
- data/lib/card/query.rb +1 -1
- data/lib/card/reference/all.rb +2 -2
- data/lib/card/set/advanced_api.rb +4 -3
- data/lib/card/set/event/all.rb +1 -1
- data/lib/card/set/event.rb +6 -8
- data/lib/card/set/format/abstract_format/haml_views.rb +2 -2
- data/lib/card/set/format/abstract_format/view_definition.rb +6 -6
- data/lib/card/set/format/abstract_format/wrapper.rb +5 -5
- data/lib/card/set/format/abstract_format.rb +7 -5
- data/lib/card/set/format/haml_paths.rb +2 -2
- data/lib/card/set/format.rb +2 -2
- data/lib/card/set/inheritance.rb +1 -1
- data/lib/card/set/pattern/base.rb +1 -0
- data/lib/card/set/required_field.rb +1 -1
- data/lib/card/subcards.rb +4 -4
- data/lib/card/view/cache/cache_action.rb +19 -7
- data/lib/card/view/cache.rb +26 -23
- data/lib/card/view/options/voo_api.rb +1 -1
- data/lib/card/view/options.rb +1 -0
- data/lib/card/view.rb +1 -1
- data/lib/cardio/command/rspec_command/parser.rb +1 -1
- data/lib/cardio/generators/deck_helper.rb +1 -1
- data/lib/cardio/job.rb +0 -1
- data/lib/cardio/mod/dirs.rb +2 -2
- data/lib/cardio/mod/eat.rb +5 -8
- data/lib/cardio/mod/load_strategy/set_binding_magic.rb +2 -2
- data/lib/cardio/mod/loader/set_loader.rb +1 -1
- data/lib/cardio/mod/loader.rb +2 -2
- data/lib/cardio/mod/sow.rb +1 -1
- data/lib/cardio/seed.rb +2 -2
- data/lib/generators/deck/deck_generator.rb +1 -1
- data/lib/generators/migration/migration_generator.rb +1 -0
- data/mod/core/config/locales/de.yml +1 -1
- data/mod/core/config/locales/en.yml +1 -1
- data/mod/core/data/fixtures/real/cards.yml +1 -1
- data/mod/core/data/real.yml +1 -1
- data/mod/core/data/recode.yml +1 -0
- data/mod/core/lib/tasks/card/mod.rake +1 -1
- data/mod/core/lib/tasks/card/trash.rake +8 -0
- data/mod/core/lib/tasks/card.rake +19 -18
- data/mod/core/set/all/assign_attributes.rb +3 -3
- data/mod/core/set/all/codename.rb +0 -1
- data/mod/core/set/all/initialize.rb +2 -2
- data/mod/core/set/all/states.rb +6 -10
- data/mod/core/set/all/type.rb +1 -1
- data/mod/core/set/self/mod.rb +2 -2
- data/mod/core/spec/set/all/admin_spec.rb +1 -1
- data/mod/core/spec/set/all/trash_spec.rb +2 -2
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: abe5aee55e82a21646046cd81ce981f95e68ec7a5c013d065e4a49202a268e22
|
|
4
|
+
data.tar.gz: 35909d80d33bd11bc6084c52adab226d655f1052df391b6e4da86c3a2275a525
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e270754fe2e275c495bb908e9d2e6a4d0f955babc02b9368c28d6ab4a07198f63453d431b7b0cd6a5900c9e1a885447c78f74c3428848efd80c73097eb8fc76
|
|
7
|
+
data.tar.gz: de120f96396a0b25f6f49f4154c936b497a94e806b02b6634af4db31fb478348ddd4a8dee610085fc38d0dba2baef428df6b6998b7f71a25d4f7b16f05b92824
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.20.0
|
data/config/locales/es.yml
CHANGED
|
@@ -133,7 +133,7 @@ es:
|
|
|
133
133
|
type:
|
|
134
134
|
error_cant_change_errors: "de %{name} no se puede cambiar; creando nuevos errores %{type_id}: %{error_messages}"
|
|
135
135
|
error_no_such_type: No hay tal tipo
|
|
136
|
-
|
|
136
|
+
error_structured: no se puede cambiar porque %{name} es una plantilla dificil de %{type_name}
|
|
137
137
|
utils:
|
|
138
138
|
exception_almost_deleted: Se evitó de forma muy estrecha eliminar el archivo actual
|
|
139
139
|
set_pattern:
|
|
@@ -302,8 +302,7 @@ es:
|
|
|
302
302
|
unsupported_view: vista (%{view}) no soportado para %{cardname}
|
|
303
303
|
not_found_named: No pudo encontrar %{cardname}.
|
|
304
304
|
not_found_no_name: la tarjeta solicitada
|
|
305
|
-
server_error: "\
|
|
306
|
-
se_hitch: 'Wagn Hitch :('
|
|
305
|
+
server_error: "\nError del Servidor. Yuck, perdon por eso.\nPara decirnos más y seguir la solución,\nagregue un ticket de soporte en %{ticket_link}\n"
|
|
307
306
|
se_sorry: Error del Servidor. Yuck, perdón por eso.
|
|
308
307
|
se_ticket: <a href="%{ticket_link}">Agregue un ticket de soporte</a> para decirnos más y seguir la solución.
|
|
309
308
|
denial: Permiso denegado
|
data/db/seeds.rb
CHANGED
data/lib/card/auth/current.rb
CHANGED
|
@@ -36,7 +36,7 @@ class Card
|
|
|
36
36
|
def signin cardish
|
|
37
37
|
user_id = Card.id(cardish) || AnonymousID
|
|
38
38
|
(session[session_user_key] = self.current_id = user_id).tap do
|
|
39
|
-
Env.
|
|
39
|
+
Env.update_session_options
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -80,7 +80,7 @@ class Card
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def session_user_key
|
|
83
|
-
"user_#{Cardio.database.underscore}"
|
|
83
|
+
:"user_#{Cardio.database.underscore}"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
private
|
data/lib/card/auth/proxy.rb
CHANGED
|
@@ -23,9 +23,9 @@ class Card
|
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
# operate with the permissions of
|
|
27
|
-
def as_bot
|
|
28
|
-
as
|
|
26
|
+
# operate with the permissions of DeckoBot (administrator)
|
|
27
|
+
def as_bot(&)
|
|
28
|
+
as(Card::DeckoBotID, &)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# id of proxy user
|
data/lib/card/auth/setup.rb
CHANGED
|
@@ -41,8 +41,8 @@ class Card
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def user_account_cql
|
|
44
|
-
# every deck starts with two accounts:
|
|
45
|
-
{ right: :account, creator_id: ["ne", Card::
|
|
44
|
+
# every deck starts with two accounts: DeckoBot and Anonymous
|
|
45
|
+
{ right: :account, creator_id: ["ne", Card::DeckoBotID] }
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def user_account_count
|
data/lib/card/cache/all.rb
CHANGED
|
@@ -12,7 +12,7 @@ class Card
|
|
|
12
12
|
def [] klass
|
|
13
13
|
raise "nil klass" if klass.nil?
|
|
14
14
|
|
|
15
|
-
cache_by_class[klass] ||= new class: klass, store:
|
|
15
|
+
cache_by_class[klass] ||= new class: klass, store: shared_cache || nil
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# clear the temporary caches and ensure we're using the latest stamp
|
data/lib/card/cache/shared.rb
CHANGED
|
@@ -16,6 +16,7 @@ class Card
|
|
|
16
16
|
#
|
|
17
17
|
class Shared
|
|
18
18
|
extend SharedClass
|
|
19
|
+
|
|
19
20
|
# @param opts [Hash]
|
|
20
21
|
# @option opts [Rails::Cache] :store
|
|
21
22
|
# @option opts [ruby Class] :class, typically ActiveRecord descendant
|
|
@@ -116,8 +117,8 @@ class Card
|
|
|
116
117
|
@store.write full_key(key), value
|
|
117
118
|
end
|
|
118
119
|
|
|
119
|
-
def fetch
|
|
120
|
-
@store.fetch
|
|
120
|
+
def fetch(key, &)
|
|
121
|
+
@store.fetch(full_key(key), &)
|
|
121
122
|
end
|
|
122
123
|
|
|
123
124
|
def delete key
|
data/lib/card/codename.rb
CHANGED
data/lib/card/content/chunk.rb
CHANGED
data/lib/card/content/parser.rb
CHANGED
|
@@ -60,7 +60,8 @@ class Card
|
|
|
60
60
|
|
|
61
61
|
def match_prefix prefix_regexp
|
|
62
62
|
prefix_match = @content[@position..].match(prefix_regexp)
|
|
63
|
-
|
|
63
|
+
return unless prefix_match
|
|
64
|
+
|
|
64
65
|
@prefix = prefix_match[0]
|
|
65
66
|
# prefix of matched chunk
|
|
66
67
|
@chunk_start = prefix_match.begin(0) + @position
|
|
@@ -73,7 +74,6 @@ class Card
|
|
|
73
74
|
@position = @chunk_start
|
|
74
75
|
# move scanning position up to beginning of chunk
|
|
75
76
|
true
|
|
76
|
-
end
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def record_chunk
|
|
@@ -98,10 +98,10 @@ class Card
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def handle_remainder
|
|
101
|
-
|
|
101
|
+
return unless @chunks.any? && @last_position < @content.size
|
|
102
|
+
|
|
102
103
|
# handle any leftover nonchunk string at the end of content
|
|
103
104
|
@chunks << @content[@last_position..]
|
|
104
|
-
end
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
end
|
data/lib/card/content.rb
CHANGED
|
@@ -7,9 +7,7 @@ class Card
|
|
|
7
7
|
# Each chunk has an object whose class inherits from {Card::Content::Chunk::Abstract}
|
|
8
8
|
#
|
|
9
9
|
class Content < SimpleDelegator
|
|
10
|
-
extend Clean
|
|
11
|
-
|
|
12
|
-
Chunk # trigger autoload
|
|
10
|
+
extend Clean # trigger autoload
|
|
13
11
|
|
|
14
12
|
attr_reader :revision, :format, :chunks, :opts
|
|
15
13
|
|
|
@@ -47,8 +45,8 @@ class Card
|
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
# sends &block to #process_chunk on each Chunk object
|
|
50
|
-
def process_chunks
|
|
51
|
-
return custom_process_chunks(&
|
|
48
|
+
def process_chunks(&)
|
|
49
|
+
return custom_process_chunks(&) if block_given?
|
|
52
50
|
|
|
53
51
|
each_chunk(&:process_chunk)
|
|
54
52
|
end
|
|
@@ -98,12 +96,12 @@ class Card
|
|
|
98
96
|
"<#{__getobj__.class}:#{card}:#{self}>"
|
|
99
97
|
end
|
|
100
98
|
|
|
101
|
-
def without_nests
|
|
102
|
-
without_chunks
|
|
99
|
+
def without_nests(&)
|
|
100
|
+
without_chunks(Chunk::Nest, &)
|
|
103
101
|
end
|
|
104
102
|
|
|
105
|
-
def without_references
|
|
106
|
-
without_chunks
|
|
103
|
+
def without_references(&)
|
|
104
|
+
without_chunks(Chunk::Nest, Chunk::Link, Chunk::EscapedLiteral, &)
|
|
107
105
|
end
|
|
108
106
|
|
|
109
107
|
def without_chunks *chunk_classes
|
data/lib/card/director/all.rb
CHANGED
|
@@ -27,11 +27,11 @@ class Card
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def act
|
|
30
|
+
def act(options={}, &)
|
|
31
31
|
if act_card
|
|
32
|
-
add_to_act
|
|
32
|
+
add_to_act(options, &)
|
|
33
33
|
else
|
|
34
|
-
start_new_act(&
|
|
34
|
+
start_new_act(&)
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -45,7 +45,7 @@ class Card
|
|
|
45
45
|
|
|
46
46
|
def save! **args
|
|
47
47
|
as_subcard = args.delete :as_subcard
|
|
48
|
-
act(as_subcard: as_subcard) { super
|
|
48
|
+
act(as_subcard: as_subcard) { super(**args) }
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def save *_args
|
|
@@ -107,11 +107,11 @@ class Card
|
|
|
107
107
|
end
|
|
108
108
|
end
|
|
109
109
|
|
|
110
|
-
def ensuring_purity
|
|
110
|
+
def ensuring_purity(card, other, opts, &)
|
|
111
111
|
if opts[:codename] && other
|
|
112
|
-
ensure_purity_advanced
|
|
112
|
+
ensure_purity_advanced(card, other, opts, &)
|
|
113
113
|
else
|
|
114
|
-
ensure_purity_simple
|
|
114
|
+
ensure_purity_simple(card, &)
|
|
115
115
|
end
|
|
116
116
|
end
|
|
117
117
|
|
|
@@ -20,10 +20,10 @@ class Card
|
|
|
20
20
|
Cardio.config.delaying == true
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def with_delay_act
|
|
23
|
+
def with_delay_act(act_id, card, &)
|
|
24
24
|
return yield unless act_id && (self.act = Act.find act_id)
|
|
25
25
|
|
|
26
|
-
run_job_with_act
|
|
26
|
+
run_job_with_act(act, card, &)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def run_job_with_act act, card, &block
|
data/lib/card/director/phases.rb
CHANGED
|
@@ -31,10 +31,10 @@ class Card
|
|
|
31
31
|
|
|
32
32
|
# Unlike other phases, the storage phase takes a block,
|
|
33
33
|
# because it is called by an "around" callback
|
|
34
|
-
def storage_phase
|
|
34
|
+
def storage_phase(&)
|
|
35
35
|
catch_up_to_stage :prepare_to_store # unless @abort
|
|
36
36
|
# puts "before store #{@card.name}: abort:#{@abort}"
|
|
37
|
-
run_stage
|
|
37
|
+
run_stage(:store, &) # unless @abort
|
|
38
38
|
run_stage :finalize # unless @abort
|
|
39
39
|
raise ActiveRecord::RecordInvalid, @card if @card.errors.any?
|
|
40
40
|
ensure
|
data/lib/card/director/store.rb
CHANGED
|
@@ -21,14 +21,14 @@ class Card
|
|
|
21
21
|
# the subcards as we do in the other phases.
|
|
22
22
|
# Instead we have to call `save` on the subcards and use the ActiveRecord
|
|
23
23
|
# :around_save callback.
|
|
24
|
-
def store
|
|
24
|
+
def store(&)
|
|
25
25
|
raise Card::Error, "need block to store main card" if main? && !block_given?
|
|
26
26
|
|
|
27
27
|
# the block is the ActiveRecord block from the around save callback that
|
|
28
28
|
# saves the card
|
|
29
29
|
if block_given?
|
|
30
30
|
run_stage_callbacks :store
|
|
31
|
-
store_with_subcards(&
|
|
31
|
+
store_with_subcards(&)
|
|
32
32
|
else
|
|
33
33
|
trigger_storage_phase_callback
|
|
34
34
|
end
|
|
@@ -10,10 +10,10 @@ class Card
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def save_location card
|
|
13
|
-
return unless save_location?
|
|
13
|
+
return unless save_location? card
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
location_history.push
|
|
15
|
+
location = request ? request.original_url : location_for_history(card)
|
|
16
|
+
location_history.push(location).uniq!
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def previous_location
|
|
@@ -21,21 +21,18 @@ class Card
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def discard_locations_for card
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (url_key = url_key_for_location(loc))
|
|
27
|
-
url_key.to_name.key == card.key
|
|
28
|
-
end
|
|
24
|
+
session[:history] = location_history.reject do |l|
|
|
25
|
+
location_cardname(l) == card.name
|
|
29
26
|
end.compact
|
|
30
27
|
end
|
|
31
28
|
|
|
32
|
-
def save_interrupted_action uri
|
|
33
|
-
|
|
34
|
-
end
|
|
29
|
+
# def save_interrupted_action uri
|
|
30
|
+
# session[:interrupted_action] = uri
|
|
31
|
+
# end
|
|
35
32
|
|
|
36
|
-
def interrupted_action
|
|
37
|
-
|
|
38
|
-
end
|
|
33
|
+
# def interrupted_action
|
|
34
|
+
# session.delete :interrupted_action
|
|
35
|
+
# end
|
|
39
36
|
|
|
40
37
|
private
|
|
41
38
|
|
|
@@ -43,11 +40,13 @@ class Card
|
|
|
43
40
|
Env::Location.card_path card.name.url_key
|
|
44
41
|
end
|
|
45
42
|
|
|
46
|
-
def
|
|
47
|
-
%r{
|
|
43
|
+
def location_cardname location
|
|
44
|
+
URI.parse(location).path.sub(%r{^/}, "").sub(%r{/.*$}, "")&.cardname
|
|
48
45
|
end
|
|
49
46
|
|
|
50
47
|
def save_location? card
|
|
48
|
+
# return false unless Auth.signed_in? || Cardio.config.allow_anonymous_cookies
|
|
49
|
+
|
|
51
50
|
!Env.ajax? && Env.html? && card.known? && (card.codename != :signin)
|
|
52
51
|
end
|
|
53
52
|
end
|
data/lib/card/env/support.rb
CHANGED
|
@@ -22,16 +22,17 @@ class Card
|
|
|
22
22
|
if session.is_a? Hash
|
|
23
23
|
@session = {}
|
|
24
24
|
elsif request
|
|
25
|
-
|
|
25
|
+
update_session_options drop: false
|
|
26
26
|
controller.reset_session
|
|
27
|
-
# destroy_cookie unless Cardio.config.
|
|
27
|
+
# destroy_cookie unless Cardio.config.allow_anonymous_cookies
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def
|
|
32
|
-
return unless request
|
|
31
|
+
def update_session_options drop: nil
|
|
32
|
+
return unless request
|
|
33
|
+
return if Cardio.config.allow_anonymous_cookies
|
|
33
34
|
|
|
34
|
-
request.session_options[:drop] =
|
|
35
|
+
request.session_options[:drop] = drop.nil? ? !Auth.signed_in? : drop
|
|
35
36
|
end
|
|
36
37
|
|
|
37
38
|
# private
|
data/lib/card/error.rb
CHANGED
|
@@ -27,7 +27,7 @@ class Card
|
|
|
27
27
|
self.card = message
|
|
28
28
|
message = message_from_card
|
|
29
29
|
end
|
|
30
|
-
super
|
|
30
|
+
super
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def message_from_card
|
|
@@ -119,7 +119,7 @@ class Card
|
|
|
119
119
|
|
|
120
120
|
def initialize status, msg=""
|
|
121
121
|
@status = status
|
|
122
|
-
super
|
|
122
|
+
super(msg)
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
@@ -28,8 +28,8 @@ class Card
|
|
|
28
28
|
# new: { opts for Card#new } Return a new card when not found
|
|
29
29
|
#
|
|
30
30
|
# @return [Card]
|
|
31
|
-
def fetch
|
|
32
|
-
f = Fetch.new(*
|
|
31
|
+
def fetch(*)
|
|
32
|
+
f = Fetch.new(*)
|
|
33
33
|
f.retrieve_or_new
|
|
34
34
|
rescue ActiveModel::RangeError => _e
|
|
35
35
|
Card.new name: "card id out of range: #{f.mark}"
|
data/lib/card/format/content.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
class Card
|
|
2
2
|
class Format
|
|
3
3
|
module Content
|
|
4
|
-
def process_content
|
|
4
|
+
def process_content(override_content=nil, content_opts=nil, &)
|
|
5
5
|
content_obj = content_object override_content, content_opts
|
|
6
|
-
content_obj.process_chunks(&
|
|
6
|
+
content_obj.process_chunks(&)
|
|
7
7
|
content_obj.to_s
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
# 1. Break out references (nests / links) into separate chunks
|
|
11
11
|
# 2. yields the other (non-ref) content
|
|
12
12
|
# 3. processes references
|
|
13
|
-
def safe_process_content
|
|
13
|
+
def safe_process_content(override_content=nil, content_opts=nil, &)
|
|
14
14
|
content_obj = content_object override_content, chunk_list: :references
|
|
15
|
-
process_content content_obj.without_references(&
|
|
15
|
+
process_content content_obj.without_references(&), content_opts
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# nested by another card's content
|
data/lib/card/format/error.rb
CHANGED
|
@@ -17,8 +17,8 @@ class Card
|
|
|
17
17
|
|
|
18
18
|
def view_for_unknown setting_view
|
|
19
19
|
if main? && voo.root?
|
|
20
|
-
root.error_status =
|
|
21
|
-
|
|
20
|
+
root.error_status = page_status_for_unknown
|
|
21
|
+
page_view_for_unknown
|
|
22
22
|
else
|
|
23
23
|
setting_view || :unknown
|
|
24
24
|
end
|
|
@@ -39,11 +39,21 @@ class Card
|
|
|
39
39
|
yield
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
private
|
|
43
|
+
|
|
42
44
|
def rescue_view e, view
|
|
43
45
|
method = loud_error? ? :loud_error : :quiet_error
|
|
44
46
|
send method, e, view
|
|
45
47
|
end
|
|
46
48
|
|
|
49
|
+
def page_status_for_unknown
|
|
50
|
+
404
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def page_view_for_unknown
|
|
54
|
+
:not_found
|
|
55
|
+
end
|
|
56
|
+
|
|
47
57
|
def error_cardname _exception
|
|
48
58
|
if card&.name.present?
|
|
49
59
|
safe_name
|
|
@@ -38,11 +38,11 @@ class Card
|
|
|
38
38
|
# TODO: make it so we fall back to super if action_view can't handle method.
|
|
39
39
|
# It's not as easy as `elsif api_render? method`, because respond_to gives
|
|
40
40
|
# false for many methods action view can actually handle, like `h`
|
|
41
|
-
def method_missing
|
|
41
|
+
def method_missing(method, *opts, &)
|
|
42
42
|
if (match = api_render? method)
|
|
43
43
|
api_render match, opts
|
|
44
44
|
else
|
|
45
|
-
delegate_to_action_view
|
|
45
|
+
delegate_to_action_view(method, opts, &)
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
|
|
@@ -54,8 +54,8 @@ class Card
|
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
|
-
def interpret_render_opts
|
|
58
|
-
(opts[0] ? opts.shift.clone : {}).tap(&
|
|
57
|
+
def interpret_render_opts(opts, &)
|
|
58
|
+
(opts[0] ? opts.shift.clone : {}).tap(&)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def optional_render_opt opts, args
|
|
@@ -21,11 +21,11 @@ class Card
|
|
|
21
21
|
# run block with new_mode as nest_mode, then return to prior mode
|
|
22
22
|
# @param new_mode [Symbol] :normal, :compact, :edit, or :template
|
|
23
23
|
# @return block result
|
|
24
|
-
def with_nest_mode
|
|
24
|
+
def with_nest_mode(new_mode, &)
|
|
25
25
|
if new_mode == @nest_mode
|
|
26
26
|
yield
|
|
27
27
|
else
|
|
28
|
-
with_altered_nest_mode
|
|
28
|
+
with_altered_nest_mode(new_mode, &)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|