many changes
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
class ProductDecorator < Draper::Base
|
||||
decorates :product
|
||||
|
||||
def category_links(options = {})
|
||||
if namespace = options[:namespace]
|
||||
product_categories.map{|pc| h.link_to pc.name, [namespace, pc]}.join(', ').html_safe
|
||||
else
|
||||
product_categories.map{|pc| h.link_to pc.name, pc}.join(', ').html_safe
|
||||
end
|
||||
end
|
||||
|
||||
# Accessing Helpers
|
||||
# You can access any helper via a proxy
|
||||
#
|
||||
# Normal Usage: helpers.number_to_currency(2)
|
||||
# Abbreviated : h.number_to_currency(2)
|
||||
#
|
||||
# Or, optionally enable "lazy helpers" by including this module:
|
||||
# include Draper::LazyHelpers
|
||||
# Then use the helpers with no proxy:
|
||||
# number_to_currency(2)
|
||||
|
||||
# Defining an Interface
|
||||
# Control access to the wrapped subject's methods using one of the following:
|
||||
#
|
||||
# To allow only the listed methods (whitelist):
|
||||
# allows :method1, :method2
|
||||
#
|
||||
# To allow everything except the listed methods (blacklist):
|
||||
# denies :method1, :method2
|
||||
|
||||
# Presentation Methods
|
||||
# Define your own instance methods, even overriding accessors
|
||||
# generated by ActiveRecord:
|
||||
#
|
||||
# def created_at
|
||||
# h.content_tag :span, attributes["created_at"].strftime("%a %m/%d/%y"),
|
||||
# :class => 'timestamp'
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user