Sha256: 2984b7b2c2aaaf8d561f1bc335dccba9151785d435f98a1a0c1c71b7af3f21e5
Contents?: true
Size: 1.16 KB
Versions: 6
Compression:
Stored size: 1.16 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| %[{ 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
6 entries across 6 versions & 2 rubygems