Sha256: 8b9821bc35ee06fe27a585076c5d064a202dec199c3b43b5b4e06c1d80f3da1c

Contents?: true

Size: 840 Bytes

Versions: 52

Compression:

Stored size: 840 Bytes

Contents

require_dependency "ishapi/application_controller"
module Ishapi
  class ReportsController < ApplicationController

    def show
      @report = Report.unscoped.find_by :slug => params[:slug]
      authorize! :show, @report
    end

    def index
      authorize! :index, Report
      @reports = Report.all
      if params[:cityname]
        city = City.find_by :cityname => params[:cityname]
        @reports = @reports.where( :city_id => city.id )
      end
      if params[:domain]
        site = Site.find_by :domain => params[:domain], :lang => :en
        @reports = @reports.where( :site_id => site.id )
      end

      if params[:tag]
        tag = Tag.find_by(:name => params[:tag])
        @reports = @reports.where(:tag_ids => tag)
      end

      @reports = @reports.page( params[:reports_page] ).per( 10 )
    end

  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
ishapi-0.1.8.212 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.211 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.210 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.209 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.208 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.206 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.205 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.204 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.203 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.202 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.201 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.200 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.199 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.197 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.196 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.195 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.194 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.193 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.192 app/controllers/ishapi/reports_controller.rb
ishapi-0.1.8.191 app/controllers/ishapi/reports_controller.rb