nilbus/handoff

View on GitHub
app/views/handoffs/_annotations.html.erb

Summary

Maintainability
Test Coverage
<% fail 'Rendered handoffs/_annotations without @annotations_by_resource' if @annotations_by_resource.nil? %>
<div class="annotations" style="display: none;">
  <% @annotations_by_resource.merge(annotation_template).each do |id, annotations| %>
    <div class="annotations-for-id panel panel-info" data-id="<%= id %>">
      <%= icon 'caret-left', '', class: 'annotation-pointer' %>
      <% annotations.each do |annotation| %>
        <%= render partial: 'annotation', object: annotation %>
      <% end %>
      <div class="panel-body reply">
        <%= form_for Annotation.new do |f| %>
          <div class="reply-content" style="display: none;">
            <%= f.text_area :content, rows: 3, class: 'form-control' %>
          </div>
          <%= f.hidden_field :type, value: 'Comment' %>
          <%= f.hidden_field :handoff_id, value: @handoff.id %>
          <%= f.hidden_field :resource_id, value: id, class: 'resource-id' %>
          <button type="submit" class="btn btn-default btn-xs btn-reply">reply</button>
          <button type="button" class="close" aria-label="cancel" style="display: none;"><span aria-hidden="true">&times;</span></button>
        <% end %>
      </div>
    </div>
  <% end %>
</div>