add Member frontend page selection options and fix backend role filter page

This commit is contained in:
Spen 2013-11-15 15:37:19 +08:00
parent e129b25554
commit 28f3d80c81
20 changed files with 228 additions and 107 deletions

View File

@ -39,10 +39,8 @@ if($.support.touch) {
if(!$(this).closest('div').hasClass('togglebox')) { if(!$(this).closest('div').hasClass('togglebox')) {
$(this).wrap('<div class="toggle-control"/>'); $(this).wrap('<div class="toggle-control"/>');
if($(this).attr('type') == "hidden" && $(this).attr('value') == 'true') { if($(this).attr('type') == "hidden" && $(this).attr('value') == 'true') {
console.log('true')
$(this).wrap('<div class="togglebox disable" />'); $(this).wrap('<div class="togglebox disable" />');
} else { } else {
console.log('false')
$(this).wrap('<div class="togglebox" />'); $(this).wrap('<div class="togglebox" />');
} }
$('<label><b></b></label>').insertAfter($(this)); $('<label><b></b></label>').insertAfter($(this));
@ -73,7 +71,6 @@ if($.support.touch) {
$(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled'); $(this).parent('.togglebox').removeClass('disable').closest('li').removeClass('disabled');
}; };
} else { } else {
console.log($(this))
if($(this).prop('checked')) { if($(this).prop('checked')) {
$(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled'); $(this).parent('.togglebox').addClass('disable').closest('li').addClass('disabled');
}; };
@ -543,7 +540,6 @@ function changeStatusHidden() {
// Document Ready // Document Ready
$(function() { $(function() {
console.log('true')
showFiltersOnPageRefresh(); showFiltersOnPageRefresh();
new ini(); new ini();

View File

@ -4,3 +4,4 @@
//= require lib/jquery.fastLiveFilter.js //= require lib/jquery.fastLiveFilter.js
//= require lib/checkbox.card.js //= require lib/checkbox.card.js
//= require lib/jquery.form.js //= require lib/jquery.form.js
//= require lib/member/member-role.js

View File

@ -40,8 +40,18 @@ class Admin::ItemsController < OrbitBackendController
m["main"] = [module_app.label, module_app.id.to_s] m["main"] = [module_app.label, module_app.id.to_s]
m["sub"] = module_app.app_pages.map{|name, data| [t(data["i18n"]), name]} rescue [] m["sub"] = module_app.app_pages.map{|name, data| [t(data["i18n"]), name]} rescue []
m["sub"] << [I18n.t('default_widget.default_widget'),'default_widget'] if module_app.has_default_widget? m["sub"] << [I18n.t('default_widget.default_widget'),'default_widget'] if module_app.has_default_widget?
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue '' if module_app.key == 'member'
m["category"] = RoleStatus.where(:role_id=> RoleStatus.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.where(:role_id=> RoleCategory.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
elsif module_app.key == 'member_staff'
m["category"] = RoleStatus.where(:role_id=> RoleStatus.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.where(:role_id=> RoleCategory.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
else
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
end
m["count"] = module_app.get_registration.get_data_count.to_a m["count"] = module_app.get_registration.get_data_count.to_a
module_apps << m module_apps << m
end end

View File

@ -68,8 +68,19 @@ class Admin::PagePartsController < OrbitBackendController
m = {} m = {}
m["main"] = [module_app.label, module_app.id.to_s] m["main"] = [module_app.label, module_app.id.to_s]
m["sub"] = module_app.widgets.map{|name, data| [t(data["i18n"]), name]} rescue [] m["sub"] = module_app.widgets.map{|name, data| [t(data["i18n"]), name]} rescue []
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
if module_app.key == 'member'
m["category"] = RoleStatus.can_display.where(:role_id=> RoleStatus.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.can_display.where(:role_id=> RoleCategory.get_role_data("teacher") ).map{|category| [category.title, category.id.to_s] } rescue ''
elsif module_app.key == 'member_staff'
m["category"] = RoleStatus.can_display.where(:role_id=> RoleStatus.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = RoleCategory.can_display.where(:role_id=> RoleCategory.get_role_data("staff") ).map{|category| [category.title, category.id.to_s] } rescue ''
else
m["category"] = module_app.categories.map{|category| [category.title, category.id.to_s] } rescue ''
m["tags"] = module_app.tags.map{|tag| [tag.name, tag.id.to_s] } rescue ''
end
m["count"] = module_app.get_registration.get_data_count.to_a m["count"] = module_app.get_registration.get_data_count.to_a
module_apps << m module_apps << m
end end

View File

@ -3,6 +3,8 @@ class RoleCategory < RoleFilter
has_and_belongs_to_many :users has_and_belongs_to_many :users
belongs_to :role belongs_to :role
scope :can_display,where(disable: false)
def self.get_role_data(role_key) def self.get_role_data(role_key)
@role = Role.where(:key =>role_key).first @role = Role.where(:key =>role_key).first

View File

@ -186,20 +186,21 @@ class User
}.uniq! }.uniq!
end end
def self.get_member_list_attribute_field_name(role_type,field_key) def self.get_member_list_attribute_field(role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first @attribute = ::Attribute.where(:key => role_type).first
return ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first.title return ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
end end
def self.get_member_list_attribute_value(user_id,role_type,field_key) def self.get_member_list_attribute_value(user_id,field_id)
@attribute = ::Attribute.where(:key => role_type).first # @attribute = ::Attribute.where(:key => role_type).first
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first # @AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first return ::AttributeValue.where(attribute_field_id: field_id, :user_id => user_id).first
end end
def self.get_role_member_data_by_sort(role_status_id) def self.get_role_member_data_by_sort(role, field_key, role_status_id)
a = Array.new a = Array.new
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,"staff","job_title")['val'].to_i, t ] } attribute_field_data = get_member_list_attribute_field(role,field_key)
where(:role_status_ids=>role_status_id).desc(:_id).collect{|t| a << [ get_member_list_attribute_value(t.id,attribute_field_data.id)['val'].to_i, t ] }
member_data = a.sort member_data = a.sort
member_data_tmp = member_data.collect {|v| v[1] } member_data_tmp = member_data.collect {|v| v[1] }
end end

View File

@ -18,7 +18,7 @@
<td class="action span3"> <td class="action span3">
<div class="toggle-control" style="float: right;"> <div class="toggle-control" style="float: right;">
<div class="togglebox <%= attribute.disabled ? 'disabled' : '' %>"> <div class="togglebox <%= attribute.disabled ? 'disabled' : '' %>">
<%= link_to (check_box_tag 'accept', false , :class => 'toggle-check', :data=>{:deploy=>"right"}) , eval("admin_#{@attribute_type}_toggle_path(attribute)"), method: :post, remote: true, class: "switch" %> <%= check_box_tag 'accept', attribute.disabled ? 'fasle' : 'true', false ,{ :class => 'toggle-check role_filter_checked', :data=>{:deploy=>"right"}, :data=>{:path=> eval("admin_#{@attribute_type}_toggle_path(attribute)")}, :checked=> attribute.disabled} %>
<label><b></b></label> <label><b></b></label>
</div> </div>
</div> </div>

View File

@ -1,3 +1,4 @@
$("#attributes_index").html("<%= j render 'admin/attributes/index' %>") // $("#attributes_index").html("<%= j render 'admin/attributes/index' %>")
location.reload();
$.pageslide.close(); $.pageslide.close();
openSlide(); openSlide();

View File

@ -1,5 +1,5 @@
<tr id="<%= dom_id role_filter %>" class="<% role_filter.disable ? 'disable' : '' %>"> <tr id="<%= dom_id role_filter %>" class="<%= role_filter.disable ? 'disable' : '' %>">
<td><span class="label label-info"><%= role_filter.key %></span></td> <td><span class="label label-info"><%= role_filter.key %></span></td>
<% if @types.is_localized?(:title) %> <% if @types.is_localized?(:title) %>
<% @site_valid_locales.each_with_index do |locale, i| %> <% @site_valid_locales.each_with_index do |locale, i| %>
@ -18,15 +18,7 @@
<td><%= role_filter.title %></td> <td><%= role_filter.title %></td>
<% end %> <% end %>
<td class="action"> <td class="action dsrgsdgsdg">
<%#= link_to role_filter.disable ? t(:disable) : t(:enable), polymorphic_path([:admin, role_filter]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"btn btn-mini btn-success", :type=>"button" %> <%= check_box_tag 'accept', role_filter.disable ? 'fasle' : 'true', false ,{ :class => 'toggle-check role_filter_checked', :data=>{:deploy=>"right"}, :data=>{:path=> eval("admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_toggle_path(role_filter)")}, :checked=> role_filter.disable} %>
<div class="toggle-control" style="float: right;">
<div class="togglebox <%= role_filter.disable ? 'disabled' : '' %>">
<%= link_to (check_box_tag 'accept', false , :class => 'toggle-check', :data=>{:deploy=>"right"}) , eval("admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_toggle_path(role_filter)"), method: :post, remote: true, class: "switch" %>
<label><b></b></label>
</div>
</div>
</td> </td>
</tr> </tr>

View File

@ -1,3 +1,4 @@
<% content_for :side_bar do %> <% content_for :side_bar do %>
<%= render :partial => 'admin/users_new_interface/side_bar' %> <%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %> <% end %>
@ -9,14 +10,6 @@
<%= stylesheet_link_tag "lib/togglebox.css" %> <%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%> <% end -%>
<div id="filter" class="topnav clearfix">
<ul class="breadcrumb text-info pull-left">
<li><%= link_to( t("role"), admin_roles_path ) %> <span class="divider">/</span></li>
<li class="active">( <%= @role.title %> ) <%= t(@app_type_name) %></a></li>
</ul>
</div>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), eval("new_admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_path(:role_id=>params[:role_id])"), class: "btn btn-primary open-slide" %> <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), eval("new_admin_#{@app_type == 'role_statuses' ? 'role_status' : @app_type }_path(:role_id=>params[:role_id])"), class: "btn btn-primary open-slide" %>
@ -27,4 +20,4 @@
<%= render 'index' %> <%= render 'index' %>
</div> </div>
<% @path = "/admin/#{@app_type == 'role_category' ? 'role_categorys' : @app_type }/" %>

View File

@ -1,3 +1,4 @@
$("#role_filters_index").html("<%= j render 'index' %>") // $("#role_filters_index").html("<%= j render 'index' %>")
location.reload();
$.pageslide.close(); $.pageslide.close();
openSlide(); openSlide();

View File

@ -2,7 +2,6 @@
<%= render :partial => 'admin/users_new_interface/side_bar' %> <%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %> <% end %>
<% content_for :page_specific_css do -%> <% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %> <%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %> <%= stylesheet_link_tag "lib/pageslide.css" %>
@ -10,13 +9,6 @@
<%= stylesheet_link_tag "lib/togglebox.css" %> <%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%> <% end -%>
<div id="filter" class="topnav clearfix">
<ul class="breadcrumb text-info pull-left">
<li><%= link_to( t("#{@attribute_type}"), admin_roles_path ) %>/</span></li>
<li class="active"><%= @attribute.title %></a></li>
</ul>
</div>
<div class="bottomnav clearfix"> <div class="bottomnav clearfix">
<div class="action pull-right"> <div class="action pull-right">
<%= link_to content_tag(:i,t("new.sub_role"),:class=>"icon-plus"),eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"),:class=>"btn btn-primary open-slide"%> <%= link_to content_tag(:i,t("new.sub_role"),:class=>"icon-plus"),eval("admin_#{@attribute_type}_add_sub_role_path(@attribute)"),:class=>"btn btn-primary open-slide"%>

View File

@ -1 +1 @@
<%=render :partial=>"role",:collection=>Role.all.asc("_id")%> <%=render :partial=>"role",:collection=>Role.where(:disabled=>false).asc("_id")%>

View File

@ -24,8 +24,16 @@
<div class="wrap-inner"> <div class="wrap-inner">
<div id="filter" class="topnav clearfix"> <div id="filter" class="topnav clearfix">
<ul class="breadcrumb text-info pull-left"> <ul class="breadcrumb text-info pull-left">
<% if !@role.blank? %>
<li><%= link_to( t("role"), admin_roles_path ) %> <span class="divider">/</span></li>
<li class="active">( <%= @role.title %> ) <%= t(@app_type_name) %></a></li>
<% elsif !@attribute.blank? %>
<li><%= link_to( t("#{@attribute_type}"), admin_roles_path ) %>/</span></li>
<li class="active"><%= @attribute.title %></a></li>
<% else %>
<li><a href="<%= admin_users_new_interface_index_path %>">Member</a> <span class="divider">/</span></li> <li><a href="<%= admin_users_new_interface_index_path %>">Member</a> <span class="divider">/</span></li>
<li class="active">All</li> <li class="active">All</li>
<% end %>
</ul> </ul>
<%= yield :right_nav %> <%= yield :right_nav %>
</div> </div>

View File

@ -28,21 +28,26 @@ class Panel::Member::FrontEnd::MemberListsController < OrbitWidgetController
@member_subroles = SubRole.where(:role_id => @role_id, :disabled => false) @member_subroles = SubRole.where(:role_id => @role_id, :disabled => false)
@member_list_categorys = RoleCategory.where(:role_id => @role_id,disable: false).asc("key") @member_list_categorys = RoleCategory.can_display.any_in(:_id => params[:tag_id]).asc("key")
if !params[:category_id].blank? @member_status = RoleStatus.can_display.any_in(:_id => params[:category_id]).asc("key")
@member_status = RoleStatus.can_display.any_in(:_id => params[:category_id]).asc("key")
@mlcs = @member_list_categorys.map{|category| category.id.to_s }
@mcs = params[:mcid].blank? ? @mlcs.first : params[:mcid]
if !@member_list_categorys.blank? or !@member_status.blank?
if !@mcs.blank? and @mlcs.include?(@mcs)
@member_lists = User.where(:role_ids => @role_id,:role_category_ids => @mcs).asc(:position)
else
@member_lists = User.where(:role_ids => @role_id).asc(:position)
end
else else
@member_status = RoleStatus.can_display.where(:role_id => @role_id).asc("key") # @member_lists = User.where(:role_ids => @role_id)
@member_lists = ''
end end
if !params[:mcid].blank?
@member_lists = User.where(:role_ids => @role_id, :role_category_ids => params[:mcid])
else
@member_lists = User.where(:role_ids => @role_id)
end
end end
def show def show

View File

@ -1,5 +1,9 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<% if !@member_lists.blank? %>
<% @job_title_field = @member_lists.get_member_list_attribute_field("teacher","job_title") %>
<section> <section>
<div class="side"></div> <div class="side"></div>
@ -8,7 +12,7 @@
<% if !@member_list_categorys.blank? %> <% if !@member_list_categorys.blank? %>
<ul class="o-members-nav"> <ul class="o-members-nav">
<% @member_list_categorys.each do |mc| %> <% @member_list_categorys.each do |mc| %>
<li class="<%= (params[:mcid] == mc.id.to_s) ? 'active' : '' %>"><a href="?&mcid=<%= mc.id %>"><%= mc.title %></a></li> <li class="<%= (params[:mcid] == mc.id.to_s or @mcs.to_s == mc.id.to_s) ? 'active' : '' %>"><a href="?&mcid=<%= mc.id %>"><%= mc.title %></a></li>
<% end %> <% end %>
</ul> </ul>
<% end %> <% end %>
@ -17,6 +21,8 @@
<div class="o-members"> <div class="o-members">
<%# @member_lists = @member_lists.where(:role_category_ids => @mcs) if !@mcs.blank? and @mlcs.include?(@mcs) %>
<% @member_status.each do |ms| %> <% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %> <% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
@ -30,11 +36,11 @@
<div class="o-members-pic"><%= show_avatar(member) %></div> <div class="o-members-pic"><%= show_avatar(member) %></div>
<ul class="o-members-info"> <ul class="o-members-info">
<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li> <li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li>
<% @job_title = show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"teacher","job_title").get_value_by_locale(I18n.locale)) <% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
if @job_title != 'NoData' and !@job_title.blank? if @job_title != 'NoData' and !@job_title.blank?
%> %>
<li><b class="o-members-label"> <li><b class="o-members-label">
<%= @member_lists.get_member_list_attribute_field_name("teacher","job_title") %></b> <%= @job_title_field.title %></b>
<%= @job_title %> <%= @job_title %>
</li> </li>
<% end %> <% end %>
@ -55,12 +61,10 @@
<% elsif @item.frontend_style == 'Two' or @item.frontend_style.blank? %> <% elsif @item.frontend_style == 'Two' or @item.frontend_style.blank? %>
<section>
<div class="side"></div>
<div class="main">
<div class="o-members view-columns"> <div class="o-members view-columns">
<%# @member_lists = @member_lists.where(:role_category_ids => @mcs) if !@mcs.blank? %>
<% @member_status.each do |ms| %> <% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %> <% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
@ -74,10 +78,10 @@
<div class="o-members-pic"><%= show_avatar(member) %></div> <div class="o-members-pic"><%= show_avatar(member) %></div>
<ul class="o-members-info"> <ul class="o-members-info">
<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li> <li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li>
<% @job_title = show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"teacher","job_title").get_value_by_locale(I18n.locale)) <% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
if @job_title != 'NoData' and !@job_title.blank? if @job_title != 'NoData' and !@job_title.blank?
%> %>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("teacher","job_title") %></b><%= @job_title %></li> <li><b class="o-members-label"><%= @job_title_field.title %></b><%= @job_title %></li>
<% end %> <% end %>
<li><b class="o-members-label"><%= t("users.email")%></b> <%= member.email %></li> <li><b class="o-members-label"><%= t("users.email")%></b> <%= member.email %></li>
<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li> <li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
@ -98,5 +102,6 @@
</div> </div>
</section> </section>
<% end %>
<%#= stylesheet_link_tag "member/members" %> <%= stylesheet_link_tag "member/members" %>

View File

@ -36,7 +36,7 @@
<% end -%> <% end -%>
<% end -%> <% end -%>
<%= render :partial=> "show_roles",:collection=>@member.roles.asc(:created_at) %> <%= render :partial=> "show_roles",:collection=>@member.roles.where(:disabled=>false).asc(:created_at) %>
</tbody> </tbody>
</table> </table>

View File

@ -8,6 +8,36 @@
.o-members-category:first-child { .o-members-category:first-child {
margin-top: 0; margin-top: 0;
} }
.o-members-nav {
margin: 0 0 10px;
padding: 0;
list-style: none;
}
.o-members-nav:after {
content: "";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
.o-members-nav li {
float: left;
}
.o-members-nav li + li {
margin-left: 8px;
}
.o-members-nav li a {
display: inline-block;
line-height: 23px;
padding: 5px 8px;
height: 23px;
background-color: #ccc;
border-radius: 3px;
}
.o-members-nav li.active a {
color: #FFF;
background-color: #0088CE;
}
.o-members-list { .o-members-list {
list-style: none; list-style: none;
margin: 0; margin: 0;

View File

@ -28,16 +28,24 @@ class Panel::MemberStaff::FrontEnd::MemberStaffListsController < OrbitWidgetCont
@member_subroles = SubRole.where(:role_id => @role_id, :disabled => false) @member_subroles = SubRole.where(:role_id => @role_id, :disabled => false)
if !params[:category_id].blank? @member_list_categorys = RoleCategory.can_display.any_in(:_id => params[:tag_id]).asc("key")
@member_status = RoleStatus.can_display.any_in(:_id => params[:category_id]).asc("key")
@member_lists = User.where(:role_ids => @role_id) @member_status = RoleStatus.can_display.any_in(:_id => params[:category_id]).asc("key")
@mlcs = @member_list_categorys.map{|category| category.id.to_s }
@mcs = params[:mcid].blank? ? @mlcs.first : params[:mcid]
if !@member_list_categorys.blank? or !@member_status.blank?
if !@mcs.blank? and @mlcs.include?(@mcs)
@member_lists = User.where(:role_ids => @role_id,:role_category_ids => @mcs).asc(:position)
else
@member_lists = User.where(:role_ids => @role_id).asc(:position)
end
else else
@member_status = RoleStatus.can_display.where(:role_id => @role_id).asc("key") # @member_lists = User.where(:role_ids => @role_id)
@member_lists = ''
@member_lists = User.where(:role_ids => @role_id)
end end
end end

View File

@ -1,29 +1,61 @@
<% # encoding: utf-8 %> <% # encoding: utf-8 %>
<% if @item.frontend_style == 'Single' %> <% if !@member_lists.blank? %>
<% @job_title_field = @member_lists.get_member_list_attribute_field("staff","job_title") %>
<% @job_business_field = @member_lists.get_member_list_attribute_field("staff","business") %>
<% if @item.frontend_style == 'Single' or @item.frontend_style == 'Two' %>
<section> <section>
<div class="side"></div> <div class="side"></div>
<div class="main"> <div class="main">
<% if !@member_list_categorys.blank? %>
<ul class="o-members-nav">
<% @member_list_categorys.each do |mc| %>
<li class="<%= (params[:mcid] == mc.id.to_s or @mcs.to_s == mc.id.to_s) ? 'active' : '' %>"><a href="?&mcid=<%= mc.id %>"><%= mc.title %></a></li>
<% end %>
</ul>
<% end %>
<% if @item.frontend_style == 'Single' %>
<div class="o-members"> <div class="o-members">
<% @member_status.each do |ms| %> <% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
<h3 class="o-members-category h3"><%= ms.title %></h3> <h3 class="o-members-category h3"><%= ms.title %></h3>
<ul class="o-members-list"> <ul class="o-members-list">
<% @member_lists.get_role_member_data_by_sort(ms.id).each do |member| %> <% @member_lists.where(:role_status_ids=>ms.id).each do |member| %>
<li class="odd"> <li class="odd">
<div class="o-members-pic"><%= show_avatar(member) %></div> <div class="o-members-pic"><%= show_avatar(member) %></div>
<ul class="o-members-info"> <ul class="o-members-info">
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("staff","job_title") %></b><%= show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"staff","job_title").get_value_by_locale(I18n.locale)) %></li> <% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
if @job_title != 'NoData' and !@job_title.blank?
%>
<li><b class="o-members-label">
<%= @job_title_field.title %></b>
<%= @job_title %>
</li>
<% end %>
<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li> <li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li>
<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li> <li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
<li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li> <li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("staff","business") %></b><%= nl2br(@member_lists.get_member_list_attribute_value(member.id,"staff","business").get_value_by_locale(I18n.locale)) %></li>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("staff","agent") %></b><%= @member_lists.get_member_list_attribute_value(member.id,"staff","agent").get_value_by_locale(I18n.locale) %></li> <% @job_business = @member_lists.get_member_list_attribute_value(member.id,@job_business_field.id).get_value_by_locale(I18n.locale)
if @job_business != 'NoData' and !@job_business.blank?
%>
<li><b class="o-members-label">
<%= @job_business_field.title %></b>
<%= @job_business %>
</li>
<% end %>
</ul> </ul>
</li> </li>
@ -33,34 +65,47 @@
<% end %> <% end %>
<% end %>
</div> </div>
</div>
</section>
<% elsif @item.frontend_style == 'Two' %> <% elsif @item.frontend_style == 'Two' %>
<section>
<div class="side"></div>
<div class="main">
<div class="o-members view-columns"> <div class="o-members view-columns">
<% @member_status.each do |ms| %> <% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
<h3 class="o-members-category h3"><%= ms.title %></h3> <h3 class="o-members-category h3"><%= ms.title %></h3>
<ul class="o-members-list"> <ul class="o-members-list">
<% @member_lists.get_role_member_data_by_sort(ms.id).each_with_index do |member, i| %> <% @member_lists.where(:role_status_ids=>ms.id).each_with_index do |member, i| %>
<li <%= ( (i + 1) % 2 != 0 ) ? "class=odd" : '' %>> <li <%= ( (i + 1) % 2 != 0 ) ? "class=odd" : '' %>>
<div class="o-members-pic"><%= show_avatar(member) %></div> <div class="o-members-pic"><%= show_avatar(member) %></div>
<ul class="o-members-info"> <ul class="o-members-info">
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("staff","job_title") %></b><%= show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"staff","job_title").get_value_by_locale(I18n.locale)) %></li> <% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
if @job_title != 'NoData' and !@job_title.blank?
%>
<li><b class="o-members-label">
<%= @job_title_field.title %></b>
<%= @job_title %>
</li>
<% end %>
<li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li> <li><b class="o-members-label"><%= t("users.name")%></b><%= link_to member.name, panel_member_front_end_member_list_path(member.id), {:class => "o-members-link"} %></li>
<li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li> <li><b class="o-members-label"><%= t("users.office_tel")%></b><%= member.office_tel %></li>
<li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li> <li><b class="o-members-label"><%= t("users.email")%></b><%= member.email %></li>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("staff","business") %></b><%= nl2br(@member_lists.get_member_list_attribute_value(member.id,"staff","business").get_value_by_locale(I18n.locale)) %></li>
<li><b class="o-members-label"><%= @member_lists.get_member_list_attribute_field_name("staff","agent") %></b><%= @member_lists.get_member_list_attribute_value(member.id,"staff","agent").get_value_by_locale(I18n.locale) %></li>
<% @job_business = @member_lists.get_member_list_attribute_value(member.id,@job_business_field.id).get_value_by_locale(I18n.locale)
if @job_business != 'NoData' and !@job_business.blank?
%>
<li><b class="o-members-label">
<%= @job_business_field.title %></b>
<%= @job_business %>
</li>
<% end %>
</ul> </ul>
</li> </li>
@ -70,47 +115,64 @@
<% end %> <% end %>
<% end %>
</div> </div>
<% end %>
</div> </div>
</section> </section>
<% elsif @item.frontend_style == 'List' %> <% elsif @item.frontend_style == 'List' %>
<% if !@member_list_categorys.blank? %>
<ul class="o-members-nav">
<% @member_list_categorys.each do |mc| %>
<li class="<%= (params[:mcid] == mc.id.to_s or @mcs.to_s == mc.id.to_s) ? 'active' : '' %>"><a href="?&mcid=<%= mc.id %>"><%= mc.title %></a></li>
<% end %>
</ul>
<% end %>
<div class="o-members view-ntu-lists"> <div class="o-members view-ntu-lists">
<% @member_status.each do |ms| %> <% @member_status.each do |ms| %>
<% if @member_lists.where(:role_status_ids=>ms.id).count > 0 %>
<h3 class="o-members-category h3"><%= ms.title %></h3> <h3 class="o-members-category h3"><%= ms.title %></h3>
<table> <table>
<thead> <thead>
<tr> <tr>
<td><span class="job_title"><%= @member_lists.get_member_list_attribute_field_name("staff","job_title") %></span></td> <td><span class="job_title"><%= @job_title_field.title %></span></td>
<td><span class="name"><%= t("users.name")%></span></td> <td><span class="name"><%= t("users.name")%></span></td>
<td><span class="tel"><%= t("users.office_tel")%></span></td> <td><span class="tel"><%= t("users.office_tel")%></span></td>
<td><span class="business"><%= @member_lists.get_member_list_attribute_field_name("staff","business") %></span></td> <td><span class="business"><%= @job_business_field.title %></span></td>
<td><span class="agent"><%= @member_lists.get_member_list_attribute_field_name("staff","agent") %></span></td>
</tr> </tr>
</thead> </thead>
<% @member_lists.get_role_member_data_by_sort(ms.id).each_with_index do |member, i| %> <% @member_lists.where(:role_status_ids=>ms.id).each_with_index do |member, i| %>
<tr> <tr>
<td> <td>
<span class="job_title"> <span class="job_title">
<%= show_attribute_value(@member_lists.get_member_list_attribute_value(member.id,"staff","job_title").get_value_by_locale(I18n.locale)) rescue '' %> <% @job_title = @member_lists.get_member_list_attribute_value(member.id,@job_title_field.id).get_value_by_locale(I18n.locale)
if @job_title != 'NoData' and !@job_title.blank?
%>
<%= @job_title %>
<% end %>
</span> </span>
</td> </td>
<td><span class="name"><%= link_to member.name, "mailto:#{member.email}" %></span></td> <td><span class="name"><%= link_to member.name, "mailto:#{member.email}" %></span></td>
<td><span class="tel"><%= member.office_tel %></span></td> <td><span class="tel"><%= member.office_tel %></span></td>
<td> <td>
<span class="business"> <span class="business">
<%= nl2br(@member_lists.get_member_list_attribute_value(member.id,"staff","business").get_value_by_locale(I18n.locale)) rescue '' %> <% @job_business = @member_lists.get_member_list_attribute_value(member.id,@job_business_field.id).get_value_by_locale(I18n.locale)
</span> if @job_business != 'NoData' and !@job_business.blank?
</td> %>
<td> <%= @job_business %>
<span class="agent"> <% end %>
<%= @member_lists.get_member_list_attribute_value(member.id,"staff","agent").get_value_by_locale(I18n.locale) rescue '' %>
</span> </span>
</td> </td>
</tr> </tr>
@ -121,9 +183,12 @@
<% end %> <% end %>
<% end %>
</div> </div>
<% end %> <% end %>
<% end %>
<%= stylesheet_link_tag "member_staff/members" %> <%= stylesheet_link_tag "member_staff/members" %>