Merge pull request #59 from medialab-prado/18-create-comment
Create annotations and comments
This commit is contained in:
36
app/views/legislation/annotations/_form.html.erb
Normal file
36
app/views/legislation/annotations/_form.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<div class="comment-header">
|
||||
<span class="icon-comment" aria-hidden="true"></span>
|
||||
<div class="comment-number"><%= t('legislation.annotations.comments.comments_count', count: 0) %></div>
|
||||
<%= link_to '#' do %>
|
||||
<span class="icon-expand" aria-hidden="true"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="comments-wrapper">
|
||||
<div class="comment-input">
|
||||
<% if !@process.open_phase?(:allegations) %>
|
||||
<div data-alert class="callout primary">
|
||||
<%= t("legislation.annotations.form.phase_not_open") %>
|
||||
</div>
|
||||
<% elsif user_signed_in? %>
|
||||
<%= form_for Legislation::Annotation.new, url: legislation_process_draft_version_annotations_path(@process, @draft_version), remote: true do |f| %>
|
||||
<%= f.text_area :text %>
|
||||
|
||||
<div class="comment-actions">
|
||||
<a class="cancel-comment" href="#" data-cancel-annotation><%= t('legislation.annotations.comments.cancel') %></a>
|
||||
<%= f.submit t('legislation.annotations.comments.publish_comment'), class: 'button strong publish-comment' %>
|
||||
</div>
|
||||
|
||||
<%= f.hidden_field :quote %>
|
||||
<%= f.hidden_field :ranges %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div data-alert class="callout primary">
|
||||
<%= t("legislation.annotations.form.login_to_comment",
|
||||
signin: link_to(t("legislation.annotations.form.signin"), new_user_session_path),
|
||||
signup: link_to(t("legislation.annotations.form.signup"), new_user_registration_path)).html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
$("#comments-box").html("<%= j render('comments_box', annotation: @annotation) %>");
|
||||
$("#comments-box").html("<%= j render('comments_box', annotation: @annotation) %>").show();
|
||||
|
||||
|
||||
2
app/views/legislation/annotations/new.js.erb
Normal file
2
app/views/legislation/annotations/new.js.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
$("#comments-box").html("<%= j render('form') %>");
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<section class="legislation-annotatable"
|
||||
data-legislation-draft-version-id="<%= @draft_version.id %>"
|
||||
data-legislation-annotatable-base-url="<%= legislation_process_draft_version_path(@process, @draft_version) %>"
|
||||
data-legislation-open-phase="<%= @process.open_phase?(:allegations) %>"
|
||||
>
|
||||
<% end %>
|
||||
<%= @draft_version.body_html.html_safe %>
|
||||
|
||||
Reference in New Issue
Block a user