Skip to content

Instantly share code, notes, and snippets.

@jcasimir
Created July 20, 2010 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcasimir/483537 to your computer and use it in GitHub Desktop.
Save jcasimir/483537 to your computer and use it in GitHub Desktop.
module PlacesTags
include Radiant::Taggable
include PlacesHelper
tag 'place' do |tag|
tag.locals.place = Place.find_by_url(@request.request_uri) if tag.locals.place.nil?
tag.expand
end
desc 'Finds all places'
tag 'places' do |tag|
tag.locals.places = Place.all
tag.expand
end
tag 'places:each' do |tag|
tag.locals.places.collect do |place|
tag.locals.place = place
tag.expand
end
end
tag 'place:thumbnail' do |tag|
tag.locals.place.thumbnail
end
tag 'place:badge_classes' do |tag|
tag.locals.place.badge_classes
end
tag 'place:path' do |tag|
"/places/" + tag.locals.place.to_param
end
tag 'place:title' do |tag|
tag.locals.place.title
end
tag 'place:description' do |tag|
tag.locals.place.description
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment