Skip to content

Commit

Permalink
Fixed some minor typos. Should be able to correctly select a page.
Browse files Browse the repository at this point in the history
  • Loading branch information
littlefyr committed Oct 3, 2008
1 parent 01e667b commit a438a99
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
37 changes: 37 additions & 0 deletions README
Expand Up @@ -10,3 +10,40 @@ I've made a few modifications to GeoKit to get it to work inside the extension a

* Geokit is included as a library to the extension rather than as a plugin
* All references to the configuration values have been changed to use Radiant::Config

== Finding Results in space

To process search requests for locations you must create a Location Page. use <r:location> to find and return locations.

The parameters you can use to "find" locations are:

=== start point

The start point is some point in space relative to which we will find locations. This allows a user to say "Find location near Main Street and First Street, My Town, BC, Canada".

When a start value is specified (using either *address* or *lat*&*lng*), then it will be always be used to calculate a distance to each returned location. If a distance is requested, we will return all the locations with that distance of the start point.

==== *address*

If supplied, this will be an address that will be geocoded using the configured geocode providers. Once a latitude & longitude are calculated, they form the start point for the request.

==== *lat* & *lng*

If both parameters are supplied, they are used as the start point. They always take precedence over *address*.

=== *distance*

When specified, all the locations within this distance of the start point are returned. If no distance is specified, _all_ locations are returned

=== *units*

The units are used for calculating distance from a location to the start point. The default value is "km"

=== *count*

The number of results to return. Defaults to returning ALL results

=== *offset*

The number of the first result to return. This allows you to build pagination into your code

16 changes: 9 additions & 7 deletions app/models/location_page.rb
Expand Up @@ -53,10 +53,10 @@ class LocationPage < Page
tag "location:count" do |tag|
tag.locals.locations.length
end
tag "location:each:has_next?" do |tag|
tag "location:has_next?" do |tag|
(tag.locals.locations.length - tag.locals.location_index) > 1
end
tag "location:each:index" do |tag|
tag "location:index" do |tag|
tag.locals.location_index
end

Expand All @@ -83,19 +83,21 @@ class LocationPage < Page

desc %{Allows you to use page tags (such as <r:slug>, <r:title>, etc.) for the page associated with the location.}
tag "location:page" do |tag|
if tag.locals.location.page?
tag.locals.page = Page.find_by_path tag.locals.location.page
if tag.locals.location.page_path?
tag.locals.page = Page.find_by_url tag.locals.location.page_path
tag.expand
end
end
tag "location:unless_page" do |tag|
unless Page.find_by_path tag.locals.location.page
unless Page.find_by_url tag.locals.location.page_path
tag.expand
end
end
tag "location:if_page" do |tag|
return unless tag.locals.location.page?
if Page.find_by_path tag.locals.location.page
return unless tag.locals.location.page_path?
printf tag.locals.location.page_path

if Page.find_by_url tag.locals.location.page_path
tag.expand
end
end
Expand Down

0 comments on commit a438a99

Please sign in to comment.