修改项目邀请用户的界面
This commit is contained in:
parent
1e23007e5d
commit
2ee04d55f2
|
@ -310,6 +310,7 @@ class MembersController < ApplicationController
|
|||
end
|
||||
|
||||
def autocomplete
|
||||
@flag = params[:flag] || false
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -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 << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)}</li>\n"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
#扩展的checkbox生成
|
||||
def principals_check_box_tags_ex(name, principals)
|
||||
s = ''
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -14,36 +14,45 @@
|
|||
|
||||
<div style="margin-left: 30px" >
|
||||
<div class="floatbox" style="margin:100px;">
|
||||
<div ><a href="#" class="box_close"></a></div>
|
||||
<div >
|
||||
<a href="#" class="box_close"></a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="box_main">
|
||||
<h3 class="box_h3">邀请Trustie注册用户</h3>
|
||||
<% if roles.any? %>
|
||||
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<div class="invi_search">
|
||||
<input id="principal_search" class="invi_search_input fl" type="text" placeholder="输入用户名称搜索好友">
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js',:flag => true) }')" %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="invi_search">
|
||||
<%= label_tag "principal_search", l(:label_principal_search) %>
|
||||
<%= text_field_tag 'principal_search', nil %>
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_project_members(@project) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_principals_for_new_members(@project) %>
|
||||
</div>
|
||||
<p style="padding-top: 5px">
|
||||
<%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
<label>
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<ul class="rolebox">
|
||||
<li class="fl mr5">
|
||||
<%= l(:label_role_plural) %>:
|
||||
</li>
|
||||
<% roles.each do |role| %>
|
||||
<li class="fl mr5">
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
||||
<%= h role %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="cl mb10"></div>
|
||||
<a href="#" class="btn_free" onclick="$('#new_membership').submit();">
|
||||
<%= l(:label_invite_members)%>
|
||||
</a>
|
||||
</div>
|
||||
<!--<p>-->
|
||||
<!--<%#= submit_tag l(:label_invite_members), :id => 'member-add-submit', :style => 'display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;' %>-->
|
||||
<!--</p>-->
|
||||
<% end %>
|
||||
</p>
|
||||
<p>
|
||||
<%= submit_tag l(:label_invite_members), :id => 'member-add-submit', :style => 'display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;' %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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;}
|
||||
|
|
Loading…
Reference in New Issue