|
10 | 10 | %> |
11 | 11 |
|
12 | 12 | <% |
| 13 | + # TODO: make configurable |
| 14 | + min_chars = 15 |
| 15 | + max_chars = 1000 |
| 16 | + |
13 | 17 | can_comment = user.can_reply_to?(thread) |
14 | 18 | is_rate_limited, rate_limit_message = comment_rate_limited?(user, post, create_audit_log: false) |
15 | 19 | text ||= defined?(text) && text.present? ? text : t('comments.labels.reply_to_thread') |
|
28 | 32 |
|
29 | 33 | <div class="reply-to-thread-wrapper"> |
30 | 34 | <%= link_to 'javascript:void(0)', class: 'button is-outlined is-small js-reply-to-thread-link', |
31 | | - data: { post: post.id }, |
| 35 | + data: { post: post.id, thread: thread.id }, |
32 | 36 | disabled: !can_comment, |
33 | 37 | role: 'button', |
34 | 38 | title: is_exempt ? '' : title do %> |
|
40 | 44 | </div> |
41 | 45 |
|
42 | 46 | <% if can_comment %> |
43 | | - <%= form_tag create_comment_path(thread.id), class: 'reply-to-thread-form', id: "reply-to-thread-form-#{post.id}" do %> |
| 47 | + <%= form_tag create_comment_path(thread.id), class: 'reply-to-thread-form', |
| 48 | + id: "reply-to-thread-form-#{post.id}-#{thread.id}" do %> |
44 | 49 | <%= hidden_field_tag :post_id, post.id %> |
45 | 50 | <%= hidden_field_tag :inline, inline %> |
46 | 51 | <%= label_tag :content, 'Your message', class: 'form-element' %> |
47 | 52 | <%= text_area_tag :content, '', |
48 | 53 | class: 'form-element js-comment-field', |
| 54 | + minlength: min_chars, |
| 55 | + maxlength: max_chars, |
| 56 | + required: true, |
49 | 57 | data: { thread: thread.id, |
50 | 58 | post: thread.post_id, |
51 | | - character_count: ".js-character-count-#{post.id}" } %> |
52 | | - <%= render 'shared/char_count', type: post.id, min: 15, max: 1000 %> |
| 59 | + character_count: ".js-character-count-thread-reply-#{post.id}-#{thread.id}" } %> |
| 60 | + <%= render 'shared/char_count', type: "thread-reply-#{post.id}-#{thread.id}", min: min_chars, max: max_chars %> |
53 | 61 | <%= submit_tag 'Add reply', class: 'button is-muted is-filled', disabled:true %> |
54 | 62 | <% end %> |
55 | 63 | <% end %> |
0 commit comments