Change texts for legislation questions comments
This commit is contained in:
@@ -1,11 +1,31 @@
|
||||
module CommentsHelper
|
||||
|
||||
def comment_tree_title_text(commentable)
|
||||
if commentable.class == Legislation::Question
|
||||
t("legislation.questions.comments.comments_title")
|
||||
else
|
||||
t("comments_helper.comments_title")
|
||||
end
|
||||
end
|
||||
|
||||
def leave_comment_text(commentable)
|
||||
if commentable.class == Legislation::Question
|
||||
t("legislation.questions.comments.form.leave_comment")
|
||||
else
|
||||
t("comments.form.leave_comment")
|
||||
end
|
||||
end
|
||||
|
||||
def comment_link_text(parent_id)
|
||||
parent_id.present? ? t("comments_helper.reply_link") : t("comments_helper.comment_link")
|
||||
end
|
||||
|
||||
def comment_button_text(parent_id)
|
||||
parent_id.present? ? t("comments_helper.reply_button") : t("comments_helper.comment_button")
|
||||
def comment_button_text(parent_id, commentable)
|
||||
if commentable.class == Legislation::Question
|
||||
parent_id.present? ? t("comments_helper.reply_button") : t("legislation.questions.comments.comment_button")
|
||||
else
|
||||
parent_id.present? ? t("comments_helper.reply_button") : t("comments_helper.comment_button")
|
||||
end
|
||||
end
|
||||
|
||||
def parent_or_commentable_dom_id(parent_id, commentable)
|
||||
@@ -48,4 +68,4 @@ module CommentsHelper
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="row">
|
||||
<div id="comments" class="small-12 column">
|
||||
<h2>
|
||||
<%= t("debates.show.comments_title") %>
|
||||
<%= comment_tree_title_text(commentable) %>
|
||||
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
|
||||
</h2>
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
<% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>
|
||||
<div id="js-comment-form-<%= css_id %>" <%= "style='display:none'".html_safe if toggeable %> class="comment-form">
|
||||
<%= form_for Comment.new, remote: true do |f| %>
|
||||
<%= label_tag "comment-body-#{css_id}", t("comments.form.leave_comment") %>
|
||||
<%= label_tag "comment-body-#{css_id}", leave_comment_text(commentable) %>
|
||||
<%= f.text_area :body, id: "comment-body-#{css_id}", maxlength: Comment.body_max_length, label: false %>
|
||||
<%= f.hidden_field :commentable_type, value: commentable.class.name %>
|
||||
<%= f.hidden_field :commentable_id, value: commentable.id %>
|
||||
<%= f.hidden_field :parent_id, value: parent_id %>
|
||||
|
||||
<%= f.submit comment_button_text(parent_id), class: "button" %>
|
||||
<%= f.submit comment_button_text(parent_id, commentable), class: "button" %>
|
||||
|
||||
<% if can? :comment_as_moderator, commentable %>
|
||||
<div class="float-right">
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render 'legislation/shared/comments', commentable: @annotation %>
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<%= render 'legislation/shared/comments', commentable: @question %>
|
||||
|
||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
|
||||
|
||||
</section>
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<% cache [locale_and_user_status, @current_order, commentable_cache_key(commentable), @comment_tree.comments, @comment_tree.comment_authors, commentable.comments_count, @comment_flags] do %>
|
||||
<div class="row comments">
|
||||
<div id="comments" class="small-12 column">
|
||||
<h3>
|
||||
<%= t("legislation.shared.comments") %>
|
||||
<span class="js-comments-count">(<%= commentable.comments_count %>)</span>
|
||||
</h3>
|
||||
|
||||
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
<%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %>
|
||||
<% else %>
|
||||
<br>
|
||||
|
||||
<div data-alert class="callout primary">
|
||||
<%= t("debates.show.login_to_comment",
|
||||
signin: link_to(t("votes.signin"), new_user_session_path),
|
||||
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% @comment_tree.root_comments.each do |comment| %>
|
||||
<%= render 'comments/comment', comment: comment %>
|
||||
<% end %>
|
||||
<%= paginate @comment_tree.root_comments %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user