zurb / front-router

Generate AngularJS states from Front Matter in state templates. Used by Foundation for Apps.
MIT License
8 stars 3 forks source link

Route generation not respected #2

Open Dillie-O opened 9 years ago

Dillie-O commented 9 years ago

Greetings guys,

I've been working on updating my routes, and if I'm following documentation so far, I'm doing things simple. I have three pages...


---
name: groups
url: /groups
controller: GroupsController

---

---
name: groups.add
url: /add
controller: GroupsController

---

---
name: groups.view
url: /view/{groupId}
controller: GroupsController

---

When I gulp and launch this, the groups route works, but the view and add routes don't seem to work. When I check the generated routes.js file, I find that the routes aren't appending the groups title in front of them, like the documentation indicates it should:

https://www.evernote.com/l/ACLigBmwLB1NfrJ7J6ssCLWIxgKAjbwyJps

Any idea why this might be happening? I'd also love to be able to use a route such as groups/1 in order to view the group, but that seems off as well. When I was using an older version of Foundation for Apps, I ran into similar issues, but wound up going around it by simply naming my views "AddGroup", "ViewGroups" and so on and putting the full path in, but that gives me grief as well now, especially with the "/groups/add" vs the "/groups/1" to view a group.

If you want to log in and track this in action, you can go here: http://prayerjournal.apphb.com

Use the test credentials: User: DaBean Password: test1234%

Thanks!

Dillie-O commented 9 years ago

I should add that I'm using ui-sref for all of my links, for what it's worth.

Dillie-O commented 9 years ago

One more update. It seems for the time being that the only way for me to get the routing to work is to redefine my front matter as follows

---
name: Groups
url: ^/groups
controller: GroupsController
---

---
name: AddGroup
url: ^groups/add
controller: GroupsController
---

---
name: ViewGroup
url: ^groups/view/{groupId}
controller: GroupsController
---

Note the use of unique names and not the dot notation in some of the examples. I'm still also encountering the issue where if I have my ViewGroup url be group/{groupId} there is a conflict between that and the "add" URL. It's almost as if the routing is treating "add" as an Id and attempting to load a group, at least that's how my templates are looking.

Hopefully this helps diagnose things, or my ignorance. 8^D

gakimball commented 9 years ago

Hey, sorry for not getting to this sooner! Did you see this behavior with the old plugin, or did this only happen when you switched to the new standalone one?

The code of the two is identical, but maybe we can narrow the source of the issue.

Dillie-O commented 9 years ago

Yes, I was seeing this in the older version as well. I discovered that I did some odd url naming like AddPrayer, ViewGropu{id} and such to work around it at the time

gakimball commented 9 years ago

Alright, looking into it shortly...

gakimball commented 9 years ago

The output of the plugin seems correct, so maybe it's related to how the data is handed over to ui-router, which happens in the foundation.dynamicRouting module.

Dillie-O commented 9 years ago

Something I can do on my end to help diagnose / test?

gakimball commented 9 years ago

Admittedly the Foundation team is kind of tied up right now working on Foundation 6, so I don't know when I'll be able to address this in earnest :< If you want to try and figure out what combination of parameters work together and which ones don't, it would be really helpful.

I can also hook you up with some Foundation swag sometime, since you've been a faithful user and contributor for a while ;)

Dillie-O commented 9 years ago

Understandable. I'm excited to see Foundation 6, based on the blog post I read! I'll see if I can track down things and update this ticket.