Class: App::Views::PlacesShow

Inherits:
Layout
  • Object
show all
Includes:
App::ViewHelpers
Defined in:
app/views/places_show.rb

Instance Method Summary collapse

Methods included from App::ViewHelpers

#add_book_button, #admin, #admin?, #app_name, #base_url, #book_permitted, #count_instances, #external_link_glyph, #flag_modal_button, #flags, #get_instances_per_page, #instance_permitted, #instances_by_names, #javascripts, #json_file, #logged_in, #map_height, #metadata, #not_empty, #place_permitted, #rendered_flash, #stylesheets, #user_name

Methods inherited from Layout

#page_title, #selected_item

Instance Method Details

#confidence_class(place) ⇒ Object


35
36
37
38
39
40
41
42
# File 'app/views/places_show.rb', line 35

def confidence_class(place)
  case place.confidence
  when "2" then "bg-warning"
  when "1" then "bg-warning"
  when "0" then "bg-danger"
  else ""
  end
end

#mappable_placesObject


20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/views/places_show.rb', line 20

def mappable_places
  mappable_places = @places.select{ |p| p.confidence != "0" }
  mappable_places.map do |p|
    {
      slug: p.slug,
      lat: p.lat,
      lon: p.lon,
      name: p.name,
      instances: p.instances.count,
      place_names: p.names_to_sentence.gsub!(/"/, '\"'),
      confidence: p.confidence
    }
  end
end

#placesObject


7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/views/places_show.rb', line 7

def places
  @places.map{ |p| { 
    slug: p.slug,
    lat: p.lat,
    lon: p.lon,
    name: p.name,
    instances: p.instances.count,
    flagged: p.flagged,
    note: not_empty(p.note),
    confidence_class: confidence_class(p)
  } }
end