From 9549d695f62c3f4ed3f39ca3a3b2ec330ea9af87 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 25 Mar 2016 14:29:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=B1=80=E9=83=A8?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 19 --------------- app/views/boards/_course_show_detail.html.erb | 24 ++----------------- app/views/boards/show.html.erb | 2 -- app/views/layouts/_project_info.html.erb | 10 ++++---- app/views/users/_course_message.html.erb | 18 +++++++------- 5 files changed, 16 insertions(+), 57 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 17111b3f3..b1d16debb 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -37,16 +37,6 @@ class MessagesController < ApplicationController # Show a topic and its replies def show -=begin - if @course - topic_id = params[:r]?params[:r]:params[:id] - parent_id = params[:id] - url = course_boards_path(@course,:topic_id => topic_id,:parent_id=>parent_id); - redirect_to url - return; - end -=end - @isReply = true page = params[:page] # Find the page of the requested reply @@ -54,16 +44,7 @@ class MessagesController < ApplicationController offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i]) page = 1 + offset / REPLIES_PER_PAGE end - @reply_count = @topic.children.count - # @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page - # @replies = @topic.children. - # includes(:author, :attachments, {:board => :project}). - # reorder("#{Message.table_name}.created_on DESC"). - # limit(@reply_pages.per_page). - # offset(@reply_pages.offset). - # all - @reply = Message.new(:subject => "RE: #{@message.subject}") if @course messages_replies = @topic.children. diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb index bc7b9667e..d465571c5 100644 --- a/app/views/boards/_course_show_detail.html.erb +++ b/app/views/boards/_course_show_detail.html.erb @@ -2,20 +2,7 @@ <%= import_ke(enable_at: false, prettify: false) %> <%= javascript_include_tag "create_kindeditor" %> <% end %> - - -<% if topics%> +<% if topics %> <% topics.each do |topic| %> <% if topic %> - <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %> + <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %> <% end %> <% end %> <% if topics.count == 10 %> - <%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%> <% end %> <% end%> - diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 9dd5c78ca..6cc755b61 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -192,6 +192,4 @@ function nh_init_board(params){ }); } } - - diff --git a/app/views/layouts/_project_info.html.erb b/app/views/layouts/_project_info.html.erb index 1f40c24ad..06d6304d2 100644 --- a/app/views/layouts/_project_info.html.erb +++ b/app/views/layouts/_project_info.html.erb @@ -25,15 +25,15 @@ <%= @course.name %> - <%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %> + <% if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %> - <% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%> + <% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0 %> - <% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%> + <% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0 %> - <% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%> + <% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0 %> - <%else%> + <%else %> <%end %> diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index aed741ce5..de49ba57a 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -2,14 +2,14 @@
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %> - <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> + <%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
<% if activity.try(:author).try(:realname) == ' ' %> - <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %> <% else %> - <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> + <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %> <% end %> TO <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%> @@ -18,15 +18,15 @@ <% if activity.parent_id.nil? %> <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %> <% else %> - <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%> + <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %> <% end %>
- <% if activity.sticky == 1%> + <% if activity.sticky == 1 %> 置顶 <% end%> - <% if activity.locked%> + <% if activity.locked %>        - <% end%> + <% end %>
发帖时间:<%= format_time(activity.created_on) %> @@ -36,9 +36,9 @@
<% if activity.parent_id.nil? %> - <% content = activity.content%> + <% content = activity.content %> <% else %> - <% content = activity.parent.content%> + <% content = activity.parent.content %> <% end %> <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>