forked from saurabh/orbit4-5
Fix member frontend role status
This commit is contained in:
parent
d6085ad13e
commit
96dd726981
|
@ -5,21 +5,14 @@ class MembersController < ApplicationController
|
||||||
|
|
||||||
if page_roles.include?("all")
|
if page_roles.include?("all")
|
||||||
roles = Role.all.collect do |role|
|
roles = Role.all.collect do |role|
|
||||||
{
|
{ "title" => role.title, "id" => role.id }
|
||||||
"title" => role.title,
|
|
||||||
"id" => role.id
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
page_role_status.each do |status_id|
|
page_role_status.each do |status_id|
|
||||||
page_roles << RoleStatus.find(status_id).role.id.to_s
|
page_roles << RoleStatus.find(status_id).role.id.to_s
|
||||||
end
|
end
|
||||||
roles = Role.find(page_roles.uniq).collect do |role|
|
roles = Role.find(page_roles.uniq).collect do |role|
|
||||||
{
|
{ "title" => role.title, "id" => role.id, "status" => RoleStatus.where(:role_id=>role, :_id.in=>page_role_status) }
|
||||||
"title" => role.title,
|
|
||||||
"id" => role.id,
|
|
||||||
"status" => RoleStatus.where(:role_id=>role, :_id.in=>page_role_status)
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,35 +22,26 @@ class MembersController < ApplicationController
|
||||||
if !role['status'].blank?
|
if !role['status'].blank?
|
||||||
role['status'].each do |status|
|
role['status'].each do |status|
|
||||||
member_profiles = get_members_by_status(status, role['id'])
|
member_profiles = get_members_by_status(status, role['id'])
|
||||||
status_list << {
|
status_list << { "status-title" => status.title, "members" => member_profiles }
|
||||||
"status-title" => status.title,
|
|
||||||
"members" => member_profiles
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# Members with status
|
# Members with status
|
||||||
RoleStatus.order_by(:title=>"desc").where(:role_id=>role['id']).each do |status|
|
role_status = RoleStatus.order_by(:title=>"desc").where(:role_id=>role['id'])
|
||||||
|
role_status_ids = role_status.collect{|status| status.id.to_s}
|
||||||
|
role_status.each do |status|
|
||||||
member_profiles = get_members_by_status(status, role['id'])
|
member_profiles = get_members_by_status(status, role['id'])
|
||||||
status_list << {
|
status_list << { "status-title" => status.title, "members" => member_profiles }
|
||||||
"status-title" => status.title,
|
|
||||||
"members" => member_profiles
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
# Members without status
|
# Members without status
|
||||||
member_profiles = []
|
member_profiles = []
|
||||||
MemberProfile.where(:role_ids.in=>[role['id']], :role_status_ids.in=>[nil,[]]).collect do |profile|
|
MemberProfile.not_in(:role_status_ids.in=>role_status_ids).where(:role_ids.in=>[role['id']]).collect do |profile|
|
||||||
member_profiles << get_member_data(profile, role['id'])
|
member_profiles << get_member_data(profile, role['id'])
|
||||||
end
|
end
|
||||||
status_list << {
|
status_list << { "status-title" => "", "members" => member_profiles }
|
||||||
"status-title" => "",
|
|
||||||
"members" => member_profiles
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
role_list << {
|
role_list << { "role-title" => role['title'], "status-list" => status_list }
|
||||||
"role-title" => role['title'],
|
|
||||||
"status-list" => status_list
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
{
|
{
|
||||||
"roles" => role_list,
|
"roles" => role_list,
|
||||||
"extras" => {
|
"extras" => {
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
<label for="password" class="control-label"><%= t("users.new_password")%></label>
|
<label for="password" class="control-label"><%= t("users.new_password")%></label>
|
||||||
</label>
|
</label>
|
||||||
<div class="controls add-input">
|
<div class="controls add-input">
|
||||||
<%= f.password_field :password, :class=>"input-medium", :id=>"password" %>
|
<input name="foilautofill" style="display: none;" type="password" />
|
||||||
|
<%= f.password_field :password, :class=>"input-medium", :id=>"password", :autocomplete=>"off" %>
|
||||||
<span class="help-block"><%= t("users.new_password_note")%></span>
|
<span class="help-block"><%= t("users.new_password_note")%></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue