Sha256: e06711e143cc92008aefbdb0650b70a610ab9488a7f4a78607ba87d154096bbe

Contents?: true

Size: 471 Bytes

Versions: 2

Compression:

Stored size: 471 Bytes

Contents

module Schofield

  module Generators

    class Navigation

      def self.generate
        Levels.all.select(&:routes?).inject("\n    %ul\n      %li.toplevel") do |memo, level|
          memo += "\n\n      - if permitted_to?(:read, :#{level.name.pluralize})"
          memo += "\n        %li{ :class => nav_classes('#{level.model.name}') }= link_to '#{level.model.name.titleize.pluralize}', admin_#{level.name.pluralize}_path"
        end
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schofield-0.3.1 lib/generators/schofield/navigation.rb
schofield-0.3.0 lib/generators/schofield/navigation.rb