card 1.16.14 → 1.16.15
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/db/migrate_core_cards/20150903130006_attachment_upload_cards.rb +4 -2
- data/lib/card/auth.rb +15 -10
- data/lib/card/codename.rb +25 -21
- data/lib/card/content.rb +100 -68
- data/lib/card/format.rb +158 -129
- data/lib/card/query.rb +15 -9
- data/lib/card/query/attributes.rb +41 -49
- data/lib/card/set.rb +15 -12
- data/lib/card/set_pattern.rb +4 -5
- data/lib/card/spec_helper.rb +54 -16
- data/lib/cardio.rb +43 -25
- data/mod/01_core/chunk/include.rb +1 -1
- data/mod/01_core/set/all/collection.rb +76 -73
- data/mod/01_core/set/all/content.rb +0 -4
- data/mod/01_core/set/all/fetch.rb +35 -42
- data/mod/01_core/set/all/name.rb +17 -7
- data/mod/01_core/set/all/pattern.rb +12 -11
- data/mod/01_core/set/all/permissions.rb +51 -42
- data/mod/01_core/set/all/phases.rb +2 -1
- data/mod/01_core/set/all/references.rb +2 -2
- data/mod/01_core/set/all/rules.rb +28 -35
- data/mod/01_core/set/all/subcards.rb +12 -12
- data/mod/01_core/set/all/tracked_attributes.rb +1 -1
- data/mod/01_core/set/all/type.rb +11 -11
- data/mod/01_core/set/all/utils.rb +6 -1
- data/mod/01_core/spec/set/all/fetch_spec.rb +6 -6
- data/mod/01_core/spec/set/all/permissions_spec.rb +11 -11
- data/mod/01_core/spec/set/all/tracked_attributes_spec.rb +1 -1
- data/mod/01_history/lib/card/action.rb +52 -47
- data/mod/01_history/set/all/actions.rb +20 -16
- data/mod/01_history/set/all/history.rb +18 -13
- data/mod/02_basic_types/set/all/base.rb +23 -2
- data/mod/02_basic_types/set/type/pointer.rb +45 -36
- data/mod/02_basic_types/spec/set/all/base_spec.rb +40 -24
- data/mod/02_basic_types/spec/set/type/pointer_spec.rb +87 -0
- data/mod/03_machines/set/right/machine_output.rb +10 -6
- data/mod/04_settings/set/abstract/permission.rb +10 -5
- data/mod/04_settings/set/type/setting.rb +4 -1
- data/mod/05_email/set/all/follow.rb +39 -44
- data/mod/05_email/set/all/notify.rb +4 -1
- data/mod/05_email/set/right/followers.rb +16 -14
- data/mod/05_email/set/self/follow_defaults.rb +22 -19
- data/mod/05_standard/lib/carrier_wave/cardmount.rb +1 -0
- data/mod/05_standard/set/abstract/attachment.rb +85 -58
- data/mod/05_standard/set/all/comment.rb +35 -19
- data/mod/05_standard/set/all/error.rb +124 -98
- data/mod/05_standard/set/all/list_changes.rb +27 -22
- data/mod/05_standard/set/all/rich_html/editing.rb +96 -70
- data/mod/05_standard/set/all/rich_html/form.rb +123 -81
- data/mod/05_standard/set/all/rich_html/modal.rb +15 -58
- data/mod/05_standard/set/right/account.rb +2 -2
- data/mod/05_standard/set/right/email.rb +3 -2
- data/mod/05_standard/set/rstar/rules.rb +3 -3
- data/mod/05_standard/set/self/search.rb +45 -22
- data/mod/05_standard/set/type/cardtype.rb +13 -11
- data/mod/05_standard/set/type/listed_by.rb +3 -2
- data/mod/05_standard/set/type/set.rb +17 -13
- data/mod/05_standard/set/type/signup.rb +1 -2
- data/mod/05_standard/set/type/user.rb +1 -1
- data/mod/05_standard/spec/set/all/account_spec.rb +1 -1
- data/mod/05_standard/spec/set/all/history_spec.rb +1 -1
- data/mod/05_standard/spec/set/type/email_template_spec.rb +140 -134
- data/mod/05_standard/spec/set/type/image_spec.rb +2 -1
- data/mod/05_standard/spec/set/type/signup_spec.rb +2 -2
- data/spec/models/card/trash_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -1
- metadata +2 -2
@@ -18,7 +18,10 @@ class FollowerStash
|
|
18
18
|
add_affected_card left_card
|
19
19
|
break
|
20
20
|
elsif item.to_name.key == Card[:includes].key
|
21
|
-
includee_set = Card.search(
|
21
|
+
includee_set = Card.search(
|
22
|
+
{ included_by: left_card.name },
|
23
|
+
"follow cards included by #{left_card.name}"
|
24
|
+
).map(&:key)
|
22
25
|
if !@visited.intersection(includee_set).empty?
|
23
26
|
add_affected_card left_card
|
24
27
|
break
|
@@ -4,18 +4,18 @@ include Card::Set::Type::Pointer
|
|
4
4
|
|
5
5
|
def raw_content
|
6
6
|
if left
|
7
|
-
items =
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
items.map {|item| "[[#{item}]]"}.join "\n"
|
7
|
+
items =
|
8
|
+
if (left.type_id == SetID) || (left.type_id == CardtypeID)
|
9
|
+
set_card = left.default_follow_set_card
|
10
|
+
set_card.all_user_ids_with_rule_for(:follow).map do |user_id|
|
11
|
+
if left.followed_by?(user_id) && (user = Card.find(user_id))
|
12
|
+
user.name
|
13
|
+
end
|
14
|
+
end.compact
|
15
|
+
else
|
16
|
+
left.follower_names
|
17
|
+
end
|
18
|
+
items.map { |item| "[[#{item}]]" }.join "\n"
|
19
19
|
else
|
20
20
|
''
|
21
21
|
end
|
@@ -23,8 +23,10 @@ end
|
|
23
23
|
|
24
24
|
def virtual?; !real? end
|
25
25
|
|
26
|
-
format
|
26
|
+
format do
|
27
27
|
include Card::Set::Type::Pointer::Format
|
28
28
|
end
|
29
29
|
|
30
|
-
format
|
30
|
+
format :html do
|
31
|
+
include Card::Set::Type::Pointer::HtmlFormat
|
32
|
+
end
|
@@ -1,25 +1,28 @@
|
|
1
|
-
event :update_follow_rules,
|
1
|
+
event :update_follow_rules,
|
2
|
+
after: :store, on: :save, when: proc { |c| c.update_all_users } do
|
2
3
|
defaults = item_names.map do |item|
|
3
|
-
if (
|
4
|
-
option_card = Card.fetch(item.to_name.right) ||
|
4
|
+
if (set_card = Card.fetch item.to_name.left) && set_card.type_code == :set
|
5
|
+
option_card = Card.fetch(item.to_name.right) ||
|
6
|
+
Card[item.to_name.right.to_sym]
|
5
7
|
option = if option_card.follow_option?
|
6
8
|
option_card.name
|
7
9
|
else
|
8
10
|
'*always'
|
9
11
|
end
|
10
12
|
[set_card, option]
|
11
|
-
elsif (
|
13
|
+
elsif (set_card = Card.fetch sug) && set_card.type_code == :set
|
12
14
|
[set_card, '*always']
|
13
15
|
end
|
14
16
|
end.compact
|
15
17
|
Auth.as_bot do
|
16
18
|
Card.search(type: 'user').each do |user|
|
17
19
|
defaults.each do |set_card, option|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
follow_rule = Card.fetch(set_card.follow_rule_name(user.name), new: {})
|
21
|
+
if follow_rule
|
22
|
+
follow_rule.drop_item '*never'
|
23
|
+
follow_rule.drop_item '*always'
|
24
|
+
follow_rule.add_item option
|
25
|
+
follow_rule.save!
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
@@ -31,20 +34,20 @@ format :html do
|
|
31
34
|
view :edit, perms: :update, tags: :unknown_ok do |args|
|
32
35
|
frame_and_form :update, args do
|
33
36
|
[
|
34
|
-
_optional_render(
|
35
|
-
_optional_render(
|
36
|
-
_optional_render(
|
37
|
+
_optional_render(:content_formgroup, args),
|
38
|
+
_optional_render(:confirm_update_all, args),
|
39
|
+
_optional_render(:button_formgroup, args)
|
37
40
|
]
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
41
|
-
|
42
44
|
view :confirm_update_all do |args|
|
43
45
|
wrap args do
|
44
46
|
alert 'info' do
|
45
47
|
%{
|
46
48
|
<h1>Are you sure you want to change the default follow rules?</h1>
|
47
|
-
<p>You may choose to update all existing users.
|
49
|
+
<p>You may choose to update all existing users.
|
50
|
+
This may take a while. </p>
|
48
51
|
}
|
49
52
|
end
|
50
53
|
end
|
@@ -57,10 +60,10 @@ format :html do
|
|
57
60
|
card: { update_all_users: false }
|
58
61
|
)
|
59
62
|
args[:buttons] = %{
|
60
|
-
#{
|
61
|
-
|
62
|
-
#{
|
63
|
+
#{submit_button text: 'Submit and update all users',
|
64
|
+
disable_with: 'Updating', class: 'follow-updater'}
|
65
|
+
#{button_tag 'Submit', class: 'follow'}
|
66
|
+
#{cancel_button href: path(view: :edit, id: card.id)}
|
63
67
|
}
|
64
|
-
|
65
68
|
end
|
66
|
-
end
|
69
|
+
end
|
@@ -8,12 +8,16 @@ event :select_file_revision, after: :select_action do
|
|
8
8
|
attachment.retrieve_from_store!(attachment.identifier)
|
9
9
|
end
|
10
10
|
|
11
|
-
event :upload_attachment, before: :validate_name, on: :save,
|
11
|
+
event :upload_attachment, before: :validate_name, on: :save,
|
12
|
+
when: proc { |c| c.preliminary_upload? } do
|
12
13
|
save_original_filename # save original filename as comment in action
|
13
|
-
write_identifier # set db_content
|
14
|
+
write_identifier # set db_content
|
15
|
+
# (needs original filename to determine extension)
|
14
16
|
store_attachment!
|
15
17
|
finalize_action # create Card::Change entry for db_content
|
16
|
-
|
18
|
+
|
19
|
+
card_id = new_card? ? upload_cache_card.id : id
|
20
|
+
@current_action.update_attributes! draft: true, card_id: card_id
|
17
21
|
success << {
|
18
22
|
target: (new_card? ? upload_cache_card : self),
|
19
23
|
type: type_name,
|
@@ -23,7 +27,10 @@ event :upload_attachment, before: :validate_name, on: :save, when: proc { |c| c.
|
|
23
27
|
abort :success
|
24
28
|
end
|
25
29
|
|
26
|
-
event :assign_attachment_on_create,
|
30
|
+
event :assign_attachment_on_create,
|
31
|
+
after: :prepare,
|
32
|
+
on: :create,
|
33
|
+
when: proc { |c| c.save_preliminary_upload? } do
|
27
34
|
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
28
35
|
upload_cache_card.selected_action_id = action.id
|
29
36
|
upload_cache_card.select_file_revision
|
@@ -31,7 +38,9 @@ event :assign_attachment_on_create, after: :prepare, on: :create, when: proc { |
|
|
31
38
|
end
|
32
39
|
end
|
33
40
|
|
34
|
-
event :assign_attachment_on_update,
|
41
|
+
event :assign_attachment_on_update,
|
42
|
+
after: :prepare,
|
43
|
+
on: :update,
|
35
44
|
when: proc { |c| c.save_preliminary_upload? } do
|
36
45
|
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
37
46
|
uploaded_file =
|
@@ -42,26 +51,36 @@ event :assign_attachment_on_update, after: :prepare, on: :update,
|
|
42
51
|
end
|
43
52
|
end
|
44
53
|
|
45
|
-
|
46
54
|
def assign_attachment file, original_filename
|
47
55
|
send "#{attachment_name}=", file
|
48
56
|
write_identifier
|
49
57
|
@current_action.update_attributes! comment: original_filename
|
50
58
|
end
|
51
59
|
|
52
|
-
# we need a card id for the path so we have to update db_content when we
|
60
|
+
# we need a card id for the path so we have to update db_content when we have
|
61
|
+
# an id
|
53
62
|
event :correct_identifier, after: :store, on: :create do
|
54
|
-
update_column(:db_content,attachment.db_content(mod: load_from_mod))
|
63
|
+
update_column(:db_content, attachment.db_content(mod: load_from_mod))
|
55
64
|
expire
|
56
65
|
end
|
57
|
-
event :save_original_filename, after: :validate_name, when: proc {|c| !c.preliminary_upload? && !c.save_preliminary_upload? && c.attachment_changed?} do
|
58
66
|
|
59
|
-
|
60
|
-
|
61
|
-
|
67
|
+
def file_ready_to_save?
|
68
|
+
attachment.file.present? &&
|
69
|
+
!preliminary_upload? &&
|
70
|
+
!save_preliminary_upload? &&
|
71
|
+
attachment_changed?
|
72
|
+
end
|
73
|
+
|
74
|
+
event :save_original_filename, after: :validate_name,
|
75
|
+
when: proc { |c| c.file_ready_to_save? } do
|
76
|
+
return unless @current_action
|
77
|
+
@current_action.update_attributes! comment: original_filename
|
62
78
|
end
|
63
79
|
|
64
|
-
event :delete_cached_upload_file_on_create,
|
80
|
+
event :delete_cached_upload_file_on_create,
|
81
|
+
after: :extend,
|
82
|
+
on: :create,
|
83
|
+
when: proc { |c| c.save_preliminary_upload? } do
|
65
84
|
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
66
85
|
upload_cache_card.delete_files_for_action action
|
67
86
|
action.delete
|
@@ -69,21 +88,28 @@ event :delete_cached_upload_file_on_create, after: :extend, on: :create, when: p
|
|
69
88
|
clear_upload_cache_dir_for_new_cards
|
70
89
|
end
|
71
90
|
|
72
|
-
event :delete_cached_upload_file_on_update,
|
91
|
+
event :delete_cached_upload_file_on_update,
|
92
|
+
after: :extend,
|
93
|
+
on: :update,
|
94
|
+
when: proc { |c| c.save_preliminary_upload? } do
|
73
95
|
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
74
96
|
delete_files_for_action action
|
75
97
|
action.delete
|
76
98
|
end
|
77
99
|
end
|
78
100
|
|
101
|
+
event :validate_file_exist, before: :validate, on: :create do
|
102
|
+
unless attachment.file.present? || empty_ok?
|
103
|
+
errors.add attachment_name, 'is missing'
|
104
|
+
end
|
105
|
+
end
|
79
106
|
|
80
107
|
event :write_identifier, after: :save_original_filename do
|
81
108
|
self.content = attachment.db_content(mod: load_from_mod)
|
82
109
|
end
|
83
110
|
|
84
|
-
|
85
|
-
|
86
|
-
[self.cardname]
|
111
|
+
def item_names _args={} # needed for flexmail attachments. hacky.
|
112
|
+
[cardname]
|
87
113
|
end
|
88
114
|
|
89
115
|
def original_filename
|
@@ -91,7 +117,7 @@ def original_filename
|
|
91
117
|
end
|
92
118
|
|
93
119
|
def unfilled?
|
94
|
-
!attachment.present? && !save_preliminary_upload? &&
|
120
|
+
!attachment.present? && !save_preliminary_upload? && !subcards.present?
|
95
121
|
end
|
96
122
|
|
97
123
|
def preliminary_upload?
|
@@ -112,7 +138,7 @@ end
|
|
112
138
|
|
113
139
|
# used for uploads for new cards until the new card is created
|
114
140
|
def upload_cache_card
|
115
|
-
@upload_cache_card ||= Card["new_#{attachment_name}".to_sym
|
141
|
+
@upload_cache_card ||= Card["new_#{attachment_name}".to_sym]
|
116
142
|
end
|
117
143
|
|
118
144
|
# action id of the cached upload
|
@@ -124,12 +150,18 @@ def action_id_of_cached_upload
|
|
124
150
|
@action_id_of_cached_upload
|
125
151
|
end
|
126
152
|
|
153
|
+
def empty_ok= value
|
154
|
+
@empty_ok = value
|
155
|
+
end
|
156
|
+
|
157
|
+
def empty_ok?
|
158
|
+
@empty_ok
|
159
|
+
end
|
160
|
+
|
127
161
|
def load_from_mod= value
|
128
162
|
@mod = value
|
129
163
|
write_identifier
|
130
|
-
if value
|
131
|
-
@store_in_mod = true
|
132
|
-
end
|
164
|
+
@store_in_mod = true if value
|
133
165
|
end
|
134
166
|
|
135
167
|
def load_from_mod
|
@@ -155,22 +187,22 @@ end
|
|
155
187
|
# place for files of regular file cards
|
156
188
|
def upload_dir
|
157
189
|
if id
|
158
|
-
"#{
|
190
|
+
"#{Card.paths['files'].existent.first}/#{id}"
|
159
191
|
else
|
160
192
|
tmp_upload_dir
|
161
193
|
end
|
162
194
|
end
|
163
195
|
|
164
196
|
# place for files if card doesn't have an id yet
|
165
|
-
def tmp_upload_dir
|
166
|
-
"#{
|
197
|
+
def tmp_upload_dir _action_id=nil
|
198
|
+
"#{Card.paths['files'].existent.first}/#{upload_cache_card.id}"
|
167
199
|
end
|
168
200
|
|
169
201
|
# place for files of mod file cards
|
170
202
|
def mod_dir
|
171
203
|
mod = @mod || mod_file?
|
172
204
|
Card.paths['mod'].to_a.each do |mod_path|
|
173
|
-
dir = File.join(mod_path, mod, 'file', codename
|
205
|
+
dir = File.join(mod_path, mod, 'file', codename)
|
174
206
|
if Dir.exist? dir
|
175
207
|
return dir
|
176
208
|
end
|
@@ -183,19 +215,20 @@ def mod_file?
|
|
183
215
|
# when db_content was changed assume that it's no longer a mod file
|
184
216
|
elsif !db_content_changed? && content.present?
|
185
217
|
case content
|
186
|
-
when
|
187
|
-
when /^\~/
|
218
|
+
when %r{^:[^/]+/([^.]+)} then $1 # current mod_file format
|
219
|
+
when /^\~/ then false # current id file format
|
188
220
|
else
|
189
|
-
if lines = content.split("\n")
|
221
|
+
if (lines = content.split("\n")) && (lines.size == 4)
|
222
|
+
# old format, still used in card_changes.
|
190
223
|
lines.last
|
191
224
|
end
|
192
225
|
end
|
193
226
|
end
|
194
227
|
end
|
195
228
|
|
196
|
-
|
197
229
|
def assign_set_specific_attributes
|
198
|
-
if
|
230
|
+
# reset content if we really have something to upload
|
231
|
+
if @set_specific.present? && @set_specific[attachment_name.to_s].present?
|
199
232
|
self.content = nil
|
200
233
|
end
|
201
234
|
super
|
@@ -205,16 +238,13 @@ def clear_upload_cache_dir_for_new_cards
|
|
205
238
|
Dir.entries(tmp_upload_dir).each do |filename|
|
206
239
|
if filename =~/^\d+/
|
207
240
|
path = File.join(tmp_upload_dir, filename )
|
208
|
-
if older_than_five_days? File.ctime(path)
|
241
|
+
if Card.older_than_five_days? File.ctime(path)
|
209
242
|
FileUtils.rm path
|
210
243
|
end
|
211
244
|
end
|
212
245
|
end
|
213
246
|
end
|
214
247
|
|
215
|
-
def older_than_five_days? time
|
216
|
-
Time.now - time > 432000
|
217
|
-
end
|
218
248
|
|
219
249
|
def delete_files_for_action action
|
220
250
|
with_selected_action_id(action.id) do
|
@@ -225,34 +255,33 @@ def delete_files_for_action action
|
|
225
255
|
end
|
226
256
|
end
|
227
257
|
|
258
|
+
# create filesystem links to files from prior action
|
259
|
+
def symlink_to prior_action_id
|
260
|
+
return unless prior_action_id != last_action_id
|
261
|
+
save_action_id = selected_action_id
|
262
|
+
links = {}
|
228
263
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
self.selected_action_id = prior_action_id
|
235
|
-
attachment.versions.each do |name, version|
|
236
|
-
links[name] = version.store_path
|
237
|
-
end
|
238
|
-
original = attachment.store_path
|
239
|
-
|
240
|
-
self.selected_action_id = last_action_id
|
241
|
-
attachment.versions.each do |name, version|
|
242
|
-
::File.symlink links[name], version.store_path
|
243
|
-
end
|
244
|
-
::File.symlink original, attachment.store_path
|
264
|
+
self.selected_action_id = prior_action_id
|
265
|
+
attachment.versions.each do |name, version|
|
266
|
+
links[name] = version.store_path
|
267
|
+
end
|
268
|
+
original = attachment.store_path
|
245
269
|
|
246
|
-
|
270
|
+
self.selected_action_id = last_action_id
|
271
|
+
attachment.versions.each do |name, version|
|
272
|
+
::File.symlink links[name], version.store_path
|
247
273
|
end
|
274
|
+
::File.symlink original, attachment.store_path
|
275
|
+
|
276
|
+
self.selected_action_id = save_action_id
|
248
277
|
end
|
249
278
|
|
250
|
-
def attachment_format
|
251
|
-
if ext.present? && attachment && original_ext=attachment.extension
|
279
|
+
def attachment_format ext
|
280
|
+
if ext.present? && attachment && (original_ext = attachment.extension)
|
252
281
|
if['file', original_ext].member? ext
|
253
282
|
original_ext
|
254
|
-
elsif exts = MIME::Types[attachment.content_type]
|
255
|
-
if exts.find {|mt| mt.extensions.member? ext }
|
283
|
+
elsif (exts = MIME::Types[attachment.content_type])
|
284
|
+
if exts.find { |mt| mt.extensions.member? ext }
|
256
285
|
ext
|
257
286
|
else
|
258
287
|
exts[0].extensions[0]
|
@@ -263,5 +292,3 @@ rescue => e
|
|
263
292
|
Rails.logger.info "attachment_format issue: #{e.message}"
|
264
293
|
nil
|
265
294
|
end
|
266
|
-
|
267
|
-
|
@@ -9,37 +9,53 @@ event :add_comment, after: :approve, on: :save, when: proc { |c| c.comment } do
|
|
9
9
|
"[[#{Auth.current.name}]]"
|
10
10
|
else
|
11
11
|
Env.session[:comment_author] = comment_author if Env.session
|
12
|
-
"#{
|
12
|
+
"#{comment_author} (Not signed in)"
|
13
13
|
end
|
14
14
|
|
15
15
|
self.content = %{
|
16
16
|
#{content}
|
17
17
|
#{'<hr>' unless content.blank?}
|
18
18
|
#{cleaned_comment}
|
19
|
-
<div class="w-comment-author">--#{signature}.....#{Time.now}</div>
|
19
|
+
<div class="w-comment-author">--#{signature}.....#{Time.zone.now}</div>
|
20
20
|
}
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
format do
|
24
|
+
view :comment_box,
|
25
|
+
denial: :blank, tags: :unknown_ok,
|
26
|
+
perms: lambda { |r| r.card.ok? :comment } do |_args|
|
27
|
+
<<-HTML
|
28
|
+
<div class="comment-box nodblclick">#{comment_form}</div>
|
29
|
+
HTML
|
30
|
+
end
|
24
31
|
|
25
|
-
|
26
|
-
%{<div class="comment-box nodblclick"> #{
|
32
|
+
def comment_form
|
27
33
|
card_form :update do
|
28
34
|
%{
|
29
|
-
#{
|
30
|
-
|
35
|
+
#{hidden_field_tag('card[name]', card.name) if card.new_card?
|
36
|
+
# FIXME: wish we had more generalized solution for names.
|
37
|
+
# without this, nonexistent cards will often take left's linkname.
|
38
|
+
# (needs test)
|
31
39
|
}
|
32
|
-
#{
|
33
|
-
|
34
|
-
#{
|
35
|
-
unless Auth.signed_in?
|
36
|
-
card.comment_author= (session[:comment_author] || params[:comment_author] || "Anonymous") #ENGLISH
|
37
|
-
%{<label>My Name is:</label> #{ text_field :comment_author }}
|
38
|
-
end
|
39
|
-
}
|
40
|
-
#{ button_tag 'Comment', type: :submit, disable_with: "Commenting" }
|
41
|
-
</div>
|
40
|
+
#{text_area :comment, rows: 3}
|
41
|
+
#{comment_buttons}
|
42
42
|
}
|
43
|
-
end
|
44
|
-
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def comment_buttons
|
47
|
+
<<-HTML
|
48
|
+
<div class="comment-buttons">
|
49
|
+
#{
|
50
|
+
unless Auth.signed_in?
|
51
|
+
card.comment_author = session[:comment_author] ||
|
52
|
+
params[:comment_author] || 'Anonymous' # ENGLISH
|
53
|
+
%{<label>My Name is:</label> #{text_field :comment_author}}
|
54
|
+
end
|
55
|
+
}
|
56
|
+
#{submit_button text: 'Comment', type: :submit,
|
57
|
+
disable_with: 'Commenting'}
|
58
|
+
</div>
|
59
|
+
HTML
|
60
|
+
end
|
45
61
|
end
|