Merge pull request #59 from medialab-prado/18-create-comment

Create annotations and comments
This commit is contained in:
Amaia Castro
2017-01-16 19:30:45 +01:00
committed by GitHub
13 changed files with 213 additions and 36 deletions

View 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>

View File

@@ -1,2 +1,2 @@
$("#comments-box").html("<%= j render('comments_box', annotation: @annotation) %>");
$("#comments-box").html("<%= j render('comments_box', annotation: @annotation) %>").show();

View File

@@ -0,0 +1,2 @@
$("#comments-box").html("<%= j render('form') %>");

View File

@@ -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 %>