crowdAI/crowdai

View on GitHub
app/views/topics/edit.html.erb

Summary

Maintainability
Test Coverage
<div class='content'>
  <%= concept(Challenge::Cell::ChallengeMasthead,
                @challenge,
                current_participant: current_participant) %>
  <%= render partial: 'challenges/show/subnav',
        locals: { challenge: @challenge } %>
  <div class='row'>
    <div class="discussion-comment">
      <div class="pic">
        <%= link_to participant_path(current_participant) do %>
        <%= concept(Image::Cell,current_participant) %>
        <% end %>
      </div>
      <%= form_for [@challenge,@topic], html: { class: 'add-comment', id: 'new_comment' } do |f| %>
      <fieldset>
        <label>Topic</label>
        <%= f.text_field :topic %>
        <%= f.fields_for @topic.comments.first do |comment| %>
        <label>Comment</label>
        <%= comment.text_area :comment_markdown, placeholder: "Add a comment...", data: { behavior: "mentions" } %>
        <% if comment.object.persisted? %>
          <%= comment.hidden_field :participant_id, value: comment.object.participant.id %>
        <% else %>
          <%= comment.hidden_field :participant_id, value: current_participant.id %>
        <% end %>
        <%= comment.hidden_field :id %>
        <% end %>
      </fieldset>
      <% if @topic.persisted? %>
        <%= f.hidden_field :participant_id, value: @topic.participant.id %>
      <% else %>
        <%= f.hidden_field :participant_id, value: current_participant.id %>
      <% end %>
      <%= f.submit 'Update topic', class: 'btn btn-primary pull-right' %>
      <% end %>
    </div>
  </div>
</div>