module Tienda module ApplicationHelper def body_class "#{params[:controller].gsub('/', '_')}_#{params[:action]}" end def navigation_manager_link(item) link_to item.url(self), item.link_options.merge(class: item.active?(self) ? 'active-menu' : 'inactive') do "#{item.description}".html_safe end end def status_tag(status) content_tag :span, t("tienda.orders.statuses.#{status}"), :class => "status-tag #{status}" end def attachment_preview(attachment, options = {}) if attachment String.new.tap do |s| if attachment.mounted_as == :image style = "style='background-image:url(#{attachment.url})'" else style = '' end s << "
" end.html_safe elsif !options[:hide_if_blank] " ".html_safe end end def settings_label(field, html_class) "".html_safe end def settings_field(field, options = {}) default = I18n.t("tienda.settings.defaults")[field.to_sym] value = (params[:settings] && params[:settings][field]) || Tienda.settings[field.to_s] type = I18n.t("tienda.settings.types")[field.to_sym] || 'string' case type when 'boolean' String.new.tap do |s| value = default if value.blank? s << "