card 1.96.0 → 1.96.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/initializers/02_patches/kaminari.rb +2 -2
- data/config/locales/de.yml +38 -3
- data/config/locales/en.yml +39 -4
- data/config/locales/es.yml +606 -0
- data/db/migrate_core_cards/data/cards/{*header → Xheader} +0 -0
- data/db/migrate_core_cards/data/cards/{*main_menu → Xmain_menu} +0 -0
- data/lib/card.rb +2 -2
- data/lib/card/act_manager.rb +1 -1
- data/lib/card/env/success.rb +26 -13
- data/lib/card/format/nest/fetch.rb +6 -1
- data/lib/card/migration/import/import_data/card_content.rb +1 -1
- data/mod/account/set/right/account.rb +115 -101
- data/mod/account/set/self/signin.rb +106 -96
- data/mod/account/spec/set/all/account_spec.rb +0 -2
- data/mod/account/spec/set/right/account_spec.rb +6 -9
- data/mod/account/spec/set/self/signin_spec.rb +2 -5
- data/mod/admin/set/self/admin_info.rb +4 -4
- data/mod/admin/spec/set/self/admin_info_spec.rb +10 -0
- data/mod/admin/spec/set/self/trash_spec.rb +7 -0
- data/mod/basic_formats/set/all/json.rb +7 -3
- data/mod/basic_formats/spec/set/all/head_spec.rb +33 -0
- data/mod/basic_types/set/type/json.rb +1 -1
- data/mod/basic_types/spec/set/type/plain_text_spec.rb +6 -0
- data/mod/bootstrap/set/type/customized_bootswatch_skin.rb +2 -2
- data/mod/bootstrap/spec/set/type/customized_bootswatch_skin/html_views_spec.rb +5 -0
- data/mod/bootstrap/spec/set/type_plus_right/customized_bootswatch_skin/colors_spec.rb +8 -0
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +12 -13
- data/mod/core/set/all/actify.rb +5 -0
- data/mod/core/set/all/codename.rb +2 -2
- data/mod/core/set/all/event_conditions.rb +2 -1
- data/mod/core/set/all/fetch_helper.rb +2 -2
- data/mod/core/set/all/i18n.rb +1 -1
- data/mod/core/set/all/item.rb +6 -0
- data/mod/core/set/all/location_history.rb +12 -1
- data/mod/core/set/all/name_events.rb +8 -9
- data/mod/core/set/all/permissions.rb +1 -1
- data/mod/core/set/all/rename.rb +3 -5
- data/mod/core/set/all/trash.rb +4 -9
- data/mod/core/set/all/type.rb +7 -5
- data/mod/core/set/all/utils.rb +13 -5
- data/mod/core/spec/set/abstract/code_file_spec.rb +8 -0
- data/mod/core/spec/set/all/tabs_spec.rb +19 -0
- data/mod/developer/spec/set/all/view_viz_spec.rb +9 -0
- data/mod/follow/spec/set/all/follow/follow_link_spec.rb +7 -0
- data/mod/follow/spec/set/all/notify/html_views_spec.rb +7 -0
- data/mod/follow/spec/set/right/follow_spec.rb +0 -0
- data/mod/follow/spec/set/right/following_spec.rb +6 -0
- data/mod/follow/spec/set/type/notification_template_spec.rb +1 -1
- data/mod/history/set/all/content_history.rb +1 -1
- data/mod/history/spec/set/all/act_view_spec.rb +16 -0
- data/mod/history/spec/set/all/action_view_spec.rb +10 -0
- data/mod/history/spec/set/all/history_spec.rb +11 -0
- data/mod/item/spec/set/all/bar_spec.rb +41 -0
- data/mod/machines/lib/javascript/decko_slot.js.coffee +1 -1
- data/mod/pointer/set/abstract/02_pointer/other_views.rb +0 -4
- data/mod/recaptcha/set/all/recaptcha.rb +1 -1
- data/mod/search/spec/set/abstract/search_spec.rb +8 -0
- data/mod/standard/set/all/error.rb +48 -26
- data/mod/standard/set/all/rich_html/toolbar.rb +6 -1
- data/mod/standard/set/type/list.rb +7 -9
- data/mod/standard/set/type/number.rb +1 -1
- data/mod/standard/set/type/session.rb +1 -1
- data/mod/standard/spec/content/chunk/link_spec.rb +3 -3
- data/mod/utility/set/abstract/media.rb +13 -9
- data/mod/utility/set/abstract/media/media_snippet.haml +5 -3
- metadata +22 -6
data/mod/core/set/all/rename.rb
CHANGED
@@ -14,11 +14,9 @@ def suspend_name name
|
|
14
14
|
Card.where(id: id).update_all(name: tmp_name, key: tmp_name)
|
15
15
|
end
|
16
16
|
|
17
|
-
event :validate_renaming, :validate, on: :update, changed: :name do
|
18
|
-
if db_content_is_changing?
|
19
|
-
|
20
|
-
end
|
21
|
-
errors.add :type, "cannot change type while changing name" if type_id_is_changing?
|
17
|
+
event :validate_renaming, :validate, on: :update, changed: :name, skip: :allowed do
|
18
|
+
errors.add :content, tr(:cannot_change_content) if db_content_is_changing?
|
19
|
+
errors.add :type, tr(:cannot_change_type) if type_id_is_changing?
|
22
20
|
end
|
23
21
|
|
24
22
|
event :cascade_name_changes, :finalize, on: :update, changed: :name,
|
data/mod/core/set/all/trash.rb
CHANGED
@@ -31,9 +31,7 @@ module ClassMethods
|
|
31
31
|
file_ids = all_file_ids
|
32
32
|
file_ids.each do |file_id|
|
33
33
|
next unless trashed_card_ids.member?(file_id)
|
34
|
-
if Card.exists?(file_id)
|
35
|
-
raise Card::Error, "Narrowly averted deleting current file"
|
36
|
-
end
|
34
|
+
raise Card::Error, tr(:exception_almost_deleted) if Card.exists?(file_id)
|
37
35
|
::FileUtils.rm_rf "#{dir}/#{file_id}", secure: true
|
38
36
|
end
|
39
37
|
end
|
@@ -92,7 +90,7 @@ end
|
|
92
90
|
|
93
91
|
event :validate_delete, :validate, on: :delete do
|
94
92
|
unless codename.blank?
|
95
|
-
errors.add :delete,
|
93
|
+
errors.add :delete, tr(:error_system_card, name: name, codename: codename)
|
96
94
|
end
|
97
95
|
|
98
96
|
undeletable_all_rules_tags =
|
@@ -101,13 +99,10 @@ event :validate_delete, :validate, on: :delete do
|
|
101
99
|
|
102
100
|
if junction? && left&.codename == :all &&
|
103
101
|
undeletable_all_rules_tags.member?(right.codename.to_s)
|
104
|
-
errors.add :delete,
|
102
|
+
errors.add :delete, tr(:error_indestructible, name: name)
|
105
103
|
end
|
106
104
|
|
107
|
-
if account && has_edits?
|
108
|
-
errors.add :delete, "Edits have been made with #{name}'s user account.\n" \
|
109
|
-
"Deleting this card would mess up our history."
|
110
|
-
end
|
105
|
+
errors.add :delete, tr(:error_user_edits, name: name) if account && has_edits?
|
111
106
|
end
|
112
107
|
|
113
108
|
event :validate_delete_children, after: :validate_delete, on: :delete do
|
data/mod/core/set/all/type.rb
CHANGED
@@ -44,16 +44,18 @@ end
|
|
44
44
|
|
45
45
|
event :validate_type_change, :validate, on: :update, changed: :type_id do
|
46
46
|
if (c = dup) && c.action == :create && !c.valid?
|
47
|
-
errors.add :type,
|
48
|
-
|
47
|
+
errors.add :type, tr(
|
48
|
+
:error_cant_change_errors,
|
49
|
+
name: name, type_id: type_id,
|
50
|
+
error_messages: c.errors.full_messages
|
51
|
+
)
|
49
52
|
end
|
50
53
|
end
|
51
54
|
|
52
55
|
event :validate_type, :validate, changed: :type_id do
|
53
|
-
errors.add :type,
|
56
|
+
errors.add :type, tr(:error_no_such_type) unless type_name
|
54
57
|
|
55
58
|
if (rt = structure) && rt.assigns_type? && type_id != rt.type_id
|
56
|
-
errors.add :type,
|
57
|
-
"to #{rt.type_name}"
|
59
|
+
errors.add :type, tr(:error_hard_templated, name: name, type_name: rt.type_name)
|
58
60
|
end
|
59
61
|
end
|
data/mod/core/set/all/utils.rb
CHANGED
@@ -31,14 +31,22 @@ module ClassMethods
|
|
31
31
|
def merge name, attribs={}, opts={}
|
32
32
|
# puts "merging #{name}"
|
33
33
|
card = fetch name, new: {}
|
34
|
+
return unless mergeable? card, opts[:pristine]
|
35
|
+
resolve_file_attributes! attribs
|
36
|
+
card.update_attributes! attribs.reverse_merge(skip: :validate_renaming)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def resolve_file_attributes! attribs
|
34
42
|
%i[image file].each do |attach|
|
35
43
|
next unless attribs[attach] && attribs[attach].is_a?(String)
|
36
44
|
attribs[attach] = ::File.open(attribs[attach])
|
37
45
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
def mergeable? card, pristine_only
|
49
|
+
return true unless pristine_only
|
50
|
+
!card.pristine?
|
43
51
|
end
|
44
52
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
describe Card::Set::All::Tabs do
|
4
|
+
specify "view tabs" do
|
5
|
+
expect_view(:tabs).to have_tag("div.tabbable") do
|
6
|
+
with_tag "ul.nav"
|
7
|
+
with_tag "li.nav-item"
|
8
|
+
with_tag "div.tab-content"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
specify "view pills" do
|
13
|
+
expect_view(:pills).to have_tag("div.tabbable") do
|
14
|
+
with_tag "ul.nav"
|
15
|
+
with_tag "li.nav-item"
|
16
|
+
with_tag "div.tab-content"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
File without changes
|
@@ -169,7 +169,7 @@ def draft_acts
|
|
169
169
|
end
|
170
170
|
|
171
171
|
event :detect_conflict, :validate, on: :update, when: :edit_conflict? do
|
172
|
-
errors.add :conflict,
|
172
|
+
errors.add :conflict, tr(:error_not_latest_revision)
|
173
173
|
end
|
174
174
|
|
175
175
|
def edit_conflict?
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
describe Card::Set::All::ActView do
|
4
|
+
specify "view act" do
|
5
|
+
expect_view(:act).to have_tag("div.card") do
|
6
|
+
with_tag "div.card-header"
|
7
|
+
with_tag "div.card-body"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
specify "view act_legend" do
|
12
|
+
expect_view(:act_legend).to have_tag("div.row") do
|
13
|
+
with_tag "div"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
describe Card::Set::All::Bar do
|
4
|
+
specify "view thin_bar" do
|
5
|
+
expect_view(:thin_bar).to have_tag("div.card-slot.bar-view")
|
6
|
+
end
|
7
|
+
|
8
|
+
specify "view bar_left" do
|
9
|
+
expect_view(:bar_left).to have_tag("span.card-title")
|
10
|
+
end
|
11
|
+
|
12
|
+
specify "view bar_middle" do
|
13
|
+
expect_view(:bar_middle).to have_tag("span.labeled-badge")
|
14
|
+
end
|
15
|
+
|
16
|
+
specify "view bar_bottomm" do
|
17
|
+
expect_view(:bar_bottomm).to have_tag("strong")
|
18
|
+
end
|
19
|
+
|
20
|
+
specify "view bar_page_link" do
|
21
|
+
expect_view(:bar_page_link).to have_tag("a.text-muted") do
|
22
|
+
with_tag "i"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
specify "view bar_expand_link" do
|
27
|
+
expect_view(:bar_expand_link).to have_tag("a.slotter") do
|
28
|
+
with_tag "i"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
specify "view bar_collapse_link" do
|
33
|
+
expect_view(:bar_collapse_link).to have_tag("a.slotter") do
|
34
|
+
with_tag "i"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
specify "view edit_button" do
|
39
|
+
expect_view(:edit_button).to have_tag("a.btn")
|
40
|
+
end
|
41
|
+
end
|
@@ -72,7 +72,7 @@ jQuery.fn.extend {
|
|
72
72
|
s = @slot()
|
73
73
|
v = $(val)[0] && $(val) || val
|
74
74
|
if typeof(v) == "string"
|
75
|
-
#
|
75
|
+
# needed to support unwrapped views
|
76
76
|
s.replaceWith v
|
77
77
|
else
|
78
78
|
s.setSlotContentFromElement v
|
@@ -10,7 +10,7 @@ format do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
view :unsupported_view, perms: :none, tags: :unknown_ok, error_code: 404 do
|
13
|
-
|
13
|
+
tr(:unsupported_view, view: voo.unsupported_view, cardname: error_cardname)
|
14
14
|
end
|
15
15
|
|
16
16
|
view :missing, perms: :none do
|
@@ -18,28 +18,28 @@ format do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
view :not_found, perms: :none, error_code: 404 do
|
21
|
-
error_name = card.name.present? ? safe_name :
|
22
|
-
|
21
|
+
error_name = card.name.present? ? safe_name : tr(:not_found_no_name)
|
22
|
+
tr(:not_found_named, cardname: error_name)
|
23
23
|
end
|
24
24
|
|
25
25
|
view :server_error, perms: :none, error_code: 500 do
|
26
|
-
|
26
|
+
tr(:server_error)
|
27
27
|
end
|
28
28
|
|
29
29
|
view :denial, perms: :none, error_code: 403 do
|
30
|
-
focal? ?
|
30
|
+
focal? ? tr(:denial) : ""
|
31
31
|
end
|
32
32
|
|
33
33
|
view :bad_address, perms: :none, error_code: 404 do
|
34
|
-
|
34
|
+
tr(:bad_address)
|
35
35
|
end
|
36
36
|
|
37
37
|
view :too_deep, perms: :none, closed: true do
|
38
|
-
|
38
|
+
tr(:too_deep)
|
39
39
|
end
|
40
40
|
|
41
41
|
view :too_slow, perms: :none, closed: true, error_code: 408 do
|
42
|
-
|
42
|
+
tr(:too_slow, showname: title_in_context)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -62,7 +62,7 @@ format :html do
|
|
62
62
|
debug_error exception if Auth.always_ok?
|
63
63
|
details = Auth.always_ok? ? backtrace_link(exception) : error_cardname
|
64
64
|
wrap_with :span, class: "render-error alert alert-danger" do
|
65
|
-
[
|
65
|
+
[tr(:error_rendering), details, "(#{view} view)"].join "\n"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
@@ -122,7 +122,7 @@ format :html do
|
|
122
122
|
|
123
123
|
view :errors, perms: :none do
|
124
124
|
return if card.errors.empty?
|
125
|
-
voo.title = card.name.blank? ? "Problems" :
|
125
|
+
voo.title = card.name.blank? ? "Problems" : tr(:problems_name, cardname: card.name)
|
126
126
|
voo.hide! :menu
|
127
127
|
class_up "d0-card-frame", "card card-warning card-inverse"
|
128
128
|
class_up "alert", "card-error-msg"
|
@@ -145,7 +145,7 @@ format :html do
|
|
145
145
|
voo.hide! :menu
|
146
146
|
voo.title = "Not Found"
|
147
147
|
frame do
|
148
|
-
[not_found_errors, sign_in_or_up_links]
|
148
|
+
[not_found_errors, sign_in_or_up_links("to create it")]
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
@@ -157,11 +157,25 @@ format :html do
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
|
-
def sign_in_or_up_links
|
160
|
+
def sign_in_or_up_links to_task
|
161
161
|
return if Auth.signed_in?
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
links = [signin_link, signup_link].compact.join " #{tr :or} "
|
163
|
+
wrap_with(:div) do
|
164
|
+
[tr(:please), links, to_task].join(" ") + "."
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def signin_link
|
169
|
+
link_to_card :signin, tr(:sign_in_c)
|
170
|
+
end
|
171
|
+
|
172
|
+
def signup_link
|
173
|
+
return unless signup_ok?
|
174
|
+
link_to tr(:sign_up_c), path: { action: :new, mark: :signup }
|
175
|
+
end
|
176
|
+
|
177
|
+
def signup_ok?
|
178
|
+
Card.new(type_id: Card::SignupID).ok? :create
|
165
179
|
end
|
166
180
|
|
167
181
|
view :denial do
|
@@ -176,32 +190,40 @@ format :html do
|
|
176
190
|
|
177
191
|
def loud_denial
|
178
192
|
frame do
|
179
|
-
[
|
180
|
-
|
181
|
-
wrap_with(:div, loud_denial_message)
|
182
|
-
]
|
193
|
+
[wrap_with(:h1, tr(:sorry)),
|
194
|
+
wrap_with(:div, loud_denial_message)]
|
183
195
|
end
|
184
196
|
end
|
185
197
|
|
186
198
|
def loud_denial_message
|
187
|
-
to_task = @denied_task ?
|
199
|
+
to_task = @denied_task ? tr(:denied_task, denied_task: @denied_task) : tr(:to_do_that)
|
200
|
+
|
188
201
|
case
|
189
|
-
when
|
190
|
-
|
202
|
+
when not_denied_task_read?
|
203
|
+
tr(:read_only)
|
191
204
|
when Auth.signed_in?
|
192
|
-
|
205
|
+
tr(:need_permission_task, task: to_task)
|
193
206
|
else
|
194
|
-
|
207
|
+
Env.save_interrupted_action request.env["REQUEST_URI"]
|
208
|
+
sign_in_or_up_links to_do_unauthorized_task
|
195
209
|
end
|
196
210
|
end
|
197
211
|
|
212
|
+
def not_denied_task_read?
|
213
|
+
@denied_task != :read && Card.config.read_only
|
214
|
+
end
|
215
|
+
|
216
|
+
def to_do_unauthorized_task
|
217
|
+
@denied_task ? tr(:denied_task, denied_task: @denied_task) : tr(:to_do_that)
|
218
|
+
end
|
219
|
+
|
198
220
|
def denial_message_with_links to_task
|
199
221
|
linx = [link_to_card(:signin, "sign in")]
|
200
222
|
if Card.new(type_id: Card::SignupID).ok?(:create)
|
201
|
-
|
223
|
+
[tr(:or), link_to(tr(:sign_up), path: { action: "new", mark: :signup })]
|
202
224
|
end
|
203
225
|
Env.save_interrupted_action request.env["REQUEST_URI"]
|
204
|
-
"
|
226
|
+
"#{tr(:please)} #{linx.join ' '} #{to_task}"
|
205
227
|
end
|
206
228
|
|
207
229
|
view :server_error, template: :haml
|