Sha256: 074d1f52011fad5b5c25c8a82afba43ea06bab42d40a88ba8103229038c42927

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module Surveyor
  module SurveyorAdminControllerMethods
    def self.included(base)
      # base.send :before_filter, :get_current_user, :only => [:new, :create]
      # base.send :layout, 'surveyor_default'
    end

    # Actions
    def new

    end

    def create
    end


    def show
    end

    def edit
    end

    def update
    end

    private

    # This is a hoock method for surveyor-using applications to override and provide the context object
    def render_context
      nil
    end

    # Filters
    def get_current_user
      @current_user = self.respond_to?(:current_user) ? self.current_user : nil
    end

    def set_render_context
      @render_context = render_context
    end

    def redirect_with_message(path, message_type, message)
      respond_to do |format|
        format.html do
          flash[message_type] = message if !message.blank? and !message_type.blank?
          redirect_to path
        end
        format.js do
          render :text => message, :status => 403
        end
      end
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
surveyor-1.2.0 lib/surveyor/surveyor_admin_controller_methods.rb
surveyor-1.1.0 lib/surveyor/surveyor_admin_controller_methods.rb
surveyor-1.0.1 lib/surveyor/surveyor_admin_controller_methods.rb