diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index cd3870e9a..9b12262af 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -325,6 +325,7 @@ class FilesController < ApplicationController @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] show_attachments @containers + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -377,6 +378,7 @@ class FilesController < ApplicationController @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] show_attachments @containers + get_attachment_for_tip(@all_attachments) @tag_list = attachment_tag_list @all_attachments @@ -440,6 +442,13 @@ class FilesController < ApplicationController end + # 获取提示中私有、公开总数信息 + def get_attachment_for_tip all_attachment + @tip_all_attachments = all_attachment.count + @tip_all_public_attachments = all_attachment.select{|attach| attach.is_public == 1}.count + @tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count + end + def quote_resource_show @file = Attachment.find(params[:id]) @can_quote = attachment_candown @file @@ -883,6 +892,7 @@ class FilesController < ApplicationController end @all_attachments = @result + get_attachment_for_tip(@all_attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 946449680..0afe01ae2 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -115,7 +115,9 @@
-

共有 <%= @all_attachments.count%> 个资源

+

+ <%= render :partial => "files/tip_attachment_count" %> +

<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>

diff --git a/app/views/files/_project_file.html.erb b/app/views/files/_project_file.html.erb index 40e5163a8..53cf4e15b 100644 --- a/app/views/files/_project_file.html.erb +++ b/app/views/files/_project_file.html.erb @@ -85,7 +85,9 @@
-

共有 <%= @all_attachments.count%> 个资源

+

+ <%= render :partial => "files/tip_attachment_count" %> +

<% if @order == "asc" %> 按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /  diff --git a/app/views/files/_tip_attachment_count.html.erb b/app/views/files/_tip_attachment_count.html.erb new file mode 100644 index 000000000..35ef949a9 --- /dev/null +++ b/app/views/files/_tip_attachment_count.html.erb @@ -0,0 +1,3 @@ +共有 <%= @tip_all_attachments %> 个资源 +公共资源:<%= @tip_all_public_attachments %>个 +私有资源:<%= @tip_all_private_attachments %>个 \ No newline at end of file diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb index dff75023b..8aaff5aa5 100644 --- a/app/views/files/search_tag_attachment.js.erb +++ b/app/views/files/search_tag_attachment.js.erb @@ -3,5 +3,6 @@ $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% else %> $("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>"); + $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>"); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); <% end %> diff --git a/db/schema.rb b/db/schema.rb index 47b3bf210..1e20df076 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160810081337) do +ActiveRecord::Schema.define(:version => 20160811084401) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -2207,6 +2207,7 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.integer "simi_id" t.integer "simi_value" t.integer "work_status", :default => 0 + t.datetime "commit_time" end add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id" @@ -2510,8 +2511,9 @@ ActiveRecord::Schema.define(:version => 20160810081337) do t.string "remark" t.integer "groupid" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "bindtype", :default => 0 end create_table "users", :force => true do |t|