用户邀请加入的时候增加拒绝功能

删除提示星系修改
申请加入模块样式调整
This commit is contained in:
huang 2015-04-14 19:34:01 +08:00
parent e4b2092c7f
commit b8058c3e12
7 changed files with 58 additions and 18 deletions

View File

@ -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
#更改课程成员逻辑
@ -119,6 +123,8 @@ class MembersController < ApplicationController
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 }
@ -187,6 +193,8 @@ class MembersController < ApplicationController
end # end of params[:refusal_button]
end
def update

View File

@ -572,6 +572,15 @@ module ApplicationHelper
s.html_safe
end
# li标签checkbos扩展
def principals_check_box_tags_li(name, principals)
s = ''
principals.each do |principal|
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id), :class => "c_blue" }</li>\n"
end
s.html_safe
end
#扩展的checkbox生成
def principals_radio_box_tags_ex(name, principals)
s = ''

View File

@ -72,7 +72,7 @@ module MembersHelper
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')
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
}

View File

@ -4,7 +4,7 @@
<% else%>
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
hideOnLoad();
alert("添加成功");
alert("<%= @succes_message%>");
<% end%>
<%elsif @course%>
<% if @create_member_error_messages%>

View File

@ -47,7 +47,7 @@
<%= 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? %>
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_for_project_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
<% end%>
</li>
<% end%>
@ -55,14 +55,14 @@
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div><!-- 左边-->
<!--右侧部分 begin-->
</div><!-- left -->
<!--right begin-->
<% if roles.any? %>
<div class="members_right">
<!--申请加入-->
<!-- applied -->
<% if @project.applied_projects.any? %>
<div class="members_jion">
<p class="c_blue mb10 fb"><%= l(:label_apply_project) %></p>
<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) %>
@ -76,17 +76,18 @@
</li>
<% end %>
</ul>
<a remote="true" href="javascript:void(0)" class="blue_btn fl" onclick="$('#new_membership').submit();">
<%= l(:label_approve) %>
</a>
<a remote="true" href="javascript:void(0)" class="grey_btn fl ml10" onclick="refusal_applied_member();">
<%= l(:label_refusal) %>
</a>
<% 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>
</div>
<% end %><!--members_jion end-->
<div class="cl"></div>
<!--添加成员-->
<!-- add members -->
<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">
@ -111,7 +112,7 @@
<% end %>
</ul>
<div class="cl mb10"></div>
<a href="javascript:void(0)" class="member_btn" onclick="$('#new_membership').submit();">
<a href="javascript:void(0)" class="member_btn" onclick="$(this).parent().parent().submit();">
新增成员
</a>
</div>
@ -119,3 +120,17 @@
</div><!-- 右边 end-->
<% end %>
<script type="text/javascript">
$(document).ready(function () {
var collection=$("#principals_for_new_member").children("#principals").children("label");
collection.css("text-overflow","ellipsis");
collection.css("white-space","nowrap");
collection.css("width","200px");
collection.css("overflow","hidden");
for(i=0;i<collection.length;i++){ //增加悬浮显示
var label=collection[i];
var text=$(label).text();
$(label).attr("title",text);
}
});
</script>

View File

@ -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}"

View File

@ -188,4 +188,11 @@ function project_setting(n)
function submitModules()
{
$("#modules-form").submit();
}
//配置--成员---申请列表--拒绝
function refusal_applied_member()
{
$('#new_membership').append("<input name = 'refusal_button' style='display: none;'>");
$('#new_membership').submit();
}