diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index b28fda55b..5c3503718 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -366,7 +366,7 @@ class AttachmentsController < ApplicationController end rescue NoMethodError @save_flag = false - @save_message = [] << l(:error_attachment_empty) + @save_message = [] << l(:label_course_empty_select) respond_to do |format| format.js end diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 6de800efc..251496e30 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -26,13 +26,15 @@ class FilesController < ApplicationController helper :sort include SortHelper + include FilesHelper helper :project_score def show_attachments obj - @all_attachments = [] + @attachments = [] obj.each do |container| - @all_attachments += container.attachments + @attachments += container.attachments end + @all_attachments = visable_attachemnts(@attachments) @limit = 10 @feedback_count = @all_attachments.count @feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @@ -48,9 +50,11 @@ class FilesController < ApplicationController #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank? if params[:insite] @result = find_public_attache q + @result = visable_attachemnts @result @searched_attach = paginateHelper @result,10 else @result = find_course_attache q,@course + @result = visable_attachemnts @result @searched_attach = paginateHelper @result,10 end @@ -69,7 +73,7 @@ class FilesController < ApplicationController # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map # 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。 # 现在还木有思路 药丸 - resultSet = Attachment.where("attachments.container_type IS NOT NULL AND (is_public = 1 OR author_id = #{User.current.id}) AND filename LIKE :like ", like: "%#{keywords}%"). + resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%"). reorder("created_on DESC") end diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb index f1f4f06f4..cd7603c65 100644 --- a/app/helpers/files_helper.rb +++ b/app/helpers/files_helper.rb @@ -72,6 +72,16 @@ module FilesHelper result end + def visable_attachemnts attachments + result = [] + attachments.each do |attachment| + if attachment.is_public? || attachment.author_id == User.current.id + result << attachment + end + end + result + end + def get_qute_number attachment if attachment.copy_from.nil? return 0 diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index 51091caae..b8d0ad098 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,6 +1,6 @@ <% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
-

共有 <%= User.current.member_of_course?(course) ? all_attachments.count : 0 %> 个资源

+

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

<% end %> - + <% else %> + <%= link_to "选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select",:remote => true %> + <% end %> <% else %> - <%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> <% end %>

@@ -41,7 +41,7 @@

文件大小:<%= number_to_human_size(file.filesize) %>

<%= link_to( l(:button_delete), attachment_path(file), :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%> -

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  |  引用<%=get_qute_number file %>

+

<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>  |  下载<%= file.downloads %>  

diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb index c815d71f8..549ed1751 100644 --- a/app/views/tags/_tag_list.html.erb +++ b/app/views/tags/_tag_list.html.erb @@ -14,7 +14,7 @@ <% end %> <% else %> - -    <%= l(:label_tags_no) %> - + + <% end %> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 94272b1fd..22b0df023 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1851,4 +1851,5 @@ en: label_teacher_comments: Teacher comments label_anonymous_comments: Anonymous comments label_anonymous: Anonymous - label_submit_comments: Submit_comments \ No newline at end of file + label_submit_comments: Submit_comments + label_course_empty_select: You have not selected course! \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 3f4267b76..bad27274f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2204,3 +2204,4 @@ zh: field_evaluation_num: 匿评分配数量 label_my_score: 我的评分 field_open_anonymous_evaluation: 是否开启匿评 + label_course_empty_select: 尚未选择课程! diff --git a/public/stylesheets/resource.css b/public/stylesheets/resource.css index fc6b74b75..86ff85825 100644 --- a/public/stylesheets/resource.css +++ b/public/stylesheets/resource.css @@ -1,4 +1,4 @@ -body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;} +body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9 !important; background:#fff !important; font-style:normal !important;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,form,span,textarea{ margin:0; padding:0;} div,img,tr,td,textarea{ border:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;} @@ -52,10 +52,33 @@ a:hover.re_fabu{background:#55a1b9 !important;} .re_con{ margin:5px; width:683px;} .re_con_top{color:#494949; } .re_con_top span{ color:#999999; font-weight:bold;} -a.re_select{ display:block; width:88px; height:22px; background:url(images/pic_select01.png) 0 0 no-repeat; color:#fff; font-weight:bold; margin-left:10px;} -a:hover.re_select{background:url(images/pic_select02.png) 0 0 no-repeat;} -.re_open{display:block; width:46px; height:22px; background:url(images/pic_open01.png) 0 0 no-repeat; color:#fff !important; font-weight:bold; margin-left:10px;} -a:hover.re_open{background:url(images/pic_open02.png) 0 0 no-repeat;} +a.re_select{ + display: block; + height: 22px; + border: 1px solid #ff9900; + color: #ff9900; + margin-left: 10px; + padding-left: 10px; + padding-right: 10px; +} +a:hover.re_select{ + background: #ff9900; + color: #fff; + text-decoration: none;} +.re_open{ + display: block !important; + width: 46px !important; + height: 22px !important; + border: 1px solid #64bdd9 !important; + color: #64bdd9 !important; + margin-left: 10px !important; +} +a:hover.re_open +{ + background: #64bdd9; + color: #fff !important; + text-decoration: none !important; +} a.re_de{ color:#6883b6; margin-left:15px;} .re_con_box{ border-bottom:1px dashed #dadada; padding:10px 0;} /****翻页***/