Sha256: 596b209923fe57e19b1b1680ff75281894648abdff1054c26e39b1026f552d04

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

module Optimacms
  module Mycontroller
    #extend ActiveSupport::Concern

    #included do
    #  before_filter :my_set_render
    #end

    def my_set_render
      @is_optimacms = true

    end

    def default_render(*args)
      if self.controller_name!='pages' && !@optimacms_tpl.nil? && @is_optimacms
        render @optimacms_tpl, :layout=>@optimacms_layout and return
        #(render :text => "hello", :layout => @optimacms_layout) and return

        # http://stackoverflow.com/questions/21129587/ruby-on-rails-how-to-render-file-as-plain-text-without-any-html
        #render :plain will set the content type to text/plain
        #render :html will set the content type to text/html
        #render :body will not set the content type header.
        # render text: "some text". :plain does not work.
      end

      super
    end

    def my_set_render_template(tpl_view, tpl_layout)
      @optimacms_tpl = tpl_view
      @optimacms_layout = tpl_layout
    end

    def my_set_meta(meta)
      @optimacms_meta_title = meta[:title]
      @optimacms_meta_keywords = meta[:keywords]
      @optimacms_meta_description = meta[:description]
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
optimacms-0.1.36 lib/optimacms/mycontroller.rb
optimacms-0.1.34 lib/optimacms/mycontroller.rb
optimacms-0.1.32 lib/optimacms/mycontroller.rb
optimacms-0.1.31 lib/optimacms/mycontroller.rb
optimacms-0.1.28 lib/optimacms/mycontroller.rb
optimacms-0.1.27 lib/optimacms/mycontroller.rb
optimacms-0.1.25 lib/optimacms/mycontroller.rb
optimacms-0.1.24 lib/optimacms/mycontroller.rb
optimacms-0.1.23 lib/optimacms/mycontroller.rb
optimacms-0.1.21 lib/optimacms/mycontroller.rb
optimacms-0.1.19 lib/optimacms/mycontroller.rb
optimacms-0.1.17 lib/optimacms/mycontroller.rb