Skip to content

Commit

Permalink
Fixed a few more things. I wanna go to bed...
Browse files Browse the repository at this point in the history
  • Loading branch information
rtlong committed Feb 16, 2010
1 parent 7b0bbdb commit c12ee1f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/helpers/contributions_helper.rb
Expand Up @@ -22,7 +22,7 @@ def delivery_method_display(contribution)
when :mail, :pickup
[DELIVERY_METHODS_DESCRIPTIONS[contribution.delivery_method.to_sym], contribution.delivery_details].compact.join ", "
when :other
"it will get to you in the following method: #{contribution.delivery_details.strip}"
"it will get to you in the following method: #{(contribution.delivery_details || 'undefined').strip}"
end
end
end
2 changes: 2 additions & 0 deletions app/models/contribution.rb
Expand Up @@ -11,6 +11,8 @@ class Contribution < ActiveRecord::Base
accepts_nested_attributes_for :business

validates_presence_of :nature, :value, :delivery_method
validates_inclusion_of :delivery_method, :in => DELIVERY_METHODS
validates_presence_of :delivery_details, :if => Proc.new { |contribution| contribution.delivery_method == :other }, :message => "Please explain the details of how we will get the contribution"

named_scope :received, :condition => 'received_at IS NOT NULL'

Expand Down
9 changes: 6 additions & 3 deletions app/views/admin/contributions/index.html.haml
Expand Up @@ -14,12 +14,15 @@
%th{:colspan => 6} #{@contributions.count} Contributions
%tbody
- for contribution in @contributions
- content_tag_for :tr, contribution, :class => cycle('even','odd') do
%tr[contribution]{:class => cycle('even','odd')}
%td= link_to contribution.nature, admin_business_contribution_path(contribution.business)
%td= contribution.value
%td= link_to contribution.business.name, admin_business_path(contribution.business)
%td= delivery_method_display(contribution)
%td.received_at
%td.delivery<
%span.method>= contribution.delivery_method.to_s.humanize
- if contribution.delivery_details?
%span.details> : #{contribution.delivery_details}
%td.received_at<
- if contribution.received?
= contribution.received_at.to_words
- else
Expand Down
3 changes: 3 additions & 0 deletions public/stylesheets/sass/admin.sass
Expand Up @@ -30,6 +30,9 @@ form.formtastic
fieldset
:border-color = !primary_color

.inline-errors
:color = !color3

table
tr
th
Expand Down

0 comments on commit c12ee1f

Please sign in to comment.