Class: Ishapi::MapsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/ishapi/maps_controller.rb

Instance Method Summary collapse

Instance Method Details

#show ⇒ Object



7
8
9
10
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
# File 'app/controllers/ishapi/maps_controller.rb', line 7

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

#show_marker ⇒ Object



40
41
42
43
44
# File 'app/controllers/ishapi/maps_controller.rb', line 40

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