Module: UsersHelper

Defined in:
app/helpers/users_helper.rb

Overview

Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.


Instance Method Summary collapse

Instance Method Details

#language_for(user) ⇒ Object



20
21
22
23
24
25
# File 'app/helpers/users_helper.rb', line 20

def language_for(user)
  if user.preference[:locale]
    locale, language = languages.detect{ |locale, language| locale == user.preference[:locale] }
  end
  language || "English"
end

#sort_by_languageObject



27
28
29
30
31
# File 'app/helpers/users_helper.rb', line 27

def sort_by_language
  languages.sort.map do |locale, language|
    %Q[{ name: "#{language}", on_select: function() { #{redraw(:locale, [ locale, language ], url_for(:action => :redraw))} } }]
  end
end

#user_select(asset) ⇒ Object



33
34
35
36
37
38
# File 'app/helpers/users_helper.rb', line 33

def user_select(asset)
  collection_select asset, :assigned_to, @users, :id, :full_name,
                    { :include_blank => "" }, 
                    { :"data-placeholder" => t(:myself),
                      :style => "width:160px" } 
end