beast rev 2066
[beast-modified.git] / app / views / topics / show.html.erb
bloba76d246c96b4c152109434a932952847ee91367b
1 <% @page_title = @topic.title %>
2 <% @monitoring = logged_in? && !Monitorship.count(:id, :conditions => ['user_id = ? and topic_id = ? and active = ?', current_user.id, @topic.id, true]).zero? %>
4 <% content_for :right do -%>
6 <h5><%= 'Voices'[:voices_title] %></h5>
7 <ul class="flat talking">
8 <% @topic.voices.each do | user | %>
9   <li><%= link_to h(user.display_name), user_path(user) %></li>
10 <% end %>
11 </ul>
14 <% end # right content -%>
16 <% if logged_in? %>
18 <% form_tag monitorship_path(@forum, @topic), :style => 'margin-top:0em; float:right;' do -%>
19 <div>
20   <input id="monitor_checkbox" type="checkbox" <%= "checked='checked'" if @monitoring %> 
21     onclick="if (this.checked) {<%= remote_function :url => monitorship_path(@forum, @topic) %>} else {<%= remote_function :url => monitorship_path(@forum, @topic), :method => :delete %>}" />
22   <label id="monitor_label" for="monitor_checkbox"><%= @monitoring ? 'Monitoring topic'[] : 'Monitor topic'[] %></label>
23   <%= hidden_field_tag '_method', 'delete' if @monitoring %>
24   <%= submit_tag :Set, :id => 'monitor_submit' %>
25 </div>
26 <% end -%>
28 <% end -%>
31 <div class="crumbs">
32   <%= link_to "Forums"[:forums_title], home_path %> <span class="arrow">&rarr;</span>
33   <%= link_to h(@topic.forum.name), forum_path(@topic.forum) %> 
34   <% 
35   page=session[:forum_page] ? session[:forum_page][@topic.forum.id] : nil
36   if page and page!=1 %>
37   <small style="color:#ccc">
38   (<%= link_to 'page {page}'[:page, page], forum_path(:id => @topic.forum, :page => page) %>)
39   </small>
40   <% end %>
41   <span class="arrow">&rarr;</span>
42 </div>
44 <h1 id="topic-title" style="margin-top:0.5em;"<%= %( onmouseover="$('topic_mod').show();" onmouseout="$('topic_mod').hide();") if logged_in? %>>
47   <%= h @topic.title %>
48   <% if @topic.locked? %>
49   <span>(<%= 'locked'[] %>)</span>
50   <% end %>
51   <% if logged_in? %>
52     <span style="display:none;" id="topic_mod">
53       <% if @topic.editable_by?(current_user) -%>
54         <%= link_to('edit'[], edit_topic_path(@forum, @topic), :class => "utility") %> |
55         <%= link_to('delete'[], topic_path(@forum, @topic), :class => "utility", :method => :delete, :confirm => 'Delete this topic forever?'[:delete_topic_conf]) %>
56       <% end -%>
57     </span>
58   <% end %>
59 </h1>
61 <p class="subtitle">
62   <%= feed_icon_tag @topic.title, formatted_topic_path(@forum, @topic, :rss) %>
63   <%= '{count} post(s)'[(count=@topic.posts.size)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %>, 
64   <%= '{count} voice(s)'[(count=@topic.voices.size)==1 ? :voice_count : :voices_count, number_with_delimiter(count)] %>
65 </p>
67 <%= pagination @posts %>
69 <a name="<%= dom_id @posts.first %>" id="<%= dom_id @posts.first %>">&nbsp;</a>
71 <table border="0" cellspacing="0" cellpadding="0" class="posts wide">
72 <% for post in @posts do %>
73 <% unless post == @posts.first %>
74 <tr class="spacer">
75   <td colspan="2">
76     <a name="<%= dom_id post %>" id="<%= dom_id post %>">&nbsp;</a>
77   </td>
78 </tr>
79 <% end %>
80 <tr class="post hentry" id="<%= dom_id post %>-row">
81   <td class="author vcard">
82     <div class="date">
83       <a href="#<%= dom_id post %>" rel="bookmark">
84       <abbr class="updated" title="<%= post.created_at.xmlschema %>">
85       <%= time_ago_in_words(post.created_at) %>
86       </abbr>
87       </a>
88     </div>
90     <%= avatar_for post.user %>
91     <span class="fn"><%= link_to truncate(h(post.user.display_name), 15), user_path(post.user), :class => (post.user == @posts.first.user ? "threadauthor" : nil) %></span>
92     <% if post.user.admin? or post.forum.moderators.include?(post.user) %>
93     <span class="admin">
94       <% if post.user.admin? %>
95       <%= 'Administator'[:administrator_title] %>
96       <% elsif post.forum.moderators.include?(post.user) %>
97       <%= 'Moderator'[:moderator_title] %>
98       <% end %>
99     </span>
100     <% end %>
101     <span class="posts"><%= '{count} post(s)'[(count=post.user.posts.size)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %></span>
104     <% if logged_in? && post.editable_by?(current_user) -%>
105     <p>
106       <span class="edit">
107         <%= ajax_spinner_for "edit-post-#{post.id}", "spinner_bounce.gif" %>
108         <%= link_to_remote('Edit post'[], 
109               {:url => edit_post_path(:forum_id => @forum, :topic_id => @topic, :id => post), :method => :get,
110                :before => "EditForm.init(#{post.id});", :condition => "!EditForm.isEditing(#{post.id})" }, 
111               {:href => edit_post_path(:forum_id => @forum, :topic_id => @topic, :id => post, :page => params[:page]), :class => "utility"}) %>
112       </span>
113     </p>
114     <% end -%>
117   </td>
118   <td class="body entry-content" id="post-body-<%= post.id %>">
119 <!--
120     <%= link_to_function image_tag('clearbits/comment.gif', :class => 'icon reply'), "$('reply').toggle()" if logged_in? %>
122     <%= post.body_html %>
123   </td>
124 </tr>
126 <% end %>
127 </table>
128        
129 <%= next_page @posts %>
130 <%= pagination @posts %>
132 <% if logged_in? %>
133 <div id="edit"></div>
134 <% if @topic.locked? %>
136     <%= image_tag "clearbits/lock.gif", :class => "icon grey", :title => "Topic locked"[:topic_locked_title] %> 
137     <label>
138     <%= 'This topic is locked'[:locked_topic] %>.</label>
139 </p>
140 <% else %>
142 <p><%= link_to_function 'Reply to topic'[], "ReplyForm.init()", :class => "utility" %></p>
144 <div id="reply" class="editbox">
145 <div class="container">
146   <%= content_tag 'p', h(flash[:bad_reply]), :class => 'notice' if flash[:bad_reply] %>
147   <% form_for :post, :url => posts_path(:forum_id => @forum, :topic_id => @topic, :page => @topic.last_page) do |f| -%>
148   <table width="100%" border="0" cellpadding="0" cellspacing="0">
149     <tr>
150       <td rowspan="2" width="70%">
151         <%= f.text_area :body, :rows => 8 %>
152       </td>
153       <td valign="top">
156         <h5><%= 'Formatting Help'[] %></h5>
158         <ul class="help">
159           <li><%= '*bold*'[:formatting_bold] %>
160           &nbsp; &nbsp; &nbsp;
161           <%= '_italics_'[:formatting_italics] %>
162           &nbsp; &nbsp; &nbsp;<br />
163           <%= 'bq. <span>(quotes)</span>'[:formatting_blockquote] %></li>
164           <li>"IBM":http://www.ibm.com</li>
165           <li><%= '* or # <span>(lists)</span>'[:formatting_list] %></li>
166         </ul>
168       </td>
169     </tr>
170     <tr>
171       <td valign="bottom" style="padding-bottom:15px;">
172        <%= submit_tag "Save Reply"[] %><span class="button_or">or <%= link_to_function 'cancel'[], "$('reply').hide()" %></span>
173      </td>
174    </tr>
175   </table>
176   <% end -%>
177 </div>
178 </div>
179 <%= javascript_tag "$('reply').hide();"%>
180 <% end %>
181 <% end %>
183 <div class="crumbs" style="margin-top:1.1em;">
184   <%= link_to "Forums"[:forums_title], home_path %> <span class="arrow">&rarr;</span>
185   <%= link_to h(@topic.forum.name), forum_path(@topic.forum) %> <span class="arrow">&rarr;</span>
186 </div>