Skip to content
Browse files

Show "More than one" bucket split option when editing an event with o…

…nly a single line item
  • Loading branch information...
1 parent 2c109ac commit e8a3409e8034b130f04d5946cda2375ac8def94d @jamis committed May 4, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 app/helpers/events_helper.rb
View
5 app/helpers/events_helper.rb
@@ -57,18 +57,21 @@ def select_account(section, accounts, selection)
end
def select_bucket(section, options={})
+ splittable = options.fetch(:splittable, true)
+
if options[:line_item]
select_options = options_for_select(
options[:line_item].account.buckets.sorted.map { |bucket| [bucket.name, bucket.id] },
options[:line_item].bucket_id)
+ select_options += "<option value='+'>-- More than one --</option>" if splittable
select_options += "<option value='++'>-- Add a new bucket --</option>"
disabled = false
else
select_options = "<option>-- Select an account --</option>"
disabled = true
end
- classes = ["bucket_for_#{section}", options.fetch(:splittable, true) ? "splittable" : nil]
+ classes = ["bucket_for_#{section}", splittable ? "splittable" : nil]
select_tag "event[#{section}][bucket_id]", select_options,
:class => classes.compact.join(" "),

0 comments on commit e8a3409

Please sign in to comment.
Something went wrong with that request. Please try again.