Sha256: a185d9e2ffe1c2ecebc72e8917fd9a1b4ee1a760680f0781a0a03ed424a882e5
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
class Plugins::Ecommerce::CouponDecorator < CamaleonCms::TermTaxonomyDecorator delegate_all # Define presentation-specific methods here. Helpers are accessed through # `helpers` (aka `h`). You can override attributes, for example: # # def created_at # helpers.content_tag :span, class: 'time' do # object.created_at.strftime("%a %m/%d/%y") # end # end def the_code object.slug.to_s.upcase end def the_amount opts = object.options case opts[:discount_type] when 'percent' "#{opts[:amount].to_f}%" when 'money' "#{h.current_site.current_unit}#{opts[:amount].to_f}" else "Free" end end def the_symbol opts = object.options case opts[:discount_type] when 'percent' "%" when 'money' h.current_site.current_unit else "" end end def the_status opts = object.options if "#{opts[:expirate_date]} 23:59:59".to_datetime.to_i < Time.now.to_i "<span class='label label-danger'>#{I18n.t('plugin.ecommerce.table.expired')} </span>" elsif object.status.to_s.to_bool "<span class='label label-success'>#{I18n.t('plugin.ecommerce.active')} </span>" else "<span class='label label-default'>#{I18n.t('plugin.ecommerce.not_active')} </span>" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
camaleon_ecommerce-1.2 | app/decorators/plugins/ecommerce/coupon_decorator.rb |