From 3b08adfc6852f39ef402db2efe3ee0dfebd7019c Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Sun, 27 Dec 2015 23:24:21 +0800
Subject: [PATCH 01/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 6 ++
app/views/files/_course_file.html.erb | 80 +++++++++-----
app/views/files/_course_list.html.erb | 147 ++++++++++++++------------
public/images/hwork_icon.png | Bin 0 -> 7386 bytes
public/stylesheets/courses.css | 3 +
public/stylesheets/public.css | 10 +-
6 files changed, 152 insertions(+), 94 deletions(-)
create mode 100644 public/images/hwork_icon.png
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c4bbc4ebb..db7b85fdb 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2586,6 +2586,12 @@ module ApplicationHelper
end
end
+ def file_preview_eye(file, html_options={})
+ if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)}
+ link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options
+ end
+ end
+
#将文本内的/n转换为
def text_format text
text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","
").html_safe
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index a0cb419b2..b3371eefe 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -1,4 +1,9 @@
+
-
- 上传: - 课件 | - 软件 | - 媒体 | - 代码 | - 论文 | - 其他 -
+共有 <%= @all_attachments.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"} %> / + <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> / + <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 + <% else %> + 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> / + <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> / + <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序 + <% end %> +
+共有 <%= all_attachments.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"} %> / - <%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> / - <%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 - <% else %> - 按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> / - <%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> / - <%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序 - <% end %> -
-文件大小:<%= number_to_human_size(file.filesize) %>
+下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+文件大小:<%= 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 || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course"%> -<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-xO^_R5>pZc6&!xF1z>KbXDR4v;mTe~FTCD!vi37hb;V%B>p7eHV$ z6PmOx8~mK*{#v0~Bu`5YDoJq4Ae|2xVNkk$F99Yf0-?(&_ZtN9%1E)+uOV#C=;}6vn{cRqO6rW!9`USg?Oul{5V!_IWME zwi{OLSKSNQpjLVeOSgeiG-jnXtIA63;l$9Hp@f4|VuP<(MQq1>`^}ji!TnY#g25sk ztiw*1Eg6#pI;Sn?1n|chR?Xy WT9ZYYpwB^5C@I~0Ld=kj>E@o|hpvl*AFfWLXnB|Zd5`~XjFnCh{2 zZ0UEg6>jE }&Ka%vc`=5(o6_Vg_^g__Oz8VjcvyGbk?zr3Vnz%fIMpIj-*`=EL4RI! z(hJ__J`#? Idx-aiwQe;*K%6%t~Z z7iw kTIIryY45@_Uy!H84uwOPhG^^5<@Ik+ znM^!@G7FI2y7=L1ovV _h F?+XJEr?<5{ zDX0WXOH*>*2tzP2oHtOlv#FV>n3?IL@|bs()EFlIOv_vgE+Qc=9QS~r!V&l|BWpT_ z^is&WdjU#2HqdBmA_p%5-d-*ePF;g=CBO17$bvuexxeJYm;607wXq*v9@rWFp*y%O zfe6#1jr;Yih&Y3sJkq0DYY;MgaA)(4~@KlGu*1) z+?*CRD0+ATK_{uT$AwaQYkne(8W{LSML znUa!YIwles>p! zKCLhkZT3vYN19LlN?|GL%%FFODE7ev$4m9 Dr zE`2O~-6oF%?k5b4RdH(~e+ZY 2O_Ub(c zYShU!!VTBsyh7euih&ojElE4yJsQ^{9`!Dww_v1|vb+h_Y%rST3-eGYl6|T0jn{uQ zoeq2nnD(oWGiHPcGWO9b$pdGWoL{)%Y9s-m)o-`sA+zj+1s_1&FNitKnA*{=yLGvy z#!*g#!iHcbkLFG{-YLsKF3eMS;=M#%#8 qqrap5(Y%$q84m8M9yUiM`=o9~ z?~7^WtkW-|l1h;oi-T2H <6QXqXu#U9Jt03cN%=J?U4ffVB~xTVOI zrf%a{K3p=C-Hb~UnL8iHRq}TCshzrN2E18AomvA`1E0b9$?&=$EPmU$$aw(8mKyg; zq#gZ8c$)$@xv8XbmN#=1J9kw3N~!C0^+whUhkO0AP^6zv68x^|(U{raJN!T6%zr%q u`7epUpRj)lM}O1*(<$$f!MCfMv{)Q>Ue8I-Of>!a+o-9kt5Tt47y2KIa7rNn literal 0 HcmV?d00001 diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 463fc710a..baf5fefcb 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -1231,6 +1231,9 @@ div.disable_link {background-color: #c1c1c1 !important;} /*新课程资源库*/ .reCon{ margin:5px; width:710px;} .reTop{width:710px; height:40px; background:#eaeaea; padding:5px;} +.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666;} +.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;} +.blueBtn:hover {background-color:#298fbd;} /*问题状态图片*/ .issues{ background:url(../images/public_icon.png) -66px 5px no-repeat; width:18px; height:21px;} diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index d9f370c7d..394a0cb12 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -916,4 +916,12 @@ a.resourcesTypeUser {background:url(images/homepage_icon.png) -178px -453px no-r .list_style ul li{list-style-type: disc;margin-left: 20px;} /* @功能 定义 */ -span.at {color:#269ac9;} \ No newline at end of file +span.at {color:#269ac9;} + +/*20151217资源库Tim*/ +.preview {background:url(../images/hwork_icon.png) -75px -120px no-repeat; width:20px; height:20px; display:inline-block;} +.mediaIcon {background:url(../images/hwork_icon.png) -5px -160px no-repeat; padding-left:23px;} +.codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;} +.othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;} +.thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;} +.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} \ No newline at end of file From e35d2daa0a745dd7a5456ab45c14edb6d23e04f2 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Mon, 28 Dec 2015 16:19:30 +0800 Subject: [PATCH 02/57] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 11 +- .../attachments/update_file_dense.js.erb | 9 +- app/views/files/_course_file.html.erb | 57 +++++----- app/views/files/_course_list.html.erb | 102 +++++++++--------- app/views/files/_tag_yun.html.erb | 4 +- app/views/files/index.html.erb | 16 ++- app/views/files/index.js.erb | 4 + app/views/files/search.js.erb | 7 +- app/views/files/search_tag_attachment.js.erb | 3 +- public/stylesheets/courses.css | 14 ++- 10 files changed, 137 insertions(+), 90 deletions(-) create mode 100644 app/views/files/index.js.erb diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 121cd3a42..5cbf1ab2f 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -745,7 +745,16 @@ class FilesController < ApplicationController q = "%#{@q.strip}%" @result = find_course_attache q,@course,sort @result = visable_attachemnts @result - @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + if params[:other] + @result = @result.select{|attachment| + !attachment.tag_list.include?('课件') && + !attachment.tag_list.include?('软件') && + !attachment.tag_list.include?('媒体') && + !attachment.tag_list.include?('代码') && + !attachment.tag_list.include?('论文') } + else + @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank? + end @searched_attach = paginateHelper @result,10 @tag_list = get_course_tag_list @course diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb index d99481d08..110d3fc7c 100644 --- a/app/views/attachments/update_file_dense.js.erb +++ b/app/views/attachments/update_file_dense.js.erb @@ -1,2 +1,7 @@ -$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), - :remote=>true,:class=>"f_l re_open",:method => :post) %>"); +$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), + :remote=>true,:class=>"postOptionLink",:method => :post) %>"); +<%if @attachment.is_public? %> + $("#image_private_<%= @attachment.id%>").html('') +<%else%> +$("#image_private_<%= @attachment.id%>").html('私有') +<%end%> \ No newline at end of file diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index b3371eefe..9513baab0 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -2,7 +2,7 @@ diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index 3d1ded552..f9c6c1666 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -8,12 +8,12 @@ <% tag_list.each do |k,v|%> <% if tag_name && tag_name == k%> - <%= k%>(<%= v%>) + <%= k%> x<%= v%> <% else%> <%= k%>(<%= v%>) + ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 8b199ab4e..98c1cb684 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -1,12 +1,18 @@ - + <% if @container_type == 0 %> - <%= render :partial => 'project_file_new', locals: {project: @project} %> ++ + <% end %> + ++ <%= render :partial => 'project_file_new', locals: {project: @project} %> +<% elsif @container_type == 1 %> - <%= render :partial => 'course_file', locals: {course: @course} %> ++ <%= render :partial => 'course_file', locals: {course: @course} %> +<% elsif @container_type == 2 %> - <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> ++ <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %> +<% end %> -