Sha256: 1946de62c029e3665c429ec73dacc6dc7e66df8bf8aca52cf739e95f34b16653
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
# Copyright (c) 2008-2013 Michael Dvorkin and contributors. # # Fat Free CRM is freely distributable under the terms of MIT license. # See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ module UsersHelper def language_for(user) if user.preference[:locale] locale, language = languages.detect{ |locale, language| locale == user.preference[:locale] } end language || "English" end def sort_by_language languages.sort.map do |locale, language| %Q[{ name: "#{language}", on_select: function() { #{redraw(:locale, [ locale, language ], url_for(:action => :redraw, :id => current_user))} } }] end end def all_users User.by_name end def user_select(asset, users, myself) user_options = user_options_for_select(users, myself) select(asset, :assigned_to, user_options, { :include_blank => t(:unassigned) }, { :style => "width:160px", :class => 'select2' }) end def user_options_for_select(users, myself) (users - [myself]).map{|u| [u.full_name, u.id]}.prepend([t(:myself), myself.id]) end end
Version data entries
4 entries across 4 versions & 1 rubygems