Class: Refinery::LocationExplorer::Location

Inherits:
Core::BaseModel
  • Object
show all
Defined in:
app/models/refinery/location_explorer/location.rb

Instance Method Summary collapse

Instance Method Details

#colourObject



32
33
34
# File 'app/models/refinery/location_explorer/location.rb', line 32

def colour
  colour_override
end

#description_previewObject



15
16
17
18
19
20
21
# File 'app/models/refinery/location_explorer/location.rb', line 15

def description_preview
  if description
    matches = description.match(/<p>(.*)<\/p>/)
    text = matches ? matches[1] : description
    text.truncate(200)
  end
end

#detail_urlObject



36
37
38
# File 'app/models/refinery/location_explorer/location.rb', line 36

def detail_url
  "/location_explorer/#{to_param}"
end

#latlngObject



23
24
25
# File 'app/models/refinery/location_explorer/location.rb', line 23

def latlng
  [latitude, longitude] if latitude && longitude
end

#preview_image_urlObject



27
28
29
30
# File 'app/models/refinery/location_explorer/location.rb', line 27

def preview_image_url
  image = images.first
  image.thumbnail("253x160#c").url if image
end