Module: HomeHelper
- Defined in:
- app/helpers/home_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
-
#activity_title(activity) ⇒ Object
Activity title for RSS/ATOM feeds.
-
#sort_by_actions ⇒ Object
—————————————————————————-.
- #sort_by_assets ⇒ Object
-
#sort_by_duration ⇒ Object
—————————————————————————-.
-
#sort_by_users ⇒ Object
—————————————————————————-.
Instance Method Details
#activity_title(activity) ⇒ Object
Activity title for RSS/ATOM feeds.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/helpers/home_helper.rb', line 53 def activity_title(activity) user = activity.user.full_name action = t('action_' + activity.action) type = t('subject_' + activity.subject_type.downcase) subject = if activity.subject if activity.subject.respond_to?(:full_name) activity.subject.full_name else activity.subject.name end else activity.info # Use info if the subject has been deleted. end t(:activity_text, :user => user, :action => action, :type => type, :subject => subject, :default => "#{user} #{action} #{type} #{subject}") end |
#sort_by_actions ⇒ Object
26 27 28 29 30 |
# File 'app/helpers/home_helper.rb', line 26 def sort_by_actions Activity::ACTIONS.map do |action| %Q[{ name: "#{t(action + '_past_participle')}", on_select: function() { #{redraw(:action_type, [ action, t(action + '_past_participle').downcase ], url_for(:action => :redraw))} } }] end end |
#sort_by_assets ⇒ Object
19 20 21 22 23 |
# File 'app/helpers/home_helper.rb', line 19 def sort_by_assets Activity::ASSETS.map do |asset| %Q[{ name: "#{t(asset).singularize}", on_select: function() { #{redraw(:asset, [ asset, t(asset).singularize.downcase ], url_for(:action => :redraw))} } }] end end |
#sort_by_duration ⇒ Object
33 34 35 36 37 |
# File 'app/helpers/home_helper.rb', line 33 def sort_by_duration Activity::DURATION.map do |duration| %Q[{ name: "#{t(duration)}", on_select: function() { #{redraw(:duration, [ duration, t(duration).downcase ], url_for(:action => :redraw))} } }] end end |
#sort_by_users ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'app/helpers/home_helper.rb', line 40 def sort_by_users users = [[ "all_users", t(:option_all_users) ]] + @all_users.map do |user| escaped = escape_javascript(user.full_name) [ escaped, escaped ] end users.map do |key, value| %Q[{ name: "#{value}", on_select: function() { #{redraw(:user, [ key, (value == t(:option_all_users) ? value.downcase : value) ], url_for(:action => :redraw))} } }] end end |