Sha256: 9e0c27216bce51d630526309d4798c40e4753053ac82746a0d7e1e4bd97bd8fe

Contents?: true

Size: 985 Bytes

Versions: 8

Compression:

Stored size: 985 Bytes

Contents

# Base menu for sections. Also used on admin/sections/new.
class Admin::Sections::Menu < Adva::View::Menu::Admin::Actions
  include do
    def main
      if collection?
        index
      else
        resource_label
        show
        edit unless page?
      end
    end

    def right
      new if collection?
      destroy if edit?
      reorder if index? && collection.size > 1
    end

    protected

      def index
        item(:".sections", index_parent_path(:sections))
      end

      def reorder
        super( :'data-resource_type' => 'site', :'data-sortable_type' => 'sections')
      end

      def page?
        resource.is_a?(Page)
      end

      def edit
        item(:'.edit_section', edit_path)
      end

      def active?(url, options)
        # hmmm ...
        types = Section.types.map { |type| type.underscore.pluralize }.join('|')
        return false if url =~ %r(/admin/sites/\d+/#{types}/\d+$) && request.path != url
        super
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
adva-core-0.0.14 app/views/admin/sections/_menu.html.rb
adva-core-0.0.13 app/views/admin/sections/_menu.html.rb
adva-core-0.0.9 app/views/admin/sections/_menu.html.rb
adva-core-0.0.8 app/views/admin/sections/_menu.html.rb
adva-core-0.0.7 app/views/admin/sections/_menu.html.rb
adva-core-0.0.6 app/views/admin/sections/_menu.html.rb
adva-core-0.0.5 app/views/admin/sections/_menu.html.rb
adva-core-0.0.4 app/views/admin/sections/_menu.html.rb