card 1.96.1 → 1.96.2
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/de.yml +18 -23
- data/config/locales/en.yml +16 -21
- data/config/locales/es.yml +16 -21
- data/lib/card.rb +1 -3
- data/lib/card/codename.rb +2 -1
- data/lib/card/error.rb +73 -57
- data/lib/card/format.rb +2 -2
- data/lib/card/format/error.rb +17 -18
- data/lib/card/format/nesting/mode.rb +1 -1
- data/lib/card/format/permission.rb +8 -10
- data/lib/card/format/render.rb +1 -2
- data/lib/card/model/save_helper.rb +20 -12
- data/lib/card/query.rb +1 -1
- data/lib/card/query/card_query.rb +2 -2
- data/lib/card/query/card_query/found_by.rb +43 -0
- data/lib/card/query/card_query/match_attributes.rb +72 -0
- data/lib/card/query/card_query/relational_attributes.rb +19 -0
- data/lib/card/view.rb +0 -1
- data/lib/card/view/cache_action.rb +1 -10
- data/mod/account/set/right/token.rb +1 -3
- data/mod/account/set/self/account_links.rb +9 -12
- data/mod/basic_formats/set/all/json.rb +19 -54
- data/mod/basic_formats/spec/set/all/json_spec.rb +13 -3
- data/mod/basic_formats/spec/shared_context/json_shared_context.rb +3 -8
- data/mod/basic_types/set/type/json.rb +13 -1
- data/mod/bootstrap/set/abstract/bootswatch_theme/html_views.rb +0 -1
- data/mod/bootstrap/set/all/bootstrap/helper.rb +7 -0
- data/mod/bootstrap/set/self/script_bootstrap.rb +1 -2
- data/mod/core/set/all/content.rb +4 -6
- data/mod/core/set/all/export.rb +39 -15
- data/mod/core/set/all/fetch.rb +9 -0
- data/mod/core/set/all/permissions.rb +0 -4
- data/mod/core/set/all/phases.rb +1 -1
- data/mod/core/set/all/subcards.rb +1 -0
- data/mod/core/set/all/trash.rb +6 -2
- data/mod/core/set/all/type.rb +1 -1
- data/mod/core/set/all/utils.rb +13 -1
- data/mod/core/spec/set/all/fetch_spec.rb +17 -4
- data/mod/history/set/all/history.rb +34 -57
- data/mod/history/set/all/{act_view.rb → history/act_listing.rb} +0 -13
- data/mod/history/set/all/history/actions.rb +119 -0
- data/mod/history/set/all/history/acts.rb +12 -0
- data/mod/history/set/all/history/events.rb +94 -0
- data/mod/history/set/all/history/last.rb +97 -0
- data/mod/history/set/all/history/revision.rb +54 -0
- data/mod/history/set/all/history/selected.rb +64 -0
- data/mod/history/set/all/history/views.rb +34 -0
- data/mod/history/spec/set/all/history/views_spec.rb +29 -0
- data/mod/item/spec/set/all/bar_spec.rb +2 -2
- data/mod/machines/file/all_script_machine_output/file.js +66 -30621
- data/mod/machines/file/all_style_machine_output/file.css +2 -2
- data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
- data/mod/machines/lib/javascript/decko.js.coffee +1 -1
- data/mod/pointer/lib/javascript/script_pointer_config.js.coffee +1 -1
- data/mod/pointer/set/abstract/01_paging.rb +1 -0
- data/mod/pointer/set/abstract/02_pointer/html_views.rb +2 -2
- data/mod/pointer/set/abstract/02_pointer/html_views/checkbox_input.haml +2 -2
- data/mod/pointer/set/abstract/02_pointer/html_views/filter/filter_items.haml +1 -1
- data/mod/pointer/set/abstract/02_pointer/html_views/radio_input.haml +4 -4
- data/mod/pointer/set/abstract/02_pointer/options_api.rb +25 -1
- data/mod/pointer/set/abstract/02_pointer/other_views.rb +4 -0
- data/mod/pointer/spec/set/abstract/pointer/options_api_spec.rb +35 -0
- data/mod/search/set/abstract/search.rb +4 -114
- data/mod/search/set/abstract/search/views.rb +156 -0
- data/mod/search/set/abstract/wql_search.rb +10 -0
- data/mod/search/set/self/search.rb +3 -10
- data/mod/search/set/type/search_type.rb +5 -1
- data/mod/search/template/abstract/03_filter/filter_form.haml +1 -1
- data/mod/standard/set/all/error.rb +24 -192
- data/mod/standard/set/all/rich_html/content.rb +1 -1
- data/mod/standard/set/all/rich_html/error.rb +177 -0
- data/mod/standard/{template/all → set/all/rich_html}/error/not_found.haml +0 -0
- data/mod/standard/{template/all → set/all/rich_html}/error/server_error.haml +0 -0
- data/mod/standard/set/all/rich_html/form.rb +9 -9
- data/mod/standard/set/all/rich_html/menu.rb +14 -5
- data/mod/standard/spec/content/chunk/include_spec.rb +1 -2
- data/mod/standard/spec/set/type/search_type_spec.rb +1 -1
- data/mod/utility/set/abstract/bs_badge/bs_badge.haml +1 -1
- data/mod/utility/set/abstract/media.rb +3 -1
- metadata +20 -16
- data/lib/card/query/card_query/attribute_helper.rb +0 -74
- data/lib/card/query/card_query/special_attributes.rb +0 -49
- data/mod/history/set/all/action_view.rb +0 -52
- data/mod/history/set/all/actions.rb +0 -185
- data/mod/history/set/all/acts.rb +0 -16
- data/mod/history/set/all/content_history.rb +0 -180
- data/mod/history/spec/set/all/act_view_spec.rb +0 -16
- data/mod/history/spec/set/all/action_view_spec.rb +0 -10
- data/mod/history/spec/set/all/history_spec.rb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c1961a2ce7d7e5934195e3002c3e7609318f6e4
|
|
4
|
+
data.tar.gz: 52b297b8c8b3a67261d147ac9dd70d1d787c5e55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f093ab3a76e7623d20fff9af9be1a935bb5f5aff4d047fe5fa2ae19702ff253ef69478348d5b71a71974289981f54283b212e7eba6e7a680ce4f43e37ecbbeee
|
|
7
|
+
data.tar.gz: 2f7188deb8519510247765f59306d7da32c3f03038406de03c9df421f631e135d4d48ba212e31df9b6c81d9805f707f8cb11f6a7e7909a0fdc6a8ec0e01d4d80
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.6.
|
|
1
|
+
0.6.2
|
data/config/locales/de.yml
CHANGED
|
@@ -168,6 +168,11 @@ de:
|
|
|
168
168
|
save_as_current: Als aktuelle Fassung speichern
|
|
169
169
|
show_changes: Zeige Änderungen
|
|
170
170
|
hide_changes: Verstecke Änderungen
|
|
171
|
+
:basic_formats:
|
|
172
|
+
set:
|
|
173
|
+
all:
|
|
174
|
+
base:
|
|
175
|
+
too_deep: Man, you're too deep. (Zu viele Level von Nester auf einmal)
|
|
171
176
|
:basic_types:
|
|
172
177
|
set:
|
|
173
178
|
abstract:
|
|
@@ -298,36 +303,15 @@ de:
|
|
|
298
303
|
se_ticket: <a href="%{ticket_link}">Erstelle ein Support-Ticket</a> to tell us more and follow the fix.
|
|
299
304
|
denial: Zugriff verweigert
|
|
300
305
|
bad_address: "404: Bad Address"
|
|
301
|
-
too_deep: Man, you're too deep. (Zu viele Level von Nester auf einmal)
|
|
302
306
|
too_slow: Timed out! %{showname} hat zu lange zum Laden gebraucht.
|
|
303
307
|
error_rendering: error rendering
|
|
304
308
|
error_message: Fehlermeldung (nur für Administratoren sichtbar)
|
|
305
309
|
add_thing: Füge %{title} hinzu
|
|
306
310
|
conflict: Konflikt!
|
|
311
|
+
not_found: Nicht gefunden
|
|
307
312
|
also_changes: "%{actor_link} hat gleichzeitig Änderungen gemacht."
|
|
308
313
|
conflict_instruction: Bitte überprüfe den Konflikt unten, behebe ihn oben, und sende erneut.
|
|
309
|
-
|
|
310
|
-
problems_name: Probleme mit %{cardname}
|
|
311
|
-
sign_in_c: Anmelden
|
|
312
|
-
sign_up_c: Registrieren
|
|
313
|
-
sign_in: anmelden
|
|
314
|
-
sign_up: registrieren
|
|
315
|
-
not_found: Nicht gefunden
|
|
316
|
-
sign_in_or_up: "%{signin_link} oder %{signup_link} um es zu erstellen."
|
|
317
|
-
not_found_card: Konnte %{cardname} nicht finden
|
|
318
|
-
not_found_that: Konnte das nicht finden.
|
|
319
|
-
read_only: Wir sind im Moment im Nur-Lese-Modus. Versuche es später noch einmal.
|
|
320
|
-
sorry: Sorry!
|
|
321
|
-
need_permission_task: You need permission to %{task} this.
|
|
322
|
-
need_permission_no_task: You need permission to do that.
|
|
323
|
-
sign_in_up_task: Bitte %{signin_link} oder %{signup_link} um das zu %{task}.
|
|
324
|
-
sign_in_task: Bitte %{signin_link} um das zu %{task}.
|
|
325
|
-
sign_in_up_no_task: Bitte %{signin_link} oder %{signup_link} um das zu tun.
|
|
326
|
-
sign_in_no_task: Bitte %{signin_link} um das zu tun.
|
|
327
|
-
or: oder
|
|
328
|
-
please: bitte
|
|
329
|
-
denied_task: zu %{denied_task} dies
|
|
330
|
-
to_do_that: das zu tun
|
|
314
|
+
|
|
331
315
|
list_changes:
|
|
332
316
|
search_list_fields: list fields
|
|
333
317
|
search_listed_by_fields: listed by fields
|
|
@@ -354,6 +338,17 @@ de:
|
|
|
354
338
|
rename_update: Umbenennen und aktualisieren
|
|
355
339
|
renaming: Wird umbenannt
|
|
356
340
|
rename: Umbenennen
|
|
341
|
+
error:
|
|
342
|
+
problems_name: Probleme mit %{cardname}
|
|
343
|
+
please: Bitte
|
|
344
|
+
sign_in: anmelden
|
|
345
|
+
or: oder
|
|
346
|
+
sign_up: registrieren
|
|
347
|
+
read_only: Wir sind im Moment im Nur-Lese-Modus. Versuche es später noch einmal.
|
|
348
|
+
sorry: Sorry!
|
|
349
|
+
need_permission_task: You need permission to %{task} this.
|
|
350
|
+
to_do_that: das zu tun
|
|
351
|
+
denied_task: zu %{denied_task} dies
|
|
357
352
|
form:
|
|
358
353
|
unsupported_action_class: "unsupported card_form action class: %{actionclass}"
|
|
359
354
|
submit: Speichern
|
data/config/locales/en.yml
CHANGED
|
@@ -178,6 +178,11 @@ en:
|
|
|
178
178
|
save_as_current: Save as current
|
|
179
179
|
show_changes: Show changes
|
|
180
180
|
hide_changes: Hide changes
|
|
181
|
+
:basic_formats:
|
|
182
|
+
set:
|
|
183
|
+
all:
|
|
184
|
+
base:
|
|
185
|
+
too_deep: Man, you're too deep. (Too many levels of nests at a time)
|
|
181
186
|
:basic_types:
|
|
182
187
|
set:
|
|
183
188
|
abstract:
|
|
@@ -308,7 +313,6 @@ en:
|
|
|
308
313
|
se_ticket: <a href="%{ticket_link}">Add a support ticket</a> to tell us more and follow the fix.
|
|
309
314
|
denial: Permission Denied
|
|
310
315
|
bad_address: "404: Bad Address"
|
|
311
|
-
too_deep: Man, you're too deep. (Too many levels of nests at a time)
|
|
312
316
|
too_slow: Timed out! %{showname} took too long to load.
|
|
313
317
|
error_rendering: error rendering
|
|
314
318
|
error_message: Error message (visible to admin only)
|
|
@@ -316,28 +320,8 @@ en:
|
|
|
316
320
|
conflict: Conflict!
|
|
317
321
|
also_changes: "%{actor_link} has also been making changes."
|
|
318
322
|
conflict_instruction: Please examine below, resolve above, and re-submit.
|
|
319
|
-
problems_no_name: Problems
|
|
320
|
-
problems_name: Problems with %{cardname}
|
|
321
|
-
sign_in_c: Sign in
|
|
322
|
-
sign_up_c: Sign up
|
|
323
|
-
sign_in: sign in
|
|
324
|
-
sign_up: sign up
|
|
325
323
|
not_found: Not Found
|
|
326
|
-
sign_in_or_up: "%{signin_link} or %{signup_link} to create it."
|
|
327
324
|
not_found_card: Could not find %{cardname}
|
|
328
|
-
not_found_that: Could not find that.
|
|
329
|
-
read_only: We are currently in read-only mode. Please try again later.
|
|
330
|
-
sorry: Sorry!
|
|
331
|
-
need_permission_task: You need permission to %{task} this.
|
|
332
|
-
need_permission_no_task: You need permission to do that.
|
|
333
|
-
sign_in_up_task: Please %{signin_link} or %{signup_link} to %{task} this.
|
|
334
|
-
sign_in_task: Please %{signin_link} to %{task} this.
|
|
335
|
-
sign_in_up_no_task: Please %{signin_link} or %{signup_link} to do that.
|
|
336
|
-
sign_in_no_task: Please %{signin_link} to do that.
|
|
337
|
-
or: or
|
|
338
|
-
please: please
|
|
339
|
-
denied_task: to %{denied_task} this
|
|
340
|
-
to_do_that: to do that
|
|
341
325
|
list_changes:
|
|
342
326
|
search_list_fields: list fields
|
|
343
327
|
search_listed_by_fields: listed by fields
|
|
@@ -364,6 +348,17 @@ en:
|
|
|
364
348
|
rename_update: Rename and Update
|
|
365
349
|
renaming: Renaming
|
|
366
350
|
rename: Rename
|
|
351
|
+
error:
|
|
352
|
+
problems_name: Problems with %{cardname}
|
|
353
|
+
please: Please
|
|
354
|
+
sign_in: sign in
|
|
355
|
+
or: or
|
|
356
|
+
sign_up: sign up
|
|
357
|
+
read_only: We are currently in read-only mode. Please try again later.
|
|
358
|
+
sorry: Sorry!
|
|
359
|
+
need_permission_task: You need permission to %{task} this.
|
|
360
|
+
to_do_that: to do that
|
|
361
|
+
denied_task: to %{denied_task} this
|
|
367
362
|
form:
|
|
368
363
|
unsupported_action_class: "unsupported card_form action class: %{actionclass}"
|
|
369
364
|
submit: Submit
|
data/config/locales/es.yml
CHANGED
|
@@ -178,6 +178,11 @@ es:
|
|
|
178
178
|
save_as_current: Guardar como actual
|
|
179
179
|
show_changes: Mostrar cambios
|
|
180
180
|
hide_changes: Ocultar cambios
|
|
181
|
+
:basic_formats:
|
|
182
|
+
set:
|
|
183
|
+
all:
|
|
184
|
+
base:
|
|
185
|
+
too_deep: Hombre, eres muy profundo. (Demasiados niveles de nidos a la vez)
|
|
181
186
|
:basic_types:
|
|
182
187
|
set:
|
|
183
188
|
abstract:
|
|
@@ -308,7 +313,6 @@ es:
|
|
|
308
313
|
se_ticket: <a href="%{ticket_link}">Agregue un ticket de soporte</a> para decirnos más y seguir la solución.
|
|
309
314
|
denial: Permiso denegado
|
|
310
315
|
bad_address: "404: Mala direccion"
|
|
311
|
-
too_deep: Hombre, eres muy profundo. (Demasiados niveles de nidos a la vez)
|
|
312
316
|
too_slow: Caducado! %{showname} tomó demasiado tiempo para cargar..
|
|
313
317
|
error_rendering: procesando errores
|
|
314
318
|
error_message: Mensaje de error (visible solo para el administrador)
|
|
@@ -316,28 +320,8 @@ es:
|
|
|
316
320
|
conflict: Conflicto!
|
|
317
321
|
also_changes: "%{actor_link} también ha estado haciendo cambios."
|
|
318
322
|
conflict_instruction: Por favor, examine a continuación, resuelva arriba y vuelva a enviar.
|
|
319
|
-
problems_no_name: Problemas
|
|
320
|
-
problems_name: Problemas con %{cardname}
|
|
321
|
-
sign_in_c: Registrarse
|
|
322
|
-
sign_up_c: Regístrate
|
|
323
|
-
sign_in: Registrarse
|
|
324
|
-
sign_up: Regístrate
|
|
325
323
|
not_found: Extraviado
|
|
326
|
-
sign_in_or_up: "%{signin_link} o %{signup_link} para crearlo."
|
|
327
324
|
not_found_card: No pudo encontrar %{cardname}
|
|
328
|
-
not_found_that: No pude encontrar eso.
|
|
329
|
-
read_only: Actualmente estamos en modo de solo lectura. Por favor, inténtelo de nuevo más tarde.
|
|
330
|
-
sorry: Lo siento!
|
|
331
|
-
need_permission_task: Necesitas permiso para %{task} esto.
|
|
332
|
-
need_permission_no_task: Necesitas permiso para hacer eso.
|
|
333
|
-
sign_in_up_task: Por favor %{signin_link} o %{signup_link} a %{task} this.
|
|
334
|
-
sign_in_task: Por favor %{signin_link} a %{task} esto.
|
|
335
|
-
sign_in_up_no_task: Por favor %{signin_link} o %{signup_link} para hacer eso.
|
|
336
|
-
sign_in_no_task: Por favor %{signin_link} para hacer eso.
|
|
337
|
-
or: o
|
|
338
|
-
please: por favor
|
|
339
|
-
denied_task: a %{denied_task} esto
|
|
340
|
-
to_do_that: para hacer eso
|
|
341
325
|
list_changes:
|
|
342
326
|
search_list_fields: campos de lista
|
|
343
327
|
search_listed_by_fields: listado por campos
|
|
@@ -364,6 +348,17 @@ es:
|
|
|
364
348
|
rename_update: Renombrar y actualizar
|
|
365
349
|
renaming: Renombrar
|
|
366
350
|
rename: Rebautizar
|
|
351
|
+
error:
|
|
352
|
+
problems_name: Problemas con %{cardname}
|
|
353
|
+
please: por favor
|
|
354
|
+
sign_in: Registrarse
|
|
355
|
+
or: o
|
|
356
|
+
sign_up: Regístrate
|
|
357
|
+
read_only: Actualmente estamos en modo de solo lectura. Por favor, inténtelo de nuevo más tarde.
|
|
358
|
+
sorry: Lo siento!
|
|
359
|
+
need_permission_task: Necesitas permiso para %{task} esto.
|
|
360
|
+
to_do_that: para hacer eso
|
|
361
|
+
denied_task: a %{denied_task} esto
|
|
367
362
|
form:
|
|
368
363
|
unsupported_action_class: "sin soporte card_form clase de acción: %{actionclass}"
|
|
369
364
|
submit: Enviar
|
data/lib/card.rb
CHANGED
|
@@ -121,10 +121,8 @@ class Card < ApplicationRecord
|
|
|
121
121
|
has_many :actions, -> { where(draft: [nil, false]).order :id }
|
|
122
122
|
has_many :drafts, -> { where(draft: true).order :id }, class_name: :Action
|
|
123
123
|
|
|
124
|
-
cattr_accessor :set_patterns, :serializable_attributes, :
|
|
125
|
-
:set_specific_attributes
|
|
124
|
+
cattr_accessor :set_patterns, :serializable_attributes, :set_specific_attributes
|
|
126
125
|
self.set_patterns = []
|
|
127
|
-
self.error_codes = {}
|
|
128
126
|
|
|
129
127
|
# attributes that ActiveJob can handle
|
|
130
128
|
def self.serializable_attr_accessor *args
|
data/lib/card/codename.rb
CHANGED
|
@@ -102,7 +102,8 @@ class Card
|
|
|
102
102
|
# @todo remove duplicate checks here; should be caught upon creation
|
|
103
103
|
def check_duplicates codehash, codename, card_id
|
|
104
104
|
return unless codehash.key?(codename) || codehash.key?(card_id)
|
|
105
|
-
|
|
105
|
+
Rails.logger.debug "dup codename: #{codename}, "\
|
|
106
|
+
"ID:#{card_id} (#{codehash[codename]})"
|
|
106
107
|
end
|
|
107
108
|
|
|
108
109
|
# generate Hash for @codehash and put it in the cache
|
data/lib/card/error.rb
CHANGED
|
@@ -5,38 +5,75 @@ class Card
|
|
|
5
5
|
# (arguably most of these should be Card::Exception)
|
|
6
6
|
class Error < StandardError
|
|
7
7
|
cattr_accessor :current
|
|
8
|
+
class_attribute :status_code, :view
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
self.view = :errors
|
|
11
|
+
self.status_code = 422
|
|
12
|
+
|
|
13
|
+
attr_accessor :card
|
|
14
|
+
|
|
15
|
+
def initialize message=nil
|
|
16
|
+
if message.is_a? Card
|
|
17
|
+
self.card = message
|
|
18
|
+
message = message_from_card
|
|
19
|
+
end
|
|
20
|
+
super message
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def message_from_card
|
|
24
|
+
I18n.t :exception_for_card,
|
|
25
|
+
scope: %i[lib card error], cardname: card.name, message: card_message_text
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def report
|
|
29
|
+
Rails.logger.info "exception = #{self.class}: #{message}"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def card_message_text
|
|
33
|
+
card.errors.first&.message
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# error attributable to code (as opposed to card configuration)
|
|
37
|
+
class ServerError < Error
|
|
38
|
+
self.view = :server_error
|
|
39
|
+
self.status_code = 500
|
|
40
|
+
|
|
41
|
+
def report
|
|
42
|
+
super
|
|
43
|
+
card&.notable_exception_raised
|
|
44
|
+
end
|
|
10
45
|
end
|
|
11
46
|
|
|
12
|
-
|
|
47
|
+
# error whose message can be shown to any user
|
|
48
|
+
class UserError < Error
|
|
13
49
|
end
|
|
14
50
|
|
|
15
|
-
|
|
51
|
+
# error in WQL query
|
|
52
|
+
class BadQuery < UserError
|
|
16
53
|
end
|
|
17
54
|
|
|
18
|
-
|
|
55
|
+
# card not found
|
|
56
|
+
class NotFound < UserError
|
|
57
|
+
self.status_code = 404
|
|
58
|
+
self.view = :not_found
|
|
19
59
|
end
|
|
20
60
|
|
|
21
61
|
class CodenameNotFound < NotFound
|
|
22
62
|
end
|
|
23
63
|
|
|
24
|
-
#
|
|
25
|
-
class
|
|
26
|
-
|
|
64
|
+
# two editors altering the same card at once
|
|
65
|
+
class EditConflict < UserError
|
|
66
|
+
self.status_code = 409
|
|
67
|
+
self.view = :conflict
|
|
68
|
+
end
|
|
27
69
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
super
|
|
33
|
-
end
|
|
34
|
-
end
|
|
70
|
+
# permission errors
|
|
71
|
+
class PermissionDenied < UserError
|
|
72
|
+
self.status_code = 403
|
|
73
|
+
self.view = :denial
|
|
35
74
|
|
|
36
|
-
def
|
|
37
|
-
|
|
38
|
-
cardname: card.name,
|
|
39
|
-
message: card.errors[:permission_denied]
|
|
75
|
+
def card_message_text
|
|
76
|
+
card.errors[:permission_denied]
|
|
40
77
|
end
|
|
41
78
|
end
|
|
42
79
|
|
|
@@ -52,54 +89,33 @@ class Card
|
|
|
52
89
|
|
|
53
90
|
# associating views with exceptions
|
|
54
91
|
class << self
|
|
55
|
-
|
|
56
|
-
|
|
92
|
+
KEY_MAP = { permission_denied: PermissionDenied,
|
|
93
|
+
conflict: EditConflict }.freeze
|
|
57
94
|
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
problematic_exception_view(card, exception)
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def simple_exception_view card, exception
|
|
65
|
-
# "simple" error messages are visible to end users and are generally not
|
|
66
|
-
# treated as software bugs (though they may be "ruler" bugs)
|
|
67
|
-
case exception
|
|
68
|
-
when BadContent, BadQuery
|
|
69
|
-
card.errors.add :exception, exception.message
|
|
70
|
-
:errors
|
|
71
|
-
when BadAddress
|
|
72
|
-
:bad_address
|
|
73
|
-
when PermissionDenied
|
|
74
|
-
:denial
|
|
75
|
-
when NotFound, ActiveRecord::RecordNotFound, ActionController::MissingFile
|
|
76
|
-
:not_found
|
|
95
|
+
def cardify_exception exception, card
|
|
96
|
+
unless exception.is_a? Card::Error
|
|
97
|
+
exception = card_error_class(exception, card).new exception.message
|
|
77
98
|
end
|
|
99
|
+
exception.card ||= card
|
|
100
|
+
exception
|
|
78
101
|
end
|
|
79
102
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
elsif Rails.logger.level.zero?
|
|
87
|
-
# raise error loudly when not in production (could be a better test!)
|
|
88
|
-
raise exception
|
|
103
|
+
def card_error_class exception, card
|
|
104
|
+
case exception
|
|
105
|
+
when ActiveRecord::RecordInvalid
|
|
106
|
+
invalid_card_error_class card
|
|
107
|
+
when ActiveRecord::RecordNotFound, ActionController::MissingFile
|
|
108
|
+
Card::Error::NotFound
|
|
89
109
|
else
|
|
90
|
-
|
|
110
|
+
Card::Error::ServerError
|
|
91
111
|
end
|
|
92
112
|
end
|
|
93
113
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
card.errors.keys.each do |key|
|
|
98
|
-
if (view_and_status = Card.error_codes[key])
|
|
99
|
-
return view_and_status
|
|
100
|
-
end
|
|
114
|
+
def invalid_card_error_class card
|
|
115
|
+
KEY_MAP.each do |key, klass|
|
|
116
|
+
return klass if card.errors.key? key
|
|
101
117
|
end
|
|
102
|
-
|
|
118
|
+
Card::Error
|
|
103
119
|
end
|
|
104
120
|
end
|
|
105
121
|
end
|
data/lib/card/format.rb
CHANGED
|
@@ -57,8 +57,8 @@ class Card
|
|
|
57
57
|
|
|
58
58
|
cattr_accessor :registered
|
|
59
59
|
self.registered = []
|
|
60
|
-
VIEW_VARS = [
|
|
61
|
-
(VIEW_VARS + [
|
|
60
|
+
VIEW_VARS = %i[perms denial closed].freeze
|
|
61
|
+
(VIEW_VARS + %i[view_tags aliases]).each do |accessor_name|
|
|
62
62
|
cattr_accessor accessor_name
|
|
63
63
|
send "#{accessor_name}=", {}
|
|
64
64
|
end
|
data/lib/card/format/error.rb
CHANGED
|
@@ -2,35 +2,34 @@ class Card
|
|
|
2
2
|
class Format
|
|
3
3
|
module Error
|
|
4
4
|
def rescue_view e, view
|
|
5
|
-
|
|
6
|
-
if
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def debug_error e
|
|
15
|
-
raise e if Card[:debugger]&.content == "on"
|
|
5
|
+
# make config option; don't refer directly to env
|
|
6
|
+
raise e if Rails.env =~ /^cucumber$/
|
|
7
|
+
# TODO: unify with Card::Error#report
|
|
8
|
+
Rails.logger.info "#{e.message}\n#{e.backtrace}"
|
|
9
|
+
method = focal? ? :focal_error : :rendering_error
|
|
10
|
+
send method, e, view
|
|
16
11
|
end
|
|
17
12
|
|
|
18
|
-
def error_cardname
|
|
13
|
+
def error_cardname _exception
|
|
19
14
|
if card&.name.present?
|
|
20
15
|
safe_name
|
|
21
16
|
else
|
|
22
|
-
I18n.t :no_cardname, scope: [
|
|
17
|
+
I18n.t :no_cardname, scope: %i[lib card format error]
|
|
23
18
|
end
|
|
24
19
|
end
|
|
25
20
|
|
|
26
21
|
def focal_error e, view
|
|
27
|
-
card.errors.add view
|
|
28
|
-
|
|
22
|
+
card.errors.add "#{view} view", rendering_error(e, view) if card.errors.empty?
|
|
23
|
+
raise e
|
|
29
24
|
end
|
|
30
25
|
|
|
31
|
-
def
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
def rendering_error exception, view
|
|
27
|
+
if exception.is_a? Card::Error::UserError
|
|
28
|
+
exception.message
|
|
29
|
+
else
|
|
30
|
+
tr :error_rendering, scope: [:lib, :card, :format, :error],
|
|
31
|
+
cardname: error_cardname(exception), view: view
|
|
32
|
+
end
|
|
34
33
|
end
|
|
35
34
|
end
|
|
36
35
|
end
|