Sha256: 6fe67f2bbc157a596b7edadb7edeb1d472bb3b0be9f962492fb78299b572da8b
Contents?: true
Size: 1.61 KB
Versions: 8
Compression:
Stored size: 1.61 KB
Contents
class Layouts::Admin::Top < Adva::View::Menu::Admin id :top include do def main if site.try(:persisted?) sites_menu sections_menu unless site.new_record? item(:'.assets', url_for([:admin, site, :assets])) if defined?(Asset) else item(:'.sites', url_for([:admin, :sites])) end end def right if site.try(:persisted?) item(:'.settings', url_for([:edit, :admin, site])) end end protected def sites_menu label(site.name, url_for([:admin, :sites])) do ul(:class => 'sites') do sites.each do |site| item(site.name, url_for([:admin, site])) unless site.new_record? end item(:'.new_site', url_for([:new, :admin, :site])) render_items end end end def sections_menu item(:'.sections', url_for([:admin, site, :sections])) do ul(:class => 'sections') do site.sections.each do |section| item(section.name, url_for([:admin, site, section]), :class => :section) end item(:'.new_section', url_for([:new, :admin, site, :section])) render_items end end end def sites Site.all end def active?(url, options) return false if url =~ %r(/admin/sites$) && request.path !~ %r(/admin/sites(/\d+?)?$) super end def path_and_parents(path) paths = super paths.detect { |path| path.gsub!(/(#{Section.types.map(&:tableize).join('|')})$/) { 'sections' } } paths end end end
Version data entries
8 entries across 8 versions & 1 rubygems