From 863dec03d207be036d9b5f12a0d48a7a6ec8eb4b Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 12 Jun 2014 10:03:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B=E8=AE=A8?= =?UTF-8?q?=E8=AE=BA=E5=8C=BAshow=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 2 +- app/views/boards/_course_show.html.erb | 106 ++++++++++++++++++++++ app/views/boards/_project_show.html.erb | 110 +++++++++++++++++++++++ app/views/boards/show.html.erb | 113 +----------------------- 4 files changed, 221 insertions(+), 110 deletions(-) create mode 100644 app/views/boards/_course_show.html.erb create mode 100644 app/views/boards/_project_show.html.erb diff --git a/app/models/message.rb b/app/models/message.rb index 397e7283d..952244d56 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -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) diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb new file mode 100644 index 000000000..c9f78d8e1 --- /dev/null +++ b/app/views/boards/_course_show.html.erb @@ -0,0 +1,106 @@ + + + + + + + + + +
<%=h @board.name %>
+ +<% if !User.current.logged?%> +
+ <%= l(:label_user_login_course_board) %> + <%= link_to l(:label_user_login_new), signin_path %> +
+
+<% end %> + + +
+ 共有 <%=link_to @topics.count %> 个贴子 + + <%= 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? %> + +
+
+ <% if @topics.any? %> + + <% @topics.each do |topic| %> + + + + + +
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %> + + + + + + + +
<%= link_to h(topic.subject), board_message_path(@board, topic) %> + +
<%=link_to (topic.replies_count), board_message_path(@board, topic) %>
回答
<%= authoring topic.created_on, topic.author %>
+ + + <% end %> + + + <% else %> +

<%= l(:label_no_data) %>

+ <% end %> +
+ +<% 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 %> diff --git a/app/views/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb new file mode 100644 index 000000000..35868090c --- /dev/null +++ b/app/views/boards/_project_show.html.erb @@ -0,0 +1,110 @@ + + + + + + + + + +
<%=h @board.name %>
+ +<% if !User.current.logged?%> +
+ <% 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 %> +
+
+<% end %> + + +
+ 共有 <%=link_to @topics.count %> 个贴子 + + <%= 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? %> + +
+
+ <% if @topics.any? %> + + <% @topics.each do |topic| %> + + + + + +
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %> + + + + + + + +
<%= link_to h(topic.subject), board_message_path(@board, topic) %> + +
<%=link_to (topic.replies_count), board_message_path(@board, topic) %>
回答
<%= authoring topic.created_on, topic.author %>
+ + + <% end %> + + + <% else %> +

<%= l(:label_no_data) %>

+ <% end %> +
+ +<% 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 %> diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 849519d0d..6e5888363 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,110 +1,5 @@ - - - - - - - - - -
<%=h @board.name %>
- -<% if !User.current.logged?%> -
- <% 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 %> -
-
-<% end %> - - -
-共有 <%=link_to @topics.count %> 个贴子 - - <%= 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? %> - -
-
-<% if @topics.any? %> - - <% @topics.each do |topic| %> - - - - - -
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %> - - - - - - - -
<%= link_to h(topic.subject), board_message_path(@board, topic) %> - -
<%=link_to (topic.replies_count), board_message_path(@board, topic) %>
回答
<%= authoring topic.created_on, topic.author %>
- - - <% end %> - - -<% else %> -

<%= l(:label_no_data) %>

-<% end %> -
- -<% 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 %>