Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location Dynamic Web Routes #85

Open
drewroberts opened this issue Mar 25, 2021 · 5 comments
Open

Location Dynamic Web Routes #85

drewroberts opened this issue Mar 25, 2021 · 5 comments
Assignees

Comments

@drewroberts
Copy link
Member

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.

@pdbreen
Copy link
Contributor

pdbreen commented Mar 25, 2021

This

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

and this

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.

seem to indicate locations will now have a direct dependency on the blog package. This was supposed to be a lightweight package with no external dependencies (by inverting relations with the location_id in the external package and using a hasOne|belongsTo pair for Nova), but I'm seeing its now dependent on SEO and google api.

@drewroberts
Copy link
Member Author

This already needs a dependency on the drewroberts/media package for images, so I am fine with adding that other dependency and those subdependencies of drewroberts/blog

I'm not as concerned about this being a lightweight package. We're beginning to add more to tipoff/authorization and will be expanding tipoff/support with more theme template stuff. The packages in the tipoff ecosystem will take on a lot more opinionated implementations over time that will be assumed when using one of the packages and I am good with that as long as we continue to weigh the cost and benefit of those decisions like you do. Thank you, Patrick.

@pdbreen
Copy link
Contributor

pdbreen commented Mar 25, 2021

Shouldn't the blog package be responsible for registering an about-us route? Sounds like its just a blog page but with a custom route alias. I'd think all of that would be in blogs (other pages may benefit from aliasing as well).

I think all this package needs is a config setting that lists known bad market slug names (with ['company', 'about-us'] being the initial entries).

drewroberts added a commit that referenced this issue Mar 26, 2021
Add web routes for market, location pages.  Add Route::getLocation macro #85
@chx2 chx2 mentioned this issue Apr 1, 2021
4 tasks
drewroberts added a commit that referenced this issue Apr 9, 2021
Proposed Page Extension for Market & Location #85
drewroberts added a commit that referenced this issue Apr 10, 2021
…onship

Page Relationship on Nova Resources #85 #68
@drewroberts
Copy link
Member Author

@pdbreen I think this needs to be updated. I have not been able to get it to work in the tipoff/demo application.

@pdbreen
Copy link
Contributor

pdbreen commented Apr 12, 2021

Can you add details of what you're doing? What types of data are being added? How is that data being added? What routes are you trying to access after the setup?

AFAIK, there are no location aware routes defined in any packages, so the only thing that could work would be accessing the Page associated with a market or location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants