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/38] =?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 @@ + -
-
-
- <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search f_l",:remote=>true) do %> - <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> - <%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %> - <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %> - <% end %> - <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> - -

- 上传: - 课件 |  - 软件 |  - 媒体 |  - 代码 |  - 论文 |  - 其他 -

+
+
+
资源库
+ +
+
+
+ <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %> + <%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%> + <%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %> + <%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %> + <% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %> + + <% end %> <% end %> -
-
-
- <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> -
+ + +
+
+

共有 <%= @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 %> +

+
+
+
+ <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%> +
+
+ + <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> +
<% html_title(l(:label_attachment_plural)) -%> \ No newline at end of file diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index f04d70577..2426d49f9 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,79 +1,88 @@ +
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %> -
-

共有 <%= 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 %> -

-
-
- -
- <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%> -
-
- -
<% curse_attachments.each do |file| %> <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %> -
-
- <%= link_to truncate(file.filename,length: 35, omission: '...'), - download_named_attachment_path(file.id, file.filename), - :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %> - <% if User.current.logged? %> - <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> +
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %> +
+
+
+ + <%= file.author.realname.blank? ? file.author.login : file.author.realname %> + + <% if file.container_type == 'Course' && file.container_id==course.id%> + TO <%= course.name%> | 资源库
+ <%else%> + 上传了资源 + <%end %> +
+ <%= link_to truncate(file.filename,length: 35, omission: '...'), + download_named_attachment_path(file.id, file.filename), + :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %> + <%= file_preview_eye(file, class: 'preview') %> + <% if file.is_public? == false%> + 私有 + <%end %> +
+
+ 上传时间:<%= format_date(file.created_on)%> + 上传类型:<%= %> +

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

+

下载<%= file.downloads%>  |  引用<%= file.quotes.nil? ? 0:file.quotes %>

+
+
+
+ + <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> + <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> +
+
+
    +
  • +
      +
    • 发送
    • + <% if User.current.logged? %> + <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %> - <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> - <% if @course.is_public? %> - - <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> - - <% else %> - - 私有 - - <% end %> + <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> + <% if @course.is_public? %> +
    • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
    • + <%else%> +
    • + + <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> + +
    • + <%end%> +
    • 删除资源
    • + <% end %> + <% end %> + <% end %> - <% else %> - - <% end %> - <% else %> - <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> - <% end %> - <%= file_preview_tag(file, class: 'f_l re_open') %> - <% else %> - <% end %> -
-
-
-

文件大小:<%= 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 %>

-
-
-
- - <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> - <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %> -
-
-
+ + + +
+
+
+
+
+
+
<% else %>
<%= file.filename %>是私有资源
<% end %> <% end %> + +
- -
+ + + + diff --git a/public/images/hwork_icon.png b/public/images/hwork_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0b8b488de2e9bb7f96bc6e9b73f20205485cb8e6 GIT binary patch literal 7386 zcmbVR1z1#Fw+2KSNu^;(mF^t6k&HtBz4!m_bMHORdG^`oJny^K+Iz3P_Fnru(brWcC88(7!onie)KD?FetKYGVFL;9 zu4{}ZYtz>cI+Usz%Fq>t@&S23u@oV$_E3N(0^|TSfPx@??gLOD7S;_mxRDvkOh;Q9 z?26zA{lf73BHXUoSXe-LUpElg8HxhfLml8qS+?D#HZ}kpBFknfrX#51rVMq2YxsLW z4gGbE!2Zr)DF~aq902GmeJub1MS%dm2p6QMw684NZ*rxt>%Tq=umOI9pqypdemBZY zM<1Z<>H!6a@r&?*1%-qF;^O>5qGICWLc9QBK_OuQ!RuR`Pe@c+Ok7%60`SMhcCF0= z0+TjSQTs#J^_wi4BMRjvEg<0Ig3r?ri30iZAwAju zl%N9j1be{UP;gfy;Fm;@y{i{WmhIZo-PX{R!03 z`JbT(#9wGnlmYZ_d;hIqPa{7!sDJ^~)78rZd_8b5_Ft;pq?J9OAe5_zk*llApS`H> z=!$anbaZtCC>x3c?wP`o5LX}1`@i9Jbfh(ro+uC!4AoSTWxJNZ4~Ijfm4p?=)r5rv z6~)9wg@jbaBqfxkq(nufB!xw!loTb@{^Y8-g1rz>BbTDvkKG$ z?hS>gdAK3~zcpDJ{*Sf@s{W(AKe&*8v_(+uAGre8#t8fx*nb)5KR;c2&#&rVZhQUm zm*Yc`*WT`N?be~6QfIGcl&+?VqLJ_HRyJXVwQ6dgp7FvlUrS+A3hH~3EGs#biU4qr z-pv%&or$dig;~knhSGY`rjIG&LDlZyGhU*sgt@t+RrJZNlHLwzP$pw3ChzDvd_DSp zhVUsXl{!B2`l8Tya~rADc8K}3=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FODE7ev$4m9Dr zE`2O~-6oF%?k5b4RdH(~e+ZY2O_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#%#8qqrap5(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/38] =?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} %> +
+ <%= 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 %> -
+ + <% end %> +
+
+<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> +
+
    + <% unless @orgs.empty? %> + <% @orgs.each do |org|%> +
  • + +
  • + <%end%> + <%end%> +
+
+
+
    + + + <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%> + + + + + +
+
+
+
目标地址:
+
+ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> +
+
+ 取消 +
+
+ <%end %> \ No newline at end of file diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb index ba136899c..bdf4ef439 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -2,11 +2,12 @@
-
将资源发送至
+
将资源发送到
@@ -47,7 +48,7 @@ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
- +
<% end %> diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb index 53fb6673b..b1f6270b0 100644 --- a/app/views/users/_resource_share_popup.html.erb +++ b/app/views/users/_resource_share_popup.html.erb @@ -7,6 +7,7 @@
@@ -47,7 +48,7 @@ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %> -
取消
+
取消
<% end %> diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb index 95f7784f7..57fe9d42d 100644 --- a/app/views/users/add_exist_file_to_course.js.erb +++ b/app/views/users/add_exist_file_to_course.js.erb @@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_ $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); -closePopUp(); +hideModal(); alert("发送成功") <% else%> <% end %> \ No newline at end of file diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb index 95f7784f7..57fe9d42d 100644 --- a/app/views/users/add_exist_file_to_project.js.erb +++ b/app/views/users/add_exist_file_to_project.js.erb @@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_ $("#res_count").html(0); $("#checkboxAll").attr('checked',false); $("#res_all_count").html(<%= @atta_count%>); -closePopUp(); +hideModal(); alert("发送成功") <% else%> <% end %> \ No newline at end of file diff --git a/app/views/users/change_org_subfield.js.erb b/app/views/users/change_org_subfield.js.erb new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb index 2a0c98cad..f32ed521a 100644 --- a/app/views/users/search_user_course.js.erb +++ b/app/views/users/search_user_course.js.erb @@ -9,10 +9,10 @@ //$("#upload_box").css('left','').css('top',''); //$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); //$("#upload_box").css('display','block'); -$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup"); $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb new file mode 100644 index 000000000..94ac37968 --- /dev/null +++ b/app/views/users/search_user_org.js.erb @@ -0,0 +1,9 @@ +$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); +showModal('ajax-modal', '452px'); +$('#ajax-modal').siblings().remove(); +$('#ajax-modal').before(""); +$('#ajax-modal').parent().css("top","").css("left",""); +$('#ajax-modal').parent().addClass("popbox").addClass("shareDP"); +$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); +var val = $("#search_org_input").val(); +$("#search_org_input").val("").focus().val(val); \ No newline at end of file diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb index f38d9edc8..b99d36348 100644 --- a/app/views/users/search_user_project.js.erb +++ b/app/views/users/search_user_project.js.erb @@ -8,7 +8,7 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); showModal('ajax-modal', '452px'); $('#ajax-modal').siblings().remove(); -$('#ajax-modal').before(""); +$('#ajax-modal').before(""); $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox") $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 418809917..09f8a998d 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -467,11 +467,17 @@ type: 'get', url: '<%= search_user_course_user_path(@user)%>' + '?send_id=' + id }); - } else { + } else if(sendType === '2') { $.ajax({ type: 'get', url: '<%= search_user_project_user_path(@user)%>' + '?send_id=' + id }); + }else if(sendType ==='3') + { + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(@user)%>' + '?send_id=' + res_id + }); } }else{//如果是多个发送 if (sendType === '1'){ @@ -479,11 +485,16 @@ type: 'get', url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() }); - }else{ + }else if(sendType === '2'){ $.ajax({ type: 'get', url: '<%= search_user_project_user_path(@user)%>' + '?' + $("#resources_list_form").serialize() }); + }else if(sendType === '3'){ + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current)%>' + '?'+$("#resources_list_form").serialize() + }); } } } @@ -521,5 +532,12 @@ }); } + function subfield_click(){ + var sendText = $("input[name='org_id']:checked").next().text(); + var orgDirection = "目标地址:" + var sendColumn = $("input[name='subfield']:checked").next().text(); + $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); + } + diff --git a/config/routes.rb b/config/routes.rb index 4121639c0..b9622c047 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -47,6 +47,7 @@ RedmineApp::Application.routes.draw do post 'join_project_menu' post 'join_projects' post 'logout' + get 'org_resources_subfield' end collection do get 'check_uniq' @@ -500,6 +501,7 @@ RedmineApp::Application.routes.draw do get "search_user_course" post "add_exist_file_to_course" post "add_exist_file_to_project" + post 'add_exist_file_to_org' get 'resource_preview' get 'rename_resource' get 'search_user_project' @@ -510,6 +512,8 @@ RedmineApp::Application.routes.draw do get 'store_selected_resource' get 'user_organizations' get 'search_user_orgs' + get 'search_user_org' #for send resource + # end end #resources :blogs diff --git a/db/migrate/20151229045505_create_attachment_histories.rb b/db/migrate/20151229045505_create_attachment_histories.rb new file mode 100644 index 000000000..21b599a96 --- /dev/null +++ b/db/migrate/20151229045505_create_attachment_histories.rb @@ -0,0 +1,24 @@ +class CreateAttachmentHistories < ActiveRecord::Migration + def change + create_table :attachment_histories do |t| + t.integer :container_id + t.string :container_type + t.string :filename , :default => "" + t.string :disk_filename, :default => "" + t.integer :filesize, :default => 0 + t.string :content_type, :default => "" + t.string :digest , :default => "",:limit=>40 + t.integer :downloads, :default => 0 + t.integer :author_id + t.datetime :created_on + t.string :description + t.string :disk_directory + t.integer :attachtype + t.integer :is_public + t.integer :copy_from + t.integer :quotes + t.integer :version + t.integer :version_id + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e946c493..8e9bff4e2 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 => 20151218110033) do +ActiveRecord::Schema.define(:version => 20151229045505) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -80,6 +80,27 @@ ActiveRecord::Schema.define(:version => 20151218110033) do add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id" + create_table "attachment_histories", :force => true do |t| + t.integer "container_id" + t.string "container_type" + t.string "filename", :default => "" + t.string "disk_filename", :default => "" + t.integer "filesize", :default => 0 + t.string "content_type", :default => "" + t.string "digest", :limit => 40, :default => "" + t.integer "downloads", :default => 0 + t.integer "author_id" + t.datetime "created_on" + t.string "description" + t.string "disk_directory" + t.integer "attachtype" + t.integer "is_public" + t.integer "copy_from" + t.integer "quotes" + t.integer "version" + t.integer "version_id" + end + create_table "attachments", :force => true do |t| t.integer "container_id" t.string "container_type", :limit => 30 @@ -97,6 +118,7 @@ ActiveRecord::Schema.define(:version => 20151218110033) do t.integer "is_public", :default => 1 t.integer "copy_from" t.integer "quotes" + t.integer "version", :default => 0 end add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id" @@ -558,26 +580,23 @@ ActiveRecord::Schema.define(:version => 20151218110033) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "editor_of_documents", :force => true do |t| @@ -926,6 +945,16 @@ ActiveRecord::Schema.define(:version => 20151218110033) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 3d9fba942..8932f98a3 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -978,6 +978,15 @@ $(document).ready(function () { } }); +//点击发送资源弹出框中的组织,要更改选择栏目中的内容 +//@dom 选中的radio,值为org_id +function change_org_subfield(url){ + $.ajax({ + type:'get', + url:url + }) +} + //点击图片即显示大图 function showNormalImage(id) { var description_images=$('div#'+id).find("img"); @@ -1001,4 +1010,4 @@ $(function(){ var userId = $(this).attr('data-user-id'); $(window.location).attr('href', '/users/'+userId); }); -}); \ No newline at end of file +}); diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 9b6f4f9fe..9df67452f 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -1392,3 +1392,19 @@ span.at {color:#269ac9;} .function{ background:url(../images/public_icon.png) -66px -70px no-repeat; width:18px; height:21px;} .weekly{ background:url(../images/public_icon.png) -66px -95px no-repeat; width:18px; height:21px;} +/*资源发送到org*/ +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;} +.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;} +.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;} +.columnWrap li {padding-left:10px; color:#585858; line-height:20px;} +.columnWrap li:hover {background-color:#cccccc;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {} +.sectionContent li {padding-left:10px; line-height:20px;} +.sectionContent li:hover {background-color:#cccccc;} +.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} +.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} +.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} + diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 394a0cb12..c0336ddcd 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -408,23 +408,35 @@ a:hover.search_btn{ background: #0fa9bb;} /*发送资源弹窗*/ /*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ -.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} -.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:100px; display:inline-block; font-weight:bold;} +/*发送资源弹窗*/ +/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ +/*.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}*/ +.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} +.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;} .resourcesSendTo {float:left; height:20px; margin-top:15px;} +.boxContainer {height:33px; line-height:33px; position:relative} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} .resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;} .resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} -.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} +.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;} +.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;} +.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} -.sendCourseName {font-size:12px; color:#5f6060;} -.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;} +.sendCourseName {font-size:12px; color:#5f6060;display:inline-block} +.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#269ac9; margin-right:25px; float:left;cursor: pointer;} .courseSendSubmit:hover {background-color:#297fb8;} .courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} -.courseSendCancel:hover {background-color:#717171;} -.courseReferContainer {float:left; max-height:120px; overflow:scroll; overflow-x:hidden; margin-right:16px; margin-bottom:10px;} -a.sendSourceText {font-size:14px; color:#ffffff; display:block;} +.courseSendCancel:hover {background-color: #717171;} +a.sendSourceText {font-size:14px; color:#ffffff;} +input.sendSourceText {font-size:14px;color:#ffffff;background-color:#269ac9;cursor: pointer; outline: none; border: none; width: 50px; height: 25px;} +input.sendSourceText:hover {background-color:#297fb8;} +/*input.sendSourceText:hover {font-size:14px; color:#ffffff;}*/ +.resourcesSendTo {float:left; height:20px; margin-top:15px;} +.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} +.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;} +.popbox{/* width:300px; *//* height:100px; */position:fixed !important;/* z-index:100; */left:50%;top:50%;margin:-100px 0 0 -150px; /* background:#fff; */ -moz-border-radius:5px; /* -webkit-border-radius:5px; */ /* border-radius:5px; */ /* box-shadow:0px 0px 8px #194a81; */ /* overflow:auto; */} /*上传资源弹窗*/ .resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} @@ -924,4 +936,19 @@ span.at {color:#269ac9;} .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 +.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;} + +.shareDP {width:415px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:relative; z-index:1000;} +.shareArrow {background:url(../images/arrowList.png) -90px -108px no-repeat; display:inline-block; width:5px; height:10px; margin-right:3px;} +.sectionWrap {float:left; max-height:150px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:205px; min-height:150px; padding-top:5px; border:1px solid #dddddd;} +.columnWrap {float:left; max-height:155px; margin-bottom:10px; overflow:auto; overflow-x:hidden; width:178px; min-height:155px; border:1px solid #dddddd;} +.columnWrap li {padding-left:10px; color:#585858; line-height:20px;} +.columnWrap li:hover {background-color:#cccccc;} +.columnWrap span {width:150px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; display:inline-block; height:20px; vertical-align:top;} +.sectionRow:hover {background-color:#cccccc; cursor:pointer;} +.sectionContent {} +.sectionContent li {padding-left:10px; line-height:20px;} +.sectionContent li:hover {background-color:#cccccc;} +.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} +.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} +.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} \ No newline at end of file diff --git a/spec/factories/attachment_histories.rb b/spec/factories/attachment_histories.rb new file mode 100644 index 000000000..3348cbd33 --- /dev/null +++ b/spec/factories/attachment_histories.rb @@ -0,0 +1,6 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :attachment_history do + end +end diff --git a/spec/models/attachment_history_spec.rb b/spec/models/attachment_history_spec.rb new file mode 100644 index 000000000..58e38025d --- /dev/null +++ b/spec/models/attachment_history_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe AttachmentHistory, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end From c425106d0b071eb329a5c2045026a01cec54897c Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 29 Dec 2015 17:26:45 +0800 Subject: [PATCH 05/38] =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resource_share_for_orgs.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index f35b2faec..222c8a6de 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -45,7 +45,7 @@
-
目标地址:
+
目标地址:
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
From 1103e7eab49ae1db16f64372944a62c660bca6c7 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 29 Dec 2015 17:38:59 +0800 Subject: [PATCH 06/38] find org where type is Resource --- app/controllers/users_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4d8eaf2cb..af7a1ba9a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2027,11 +2027,11 @@ class UsersController < ApplicationController def search_user_org @user = User.current - if !params[:search].nil? + if !params[:search].nil? #发送到有栏目类型为资源的组织中 search = "%#{params[:search].to_s.strip.downcase}%" - @orgs = @user.organizations.where("name like ?", search) + @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} else - @orgs = @user.organizations + @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} end @search = params[:search] #这里仅仅是传递需要发送的资源id From 659f322ca28921e7b026750f693422e980681833 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 29 Dec 2015 17:58:36 +0800 Subject: [PATCH 07/38] send resource to org --- app/controllers/users_controller.rb | 16 +++++++--------- .../users/_resource_share_for_orgs.html.erb | 2 ++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index af7a1ba9a..0c1477865 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1617,12 +1617,12 @@ class UsersController < ApplicationController @flag = true if params[:send_id].present? send_id = params[:send_id] - subfield_id = params[:subfield_id] + subfield_id = params[:subfield] if subfield_id.nil? @flag = false end ori = Attachment.find_by_id(send_id) - unless org_id.nil? + unless subfield_id.nil? attach_copied_obj = ori.copy attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 attach_copied_obj.container = OrgSubfield.find(subfield_id) @@ -1635,33 +1635,31 @@ class UsersController < ApplicationController end elsif params[:send_ids].present? send_ids = params[:send_ids].split(" ") - project_ids = params[:projects_ids] - if project_ids.nil? + subfield_id = params[:subfield] + if subfield_id.nil? @flag = false end send_ids.each do |send_id| ori = Attachment.find_by_id(send_id) - unless project_ids.nil? - project_ids.each do |project_id| + unless subfield_id.nil? next if ori.blank? attach_copied_obj = ori.copy attach_copied_obj.tag_list.add(ori.tag_list) # tag关联 - attach_copied_obj.container = Project.find(project_id) + attach_copied_obj.container = OrgSubfield.find(subfield_id) attach_copied_obj.created_on = Time.now attach_copied_obj.author_id = User.current.id if attach_copied_obj.attachtype == nil attach_copied_obj.attachtype = 1 end attach_copied_obj.save - end end end else @flag=true end user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 - @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ + @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc") @type = params[:type] @limit = 25 diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 222c8a6de..e7ddbd6f5 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -19,6 +19,8 @@
<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %> + <%= hidden_field_tag(:send_id, send_id) %> + <%= hidden_field_tag(:send_ids, send_ids) %>