资源模块,默认按时间降序排列
This commit is contained in:
parent
5bbc562abd
commit
e2eaae63f4
|
@ -134,6 +134,8 @@ class FilesController < ApplicationController
|
|||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
|
@ -148,15 +150,9 @@ class FilesController < ApplicationController
|
|||
sort += ","
|
||||
end
|
||||
end
|
||||
# if order_by.count == 1
|
||||
# sort += "#{Attachment.table_name}.#{attribute} asc " if attribute
|
||||
# elsif order_by.count == 2
|
||||
# sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1]
|
||||
# end
|
||||
# if sort_type != params[:sort].split(",").last
|
||||
# sort += ","
|
||||
# end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
|
||||
@containers = [ Project.includes(:attachments).find(@project.id)]
|
||||
|
@ -198,6 +194,8 @@ class FilesController < ApplicationController
|
|||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
|
@ -213,6 +211,8 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
|
||||
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
|
||||
<% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %>
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @curse_attachments != nil %>
|
||||
<% @curse_attachments.each do |file| %>
|
||||
<% if @obj_attachments != nil %>
|
||||
<% @obj_attachments.each do |file| %>
|
||||
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
||||
<%next%>
|
||||
<%end%>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div id="resource_list">
|
||||
<% if @isproject %>
|
||||
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
||||
<%= render :partial => 'project_file', locals: {project: @project} %>
|
||||
<% else %>
|
||||
<%= render :partial => 'course_file', locals: {course: @course} %>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue