diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 0d459e3ba..21d2254c1 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -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)]
diff --git a/app/views/files/_project_file_list.html.erb b/app/views/files/_project_file_list.html.erb
index 60675194b..136be38e1 100644
--- a/app/views/files/_project_file_list.html.erb
+++ b/app/views/files/_project_file_list.html.erb
@@ -20,7 +20,7 @@
<%= 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" %>
diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb
index 6935c186f..729f0a483 100644
--- a/app/views/files/_show_all_attachment.html.erb
+++ b/app/views/files/_show_all_attachment.html.erb
@@ -24,8 +24,8 @@
- <% 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%>
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index aefa1a5a9..4b6df47cb 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -1,6 +1,6 @@
<% 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 %>