Sha256: 2e1704d21354ff5475862e517dd9f43126d088f571ac28279221e178f901994b

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

require_dependency "ishapi/application_controller"

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

  def show
    @location   = ::Gameui::Map.where( slug: params[:slug] ).first
    @location ||= ::Gameui::Map.find params[:slug]
    @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_user.profile).order_by(ordering: :asc)

    @tags = @map.tags

    # 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

  end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ishapi-0.1.8.190 app/controllers/ishapi/maps_controller.rb