Sha256: e0a619e23696fe6ff3888edd798cf7e5c868c2f6e59948ab3eb70ac625b33008

Contents?: true

Size: 941 Bytes

Versions: 6

Compression:

Stored size: 941 Bytes

Contents

module Spree::Admin::SpreeEssentialsHelper
  
  def inside_contents_tab?
    @inside_contents_tab ||= !request.fullpath.scan(Regexp.new(extension_routes.join("|"))).empty?
  end
  
  def contents_tab
    content_tag :li, :class => inside_contents_tab? ? 'selected' : nil do
      link_to I18n.t('spree.admin.shared.contents_tab.content'), extension_routes.first
    end
  end
  
  def markdown_helper
    content_tag('em', :class => 'small markdown-helper') do
      [ 
        t('essentials.parsed_with'),
        link_to("Markdown", "http://daringfireball.net/projects/markdown/basics", :onclick => 'window.open(this.href); return false')
      ].join(" ").html_safe
    end
  end

private
  
  def extension_routes
    @extension_routes ||= SpreeEssentials.essentials.map { |key, cls|
      route = cls.tab[:route] || "admin_#{key}"
      send("#{route}_path") rescue "##{key}"      
    }.push(spree.admin_uploads_path)    
  end
  
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree_essentials_jn-0.6.1 app/helpers/spree/admin/spree_essentials_helper.rb
spree_essentials_jn-0.6.0 app/helpers/spree/admin/spree_essentials_helper.rb
spree_essentials-0.5.0 app/helpers/spree/admin/spree_essentials_helper.rb
spree_essentials-0.5.0.rc1 app/helpers/spree/admin/spree_essentials_helper.rb
spree_essentials-0.4.0 app/helpers/spree/admin/spree_essentials_helper.rb
spree_essentials-0.4.0.rc3 app/helpers/spree/admin/spree_essentials_helper.rb