Module: ApplicationHelper
- Included in:
- Admin::PaymentsController, AdminLayoutHelper, AuthenticationController
- Defined in:
- app/helpers/application_helper.rb
Overview
Methods added to this helper will be available to all templates in the application.
Instance Method Summary collapse
-
#controller_id ⇒ Object
This fixes a javascript bug in active_scaffold 1.2RC1.
- #define_application_layout_variables ⇒ Object
- #h_money(amount, inverse_polarity = false) ⇒ Object
- #money_for_input(cost) ⇒ Object
Instance Method Details
#controller_id ⇒ Object
This fixes a javascript bug in active_scaffold 1.2RC1. If the controller id starts with a number, prototype pukes during delete and create when called in a sublist on recent firefox/safari’s
30 31 32 |
# File 'app/helpers/application_helper.rb', line 30 def controller_id @controller_id ||= 'as_' + super end |
#define_application_layout_variables ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/helpers/application_helper.rb', line 15 def define_application_layout_variables company_name = Setting.grab :company_name @site_title = company_name if @site_title.nil? @page_title = "#{params[:controller]}::#{params[:action]}" if @page_title.nil? @body_id = request.request_uri.sub(/^#{root_url(:only_path => true)}/, '').sub(/\?.+$/,'').tr(' ','-').gsub(/[^a-z\/0-9\-_]/,'').tr('/','_').gsub(/[\-]{2,}/,'-') @body_class = /(.*?)_[^_]+$/.match(@body_id).to_a.pop @javascripts = ['scriptaculous.js?load=effects', 'modalbox.js','briskbills-quick-helpers.js'] @stylesheets = ['modalbox.css'] end |
#h_money(amount, inverse_polarity = false) ⇒ Object
4 5 6 7 8 9 |
# File 'app/helpers/application_helper.rb', line 4 def h_money(amount, inverse_polarity = false) '<span class="%s">%s</span>' % [ ( (inverse_polarity ? (amount > 0 ) : (amount < 0 )) ? 'money_negative':'money_positive' ), amount.format ] unless amount.nil? end |
#money_for_input(cost) ⇒ Object
11 12 13 |
# File 'app/helpers/application_helper.rb', line 11 def money_for_input(cost) '%.2f' % [(cost.respond_to? :to_f) ? cost.to_f : 0.0 ] end |