Module: AccountsHelper
- Defined in:
- app/helpers/accounts_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
-
#account_category_checbox(category, count) ⇒ Object
Sidebar checkbox control for filtering accounts by category.
- #account_select(options = {}) ⇒ Object
-
#account_summary(account) ⇒ Object
Quick account summary for RSS/ATOM feeds.
Instance Method Details
#account_category_checbox(category, count) ⇒ Object
Sidebar checkbox control for filtering accounts by category.
22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/accounts_helper.rb', line 22 def account_category_checbox(category, count) checked = (session[:filter_by_account_category] ? session[:filter_by_account_category].split(",").include?(category.to_s) : count.to_i > 0) onclick = remote_function( :url => { :action => :filter }, :with => h(%Q/"category=" + $$("input[name='category[]']").findAll(function (el) { return el.checked }).pluck("value")/), :loading => "$('loading').show()", :complete => "$('loading').hide()" ) check_box_tag("category[]", category, checked, :id => category, :onclick => onclick) end |
#account_select(options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'app/helpers/accounts_helper.rb', line 44 def account_select( = {}) # Generates a select list with the first 25 accounts, # and prepends the currently selected account, if available [:selected] = (@account && @account.id) || 0 accounts = ([@account] + Account.order("name").my.limit(25)).compact.uniq collection_select :account, :id, accounts, :id, :name, , {:"data-placeholder" => t(:select_an_account), :style => "width:330px; display:none;" } end |
#account_summary(account) ⇒ Object
Quick account summary for RSS/ATOM feeds.
35 36 37 38 39 40 41 42 |
# File 'app/helpers/accounts_helper.rb', line 35 def account_summary(account) [ number_to_currency(account.opportunities.pipeline.map(&:weighted_amount).sum, :precision => 0), t(:added_by, :time_ago => time_ago_in_words(account.created_at), :user => account.user_id_full_name), t('pluralize.contact', account.contacts.count), t('pluralize.opportunity', account.opportunities.count), t('pluralize.comment', account.comments.count) ].join(', ') end |