修复课程资源排序bug

修复课程动态时间段约束bug
This commit is contained in:
chenmin 2014-08-05 15:23:01 +08:00
parent 8b217735c3
commit fbe3e535b4
3 changed files with 21 additions and 6 deletions

View File

@ -624,7 +624,9 @@ class CoursesController < ApplicationController
"show_course_journals_for_messages" => true
}
@date_to ||= Date.today + 1
@date_from = @date_to - @days-1.years
#
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
#@date_from = @date_to - @days-1.years
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
# 决定显示所用用户或单个用户活动
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,

View File

@ -40,9 +40,17 @@ class FilesController < ApplicationController
render :layout => !request.xhr?
elsif params[:course_id]
@isproject = false
@order = params[:sort].split(",")[0];
@orderBy = @order.split(":")[0];
@orderType = @order.split(":")[1];
if params[:sort]
if params[:sort].include?":"
@orderBy = params[:sort].split(":")[0];
@orderType = params[:sort].split(":")[1].split(",")[0];
else
@orderBy = params[:sort].split(",")[0];
@orderType = "asc";
end
end
if @orderBy=="size"
@orderBy="filesize"
elsif @orderBy=="field_file_dense"
@ -52,7 +60,12 @@ class FilesController < ApplicationController
elsif @orderBy=="content_type"
@orderBy="attachtype"
end
if @orderBy
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@orderBy} #{@orderType}").find(@course.id)]
else
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on desc").find(@course.id)]
end
render :layout => 'base_courses'
end
end

View File

@ -2,7 +2,7 @@
<div class="content-title-top-avtive">
<!-- <h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> -->
<p class="subtitle">
<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
<%= l(:label_date_from_to, :start => format_date(@date_from), :end => format_date(@date_to - 1)) %>
</p>
<% @events_by_day.keys.sort.reverse.each do |day| %>