47 lines
2.1 KiB
Plaintext
47 lines
2.1 KiB
Plaintext
<% cache cache_key do %>
|
|
<% if comments_closed_for_commentable?(commentable) %>
|
|
<br>
|
|
<div data-alert class="callout primary">
|
|
<%= comments_closed_text %>
|
|
</div>
|
|
<% elsif require_verified_resident_for_commentable?(commentable, current_user) %>
|
|
<br>
|
|
<div data-alert class="callout primary">
|
|
<%= sanitize(t("comments.verified_only", verify_account: link_to_verify_account)) %>
|
|
</div>
|
|
<% elsif !valuation || can?(:comment_valuation, commentable) %>
|
|
<% css_id = parent_or_commentable_dom_id(parent_id, commentable) %>
|
|
<div id="js-comment-form-<%= css_id %>" class="comment-form">
|
|
<%= form_for Comment.new, remote: true, html: { id: "new_comment_#{css_id}" } do |f| %>
|
|
<%= f.text_area :body,
|
|
id: "comment-body-#{css_id}",
|
|
maxlength: Comment.body_max_length,
|
|
label: leave_comment_text(commentable) %>
|
|
|
|
<%= f.hidden_field :commentable_type, value: commentable.class.name, id: "comment_commentable_type_#{css_id}" %>
|
|
<%= f.hidden_field :commentable_id, value: commentable.id, id: "comment_commentable_id_#{css_id}" %>
|
|
<%= f.hidden_field :parent_id, value: parent_id, id: "comment_parent_id_#{css_id}" %>
|
|
<%= f.hidden_field :valuation, value: valuation, id: "comment_valuation_#{css_id}" %>
|
|
|
|
<%= f.submit comment_button_text(parent_id, commentable), class: "button", id: "publish_comment_#{css_id}" %>
|
|
|
|
<% if can? :comment_as_moderator, commentable %>
|
|
<div class="float-right">
|
|
<%= f.check_box :as_moderator,
|
|
label: t("comments.form.comment_as_moderator"),
|
|
id: "comment-as-moderator-#{css_id}" %>
|
|
</div>
|
|
<% end %>
|
|
<% if can? :comment_as_administrator, commentable %>
|
|
<div class="float-right">
|
|
<%= f.check_box :as_administrator,
|
|
label: t("comments.form.comment_as_admin"),
|
|
id: "comment-as-administrator-#{css_id}" %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|