项目配置添加申请加入

删除成员局部刷新
编辑成员局部刷新
项目动态国际化错误
This commit is contained in:
huang 2015-04-14 15:34:04 +08:00
parent b3689377a3
commit 5ae5cfda03
7 changed files with 86 additions and 47 deletions

View File

@ -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)

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -56,8 +56,37 @@
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div><!-- 左边-->
<!--右侧部分 begin-->
<% if roles.any? %>
<div class="members_right">
<!--申请加入-->
<% if @project.applied_projects.any? %>
<div class="members_jion">
<p class="c_blue mb10 fb"><%= l(:label_apply_project) %></p>
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<div id="principals_for_applied_member">
<%= render_principals_for_applied_members_new(@project) %>
</div>
<ul class="mb10">
<li><%= l(:label_role_plural) %>:</li>
<% roles.each do |role| %>
<li>
<%= check_box_tag 'membership[role_ids][]', role.id %>
<label ><%= h role %></label >
</li>
<% end %>
</ul>
<% end %>
<div class="cl"></div>
<a href="javascript:void(0)" class="blue_btn fl" >
<%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
</a><a href="javascript:void(0)" class="grey_btn fl ml10" >
<%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>
</a>
</div>
<% end %><!--members_jion end-->
<div class="cl"></div>
<!--添加成员-->
<p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p>
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<div class="member_search">
@ -89,6 +118,5 @@
</div>
<% end%>
</div><!-- 右边 end-->
<% end %>

View File

@ -10,7 +10,7 @@
<div class="problem_main">
<a class="problem_pic fl"><%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %></a>
<div class="problem_txt fl mt5">
<%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %><span class="fl"> <%= l(:label_project_new) %> </span>
<%= link_to e.user, user_path(e.user), :class => "problem_name c_orange fl" %> <span class="fl"> <%= l(:label_project_create) %> </span>
<%= link_to e.project.name, :class => "problem_tit fl fb" %></a><br />
<p class="mt5"><br /> <%= l :label_create_time %> <%= format_time(e.project.created_on) %></p>
</div>

View File

@ -17,6 +17,7 @@ zh:
#
# 项目托管平台主页
#
@ -86,7 +87,7 @@ zh:
label_project_overview: "项目简介:"
label_expend_information: 展开更多信息
label_project_create: "新建了项目"
#
# 项目托管平台