Sha256: c9432ca582d42ae79f5762a1f0b21b9dd21e16e899c43ada1f6bf0dffd79f1b5

Contents?: true

Size: 822 Bytes

Versions: 12

Compression:

Stored size: 822 Bytes

Contents

class ApplicationDecorator < Draper::Base
  # Lazy Helpers
  #   PRO: Call Rails helpers without the h. proxy
  #        ex: number_to_currency(model.price)
  #   CON: Add a bazillion methods into your decorator's namespace
  #        and probably sacrifice performance/memory
  #  
  #   Enable them by uncommenting this line:
  #   lazy_helpers

  # Shared Decorations
  #   Consider defining shared methods common to all your models.
  #   
  #   Example: standardize the formatting of timestamps
  #
  #   def formatted_timestamp(time)
  #     h.content_tag :span, time.strftime("%a %m/%d/%y"), 
  #                   :class => 'timestamp' 
  #   end
  # 
  #   def created_at
  #     formatted_timestamp(model.created_at)
  #   end
  # 
  #   def updated_at
  #     formatted_timestamp(model.updated_at)
  #   end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
draper-0.9.5 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.9.3 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.9.2 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.9.1 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.9.0 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.8.1 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.8.0 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.7.4 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.7.3 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.7.2 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.7.1 lib/generators/draper/decorator/templates/application_decorator.rb
draper-0.7.0 lib/generators/draper/decorator/templates/application_decorator.rb