Conflicts:
	app/controllers/files_controller.rb
This commit is contained in:
z9hang 2014-08-05 16:41:23 +08:00
commit b4be18ab9d
4 changed files with 27 additions and 12 deletions

View File

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

View File

@ -42,17 +42,30 @@ class FilesController < ApplicationController
@isproject = false @isproject = false
if params[:sort] if params[:sort]
@oder = params[:sort].split(",")[0] if params[:sort].include?":"
@order_by = @oder.split(":")[0] @orderBy = params[:sort].split(":")[0];
@order_tyoe = @oder.split(":")[1] @orderType = params[:sort].split(":")[1].split(",")[0];
if @order_by == "size" else
@order_by = "filesize" @orderBy = params[:sort].split(",")[0];
@orderType = "asc";
end end
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.#{@order_by} #{@order_tyoe}").find(@course.id)]
else
@containers = [ Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
end end
if @orderBy=="size"
@orderBy="filesize"
elsif @orderBy=="field_file_dense"
@orderBy="is_public"
elsif @orderBy=="attach_type"
@orderBy="attachtype"
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' render :layout => 'base_courses'
end end
end end

View File

@ -2,7 +2,7 @@
<div class="content-title-top-avtive"> <div class="content-title-top-avtive">
<!-- <h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> --> <!-- <h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3> -->
<p class="subtitle"> <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> </p>
<% @events_by_day.keys.sort.reverse.each do |day| %> <% @events_by_day.keys.sort.reverse.each do |day| %>

View File

@ -92,15 +92,15 @@
</ul> </ul>
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<h1></h1>
<% if User.current.logged? %> <% if User.current.logged? %>
<h1></h1>
<p id="errorExplanation"> <p id="errorExplanation">
该学校未开设任何课程,您可以查看其他学校课程 该学校未开设任何课程,您可以查看其他学校课程
</p> </p>
<h1></h1>
<% end %> <% end %>
<h1></h1>
<% find_all_new_hot_course(9, @school_id).map do |course| %> <% find_all_new_hot_course(9, @school_id).map do |course| %>
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>> <li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
<div class='avatar'> <div class='avatar'>