diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index c67310f6f..075a54f65 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -19,8 +19,8 @@ class FilesController < ApplicationController layout 'base_projects'#by young menu_item :files - before_filter :find_project_by_project_id - before_filter :authorize + before_filter :find_project_by_project_id#, :except => [:getattachtype] + before_filter :authorize, :except => [:getattachtype] helper :sort include SortHelper @@ -62,20 +62,21 @@ class FilesController < ApplicationController redirect_to project_files_path(@project) end - def showbyattachtype - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", + # 返回制定资源类型的资源列表 + def getattachtype + sort_init 'created_on', 'desc' + sort_update 'created_on' => "#{Attachment.table_name}.created_on", 'filename' => "#{Attachment.table_name}.filename", 'size' => "#{Attachment.table_name}.filesize", 'downloads' => "#{Attachment.table_name}.downloads" - + @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] #modify by Long Jun @containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort + + @attachtype = params[:type].to_i - if @project.project_type == 1 - render :layout => 'base_courses' - else - render :layout => !request.xhr? + respond_to do |format| + format.js end end end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index b4f5b0468..b8fb7a6f6 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -23,7 +23,7 @@ class SchoolController < ApplicationController end end - + def upload_logo end diff --git a/app/views/files/_show_all_attachment.html.erb b/app/views/files/_show_all_attachment.html.erb new file mode 100644 index 000000000..c65f58cc5 --- /dev/null +++ b/app/views/files/_show_all_attachment.html.erb @@ -0,0 +1,61 @@ +<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %> +
+ <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> + | +|||||
---|---|---|---|---|---|
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> | +<%= format_time(file.created_on) %> | +<%= number_to_human_size(file.filesize) %> | +<%= file.attachmentstype.typeName %> | +<%= file.downloads %> | + ++ <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> + | +
+ | + + +
- <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> - | -|||||
---|---|---|---|---|---|
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> | -<%= format_time(file.created_on) %> | -<%= number_to_human_size(file.filesize) %> | -<%= file.attachmentstype.typeName %> | -<%= file.downloads %> | - -- <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - | -
- | - - -
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> | -<%= format_time(file.created_on) %> | -<%= number_to_human_size(file.filesize) %> | -<%= file.attachmentstype.typeName %> | -<%= file.downloads %> | - -- <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - | -
- | - - -
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> | +<%= format_time(file.created_on) %> | +<%= number_to_human_size(file.filesize) %> | +<%= file.attachmentstype.typeName %> | +<%= file.downloads %> | + ++ <%= link_to(image_tag('delete.png'), attachment_path(file), + :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> + | +
+ | + + +
- <%= link_to(h(container), {:controller => 'versions', :action => 'show', :id => container}, :class => "icon icon-package", :style => "color: #666666;") %> - | -|||||
---|---|---|---|---|---|
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> | -<%= format_time(file.created_on) %> | -<%= number_to_human_size(file.filesize) %> | -<%= file.attachmentstype.typeName %> | -<%= file.downloads %> | - -- <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - | -
- | - - -
<%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %> | -<%= format_time(file.created_on) %> | -<%= number_to_human_size(file.filesize) %> | -<%= file.attachmentstype.typeName %> | -<%= file.downloads %> | - -- <%= link_to(image_tag('delete.png'), attachment_path(file), - :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %> - | -
- | - - -