From 0c221abd6175ebbb6efb603e840c0ef58ad4ef90 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 09:18:05 +0800 Subject: [PATCH 01/17] =?UTF-8?q?PULL=20REQUEST=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E4=B8=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 +----- app/views/projects/_development_group.html.erb | 14 ++++++++------ app/views/pull_requests/index.html.erb | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1ff7fc2d9..6588d15f3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -830,11 +830,7 @@ module ApplicationHelper return false if project.gpid.nil? g = Gitlab.client count = g.user_static(project.gpid, :rev => "master").count - if User.current.member_of?(project) && count > 0 - true - else - false - end + count end # 判断版本库是否初始为gitlab diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index 82bcb5501..52f4e002a 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -40,12 +40,14 @@ <% end %> - +<% if allow_pull_request(@project) %> + +<% end %> <%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %> <% if visible_repository?(@project) %> diff --git a/app/views/pull_requests/index.html.erb b/app/views/pull_requests/index.html.erb index f4fe0725e..2af67293f 100644 --- a/app/views/pull_requests/index.html.erb +++ b/app/views/pull_requests/index.html.erb @@ -3,7 +3,7 @@
  • <%= link_to "待处理#{@requests_opened_count}".html_safe, project_pull_requests_path(:type => "1"), :remote => true %>
  • <%= link_to "已处理#{@requests_merged_count}".html_safe, project_pull_requests_path(:type => "2"), :remote => true %>
  • <%= link_to "已关闭#{@requests_closed_count}".html_safe, project_pull_requests_path(:type => "3"), :remote => true %>
  • - <% if allow_pull_request(@project) %> + <% if allow_pull_request(@project) && User.current.member_of?(@project) %> <%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %> <% end %>
    From eda735db58bcc4f313cdd3a247095c09da520830 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 14:40:34 +0800 Subject: [PATCH 02/17] =?UTF-8?q?footer=E6=96=87=E5=AD=97=E5=B1=85?= =?UTF-8?q?=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/css/structure.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css index 729bf2f4a..7004c0928 100644 --- a/public/stylesheets/css/structure.css +++ b/public/stylesheets/css/structure.css @@ -455,8 +455,8 @@ a.topnav_login_box:hover {color:#a1ebff;} /*底部*/ #Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/ -.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;} -.footerAbout{ width:365px; margin:0 auto;height:35px; line-height:35px; padding-top: 10px;} +.footerAboutContainer {width:auto; border-bottom:1px solid #efefef; text-align:center;} +.footerAbout{margin:0 auto;height:35px; line-height:35px; padding-top: 10px; display:inline-block;} .languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;} .departments{ width:855px; margin:5px auto;height:40px;line-height:40px;} .departments li {height:40px; line-height:40px;} From 02fbdb57bde037e3d99fa5be26381a811f5a5895 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 14:44:31 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B8=AD=E7=94=A8=E6=88=B7=E6=B6=88=E6=81=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_messages.html.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 578e97b9a..2baa9f2f2 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -21,9 +21,7 @@ <%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %> <%# 课程消息 %> - <% if hidden_unproject_infos %> - <%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %> - <% end %> + <%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %> <%= render :partial => 'users/user_message_forge', :locals => {:ma => ma} %> From 9e9b4d12c9c4b27195bf53614c7d478f7e782369 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:00:34 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E6=96=B0=E6=B3=A8=E5=86=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=B8=8D=E5=8F=91=E9=80=81=E7=95=99=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/user.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index b863c1f70..f2b2b6824 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1162,18 +1162,20 @@ class User < Principal #为新注册用户发送留言 def add_new_jour - if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? - lead_message1 = Message.find(19292) - notes1 = lead_message1.content - lead_message2 = Message.find(19291) - notes2 = lead_message2.content - lead_message3 = Message.find(19504) - notes3 = lead_message3.content - #user_id 默认为课程使者创建 - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) - end + if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0" + if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? + lead_message1 = Message.find(19292) + notes1 = lead_message1.content + lead_message2 = Message.find(19291) + notes2 = lead_message2.content + lead_message3 = Message.find(19504) + notes3 = lead_message3.content + #user_id 默认为课程使者创建 + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) + end + end end # 更新邮箱的同事,更新invite_lists表中的邮箱信息 From 2df6047b03f2a12dc13e95c57502f9bd2343cf1a Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:14:55 +0800 Subject: [PATCH 05/17] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=B9=8B=20=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BD=86=E6=98=AF=E6=9C=AA=E5=AE=8C=E5=96=84?= =?UTF-8?q?=E8=B5=84=E6=96=99=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_footer_show.html.erb | 4 +++- app/views/layouts/_logined_header_show.html.erb | 14 ++++++++------ app/views/layouts/new_base_user_show.html.erb | 8 ++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/views/layouts/_footer_show.html.erb b/app/views/layouts/_footer_show.html.erb index 19028ed8a..99e71762d 100644 --- a/app/views/layouts/_footer_show.html.erb +++ b/app/views/layouts/_footer_show.html.erb @@ -4,7 +4,9 @@
  • <%= l(:label_about_us)%>|
  • 服务协议|
  • -
  • <%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|
  • + <% if hidden_unproject_infos %> +
  • <%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|
  • + <% end %>
  • <%= l(:label_forums)%>
  • diff --git a/app/views/layouts/_logined_header_show.html.erb b/app/views/layouts/_logined_header_show.html.erb index a6721501e..c593c3e8c 100644 --- a/app/views/layouts/_logined_header_show.html.erb +++ b/app/views/layouts/_logined_header_show.html.erb @@ -10,12 +10,14 @@ - - + <% if hidden_unproject_infos %> + + + <% end %>
    - <% hidden_courses = Setting.find_by_name("hidden_courses") %> - <% unvisiable = hidden_courses && hidden_courses.value == "1"%> - <% if !unvisiable %> + <% if hidden_unproject_infos %>
    • 课程 @@ -233,7 +231,9 @@ <%= yield %>
    - <%= render :partial => 'layouts/forbidden_new_feedback' %> + <% if hidden_unproject_infos %> + <%= render :partial => 'layouts/forbidden_new_feedback' %> + <% end %>
    <%= render :partial => 'layouts/footer_show' %> From 718e59c1449583b8c78e1bf77d9246c290b241a8 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 31 Aug 2016 15:31:09 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_selector_for_messages.html.erb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb index 14609f4fc..1e2e40e06 100644 --- a/app/views/users/_selector_for_messages.html.erb +++ b/app/views/users/_selector_for_messages.html.erb @@ -24,6 +24,7 @@ + <% if hidden_unproject_infos %>
    • @@ -35,7 +36,18 @@
    • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
  • - + <% else %> +
  • +
      +
    • 更多
    • +
    • <%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
    • +
    • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
    • +
    • <%= link_to "系统消息", user_system_messages_path(User.current, :type => 'system_messages'), :class => "homepageTypeSystem postTypeGrey" %>
    • +
    • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
    • +
    • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
    • +
    +
  • + <% end %> From 1f6bd68e61f35cdb5e4497901ac81bf0102bdce7 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:37:28 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE=20?= =?UTF-8?q?=20=E7=BB=84=E7=BB=87=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/show.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb index ab3120a5d..690750fd2 100644 --- a/app/views/organizations/show.html.erb +++ b/app/views/organizations/show.html.erb @@ -20,6 +20,7 @@
      • + <% if hidden_unproject_infos %>
        • 课程动态
        • @@ -33,6 +34,7 @@
      • + <% end %>
        • 项目动态
        • From ac85eadc30c5c5a158517b5344f7dab9a5778cbd Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 15:42:17 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E5=88=87=E6=8D=A2=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/user_resource.html.erb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index ee2ea7e4f..6c0e067db 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -8,12 +8,6 @@ function remote_get_resources(user_id,type){ } - $(document).ready(function(){ - $(".resource-switch").click(function(){ - $(".resource-switch").children().removeClass("resource-tab-active"); - $(this).children().addClass("resource-tab-active"); - }); - }); function remote_search(){ $("#resource_search_form").submit(); } @@ -75,5 +69,10 @@
          - + From 9b14b86b642277c4bb4d9f74afb9d95953394187 Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 31 Aug 2016 16:01:23 +0800 Subject: [PATCH 09/17] =?UTF-8?q?=E9=9A=90=E8=97=8F=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=B9=8B=20=E9=9A=90=E8=97=8F=E7=BB=84=E7=BB=87=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_org_left_subfield_list.html.erb | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb index 9d043fbb5..a414a1181 100644 --- a/app/views/organizations/_org_left_subfield_list.html.erb +++ b/app/views/organizations/_org_left_subfield_list.html.erb @@ -61,19 +61,21 @@ <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> <% when 'course' %> -
          -
          - 班级 - <% if User.current.logged? and User.current.admin_of_org?(organization) %> - <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%> - <% end %> -
          -
          -
            - <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> -
          -
          -
          + <% if hidden_unproject_infos %> +
          +
          + 班级 + <% if User.current.logged? and User.current.admin_of_org?(organization) %> + <%=link_to "", join_course_menu_organization_path(organization),:remote => true, :method => "post", :class => "homepageMenuSetting fr", :title => "关联班级"%> + <% end %> +
          +
          +
            + <%= render :partial => 'layouts/org_courses',:locals=>{:courses=>organization.courses.where("is_delete=0").reorder('created_at').uniq.limit(5),:org_id=>organization.id,:page=>1}%> +
          +
          +
          + <% end %> <% when 'project' %>
          From 52a8a64a691a03dfb1fd1de1df43e1e27959d787 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 10:48:13 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=8F=91=E9=80=81?= =?UTF-8?q?=E4=B8=AD=E5=8E=BB=E6=8E=89=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 3 ++ app/views/files/_tool_settings.html.erb | 12 +++++- app/views/users/_send_part.html.erb | 12 ++++++ public/javascripts/application.js | 49 +++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 app/views/users/_send_part.html.erb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a44a3bc01..b385fe610 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2152,6 +2152,7 @@ class UsersController < ApplicationController #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] + @hidden_unproject = hidden_unproject_infos respond_to do |format| format.js end @@ -2171,6 +2172,7 @@ class UsersController < ApplicationController #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids + @hidden_unproject = hidden_unproject_infos respond_to do |format| format.js end @@ -3334,6 +3336,7 @@ class UsersController < ApplicationController #这里仅仅是传递需要发送的资源id @send_id = params[:send_id] @send_ids = params[:checkbox1] || params[:send_ids] + @hidden_unproject = hidden_unproject_infos respond_to do |format| format.js end diff --git a/app/views/files/_tool_settings.html.erb b/app/views/files/_tool_settings.html.erb index a0ce42eac..5d96d8da2 100644 --- a/app/views/files/_tool_settings.html.erb +++ b/app/views/files/_tool_settings.html.erb @@ -4,7 +4,11 @@ <% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %> <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
            -
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
          • + <% if hidden_unproject_infos %> +
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
          • + <% else %> +
          • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
          • + <% end %>
          • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
          • <% if project.is_public? %>
          • @@ -20,7 +24,11 @@ <% end %> <% else %>
              -
            • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
            • + <% if hidden_unproject_infos %> +
            • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
            • + <% else %> +
            • <%= link_to("发  送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
            • + <% end %>
            <% end %> <% end %> diff --git a/app/views/users/_send_part.html.erb b/app/views/users/_send_part.html.erb new file mode 100644 index 000000000..b47386da8 --- /dev/null +++ b/app/views/users/_send_part.html.erb @@ -0,0 +1,12 @@ +<% if @hidden_unproject %> + +<% else %> + +<% end %> \ No newline at end of file diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c2e357e0f..d576ba42f 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1153,6 +1153,31 @@ function show_send(id, user_id, send_type){ } } +//为了隐藏非项目功能 +//var sendType = '1'; +var lastSendType ;//初始为发送到我的项目 +function show_send_hidden(id, user_id, send_type){ + if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + }else if( lastSendType == '2'){//组织 + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org', + data:{send_id:id, send_type:send_type} + }); + }else{ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project', + data:{send_id:id, send_type:send_type} + }); + } +} + //id 发送的id //发送的id数组 //send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻 @@ -1216,6 +1241,30 @@ function chooseSendType2(res_id,res_ids, user_id, send_type, type){ lastSendType = sendType; } +//隐藏项目其它信息特用 +function chooseSendType2hidden(res_id,res_ids, user_id, send_type, type){ + console.log(res_ids); + sendType = $(".resourcesSendType").val(); + if (sendType === lastSendType) { + return; + } else if(lastSendType != null) { //不是第一次点击的时候 + if (sendType == '1') { + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_project' + '?' + "&type=" + type, + data:{send_id:res_id, send_ids:res_ids ,send_type:send_type} + }); + }else if(sendType == '2'){ + $.ajax({ + type: 'get', + url: '/users/' + user_id + '/search_user_org' + '?' + "&type=" + type, + data:{send_id:res_id, send_ids:res_ids, send_type:send_type} + }); + } + } + lastSendType = sendType; +} + //组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项 function disable_down(source, des, hint){ if (source.attr("checked")){ From 3856ed80330705f5e346252d7ba8c147efa0b7a2 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:00:34 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=E8=B5=84=E6=BA=90=E5=8F=91=E9=80=81=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../users/_resource_share_for_orgs.html.erb | 17 ++++++++++++----- .../_resource_share_for_project_popup.html.erb | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb index 36d1c774f..b5aafcb7e 100644 --- a/app/views/users/_resource_share_for_orgs.html.erb +++ b/app/views/users/_resource_share_for_orgs.html.erb @@ -4,11 +4,18 @@ <% unless send_ids.blank? %> <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
          <%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> 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 b521bcb90..41133a91e 100644 --- a/app/views/users/_resource_share_for_project_popup.html.erb +++ b/app/views/users/_resource_share_for_project_popup.html.erb @@ -5,11 +5,18 @@ <% unless send_ids.blank? %> <% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %> <% end %> - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
          From b2aba0f0bc073e33030ec87ac8da360f174b9295 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:12:56 +0800 Subject: [PATCH 12/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E6=96=B0=E9=97=BB=E5=8F=91=E9=80=81=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E8=AF=BE=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_project_news.html.erb | 7 ++++++- app/views/users/_share_news_to_org.html.erb | 17 ++++++++++++----- app/views/users/_share_news_to_project.html.erb | 17 ++++++++++++----- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb index 4c7ec2b04..284f5b821 100644 --- a/app/views/users/_project_news.html.erb +++ b/app/views/users/_project_news.html.erb @@ -35,7 +35,12 @@
        • <% if User.current.logged? %>
            -
          • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
          • + <% if hidden_unproject_infos %> +
          • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
          • + <% else %> +
          • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %>
          • + <% end %> +
          • <%= link_to( l(:button_edit), diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb index 85d5e7104..c40e05199 100644 --- a/app/views/users/_share_news_to_org.html.erb +++ b/app/views/users/_share_news_to_org.html.erb @@ -1,11 +1,18 @@
            发送到
            - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
            <%= form_tag search_user_org_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb index d4c293304..c9c60198f 100644 --- a/app/views/users/_share_news_to_project.html.erb +++ b/app/views/users/_share_news_to_project.html.erb @@ -2,11 +2,18 @@
            发送到
            - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
            From efa162fdebed98bac0af00108640cefba516a60a Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:16:09 +0800 Subject: [PATCH 13/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=E7=BB=84=E7=BB=87=E8=B5=84=E6=BA=90=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/_org_subfield_list.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb index e567435a5..de37ed054 100644 --- a/app/views/files/_org_subfield_list.html.erb +++ b/app/views/files/_org_subfield_list.html.erb @@ -63,7 +63,11 @@
          • <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
              -
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
            • + <% if hidden_unproject_infos %> +
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
            • + <% else %> +
            • <%= link_to("发       送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %>
            • + <% end %>
            • <%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
            • <% if file.container.try(:organization).try(:is_public?) %>
            • From 1444511fd9b78d67a128d43553b296b518950827 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:18:07 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=20=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_project_show.html.erb | 6 +++++- app/views/users/_share_message_to_org.html.erb | 17 ++++++++++++----- .../users/_share_message_to_project.html.erb | 17 ++++++++++++----- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb index ff358f7c3..41c2f7d1f 100644 --- a/app/views/messages/_project_show.html.erb +++ b/app/views/messages/_project_show.html.erb @@ -116,7 +116,11 @@ ) if @message.destroyable_by?(User.current) %>
            • <% end %> -
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
            • + <% if hidden_unproject_infos %> +
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
            • + <% else %> +
            • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
            • + <% end %>
          diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb index 37575a8d5..8c1d81140 100644 --- a/app/views/users/_share_message_to_org.html.erb +++ b/app/views/users/_share_message_to_org.html.erb @@ -1,11 +1,18 @@
          发送到
          - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
          <%= form_tag search_user_org_user_path(user),:method => 'get', :remote=>true,:id=>'search_user_org_form' do %> diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb index 89b36e22a..21abd85de 100644 --- a/app/views/users/_share_message_to_project.html.erb +++ b/app/views/users/_share_message_to_project.html.erb @@ -2,11 +2,18 @@
          发送到
          - + <% if @hidden_unproject %> + + <% else %> + + <% end %>
          From c51f725a78c612c72d342a46fd966156077c46e8 Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 11:24:16 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E9=A1=B9=E7=9B=AE=E5=8A=A8=E6=80=81=E4=B8=AD?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=20=E6=96=B0=E9=97=BB=E5=8F=91?= =?UTF-8?q?=E9=80=81=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/projects/_project_news.html.erb | 7 ++++++- app/views/users/_project_message.html.erb | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb index 161221526..6b3e8e43c 100644 --- a/app/views/projects/_project_news.html.erb +++ b/app/views/projects/_project_news.html.erb @@ -38,7 +38,12 @@
        • <% if User.current.logged? %>
            -
          • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
          • + <% if hidden_unproject_infos %> +
          • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
          • + <% else %> +
          • <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %>
          • + <% end %> +
          • <%= link_to(l(:button_edit), {:controller => 'news', :action => 'edit', :id => activity}, :class => 'postOptionLink') if activity.author == User.current %>
          • diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb index afc45efde..5ee3ff0ba 100644 --- a/app/views/users/_project_message.html.erb +++ b/app/views/users/_project_message.html.erb @@ -68,7 +68,11 @@ ) if activity.destroyable_by?(User.current) %> <% end %> -
          • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
          • + <% if hidden_unproject_infos %> +
          • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
          • + <% else %> +
          • <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
          • + <% end %>
        From 4903064a5ba651aa1003e9927d757831f8f1f76b Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 12:18:39 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E5=8F=91=E9=80=81=E9=9A=90=E8=97=8F=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 27 ++++++++++++++++++++ app/views/users/_user_resource_info.html.erb | 6 ++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 3f5138107..e6e9687f3 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -87,6 +87,33 @@ } + function show_send_hidden(){ + $("#contextMenu").hide(); + document.oncontextmenu = function() {return true;} + line.children().css("background-color",'white'); + id = line.children().last().html(); + user_id = line.children().eq(5).html(); + allow = line.children().eq(13).html(); + if( allow == 0){ + alert('您无权发送私有资源') + }else{ + if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>", + data:{send_type:'file'} + }); + }else{ + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>", + data:{send_type:'file'} + }); + } + } + + } + function batch_send(){ if($("#resources_list_form").serialize() == ""){ alert('暂时不支持多页选择,您当前页没有选择任何资源'); diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index e00489193..89f10e87b 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -45,7 +45,11 @@
      • 预览
      • 重命名
      • -
      • 发送
      • + <% if hidden_unproject_infos %> +
      • 发送
      • + <% else %> +
      • 发送
      • + <% end %>
      • 删除
    From 5527b4e3a9c39c1290b7037de5ed7cfcc4aa83cb Mon Sep 17 00:00:00 2001 From: huang Date: Thu, 1 Sep 2016 12:25:35 +0800 Subject: [PATCH 17/17] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E4=B9=8B=20=E5=85=AC=E5=85=B1=E8=B5=84=E6=BA=90=E5=BA=93?= =?UTF-8?q?=E5=BA=95=E7=AB=AF=E5=8F=91=E9=80=81=E9=9A=90=E8=97=8F=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_resources_list.html.erb | 29 ++++++++++++++++++++ app/views/users/_user_resource_info.html.erb | 12 ++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index e6e9687f3..77a2386fe 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -148,6 +148,35 @@ } } +// 隐藏非项目信息特用 + function batch_send_hidden(){ + if($("#resources_list_form").serialize() == ""){ + alert('暂时不支持多页选择,您当前页没有选择任何资源'); + return ; + } + if (lastSendType === '1'){ + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + }else if (lastSendType === '2'){ + $.ajax({ + type: 'get', + url: '<%= search_user_org_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + } + else{ + $.ajax({ + type: 'get', + url: '<%= search_user_project_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>", + data:{send_type:'file'} + }); + + } + } + function preview(){ $("#contextMenu").hide(); document.oncontextmenu = function() {return true;} diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index 89f10e87b..d3b169a17 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -23,9 +23,15 @@ 删除
    -
    - 发送至 -
    + <% if hidden_unproject_infos %> +
    + 发送至 +
    + <% else %> +
    + 发送至 +
    + <% end %>
    选择 0 个资源