Sha256: b3b1167c7ed88bbdf26e8572fb8307dda0303086b4a6ee365a1236091a81b9aa

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

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

    before_action :check_profile, only: [ :show ]

=begin
    def index
      authorize! :index, ::Gameui::Map
      @maps = ::Gameui::Map.all
    end
=end

    def show
      @map = ::Gameui::Map.find_by slug: params[:slug]
      @markers = @map.markers.where( is_active: true )
      @newsitems = @map.newsitems

      case @map.ordering_type
      when ::Gameui::Map::ORDERING_TYPE_ALPHABETIC
        @markers = @markers.order_by( name: :asc )
      when ::Gameui::Map::ORDERING_TYPE_CUSTOM
        @markers = @markers.order_by( ordering: :asc )
      end

      # @TODO: move to models
      if city = City.where( cityname: @map.slug ).first
        @newsitems = city.newsitems
        @galleries = city.galleries
        @reports = city.reports
        @videos = city.videos
      end

      puts! @map, 'prod map'

      authorize! :show, @map
    end

    def show_marker
      @marker = ::Gameui::Marker.find_by slug: params[:slug]
      authorize! :show, @marker
      render json: @marker
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ishapi-0.1.8.154 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.153 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.151 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.150 app/controllers/ishapi/maps_controller.rb