Sha256: 35d8ccd208adfc4477b59cfd9ba5ea57a0f630b1a4f4c9f737e931dfc2648f4d

Contents?: true

Size: 763 Bytes

Versions: 44

Compression:

Stored size: 763 Bytes

Contents

module Krikri
  ##
  # Handles requests for provider dashboards for 'All Providers' and
  # individual providers by ID.
  #
  # @see Krikri::Provider
  class ProvidersController < ApplicationController
    ##
    # Renders the index view with `@providers` as an Array of {Krikri::Provider}s.
    def index
      @providers = Krikri::Provider.all
    end

    ##
    # Renders the show view for the provider given by `id`.
    def show
      if params[:set_session]
        session[:current_provider] = params[:id]
        redirect_to :back, provider: params[:id]
      elsif params[:clear_session]
        session.delete :current_provider
        redirect_to providers_path
      end
      @current_provider = Krikri::Provider.find(params[:id])
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
krikri-0.5.3 app/controllers/krikri/providers_controller.rb
krikri-0.5.2 app/controllers/krikri/providers_controller.rb
krikri-0.5.1 app/controllers/krikri/providers_controller.rb
krikri-0.5.0 app/controllers/krikri/providers_controller.rb