diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb
index fc243741a..6271a6832 100644
--- a/app/controllers/members_controller.rb
+++ b/app/controllers/members_controller.rb
@@ -60,8 +60,12 @@ class MembersController < ApplicationController
user_ids.each do |user_id|
AppliedProject.deleteappiled(user_id, @project.id)
end
+ @succes_message = "拒绝成功"
end
end
+ respond_to do |format|
+ format.js
+ end
else
#modify by nwb
#更改课程成员逻辑
@@ -117,9 +121,14 @@ 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(', ')
+ else
+ @succes_message = "添加成功"
+ 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?
@@ -184,6 +193,8 @@ class MembersController < ApplicationController
end # end of params[:refusal_button]
+
+
end
def update
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/helpers/application_helper.rb b/app/helpers/application_helper.rb
index b9d40303b..ab5f0a308 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)
@@ -574,6 +583,15 @@ module ApplicationHelper
s.html_safe
end
+ # li标签checkbos扩展
+ def principals_check_box_tags_li(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), :class => "c_blue" }\n"
+ end
+ s.html_safe
+ end
+
#扩展的checkbox生成
def principals_radio_box_tags_ex(name, principals)
s = ''
@@ -1352,14 +1370,16 @@ 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
end
+
+
def delete_new_link(url, options={})
options = {
:method => :delete,
diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb
index 5dc5d9542..d1cd3ccd0 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,29 @@ 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_new project
+ scope = project.applied_projects.map(&:user)
+ principals = paginateHelper scope,10
+ s = content_tag('ul', principals_check_box_tags_li('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/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 %>
- <%= l(:label_project_more) %>
+ <%= l(:label_project_more) %>
<%= render 'projects/tools_expand' %>
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 369fe12e2..30dad5ff7 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} %>
@@ -133,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 %>
+
@@ -178,19 +216,18 @@
<%= render :partial => 'layouts/new_footer'%>
-
-
-
+ <% text = @project.project_new_type == 1 ? "development_group" : (@project.project_new_type == 2 ? "research_group" : "friend_organization")%>
+
@@ -199,7 +236,7 @@
<%= l(:label_loading) %>
- <%= call_hook :view_layouts_base_body_bottom %>
+ <%= call_hook :view_layouts_base_body_bottom %>