Skip to content

Location Dynamic Web Routes #85

@drewroberts

Description

@drewroberts

I want web routes (TIPOFF/support#113) created for this package that all other packages requiring tipoff/locations should be able to extend. The routes will be based on the number of Locations (#42) that exist in the Markets (#41) and should be dynamic.

If an application only has 1 Market and 1 Location, then any visits to the Market slug or the Location slug under that market should be redirected to the homepage.

If an application has more than 1 Market but there is only 1 Location in a Market, then the Location slug will redirect to the Market slug to which the Location belongs.

If an application has multiple Locations in a Market, then those Locations will have their own pages under the Market path, even if there is only 1 Market in the application. They will exist in the following format:

example.com/{market->slug}/{location->slug}

Location slugs are unique so a website visitor that ends up on a Location slug under the wrong Market slug should be redirected to the correct path for the Location nested under the correct Market slug.

This package should also contain a Controller and base Views for the following:

  • Market View
  • Location View
  • Choose a Location in Market View (will be used in the example below)
  • Choose a Location under Company path (lists all Locations in application)

This package will also contain an "About Us" style page and generate a Page (drewroberts/blog#15) with that as the slug.

All packages that extend this tipoff/locations package should be able to implement their own web routes with location-based pages. These Pages will be persisted with their slug in the database and have a true boolean value for location_based (drewroberts/blog#54) in that model. The structure for the URL path of those location-based pages will be dynamic as follows:

// Example A - Market with multiple Locations:
example.com/{market->slug}/{location->slug}/{location_based_page->slug}

// Example B - Market with only 1 Location:
example.com/{market->slug}/{location_based_page->slug}

// Example C - application with 1 Market & 1 Location:
example.com/company/{location_based_page->slug}

If the application has more than 1 location, then the path in Example C should not return the view for the Page but should return the "Choose a Location under Company" view from this package.

The path in Example B should display the "Choose a Location in Market" view from this package if the Market has more than 1 Location.

As a result of all of this, an exception needs to be thrown when creating a Location if a Page already has a slug that matches the proposed Location slug. There can't be a conflict between them.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions