Skip to content

Commit

Permalink
refactor classes, don't show a trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger Campos committed Nov 16, 2012
1 parent eccac00 commit 6bbc952
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/best_in_place/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ def best_in_place(object, field, opts = {})
value = fieldValue ? opts[:collection][1] : opts[:collection][0]
collection = opts[:collection].to_json
end
classes = ["best_in_place"]
unless opts[:classes].nil?
# the next three lines enable this opt to handle both a stings and a arrays
classes = []
classes << opts[:classes]
classes = classes.flatten
opts[:classes] = classes.join(' ')
classes.flatten!
end
out = "<span class='best_in_place #{opts[:classes]}'"
out = "<span class='#{classes.join(" ")}'"
out << " id='#{BestInPlace::Utils.build_best_in_place_id(real_object, field)}'"
out << " data-url='#{opts[:path].blank? ? url_for(object) : url_for(opts[:path])}'"
out << " data-object='#{opts[:object_name] || BestInPlace::Utils.object_to_key(real_object)}'"
Expand Down

0 comments on commit 6bbc952

Please sign in to comment.