more user display changes

This commit is contained in:
wvengen 2013-09-22 02:15:35 +02:00
parent 6d3db7636a
commit f6c2fd9a9d
5 changed files with 8 additions and 7 deletions

View file

@ -161,7 +161,7 @@ module ApplicationHelper
end end
# show a user, depending on settings # show a user, depending on settings
def show_user(user=@current_user, options = {})#full: false, markup: false, unique: false) def show_user(user=@current_user, options = {})
if user.nil? if user.nil?
"?" "?"
elsif FoodsoftConfig[:use_nick] elsif FoodsoftConfig[:use_nick]

View file

@ -2,7 +2,7 @@ module TasksHelper
def task_assignments(task) def task_assignments(task)
task.assignments.map do |ass| task.assignments.map do |ass|
content_tag :span, ass.user.nick, :class => (ass.accepted? ? 'accepted' : 'unaccepted') content_tag :span, show_user(ass.user), :class => (ass.accepted? ? 'accepted' : 'unaccepted')
end.join(", ").html_safe end.join(", ").html_safe
end end

View file

@ -17,7 +17,7 @@ class Group < ActiveRecord::Base
# Returns all NONmembers and a checks for possible multiple Ordergroup-Memberships # Returns all NONmembers and a checks for possible multiple Ordergroup-Memberships
def non_members def non_members
User.all(:order => 'nick').reject { |u| users.include?(u) } User.natural_order.all.reject { |u| users.include?(u) }
end end
def user_tokens=(ids) def user_tokens=(ids)

View file

@ -1,5 +1,5 @@
<ul class="autocomplete"> <ul class="autocomplete">
<% for user in @users do -%> <% for user in @users do -%>
<li><span class="nick"><%=h user.nick %></span><span class="informal"> (<%= user.ordergroup.name.to_s if user.ordergroup %>)</span></li> <li><span class="nick"><%= show_user(user) %></span><span class="informal"> (<%= user.ordergroup.try(:name) %>)</span></li>
<% end -%> <% end -%>
</ul> </ul>

View file

@ -8,7 +8,8 @@
%div{id: "collapse#{workgroup.id}", class: 'accordion-body collapse'} %div{id: "collapse#{workgroup.id}", class: 'accordion-body collapse'}
.accordion-inner .accordion-inner
%ul.unstyled %ul.unstyled
- workgroup.users.includes(:groups).order('nick').each do |user| - workgroup.users.includes(:groups).natural_order.each do |user|
%li %li
= user.nick = show_user(user)
%small (#{user.ordergroup.try(:name)}) %small (#{user.ordergroup.try(:name)})