From fadca9128fadf1931b165fcd219945ce4cfeebea Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Apr 2015 10:17:42 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=9C=8B=E5=8F=8B=E5=9C=88=E3=80=81=E5=BC=80=E5=8F=91=E7=BB=84?= =?UTF-8?q?=E3=80=81=E7=A7=91=E7=A0=94=E7=BB=84=E7=9B=B4=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 19 ++++--- app/views/layouts/_join_exit_project.html.erb | 2 +- app/views/layouts/base_projects.html.erb | 54 ++++++++++++++----- .../projects/change_project_type.html.erb | 0 config/routes.rb | 1 + 5 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 app/views/projects/change_project_type.html.erb diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 406b921ac..8e9802280 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -27,15 +27,7 @@ class ProjectsController < ApplicationController menu_item :feedback, :only => :feedback menu_item :share, :only => :share - before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, - :course, :enterprise_course, :course_enterprise,:view_homework_attaches] - before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, - :reopen,:view_homework_attaches,:course] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] - # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, - # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, - # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] - #此条勿删 课程相关权限 ,:new_homework,:homework,:feedback,,:member before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] @@ -606,6 +598,17 @@ class ProjectsController < ApplicationController end end + #朋友圈、科研组、开发组之间的切换 + def change_project_type + @project.project_new_type = params[:project_type] + if @project.save + message = @project.project_new_type + else + message = "0" + end + render :json => message + end + private def memberAccess diff --git a/app/views/layouts/_join_exit_project.html.erb b/app/views/layouts/_join_exit_project.html.erb index 5d7c9210e..64e9f64d2 100644 --- a/app/views/layouts/_join_exit_project.html.erb +++ b/app/views/layouts/_join_exit_project.html.erb @@ -10,6 +10,6 @@ <% if ((User.current.member_of? @project) && User.current.login? && User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project)) %> <%= link_to "#{l(:button_configure)}".html_safe, settings_project_path(@project), :class => "pr_join_a" %> - <%= link_to "#{l(:label_friend_organization)}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%> + <%= link_to "#{text}".html_safe,"javascript:void(0)" ,:onClick => "show_window();", :class => "pr_join_a",:id => "setting_project_type"%> <% end %> diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index b979e2b41..470d03f87 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -20,21 +20,50 @@ @@ -86,7 +115,8 @@
- <%= render 'layouts/join_exit_project' %> + <% text = @project.project_new_type == 1 ? l(:label_development_team) : (@project.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%> + <%= render 'layouts/join_exit_project',{:text => text} %>
@@ -180,8 +210,8 @@
- -
+ <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> +

请选择项目类型:

- 确定 + 确定
diff --git a/app/views/projects/change_project_type.html.erb b/app/views/projects/change_project_type.html.erb new file mode 100644 index 000000000..e69de29bb diff --git a/config/routes.rb b/config/routes.rb index c9220769c..7dc50741d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -363,6 +363,7 @@ RedmineApp::Application.routes.draw do end resources :projects do member do + match 'change_project_type', :via => [:get, :post] get 'settings(/:tab)', :action => 'settings', :as => 'settings' #by young get 'member', :to => 'projects#member', :as => 'member' From 845794675aba440ec6b49f58ec53350133acc66e Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 14 Apr 2015 10:23:49 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E9=85=8D=E7=BD=AE-=E6=88=90=E5=91=98?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=91=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 15 ++++- .../projects/settings/_new_members.html.erb | 60 +++++++++++++++++-- 2 files changed, 67 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5207be823..bc222a302 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -128,6 +128,15 @@ module ApplicationHelper end end + def link_to_settings_user(user, options={}) + if user.is_a?(User) + name = h(user.name(options[:format])) + link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "w90 c_orange fl" + else + h(user.to_s) + end + end + #重载上面方法,增加样式显示 def link_to_user_header user,canShowRealName=false,options={} if user.is_a?(User) @@ -1341,9 +1350,9 @@ module ApplicationHelper def delete_link(url, options={}) options = { - :method => :delete, - :data => {:confirm => l(:text_are_you_sure)}, - :class => 'icon icon-del' + :method => :delete, + :data => {:confirm => l(:text_are_you_sure)}, + :class => 'icon icon-del' }.merge(options) link_to l(:button_delete), url, options diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index a38b462e2..ac3d757fc 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -1,12 +1,62 @@ +<%= error_messages_for 'member' %> +<% + roles = Role.givable.all + if @project.project_type == Project::ProjectType_course + roles = roles[3..5] + else + roles = roles[0..2] + end + members = @project.member_principals.includes(:roles, :principal).all.sort +%> +
+ <% if members.any? %> - + <% else %> +

<%= l(:label_no_data) %>

+ <% end %>
From 8c122a35f7b2470ca22f9213ddcc1b5a52bd1ca9 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Apr 2015 10:46:31 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=B0=E5=85=B6=E4=BB=96=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=86=8D=E5=88=87=E5=9B=9E=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E7=BB=84=EF=BC=8C=E6=9B=B4=E5=A4=9A=E6=8C=89=E9=92=AE=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/_base_development_group.html.erb | 2 +- public/javascripts/project.js | 20 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/views/layouts/_base_development_group.html.erb b/app/views/layouts/_base_development_group.html.erb index f8e27a570..87ee4e8d8 100644 --- a/app/views/layouts/_base_development_group.html.erb +++ b/app/views/layouts/_base_development_group.html.erb @@ -47,7 +47,7 @@ <% end %> - + diff --git a/public/javascripts/project.js b/public/javascripts/project.js index fe850728c..01cdae5d7 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -14,15 +14,19 @@ function regexName() { } // 项目描述超过展开 -$(function(){ - $(".subNav").click(function(){ - $(this).toggleClass("currentDd").siblings(".subNav").removeClass("currentDd") - $(this).toggleClass("currentDt").siblings(".subNav").removeClass("currentDt") +//$(function(){ +// $(".subNav").click(function(){ +// +// }) +//}) +function expand_tools_expand() +{ + $("#expand_tools_expand").toggleClass("currentDd").siblings(".subNav").removeClass("currentDd"); + $("#expand_tools_expand").toggleClass("currentDt").siblings(".subNav").removeClass("currentDt"); - // 修改数字控制速度, slideUp(500)控制卷起速度 - $(this).next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500); - }) -}) + // 修改数字控制速度, slideUp(500)控制卷起速度 + $("#expand_tools_expand").next(".navContent").slideToggle(500).siblings(".navContent").slideUp(500); +} // 描述显示更多信息 function show_more_msg() From b98a67f50dd0a5e9a50860f7391410f80a31e5ef Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 14 Apr 2015 11:47:47 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=85=8D=E7=BD=AE-=E6=88=90=E5=91=98=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/members_helper.rb | 15 ++- app/views/layouts/base_projects.html.erb | 20 +++- app/views/members/autocomplete.js.erb | 2 +- .../projects/settings/_new_members.html.erb | 103 +++++++----------- 4 files changed, 69 insertions(+), 71 deletions(-) diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 5dc5d9542..6162c5b52 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -38,7 +38,7 @@ module MembersHelper 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', :style =>"float:left;margin-top:0px;") + s + content_tag('ul', links,:class => 'wlist', :id => "course_member_pagination_links" ) end # add by nwb @@ -55,6 +55,19 @@ module MembersHelper s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links") end + # 项目配置中添加成员列表 + def render_principals_for_new_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', :id => 'principals') + + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true) {|text, parameters, options| + link_to text, appliedproject_project_memberships_path(project, parameters.merge(:q => params[:q], :format => 'js')), :remote => true + } + + s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links") + end + # 当前申请加入的成员名单 def render_principals_for_applied_members(project) diff --git a/app/views/layouts/base_projects.html.erb b/app/views/layouts/base_projects.html.erb index 470d03f87..30dad5ff7 100644 --- a/app/views/layouts/base_projects.html.erb +++ b/app/views/layouts/base_projects.html.erb @@ -163,8 +163,16 @@
  • <%= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %>
  • <% end %> - - <%= render :partial => 'layouts/base_development_group', :locals => {:project => @project}%> + + + <% if @project.project_new_type == 1 || @project.project_new_type.nil? %> + <%= render :partial => 'layouts/base_development_group', :locals => {:project => @project}%> + <% elsif @project.project_new_type == 2 %> + <%= render :partial => 'layouts/base_research_team', :locals => {:project => @project}%> + <% else %> + <%= render :partial => 'layouts/base_friend_group', :locals => {:project => @project}%> + <% end %> +
    @@ -211,13 +219,13 @@
    <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%> -
    +

    请选择项目类型:

      -
    • -
    • -
    • +
    • id="development_group"/>
    • +
    • id="research_group"/>
    • +
    • id="friend_organization"/>
    确定 diff --git a/app/views/members/autocomplete.js.erb b/app/views/members/autocomplete.js.erb index f7f9de151..01faf7da9 100644 --- a/app/views/members/autocomplete.js.erb +++ b/app/views/members/autocomplete.js.erb @@ -2,7 +2,7 @@ <% 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)) %>'); + $('#principals_for_new_member').html('<%= escape_javascript(render_project_members(@project)) %>'); <% end%> <% elsif @course%> var checked = $("#principals input:checked").size(); diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index ac3d757fc..c59f24ad2 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -11,11 +11,11 @@
    <% if members.any? %> -
      -
    • <%= l(:label_user) %><%= l(:label_role_plural) %>
    • +
        +
      • <%= l(:label_user) %><%= l(:label_role_plural) %>
      • <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %> <% members.each do |member| %> -
      • +
      • <%= link_to_user_header member.principal,false,:class => "w150 c_orange fl" %> <%= h member.roles.sort.collect(&:to_s).join(', ') %> @@ -25,8 +25,8 @@ ) do |f| %> <% roles.each do |role| %>
          - <%= radio_button_tag 'membership[role_ids][]', role.id, member.roles.include?(role), - :disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> + <%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), + :disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
        @@ -50,68 +50,45 @@ :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %> <%# end%>
      • - <% end%> - - -
      + <% end%> +
    <% else %>

    <%= l(:label_no_data) %>

    <% end %>
    -
    -

    +申请加入

    - -
      -
    • 角色:
    • -
    • -
    • -
    • -
    -
    - 批准拒绝 +

    <%= l(:label_member_new) %>

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

    添加成员

    - -
    -
    \ No newline at end of file From 5ae5cfda03df1c38147821ea9c7e7b3211dddebb Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 14 Apr 2015 15:34:04 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=B3=E8=AF=B7=E5=8A=A0=E5=85=A5=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=88=90=E5=91=98=E5=B1=80=E9=83=A8=E5=88=B7?= =?UTF-8?q?=E6=96=B0=20=E7=BC=96=E8=BE=91=E6=88=90=E5=91=98=E5=B1=80?= =?UTF-8?q?=E9=83=A8=E5=88=B7=E6=96=B0=20=E9=A1=B9=E7=9B=AE=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E5=9B=BD=E9=99=85=E5=8C=96=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/members_helper.rb | 10 ++++ app/views/members/create.js.erb | 54 +++++++++---------- app/views/members/destroy.js.erb | 13 ++--- app/views/members/update.js.erb | 17 +++--- .../projects/settings/_new_members.html.erb | 34 ++++++++++-- app/views/projects/show.html.erb | 2 +- config/locales/projects/zh.yml | 3 +- 7 files changed, 86 insertions(+), 47 deletions(-) diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 6162c5b52..149acb5dd 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -68,6 +68,16 @@ module MembersHelper s + content_tag('ul', links,:class => 'wlist',:id => "course_member_pagination_links") end + # 新申请加入项目成员列表 + def render_principals_for_applied_members_new project + scope = project.applied_projects.map(&:user) + principals = paginateHelper scope,10 + s = content_tag('ul', principals_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5') + links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| + link_to text, appliedproject_project_memberships_path(project, parameters.merge(:q => params[:q],:flag => true, :format => 'js')), :remote => true + } + s + content_tag('ul', links,:class => 'wlist', :id => "course_member_pagination_links" ) + end # 当前申请加入的成员名单 def render_principals_for_applied_members(project) diff --git a/app/views/members/create.js.erb b/app/views/members/create.js.erb index 93aad5b5e..941582c04 100644 --- a/app/views/members/create.js.erb +++ b/app/views/members/create.js.erb @@ -1,27 +1,27 @@ -<%if @project%> -$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); - -<%if !@applied_members%> -<% if @members.present? && @members.all? {|m| m.valid? } %> -<% @members.each do |member| %> -$("#member-<%= member.id %>").effect("highlight"); -<% end %> -<% else %> -<% if @members %> -<% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')%> -alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors || ''))) %>'); -<% else%> -// alert(''); -<% end%> -<% end %> -<% end %> -<%elsif @course%> - <% if @create_member_error_messages%> - alert("<%= @create_member_error_messages%>"); - <% else%> - $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); - alert("添加成功"); - <% end%> -<%end%> - -hideOnLoad(); +<%if @project%> +$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); + + <%if !@applied_members%> + <% if @members.present? && @members.all? {|m| m.valid? } %> + <% @members.each do |member| %> + $("#member-<%= member.id %>").effect("highlight"); + <% end %> + <% else %> + <% if @members %> + <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')%> + alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors || ''))) %>'); + <% end%> + <% end %> + <% end %> + + +<%elsif @course%> + <% if @create_member_error_messages%> + alert("<%= @create_member_error_messages%>"); + <% else%> + $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); + alert("添加成功"); + <% end%> +<%end%> + +hideOnLoad(); diff --git a/app/views/members/destroy.js.erb b/app/views/members/destroy.js.erb index 912cfde58..fcef883ff 100644 --- a/app/views/members/destroy.js.erb +++ b/app/views/members/destroy.js.erb @@ -1,6 +1,7 @@ - <%if @project%> - $('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); - <%elsif @course%> - $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); - <%end%> -hideOnLoad(); + <%if @project%> + $('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); +// $('#tab-content-members').html('<%#= escape_javascript(render :partial => 'projects/settings/members') %>'); + <%elsif @course%> + $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); + <%end%> +hideOnLoad(); diff --git a/app/views/members/update.js.erb b/app/views/members/update.js.erb index a166e76ab..2dd2ea9dd 100644 --- a/app/views/members/update.js.erb +++ b/app/views/members/update.js.erb @@ -1,9 +1,8 @@ -<%if @project%> -$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); -$("#member-<%= @member.id %>").effect("highlight"); -<%elsif @course%> -$('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); -<%end%> -hideOnLoad(); - - +<%if @project%> +$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); +<%elsif @course%> +$('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); +<%end%> +hideOnLoad(); + + diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index c59f24ad2..81aaa4186 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -56,8 +56,37 @@

    <%= l(:label_no_data) %>

    <% end %>
    - + +<% if roles.any? %>
    + + <% if @project.applied_projects.any? %> +
    +

    <%= l(:label_apply_project) %>

    + <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> +
    + <%= render_principals_for_applied_members_new(@project) %> +
    +
      +
    • <%= l(:label_role_plural) %>:
    • + <% roles.each do |role| %> +
    • + <%= check_box_tag 'membership[role_ids][]', role.id %> + +
    • + <% end %> +
    + <% end %> +
    + + <%= submit_tag l(:label_approve), :id => 'member-add-submit' %> + + <%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %> + +
    + <% end %> +
    +

    <%= l(:label_member_new) %>

    <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> <% end%>
    - - +<% end %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index d0c4bd54f..956a725be 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -10,7 +10,7 @@
    <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %>
    - <%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %> <%= l(:label_project_new) %> : + <%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %> <%= l(:label_project_create) %> : <%= link_to e.project.name, :class => "problem_tit fl fb" %>


    <%= l :label_create_time %> :<%= format_time(e.project.created_on) %>

    diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index bbf9cc343..2fb78efde 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -17,6 +17,7 @@ zh: + # # 项目托管平台主页 # @@ -86,7 +87,7 @@ zh: label_project_overview: "项目简介:" label_expend_information: 展开更多信息 - + label_project_create: "新建了项目" # # 项目托管平台 From 729b28ae43105ded77ad4975198739835744d18f Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 14 Apr 2015 16:03:47 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=9B=E5=A7=8B=E4=BA=BA=E4=B8=8D=E8=83=BD=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=87=AA=E5=B7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 ++ app/views/projects/settings/_new_members.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bc222a302..9c6265f02 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1358,6 +1358,8 @@ module ApplicationHelper link_to l(:button_delete), url, options end + + def delete_new_link(url, options={}) options = { :method => :delete, diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index 81aaa4186..d8b75775b 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -42,13 +42,13 @@
    <% end %> - <%# unless member.roles.first.to_s == "Manager"%> + <% unless member.user_id == @project.user_id %> 编辑 <%= delete_link membership_path(member), :remote => true, :class => "c_dblue ml30 fl", :data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %> - <%# end%> + <% end%> <% end%> From e4b2092c7fea78d8c7c10491a2b4052b02e22e20 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 14 Apr 2015 16:56:32 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=88=90=E5=91=98=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E5=91=98=EF=BC=8C=E4=BB=A5=E5=8F=8A=E7=94=A8=E6=88=B7/?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E7=95=99=E7=A9=BA=E6=97=B6=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/members_controller.rb | 5 +++- app/views/members/create.js.erb | 26 ++++++------------- .../projects/settings/_new_members.html.erb | 1 - 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index fc243741a..2a5c7f118 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -117,9 +117,12 @@ class MembersController < ApplicationController format.html { redirect_to invite_members_project_url(@project) } end else + unless members.present? && members.all? {|m| m.valid? } + @project_error_message = members.empty? ? l(:label_user_role_null) :members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') + end respond_to do |format| format.html { redirect_to_settings_in_projects } - format.js { @members = members; @applied_members = applied_members; } + format.js format.api { @member = members.first if @member.valid? diff --git a/app/views/members/create.js.erb b/app/views/members/create.js.erb index 941582c04..2e7af18d8 100644 --- a/app/views/members/create.js.erb +++ b/app/views/members/create.js.erb @@ -1,20 +1,11 @@ <%if @project%> -$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>'); - - <%if !@applied_members%> - <% if @members.present? && @members.all? {|m| m.valid? } %> - <% @members.each do |member| %> - $("#member-<%= member.id %>").effect("highlight"); - <% end %> - <% else %> - <% if @members %> - <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')%> - alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors || ''))) %>'); - <% end%> - <% end %> - <% end %> - - + <% if @project_error_message%> + alert("<%= @project_error_message%>"); + <% else%> + $('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>'); + hideOnLoad(); + alert("添加成功"); + <% end%> <%elsif @course%> <% if @create_member_error_messages%> alert("<%= @create_member_error_messages%>"); @@ -22,6 +13,5 @@ $('#tab-content-members').html('<%= escape_javascript(render :partial => 'projec $('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>'); alert("添加成功"); <% end%> + hideOnLoad(); <%end%> - -hideOnLoad(); diff --git a/app/views/projects/settings/_new_members.html.erb b/app/views/projects/settings/_new_members.html.erb index d8b75775b..82ed52d9a 100644 --- a/app/views/projects/settings/_new_members.html.erb +++ b/app/views/projects/settings/_new_members.html.erb @@ -90,7 +90,6 @@

    <%= l(:label_member_new) %>

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

    <%= l(:label_apply_project) %>

    +
    +

    <%= l(:label_apply_project) %>

    <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> - <% end %> +
    +
    + <% end %>
    - +

    <%= l(:label_member_new) %>

    <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> @@ -119,3 +120,17 @@
    <% end %> + \ No newline at end of file diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 0668f152e..6fc7aa8da 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -981,6 +981,7 @@ zh: text_wiki_page_destroy_children: 删除子页面及其所有下级页面 text_wiki_page_reassign_children: 将子页面的上级页面设置为 text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该课程了。你确定要继续吗? + text_own_membership_for_project_confirmation: 你正在删除现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该项目了。你确定要继续吗? text_zoom_in: 放大 text_zoom_out: 缩小 text_applied_project: "用户 %{id} 申请加入项目 %{project}" diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 01cdae5d7..18d461029 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -188,4 +188,11 @@ function project_setting(n) function submitModules() { $("#modules-form").submit(); +} + +//配置--成员---申请列表--拒绝 +function refusal_applied_member() +{ + $('#new_membership').append(""); + $('#new_membership').submit(); } \ No newline at end of file