2010-11-05 15:45:05 -07:00
|
|
|
module OutfitsHelper
|
|
|
|
def destination_tag(value)
|
|
|
|
hidden_field_tag 'destination', value, :id => nil
|
|
|
|
end
|
2011-03-23 15:23:01 -07:00
|
|
|
|
|
|
|
def link_to_edit_outfit(content_or_outfit, outfit_or_options, options={})
|
|
|
|
if block_given?
|
|
|
|
content = capture_haml(&Proc.new)
|
|
|
|
outfit = content_or_outfit
|
|
|
|
options = outfit_or_options
|
|
|
|
else
|
|
|
|
content = content_or_outfit
|
|
|
|
outfit = outfit_or_options
|
|
|
|
end
|
|
|
|
query = outfit.to_query
|
|
|
|
query << "&outfit=#{outfit.id}" if outfit.user == current_user
|
|
|
|
link_to content, wardrobe_path(:anchor => query), options
|
|
|
|
end
|
|
|
|
|
|
|
|
def outfit_li_for(outfit)
|
|
|
|
class_name = outfit.starred? ? 'starred' : nil
|
|
|
|
content_tag :li, :class => class_name, &Proc.new
|
|
|
|
end
|
|
|
|
|
2010-11-05 15:45:05 -07:00
|
|
|
def pet_attribute_select(name, collection, value=nil)
|
|
|
|
select_tag name,
|
|
|
|
options_from_collection_for_select(collection, :id, :human_name, value)
|
|
|
|
end
|
2011-03-23 15:23:01 -07:00
|
|
|
|
2010-11-07 14:19:47 -08:00
|
|
|
def pet_name_tag(options={})
|
|
|
|
options = {:spellcheck => false, :id => nil}.merge(options)
|
|
|
|
text_field_tag 'name', nil, options
|
2010-11-05 15:45:05 -07:00
|
|
|
end
|
|
|
|
end
|
2011-03-23 15:23:01 -07:00
|
|
|
|