项目、课程资源库添加私有资源提示

This commit is contained in:
huang 2016-08-26 16:26:12 +08:00
parent a434942b6d
commit a71f948f41
6 changed files with 25 additions and 5 deletions

View File

@ -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']

View File

@ -115,7 +115,9 @@
</div>
<div class="cl"></div>
<div class="re_con_top">
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= @all_attachments.count%></span>&nbsp;个资源</p>
<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
<%= render :partial => "files/tip_attachment_count" %>
</p>
<p class="f_r" style="color: #808080" id="course_filter_order">
<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>
</p>

View File

@ -85,7 +85,9 @@
</div>
<div class="cl"></div>
<div class="re_con_top">
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= @all_attachments.count%></span>&nbsp;个资源</p>
<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
<%= render :partial => "files/tip_attachment_count" %>
</p>
<p class="f_r" style="color: #808080">
<% if @order == "asc" %>
按&nbsp;<%= 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"} %>&nbsp;/&nbsp;

View File

@ -0,0 +1,3 @@
共有&nbsp;<span id="attachment_count"><%= @tip_all_attachments %></span>&nbsp;个资源
<span id="attachment_count_public" class="fontGrey2 ml10" style="font-weight: normal;">公共资源:<%= @tip_all_public_attachments %>个</span>
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>

View File

@ -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 %>

View File

@ -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|