Sha256: b0e91b7e203c79cfc90d0864763ce4f8badc1324bdfb79aeaa3567055cb3be19

Contents?: true

Size: 1.23 KB

Versions: 33

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
    if 'self' == params[:slug] # @TODO: constantize _vp_ 2023-01-11
      @location = ::Gameui::Map.where( slug: @current_profile[:email] ).first
    else
      @location   = ::Gameui::Map.where( slug: params[:slug] ).first
      @location ||= ::Gameui::Map.find params[:slug]
    end
    @map = @location.map || @location

    authorize! :show, @map

    @newsitems = @location.newsitems.page( params[:newsitems_page]
      ).per( @location.newsitems_page_size )

    @markers = @map.markers.permitted_to(@current_profile).order_by(ordering: :asc)
    # 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

    if @map.is_premium && !@current_profile.has_premium_purchase( @map )
      render 'show_restricted'
    else
      render 'show'
    end
  end

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

end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
ishapi-0.1.8.240 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.239 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.238 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.237 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.235 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.234 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.233 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.232 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.231 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.229 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.228 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.227 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.226 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.225 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.224 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.223 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.222 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.221 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.220 app/controllers/ishapi/maps_controller.rb
ishapi-0.1.8.219 app/controllers/ishapi/maps_controller.rb