Add milestones to investments show.

This commit is contained in:
taitus
2017-06-22 17:04:21 +02:00
parent 87eeb45584
commit c58371a5fe
7 changed files with 126 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
<% commentable = comment_tree.commentable %>
<% current_order = comment_tree.order %>
<% cache [locale_and_user_status, current_order, commentable_cache_key(commentable), comment_tree.comments, comment_tree.comment_authors, commentable.comments_count, comment_flags] do %>
<section class="expanded comments">
<div class="row">
<div id="comments" class="small-12 column">
<%= render 'shared/wide_order_selector', i18n_namespace: "comments" %>
<% if user_signed_in? %>
<% if comments_closed_for_commentable?(commentable) %>
<br>
<div data-alert class="callout primary">
<%= comments_closed_text(commentable) %>
</div>
<% elsif require_verified_resident_for_commentable?(commentable, current_user) %>
<br>
<div data-alert class="callout primary">
<%= t("comments.verified_only", verify_account: link_to(t("comments.verify_account"), verification_path )).html_safe %>
</div>
<% else %>
<%= render 'comments/form', {commentable: commentable, parent_id: nil, toggeable: false} %>
<% end %>
<% else %>
<br>
<div data-alert class="callout primary">
<%= t("debates.show.login_to_comment",
signin: link_to(t("votes.signin"), new_user_session_path),
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
</div>
<% end %>
<% comment_tree.root_comments.each do |comment| %>
<%= render 'comments/comment', {comment: comment, comment_flags: comment_flags} %>
<% end %>
<%= paginate comment_tree.root_comments %>
</div>
</div>
</section>
<% end %>

View File

@@ -0,0 +1,22 @@
<div class="row">
<div class="small-12 column">
<ul class="tabs" data-tabs id="investments-tabs">
<li class="tabs-title is-active">
<%= link_to "#tab-comments" do %>
<h3>
<%= t("budgets.investments.show.comments_tab") %>
<span class="js-comments-count">(<%= @investment.comments_count %>)</span>
</h3>
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-milestones" do %>
<h3>
<%= t("budgets.investments.show.milestones_tab") %>
(<%= @investment.milestones.count %>)
</h3>
<% end %>
</li>
</ul>
</div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="tabs-panel" id="tab-milestones">
<div class="row">
<div class="small-12 column">
<% if @investment.milestones.blank? %>
<div class="callout primary text-center">
<%= t('budgets.investments.show.no_milestones') %>
</div>
<% end %>
<% @investment.milestones.each do |milestone| %>
<h3><%= milestone.title %></h3>
<p><%= milestone.description %></p>
<% end %>
</div>
</div>
</div>

View File

@@ -10,4 +10,11 @@
ballot: @ballot
} %>
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
<div class="tabs-content" data-tabs-content="investments-tabs" role="tablist">
<%= render "budgets/investments/filter_subnav" %>
<%= render "budgets/investments/milestones" %>
<div class="tabs-panel is-active" id="tab-comments">
<%= render partial: 'budgets/investments/comments', locals: { comment_tree: @comment_tree, comment_flags: @comment_flags } %>
</div>
</div>