Sha256: e5cdd8ac53a1added2b0757f57e9581d8b6d66b0394bdad943fa5c29eabf95b9

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require_dependency "ishapi/application_controller"

class Ishapi::MapsController < Ishapi::ApplicationController
  before_action :check_profile, only: [ :show ]

  def show
    @location = ::Gameui::Map.unscoped.find_by slug: params[:slug]
    @map = @location.map || @location
    authorize! :show, @map
    @newsitems = @location.newsitems

    ##
    ## @TODO: absolutely change this!
    ##

    @markers = @map.markers.where( is_active: true )
    if @current_user
      a = @current_user.profile.shared_markers.unscoped.where( is_active: true, map_id: @map.id ).to_a
      @markers = @markers + a
    end

    # 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

  end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ishapi-0.1.8.168 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.167 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.166 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.165 app/controllers/ishapi/maps_controller.rb