Sha256: 317dc57d22f9c023ca9742aa369df3b16ada1923028bf67f34ab1539e2d4c89f
Contents?: true
Size: 1.92 KB
Versions: 3
Compression:
Stored size: 1.92 KB
Contents
module PufferHelper def puffer_namespaces Rails.application.routes.puffer.each do |(prefix, groups)| controller = groups.values.first.first title = prefix.to_s.humanize path = send("#{prefix}_#{controller.controller_name}_path") current = controller.namespace == namespace yield title, path, current end end def puffer_navigation Rails.application.routes.puffer[namespace].values.map(&:first).each do |controller| title = controller.configuration.group.to_s.humanize path = send("#{namespace}_#{controller.controller_name}_path") current = configuration.group && resource.root.controller.configuration.group == controller.configuration.group yield title, path, current end end def sidebar_puffer_navigation (Rails.application.routes.puffer[namespace][configuration.group] || []).each do |controller| title = controller.model.model_name.human path = send("#{namespace}_#{controller.controller_name}_path") current = controller.controller_name == resource.root.controller_name yield title, path, current end end def puffer_stylesheets stylesheet_link_tag *Puffer.stylesheets.map {|path| "/puffer/stylesheets/#{path}"}.uniq.compact end def puffer_javascripts javascript_include_tag *Puffer.javascripts.map {|path| "/puffer/javascripts/#{path}"}.uniq.compact end def render_head field field.label end def render_field field, record if field.options[:render] case field.options[:render] when Symbol then res = send(field.options[:render], record) when Proc then res = field.options[:render].bind(self).call(record) else '' end else res = record.call_chain(field.field) end unless field.native? url = edit_polymorphic_path [resource.namespace, record.call_chain(field.path)] rescue nil res = link_to res, url if url end res end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
puffer-0.0.18 | app/helpers/puffer_helper.rb |
puffer-0.0.17 | app/helpers/puffer_helper.rb |
puffer-0.0.16 | app/helpers/puffer_helper.rb |