Module: Admin::InvoicesHelper
- Includes:
- IsActiveColumnHelper
- Defined in:
- app/helpers/admin/invoices_helper.rb
Instance Method Summary collapse
- #active_scaffold_input_options(column, scope) ⇒ Object
-
#activity_types_form_column(column, input_name) ⇒ Object
Shameless copy-paste:.
- #amount_column(record) ⇒ Object
- #is_paid_column(record) ⇒ Object
- #is_published_column(record) ⇒ Object
- #is_published_form_column(column, input_name) ⇒ Object
- #issued_on_column(record) ⇒ Object
- #sub_total_column(record) ⇒ Object
- #taxes_total_column(record) ⇒ Object
Instance Method Details
#active_scaffold_input_options(column, scope) ⇒ Object
5 6 7 8 9 |
# File 'app/helpers/admin/invoices_helper.rb', line 5 def (column, scope) = super(column, scope) .merge! :include_seconds => true if column.name == :issued_on end |
#activity_types_form_column(column, input_name) ⇒ Object
Shameless copy-paste:
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/admin/invoices_helper.rb', line 40 def activity_types_form_column(column, input_name) available_types = ActivityType.find(:all) associated_ids = ( (@record.new_record?) ? available_types : @record.activity_types ).collect(&:id) return 'no options' if available_types.empty? html = '<ul class="checkbox-list">' available_types.each_with_index do |type, i| this_name = "#{input_name}[#{i}][id]" html << "<li>" html << check_box_tag(this_name, type.id, associated_ids.include?(type.id)) html << "<label for='#{this_name}'>"+type.to_label+"</label>" html << "</li>" end html << '</ul>' html end |
#amount_column(record) ⇒ Object
31 32 33 |
# File 'app/helpers/admin/invoices_helper.rb', line 31 def amount_column(record) h_money record.amount end |
#is_paid_column(record) ⇒ Object
19 20 21 |
# File 'app/helpers/admin/invoices_helper.rb', line 19 def is_paid_column(record) record.is_paid? ? 'Yes' : 'No' end |
#is_published_column(record) ⇒ Object
15 16 17 |
# File 'app/helpers/admin/invoices_helper.rb', line 15 def is_published_column(record) record.is_published ? 'Yes' : 'No' end |
#is_published_form_column(column, input_name) ⇒ Object
11 12 13 |
# File 'app/helpers/admin/invoices_helper.rb', line 11 def is_published_form_column(column, input_name) select_tag input_name, ([['Yes', 1],['No',0]], (column.is_published) ? 1 : 0 ) end |
#issued_on_column(record) ⇒ Object
35 36 37 |
# File 'app/helpers/admin/invoices_helper.rb', line 35 def issued_on_column(record) h record.issued_on.strftime((params[:action] == 'show') ? '%m/%d/%y %I:%M %p' : '%m/%d/%y') end |
#sub_total_column(record) ⇒ Object
23 24 25 |
# File 'app/helpers/admin/invoices_helper.rb', line 23 def sub_total_column(record) h_money record.sub_total end |
#taxes_total_column(record) ⇒ Object
27 28 29 |
# File 'app/helpers/admin/invoices_helper.rb', line 27 def taxes_total_column(record) h_money record.taxes_total end |