Sha256: b731ec8d3a6b626060fa610e4759b75276effe3be804f6216eaeacb9f232d99f

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

module Helena
  module Admin
    class SessionsController < Admin::ApplicationController
      respond_to :html

      before_filter :load_survey, :add_breadcrumbs

      def index
        respond_to do |format|
          @sessions = @survey.sessions.desc(:created_at)
          format.html
          format.json { render json: @sessions }
          format.csv { render text: @sessions.to_csv }
        end
      end

      def destroy
        @session = @survey.sessions.find_by id: params[:id]
        notify_successful_delete_for(@session.token) if @session.destroy
        respond_with @session, location: admin_survey_sessions_path(@survey)
      end

      private

      def load_survey
        @survey = Helena::Survey.find params['survey_id']
      end

      def add_breadcrumbs
        add_breadcrumb Helena::Survey.model_name.human(count: 2), :admin_surveys_path
        add_breadcrumb @survey.name, admin_survey_sessions_path(@survey)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helena-0.3.3 app/controllers/helena/admin/sessions_controller.rb