Sha256: 8c0272942f68c5b2d82950e3f9e52f3d30894b208841c2bc0cdff1691a6ea2d8

Contents?: true

Size: 981 Bytes

Versions: 17

Compression:

Stored size: 981 Bytes

Contents

module Refinery
  module <%= namespacing %>
    class <%= class_name.pluralize %>Controller < ::ApplicationController

      before_filter :find_all_<%= plural_name %>
      before_filter :find_page

      def index
        # you can use meta fields from your model instead (e.g. browser_title)
        # by swapping @page for @<%= singular_name %> in the line below:
        present(@page)
      end

      def show
        @<%= singular_name %> = <%= class_name %>.find(params[:id])

        # you can use meta fields from your model instead (e.g. browser_title)
        # by swapping @page for @<%= singular_name %> in the line below:
        present(@page)
      end

    protected

      def find_all_<%= plural_name %>
        @<%= "all_" if plural_name == singular_name %><%= plural_name %> = <%= class_name %>.order('position ASC')
      end

      def find_page
        @page = ::Refinery::Page.where(:link_url => "/<%= plural_name %>").first
      end

    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
refinerycms-core-2.1.5 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.1.4 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.1.3 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.1.2 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.1.1 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.1.0 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.0.10 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.0.9 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.0.8 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.0.7 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.0.6 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb
refinerycms-core-2.0.5 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb
refinerycms-core-2.0.4 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb
refinerycms-core-2.0.3 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb
refinerycms-core-2.0.2 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb
refinerycms-core-2.0.1 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb
refinerycms-core-2.0.0 lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb