Sha256: 313ee2736a9cca6e0a25314e9b1bbd89ad09e3b9d8f85346dc9b0575a3b1e801
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 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 = polymorphic_url [namespace, controller.model] 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 = polymorphic_url [namespace, controller.model] current = controller.controller_name == resource.root.controller_name yield title, path, current end end def render_head field field.human 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.to_s) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puffer-0.0.20 | app/helpers/puffer_helper.rb |