Class: Ishapi::LocationsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Ishapi::LocationsController
- Defined in:
- app/controllers/ishapi/locations_controller.rb
Overview
supersedes Ishapi::MapsController
Instance Method Summary collapse
Methods inherited from ApplicationController
#exception, #home, #long_term_token, #vote
Instance Method Details
#show ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/ishapi/locations_controller.rb', line 11 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 :show, @location map = @location.map || @location # @TODO: remove _vp_ 2023-03-20 @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 respond_to do |format| format.json do render 'show' end format.html do render 'show' end end end end |
#show_marker ⇒ Object
47 48 49 50 51 |
# File 'app/controllers/ishapi/locations_controller.rb', line 47 def show_marker @marker = ::Gameui::Marker.find_by slug: params[:slug] :show, @marker render json: @marker end |