Merge pull request #983 from Retrospring/feature/long-comments
Increase allowed comment length to 512 characters
This commit is contained in:
commit
1ea8e64a85
|
@ -19,7 +19,7 @@ export function commentCreateHandler(event: KeyboardEvent): boolean {
|
||||||
if (event.which === 13) {
|
if (event.which === 13) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
if (input.value.length > 160) {
|
if (input.value.length > 512) {
|
||||||
group.classList.add('has-error');
|
group.classList.add('has-error');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ export function commentCreateHandler(event: KeyboardEvent): boolean {
|
||||||
commentCount.innerHTML = data.count;
|
commentCount.innerHTML = data.count;
|
||||||
}
|
}
|
||||||
input.value = '';
|
input.value = '';
|
||||||
counter.innerHTML = String(160);
|
counter.innerHTML = String(512);
|
||||||
|
|
||||||
const sub = document.querySelector<HTMLElement>(`[data-action=ab-submarine][data-a-id="${id}"]`);
|
const sub = document.querySelector<HTMLElement>(`[data-action=ab-submarine][data-a-id="${id}"]`);
|
||||||
sub.dataset.torpedo = "no"
|
sub.dataset.torpedo = "no"
|
||||||
|
|
|
@ -5,7 +5,7 @@ class Comment < ApplicationRecord
|
||||||
validates :answer_id, presence: true
|
validates :answer_id, presence: true
|
||||||
has_many :smiles, class_name: "Appendable::Reaction", foreign_key: :parent_id, dependent: :destroy
|
has_many :smiles, class_name: "Appendable::Reaction", foreign_key: :parent_id, dependent: :destroy
|
||||||
|
|
||||||
validates :content, length: { maximum: 160 }
|
validates :content, length: { maximum: 512 }
|
||||||
|
|
||||||
# rubocop:disable Rails/SkipsModelValidations
|
# rubocop:disable Rails/SkipsModelValidations
|
||||||
after_create do
|
after_create do
|
||||||
|
|
|
@ -25,7 +25,10 @@
|
||||||
%span.caret
|
%span.caret
|
||||||
= render "actions/comment", comment: comment, answer: a
|
= render "actions/comment", comment: comment, answer: a
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
.form-group.has-feedback.comment__input-group.input-group{ name: "ab-comment-new-group", data: { a_id: a.id, controller: "character-count", "character-count-max-value": 160 } }
|
.form-group.has-feedback.comment__input-group.input-group{
|
||||||
|
name: "ab-comment-new-group",
|
||||||
|
data: { a_id: a.id, controller: "character-count", character_count_max_value: 512 }
|
||||||
|
}
|
||||||
%input.form-control.comment__input{ type: :text, placeholder: t(".placeholder"), name: "ab-comment-new", data: { a_id: a.id, "character-count-target": "input" } }
|
%input.form-control.comment__input{ type: :text, placeholder: t(".placeholder"), name: "ab-comment-new", data: { a_id: a.id, "character-count-target": "input" } }
|
||||||
%span.text-muted.form-control-feedback.comment__character-count{ id: "ab-comment-charcount-#{a.id}", data: { "character-count-target": "counter" } } 160
|
%span.text-muted.form-control-feedback.comment__character-count{ id: "ab-comment-charcount-#{a.id}", data: { "character-count-target": "counter" } } 512
|
||||||
%button.btn.btn-primary.d-none{ type: :button, name: "ab-comment-new-submit", data: { a_id: a.id, "character-count-target": "action" } }= t(".action")
|
%button.btn.btn-primary.d-none{ type: :button, name: "ab-comment-new-submit", data: { a_id: a.id, "character-count-target": "action" } }= t(".action")
|
||||||
|
|
Loading…
Reference in New Issue