添加课程讨论区show视图
This commit is contained in:
parent
70901832a8
commit
863dec03d2
|
@ -98,7 +98,7 @@ class Message < ActiveRecord::Base
|
|||
if parent && parent.id
|
||||
Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
|
||||
end
|
||||
board.reset_counters!(board.id)
|
||||
board.reset_counters!
|
||||
end
|
||||
|
||||
def sticky=(arg)
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
<!-- <%= course_board_breadcrumb(@board) %> -->
|
||||
|
||||
<!--new and follow-->
|
||||
<!-- <div class="content-title-top">
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
:class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
||||
<!-- <%= watcher_link(@board, User.current) %> -->
|
||||
<!-- </div> -->
|
||||
<div id="add-message" class="add_frame" style="display:none;">
|
||||
<% if User.current.logged? %>
|
||||
<h3><%= link_to h(@board.name), course_board_path(@course, @board) %> » <%= l(:label_message_new) %></h3>
|
||||
<div class="add_frame_header" >
|
||||
<%= l(:label_message_new) %>
|
||||
</div>
|
||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
||||
<p><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
|
||||
<%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> |
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %></p>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--display the board-->
|
||||
<div class="borad-title"><%=h @board.name %></div>
|
||||
|
||||
<% if !User.current.logged?%>
|
||||
<div style="font-size: 14px;margin:20px;">
|
||||
<%= l(:label_user_login_course_board) %>
|
||||
<%= link_to l(:label_user_login_new), signin_path %>
|
||||
<hr/>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- <div class="borad-description"><%=h @board.description %></div> -->
|
||||
<div class="borad-setitle">
|
||||
<span class="borad-topic-count">共有 <%=link_to @topics.count %> 个贴子</span>
|
||||
<span>
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
:class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if @topics.any? %>
|
||||
<!-- <table class="list messages">
|
||||
<thead><tr>
|
||||
<th><%= l(:field_subject) %></th>
|
||||
<th><%= l(:field_author) %></th>
|
||||
<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
|
||||
<%= sort_header_tag('replies', :caption => l(:label_reply_plural)) %>
|
||||
<%= sort_header_tag('updated_on', :caption => l(:label_message_last)) %>
|
||||
</tr></thead>
|
||||
<tbody> -->
|
||||
<% @topics.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
||||
<td>
|
||||
<table width="640px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||
<td align="right" rowspan="3"><table class="borad-count"><tr><td align="center" class="borad-count-digit"><%=link_to (topic.replies_count), board_message_path(@board, topic) %></td></tr>
|
||||
<tr><td align="center">回答</td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<!-- <tr><td colspan="2" ><span class="font_description">标签</span></td></tr> -->
|
||||
<tr><td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_on, topic.author %><br /></span></td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- <tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
|
||||
<td class="subject"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||
<td class="author"><%= link_to_user(topic.author) %></td>
|
||||
<td class="created_on"><%= format_time(topic.created_on) %></td>
|
||||
<td class="reply-count"><%= topic.replies_count %></td>
|
||||
<td class="last_message">
|
||||
<% if topic.last_reply %>
|
||||
<%= authoring topic.last_reply.created_on, topic.last_reply.author %><br />
|
||||
<%= link_to_message topic.last_reply %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr> -->
|
||||
<% end %>
|
||||
<!-- </tbody>
|
||||
</table> -->
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<% end %>
|
||||
|
||||
<% html_title @board.name %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %>
|
||||
<% end %>
|
|
@ -0,0 +1,110 @@
|
|||
<!-- <%= board_breadcrumb(@board) %> -->
|
||||
|
||||
<!--new and follow-->
|
||||
<!-- <div class="content-title-top">
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
:class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
||||
<!-- <%= watcher_link(@board, User.current) %> -->
|
||||
<!-- </div> -->
|
||||
<div id="add-message" class="add_frame" style="display:none;">
|
||||
<% if User.current.logged? %>
|
||||
<h3><%= link_to h(@board.name), project_board_path(@project, @board) %> » <%= l(:label_message_new) %></h3>
|
||||
<div class="add_frame_header" >
|
||||
<%= l(:label_message_new) %>
|
||||
</div>
|
||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
||||
<p><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
|
||||
<%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> |
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %></p>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--display the board-->
|
||||
<div class="borad-title"><%=h @board.name %></div>
|
||||
|
||||
<% if !User.current.logged?%>
|
||||
<div style="font-size: 14px;margin:20px;">
|
||||
<% if @project.project_type == 1 %>
|
||||
<%= l(:label_user_login_course_board) %>
|
||||
<% else %>
|
||||
<%= l(:label_user_login_project_board) %>
|
||||
<% end %>
|
||||
<%= link_to l(:label_user_login_new), signin_path %>
|
||||
<hr/>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- <div class="borad-description"><%=h @board.description %></div> -->
|
||||
<div class="borad-setitle">
|
||||
<span class="borad-topic-count">共有 <%=link_to @topics.count %> 个贴子</span>
|
||||
<span>
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
:class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if @topics.any? %>
|
||||
<!-- <table class="list messages">
|
||||
<thead><tr>
|
||||
<th><%= l(:field_subject) %></th>
|
||||
<th><%= l(:field_author) %></th>
|
||||
<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
|
||||
<%= sort_header_tag('replies', :caption => l(:label_reply_plural)) %>
|
||||
<%= sort_header_tag('updated_on', :caption => l(:label_message_last)) %>
|
||||
</tr></thead>
|
||||
<tbody> -->
|
||||
<% @topics.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
||||
<td>
|
||||
<table width="640px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||
<td align="right" rowspan="3"><table class="borad-count"><tr><td align="center" class="borad-count-digit"><%=link_to (topic.replies_count), board_message_path(@board, topic) %></td></tr>
|
||||
<tr><td align="center">回答</td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<!-- <tr><td colspan="2" ><span class="font_description">标签</span></td></tr> -->
|
||||
<tr><td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_on, topic.author %><br /></span></td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- <tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
|
||||
<td class="subject"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||
<td class="author"><%= link_to_user(topic.author) %></td>
|
||||
<td class="created_on"><%= format_time(topic.created_on) %></td>
|
||||
<td class="reply-count"><%= topic.replies_count %></td>
|
||||
<td class="last_message">
|
||||
<% if topic.last_reply %>
|
||||
<%= authoring topic.last_reply.created_on, topic.last_reply.author %><br />
|
||||
<%= link_to_message topic.last_reply %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr> -->
|
||||
<% end %>
|
||||
<!-- </tbody>
|
||||
</table> -->
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<% end %>
|
||||
|
||||
<% html_title @board.name %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
||||
<% end %>
|
|
@ -1,110 +1,5 @@
|
|||
<!-- <%= board_breadcrumb(@board) %> -->
|
||||
|
||||
<!--new and follow-->
|
||||
<!-- <div class="content-title-top">
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
:class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %> -->
|
||||
<!-- <%= watcher_link(@board, User.current) %> -->
|
||||
<!-- </div> -->
|
||||
<div id="add-message" class="add_frame" style="display:none;">
|
||||
<% if User.current.logged? %>
|
||||
<h3><%= link_to h(@board.name), project_board_path(@project, @board) %> » <%= l(:label_message_new) %></h3>
|
||||
<div class="add_frame_header" >
|
||||
<%= l(:label_message_new) %>
|
||||
</div>
|
||||
<%= form_for @message, :url => new_board_message_path(@board), :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'messages/form', :locals => {:f => f} %>
|
||||
<p><%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
|
||||
<%= preview_link(preview_board_message_path(@board), 'message-form' ,target='preview',{:class => 'whiteButton m3p10'} )%> |
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-message").hide(); return false;' ,:class => 'whiteButton m3p10' %></p>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!--display the board-->
|
||||
<div class="borad-title"><%=h @board.name %></div>
|
||||
|
||||
<% if !User.current.logged?%>
|
||||
<div style="font-size: 14px;margin:20px;">
|
||||
<% if @project.project_type == 1 %>
|
||||
<%= l(:label_user_login_course_board) %>
|
||||
<% else %>
|
||||
<%= l(:label_user_login_project_board) %>
|
||||
<% end %>
|
||||
<%= link_to l(:label_user_login_new), signin_path %>
|
||||
<hr/>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<!-- <div class="borad-description"><%=h @board.description %></div> -->
|
||||
<div class="borad-setitle">
|
||||
<span class="borad-topic-count">共有 <%=link_to @topics.count %> 个贴子</span>
|
||||
<span>
|
||||
<%= link_to l(:label_message_new),
|
||||
new_board_message_path(@board),
|
||||
:class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-message", "message_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
</div>
|
||||
<div style="padding-top: 10px">
|
||||
<% if @topics.any? %>
|
||||
<!-- <table class="list messages">
|
||||
<thead><tr>
|
||||
<th><%= l(:field_subject) %></th>
|
||||
<th><%= l(:field_author) %></th>
|
||||
<%= sort_header_tag('created_on', :caption => l(:field_created_on)) %>
|
||||
<%= sort_header_tag('replies', :caption => l(:label_reply_plural)) %>
|
||||
<%= sort_header_tag('updated_on', :caption => l(:label_message_last)) %>
|
||||
</tr></thead>
|
||||
<tbody> -->
|
||||
<% @topics.each do |topic| %>
|
||||
<table class="content-text-list">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
|
||||
<td>
|
||||
<table width="640px" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||
<td align="right" rowspan="3"><table class="borad-count"><tr><td align="center" class="borad-count-digit"><%=link_to (topic.replies_count), board_message_path(@board, topic) %></td></tr>
|
||||
<tr><td align="center">回答</td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
<!-- <tr><td colspan="2" ><span class="font_description">标签</span></td></tr> -->
|
||||
<tr><td align="left" colspan="2" ><span class="font_lighter"><%= authoring topic.created_on, topic.author %><br /></span></td></tr>
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- <tr class="message <%= cycle 'odd', 'even' %> <%= topic.sticky? ? 'sticky' : '' %> <%= topic.locked? ? 'locked' : '' %>">
|
||||
<td class="subject"><%= link_to h(topic.subject), board_message_path(@board, topic) %></td>
|
||||
<td class="author"><%= link_to_user(topic.author) %></td>
|
||||
<td class="created_on"><%= format_time(topic.created_on) %></td>
|
||||
<td class="reply-count"><%= topic.replies_count %></td>
|
||||
<td class="last_message">
|
||||
<% if topic.last_reply %>
|
||||
<%= authoring topic.last_reply.created_on, topic.last_reply.author %><br />
|
||||
<%= link_to_message topic.last_reply %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr> -->
|
||||
<% end %>
|
||||
<!-- </tbody>
|
||||
</table> -->
|
||||
<div class="pagination"><%= pagination_links_full @topic_pages, @topic_count %></div>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<% end %>
|
||||
|
||||
<% html_title @board.name %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
||||
<% if @project %>
|
||||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', locals: {course: @course} %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue