Sha256: 7b236da5b5fc91a2158aea57285b4fd9a2a677ac41eb7e3ca9eea183d2fd1dd0

Contents?: true

Size: 1009 Bytes

Versions: 8

Compression:

Stored size: 1009 Bytes

Contents

require_dependency "ishapi/application_controller"
module Ishapi
  class MapsController < ApplicationController
    before_action :check_profile, only: [ :show ]

    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: figure this out eventually
      if city = City.where( cityname: @map.slug ).first
        # @newsitems = city.newsitems
        @galleries = city.galleries
        @reports = city.reports
        @videos = city.videos
      end

      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

8 entries across 8 versions & 1 rubygems

Version Path
ishapi-0.1.8.162 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.161 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.160 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.159 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.158 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.157 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.156 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.155 app/controllers/ishapi/maps_controller.rb