From 5340ad7fc1cdde95b0dd0e9417f5c46628e1a56d Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 12 Mar 2015 10:20:28 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=A7=81=E6=9C=89?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/welcome_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 290af0068..949ddd643 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -28,7 +28,8 @@ class WelcomeController < ApplicationController # 企业版定制: params[:project]为传过来的参数 unless params[:organization].nil? @organization = Organization.find params[:organization] - @organization_projects = Project.visible.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all + # @organization_projects = Project.joins(:project_status).joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").where("projects.organization_id = ?", @organization.id).order("score DESC").limit(10).all + @organization_projects = @organization.projects.visible.joins("LEFT JOIN project_scores ON projects.id = project_scores.project_id").order("project_scores.score DESC").limit(10).all @part_projects = @organization_projects.count < 9 ? find_miracle_project( 9 - @organization_projects.count, 3,"score desc") : [] # @cur_projects = Project.find(params[:organization]) # @organization = @cur_projects.enterprise_name From 717be2b0457e5e90cf8ffa5960c83b03e61f4aa7 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 12 Mar 2015 10:29:19 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E7=94=A8=E6=88=B7=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/base_users.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index a7ed0aa25..d68e6abe5 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -217,7 +217,7 @@ <% end %> - <% unless @user.user_extensions.location.empty?%> + <% unless @user.user_extensions.nil?&&@user.user_extensions.location.empty?%> From 1e23007e5d43f266c60e3ce1abe89d51e4e2ac93 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 12 Mar 2015 13:58:50 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E4=B8=A2=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/locales/projects/zh.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 9411fb7d7..952f6743b 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -66,7 +66,8 @@ zh: project_module_code_review: 代码审查 project_module_calendar: 日历 project_module_gantt: 甘特图 - project_module_documents: 文档 + project_module_documents: 文档 + project_module_files: 资源库 label_project_tool_response: 用户反馈 label_module_share: DTS测试工具 From 2ee04d55f22131fb99501754e842c843f15c34b9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 12 Mar 2015 15:46:24 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E7=94=A8=E6=88=B7=E7=9A=84=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 1 + app/helpers/application_helper.rb | 9 ++++ app/helpers/members_helper.rb | 27 ++++++++++-- app/views/members/autocomplete.js.erb | 18 +++++--- app/views/projects/invite_members.html.erb | 51 +++++++++++++--------- public/stylesheets/application.css | 12 ++++- 6 files changed, 85 insertions(+), 33 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index ce899eff5..a8760a6ef 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -310,6 +310,7 @@ class MembersController < ApplicationController end def autocomplete + @flag = params[:flag] || false respond_to do |format| format.js end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a36f4b183..9629ed437 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -490,6 +490,15 @@ module ApplicationHelper s.html_safe end + #项目成员列表复选框生成 + def project_member_check_box_tags_ex name, principals + s = '' + principals.each do |principal| + s << "
  • #{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)}
  • \n" + end + s.html_safe + end + #扩展的checkbox生成 def principals_check_box_tags_ex(name, principals) s = '' diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 6c11199fb..ed18b7ae4 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -23,15 +23,22 @@ module MembersHelper principal_count = scope.count principal_pages = Redmine::Pagination::Paginator.new principal_count, 10, params['page'] #by young principals = scope.offset(principal_pages.offset).limit(principal_pages.per_page).all - s = content_tag('div', principals_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals') - links = pagination_links_full(principal_pages, principal_count, :per_page_links => false) {|text, parameters, options| link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true } - s + content_tag('div', content_tag('ul', links), :class => 'pagination_new') + end + #获取项目可邀请的成员列表 + def render_project_members project + scope = Principal.active.sorted.not_member_of(project).like(params[:q]) + principals = paginateHelper scope,10 + s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :style => "margin-left: -40px;") + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| + link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q],:flag => true, :format => 'js')), :remote => true + } + s + content_tag('ul', links,:class => 'wlist') end # add by nwb @@ -71,4 +78,18 @@ module MembersHelper s + content_tag('div', content_tag('ul', links), :class => 'applied_new') end + private + def paginateHelper obj, pre_size=20 + @obj_count = obj.count + @obj_pages = Redmine::Pagination::Paginator.new @obj_count, pre_size, params['page'] + if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation + obj.limit(@obj_pages.per_page).offset(@obj_pages.offset) + elsif obj.kind_of? Array + obj[@obj_pages.offset, @obj_pages.per_page] + else + logger.error "[ApplicationController] Error : application_controller#paginateHelper ===> unknow category: #{obj.class}" + raise RuntimeError, 'unknow type, Please input you type into this helper.' + end + end + end diff --git a/app/views/members/autocomplete.js.erb b/app/views/members/autocomplete.js.erb index 16809de48..f7f9de151 100644 --- a/app/views/members/autocomplete.js.erb +++ b/app/views/members/autocomplete.js.erb @@ -1,12 +1,16 @@ <% if @project%> -$('#principals_for_new_member').html('<%= escape_javascript(render_principals_for_new_members(@project)) %>'); + <% if @flag == "true"%> + $('#principals_for_new_member').html('<%= escape_javascript(render_project_members(@project)) %>'); + <% else%> + $('#principals_for_new_member').html('<%= escape_javascript(render_principals_for_new_members(@project)) %>'); + <% end%> <% elsif @course%> - var checked = $("#principals input:checked").size(); - if(checked > 0) - { - alert('翻页或搜索后将丢失当前选择的用户数据!'); - } - $('#principals_for_new_member').html('<%= escape_javascript(render_principals_for_new_course_members(@course)) %>'); + var checked = $("#principals input:checked").size(); + if(checked > 0) + { + alert('翻页或搜索后将丢失当前选择的用户数据!'); + } + $('#principals_for_new_member').html('<%= escape_javascript(render_principals_for_new_course_members(@course)) %>'); <%end%> var collection=$("#principals_for_new_member").children("#principals").children("label"); collection.css("text-overflow","ellipsis"); diff --git a/app/views/projects/invite_members.html.erb b/app/views/projects/invite_members.html.erb index d31a5bbe8..e2456f2b1 100644 --- a/app/views/projects/invite_members.html.erb +++ b/app/views/projects/invite_members.html.erb @@ -14,36 +14,45 @@
    -
    +
    + +

    邀请Trustie注册用户

    <% if roles.any? %> <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> +
    diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index e10004db6..b934d2dda 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -8,6 +8,13 @@ h3, .wiki h2 {font-size: 15px; padding-left: 5px} h4, .wiki h3 {font-size: 13px;} h4 {border-bottom: 1px dotted #bbb;} +/****翻页***/ +ul.wlist{ margin-left: -40px; border-bottom:none; } +ul.wlist li{float: left;} +ul.wlist li a{ border:1px solid #15bccf; padding:4px; margin-left:3px;} +ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;} +.wlist_select { background-color:#64bdd9; color:#fff; padding: 3px; margin-left:3px;margin-top: -4px; border:1px solid #64bdd9;} + /*20150203项目界面优化样式 By: huangjignquan*/ .project_new{font-size: 15px; padding: 5px;} .project_new .description{font-size: 12px; color: #ff7450; margin-bottom: 2px;} @@ -101,13 +108,14 @@ a:hover.more{ color:#64bdd9;} .icon_addm:hover{background:url(../images/img_floatbox.png) 0 -61px no-repeat; } .icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px} .icon_removem:hover{background:url(../images/img_floatbox.png) -22px -61px no-repeat;} -.btn_free{ background:#ff5722; display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;} +.btn_free{ background:#ff5722; display:block; width:80px; text-align:center; color:#fff !important; height:26px; padding-top:8px; margin-bottom:10px;} .btn_free:hover{ background:#d63502;} /*成员邀请*/ -.invi_search{ width:295px; margin:0 auto;} +.invi_search{ width:345px; margin:0 auto;} .invi_search_input{ border:1px solid #15bccf; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;} .invi_search_btn{ background:#15bccf; color:#fff; text-align: center; width:40px; height:22px;border:1px solid #15bccf; padding-top:2px; cursor:pointer;} .invi_search_btn:hover{ background:#0da1b2; border:1px solid #0da1b2;} +.rolebox{ margin-left: -40px;} /*问题跟踪*/ .problem_top{ margin:10px 0 ;} .problem_search_input{ border:1px solid #64bdd9; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;} From 312d7660b2555bd9871f0d5ccaf078f62ab4e262 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 12 Mar 2015 16:32:20 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=82=80=E8=AF=B7?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=E7=9A=84=E6=8F=90=E7=A4=BA=20?= =?UTF-8?q?=E9=82=80=E8=AF=B7=E6=88=90=E5=8A=9F=E5=90=8E=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E6=94=B9=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E6=8E=A7=E4=BB=B6=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 29 ++++++++++++++-------- app/views/projects/invite_members.html.erb | 6 +++-- config/locales/zh.yml | 1 + public/stylesheets/application.css | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index a8760a6ef..d0be72961 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -107,17 +107,24 @@ class MembersController < ApplicationController AppliedProject.deleteappiled(member.user_id, @project.id) end end - respond_to do |format| - format.html { redirect_to_settings_in_projects } - format.js { @members = members; @applied_members = applied_members; } - format.api { - @member = members.first - if @member.valid? - render :action => 'show', :status => :created, :location => membership_url(@member) - else - render_validation_errors(@member) - end - } + if params[:flag] + flash[:notice] = l(:label_invite_success) + respond_to do |format| + format.html { redirect_to invite_members_project_url(@project) } + end + else + respond_to do |format| + format.html { redirect_to_settings_in_projects } + format.js { @members = members; @applied_members = applied_members; } + format.api { + @member = members.first + if @member.valid? + render :action => 'show', :status => :created, :location => membership_url(@member) + else + render_validation_errors(@member) + end + } + end end elsif @course course_info = [] diff --git a/app/views/projects/invite_members.html.erb b/app/views/projects/invite_members.html.erb index e2456f2b1..4b07b9b3e 100644 --- a/app/views/projects/invite_members.html.erb +++ b/app/views/projects/invite_members.html.erb @@ -1,7 +1,8 @@ +

    邀请加入

    -<%= error_messages_for 'member' %> +<%#= render_flash_messages %> <% roles = Role.givable.all if @project.project_type == Project::ProjectType_course @@ -21,8 +22,9 @@

    邀请Trustie注册用户

    <% if roles.any? %> - <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> + <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :method => :post}) do |f| %>