1<!-- Gets embedded anywhere we need to list comments on a top-level commentable. We need the local variable "commentable" here. -->
2<div id="feedback" class="feedback">
3
4 <h3 class="landmark heading"><%= ts("Actions") %></h3>
5
6 <ul class="actions" role="navigation">
7 <% if @work || @admin_post %>
8 <li><%= link_to '↑ '.html_safe + ts('Top'), "#main" %></li>
9 <% end %>
10
11 <% if @work && @previous_chapter %>
12 <li><%= link_to '←'.html_safe + ts('Previous Chapter'), [@work, @previous_chapter, :anchor => "workskin"] %></li>
13 <% end %>
14
15 <% if @work && @next_chapter %>
16 <li><%= link_to h(ts('Next Chapter')) + ' →'.html_safe, [@work, @next_chapter, :anchor => "workskin"] %></li>
17 <% end %>
18
19 <% if @previous_admin_post %>
20 <li><%= link_to("Previous Post", @previous_admin_post) %></li>
21 <% end %>
22
23 <% if @next_admin_post %>
24 <li><%= link_to("Next Post", @next_admin_post) %></li>
25 <% end %>
26
27 <% if @admin_post %>
28 <li><%= link_to ts('Back to AAF News Index'), admin_posts_path %></li>
29 <% end %>
30
31 <% if @work && !is_author_of?(@work) %>
32 <li>
33 <%= form_for(:kudo, url: kudos_path, html: { method: 'post', id: 'new_kudo' }) do |kudo_form| %>
34 <%= kudo_form.hidden_field :commentable_id, :value => @work.id %>
35 <%= kudo_form.hidden_field :commentable_type, :value => 'Work' %>
36 <%= kudo_form.submit ts("Kudos ♥"), :id => 'kudo_submit' %>
37 <% end %>
38 </li>
39 <% end %>
40 <% if @work && is_maintainer? && @work.allow_collection_invitation? %>
41 <li>
42 <%= link_to t(".invite_to_collections_link"), "#collection-form", :class => "collection_item_form_placement_open" %>
43 </li>
44 <% end %>
45
46
47 <% if logged_in? && @work %>
48 <li>
49 <% @bookmark ||= bookmark_if_exists(commentable) %>
50 <%= link_to (@bookmark ? ts("Edit Bookmark") : ts("Bookmark")), "#bookmark-form", :class => "bookmark_form_placement_open" %>
51 </li>
52 <% end %>
53
54 <% if logged_in? && @work && marked_for_later?(@work) %>
55 <li>
56 <%= mark_as_read_link(@work) %>
57 </li>
58 <% end %>
59
60 <% if commentable.count_visible_comments > 0 && !commentable.is_a?(Tag) %>
61 <li id="show_comments_link"><%= show_hide_comments_link(commentable, :show_count => true) %></li>
62 <% end %>
63 </ul>
64
65
66 <div id="kudos_message"></div>
67 <%= flash_div :kudos_error, :kudos_notice %>
68
69 <% if @work && (@chapter.blank? || @chapter.posted?) %>
70 <%= render "kudos/kudos", :kudos => @kudos, :guest_kudos_count => @work.guest_kudos_count, :commentable => @work %>
71 <% end %>
72
73
74 <h3 class="landmark heading"><a id="comments"><%= ts("Comments") %></a></h3>
75 <%= flash_div :comment_error, :comment_notice %>
76
77 <% commentable_parent = find_parent(commentable) %>
78 <% if commentable_parent.is_a?(AdminPost) && commentable_parent.disable_all_comments? %>
79 <p class="notice">
80 <%= t(".permissions.admin_post.disable_all") %>
81 </p>
82 <% elsif commentable_parent.is_a?(AdminPost) && commentable_parent.disable_anon_comments? && !logged_in? %>
83 <p class="notice">
84 <%= t(".permissions.admin_post.disable_anon") %>
85 <%= t(".permissions.admin_post.alt_action", support_link: link_to(t(".permissions.admin_post.support_link"), new_feedback_report_path)).html_safe %>
86 </p>
87 <% elsif commentable_parent.is_a?(Work) && commentable_parent.disable_all_comments? %>
88 <p class="notice">
89 <%= t(".permissions.work.disable_all") %>
90 </p>
91 <% elsif commentable_parent.is_a?(Work) && commentable_parent.disable_anon_comments? && !logged_in? %>
92 <p class="notice">
93 <%= t(".permissions.work.disable_anon") %>
94 <%= t(".permissions.work.alt_action") %>
95 </p>
96 <% elsif commentable_parent.is_a?(Work) && commentable_parent.hidden_by_admin? %>
97 <p class="notice">
98 <%= t(".permissions.work.hidden") %>
99 </p>
100 <% elsif commentable_parent.is_a?(Work) && commentable_parent.in_unrevealed_collection %>
101 <p class="notice">
102 <%= t(".permissions.work.unrevealed") %>
103 </p>
104 <% elsif commentable_parent.is_a?(Work) && blocked_by?(commentable_parent) %>
105 <p class="notice">
106 <%= t(".blocked") %>
107 </p>
108 <% else %>
109 <div id="add_comment_placeholder" title="top level comment">
110 <div id="add_comment">
111 <%= render 'comments/comment_form', {:comment => Comment.new, :commentable => commentable, :button_name => t(".actions.comment")} %>
112 </div>
113 </div>
114 <% end %>
115
116 <!-- If we have javascript, here is where the comments will be spiffily inserted -->
117 <!-- If not, and show_comments is true, here is where the comments will be rendered -->
118 <div id="comments_placeholder" <% unless params[:show_comments] || params[:tag_id] %>style="display:none;"<% end %>>
119 <% if params[:show_comments] || params[:tag_id] %>
120 <% @comments = CommentDecorator.for_commentable(commentable, page: params[:page]) %>
121 <%= will_paginate @comments, params: { anchor: :comments } %>
122 <%= render 'comments/comment_thread', { :depth => 0, :comments => @comments } %>
123 </ol><!-- need to tack this on to close thread -->
124 <%= will_paginate @comments, params: { anchor: :comments } %>
125 <% end %>
126 </div>
127
128 <% if logged_in? && @work %>
129 <% if is_maintainer? && @work.allow_collection_invitation? %>
130 <div id="collection_item_form_placement" class="wrapper toggled">
131 <%= render "collection_items/collection_item_form", :item => @work, :in_page => true %>
132 </div>
133 <% end %>
134
135 <div id="bookmark_form_placement" class="wrapper toggled">
136 <% @bookmark ||= bookmark_if_exists(commentable) %>
137 <% bookmarkable = (commentable.respond_to?(:work) ? commentable.work : commentable) %>
138 <% if @bookmark %>
139 <%= render "bookmarks/bookmark_form", :bookmarkable => bookmarkable, :bookmark => @bookmark, :button_name => ts("Update"), :action => :update, :in_page => true %>
140 <% else %>
141 <%= render "bookmarks/bookmark_form", :bookmarkable => bookmarkable, :bookmark => Bookmark.new, :button_name => ts("Create"), :action => :create, :in_page => true %>
142 <% end %>
143 </div>
144 <% end %>
145
146</div>
147<!-- END comments -->