Sha256: 70561519dc654cf031d0eb64bbb1c0ad80aee666a7a279d75c978bbb96f5086c

Contents?: true

Size: 771 Bytes

Versions: 13

Compression:

Stored size: 771 Bytes

Contents

require_dependency "think_feel_do_dashboard/application_controller"

module ThinkFeelDoDashboard
  # Provide access to data exports.
  class ReportsController < ApplicationController
    rescue_from ActionController::MissingFile, with: :missing_report

    def index
      authorize! :read, "Reports"
      fetch_reports
    end

    def show
      authorize! :read, "Reports"
      file_path = reporter.file_path(params[:id]) || {}

      respond_to { |fmt| fmt.csv { send_file file_path, type: "text/csv" } }
    end

    private

    def missing_report
      redirect_to reports_url, alert: "Report not found"
    end

    def fetch_reports
      @reports = reporter.fetch_reports
    end

    def reporter
      ThinkFeelDoEngine::Reports::Reporter
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_dashboard-1.2.0.beta1 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.21 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.20 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.19 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.18 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.17 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.16 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.15 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.14 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.13 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.12 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.11 app/controllers/think_feel_do_dashboard/reports_controller.rb
think_feel_do_dashboard-1.1.10 app/controllers/think_feel_do_dashboard/reports_controller.rb