Sha256: 7ea9de056edb9d8c955cc396191e3a14276439206127e4e9599616ca6aa66242
Contents?: true
Size: 839 Bytes
Versions: 28
Compression:
Stored size: 839 Bytes
Contents
module Spree module Admin module AdjustmentsHelper def link_to_toggle_adjustment_state(order, adjustment, options={}) return if adjustment.finalized? icon = { closed: 'icon-unlock', open: 'icon-lock' } alt_text = adjustment.immutable? ? Spree.t(:open) : Spree.t(:close) link_to_with_icon(icon[adjustment.state.to_sym], alt_text, toggle_state_admin_order_adjustment_url(order, adjustment), options) end def adjustment_state(adjustment) state = adjustment.state.to_sym if adjustment.finalized? Spree.t(state) else icon_for(state) end end def icon_for(adjustment_state) icon = { closed: 'icon-lock', open: 'icon-unlock' } content_tag(:span, '', class: icon[adjustment_state]) end end end end
Version data entries
28 entries across 28 versions & 1 rubygems