ntu dropdown fix list sort

This commit is contained in:
Spen 2013-05-02 17:24:06 +08:00 committed by Matt K. Fu
parent b8da40b4ae
commit 5b368235e8
2 changed files with 17 additions and 9 deletions

View File

@ -184,6 +184,13 @@ class User
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first
end
def self.get_role_member_data_by_sort(role_status_id)
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'], t ] }
member_data = a.sort
member_data_tmp = member_data.collect {|v| v[1] }
end
def create_dept_cache
dept_hash = {}

View File

@ -13,17 +13,17 @@
<h3 class="o-members-category h3"><%= ms.title %></h3>
<ul class="o-members-list">
<% @member_lists.where(:role_status_ids=>ms.id).each do |member| %>
<% @member_lists.get_role_member_data_by_sort(ms.id).each do |member| %>
<li class="odd">
<div class="o-members-pic"><%= show_avatar(member) %></div>
<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")) %></li>
<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>
<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.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")) %></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") %></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>
</ul>
</li>
@ -50,17 +50,17 @@
<h3 class="o-members-category h3"><%= ms.title %></h3>
<ul class="o-members-list">
<% @member_lists.where(:role_status_ids=>ms.id).each_with_index do |member, i| %>
<% @member_lists.get_role_member_data_by_sort(ms.id).each_with_index do |member, i| %>
<li <%= ( (i + 1) % 2 != 0 ) ? "class=odd" : '' %>>
<div class="o-members-pic"><%= show_avatar(member) %></div>
<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")) %></li>
<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>
<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.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")) %></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") %></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>
</ul>
</li>
@ -92,7 +92,8 @@
<td><span class="agent"><%= @member_lists.get_member_list_attribute_field_name("staff","agent") %></span></td>
</tr>
</thead>
<% @member_lists.where(:role_status_ids=>ms.id).each_with_index do |member, i| %>
<% @member_lists.get_role_member_data_by_sort(ms.id).each_with_index do |member, i| %>
<tr>
<td>