kennethlynne / generator-angular-xl

An opinionated kickstarter for your next large scale AngularJS application
http://kennethlynne.github.io/generator-angular-xl/
92 stars 12 forks source link

Controllers / states - improving folder structure #133

Open grabbou opened 10 years ago

grabbou commented 10 years ago

When creating state, e.g.

yo angular-xl:state users

I am getting folder users/index/index-controller.js which is correct. The problem is when I enter e.g.

yo angular-xl:state users/edit

That command creates users/edit/index/edit-controller.js and that has to be improved. The additional "index" folder here is useless and makes project a bit disorganized in my opinion.

I suggest:

1. The easiest way is to force users to use controller/action pattern, so to accomplish the first example, they should run

yo angular-xl:state users/index

(that command would create states/users/index/)

In the second example, the command would create simply states/users/edit/ which is a correct way to create multiple views.

2. If no action specified, assume it's 'index'. If action is specified (e.g. users/edit), skip appending index to the src.

I am able to create PR for that as currently I had to customize that in my project :)

kennethlynne commented 10 years ago

Sorry for getting back to you on this half a year after your issue was created!

I agree that this pattern might be a bit unclear, but if I understand you correctly it will cause the index states files to be in a top level folder, so that if one chose to create another state at users/edit/confirm it would mix index states files with subfolders for the other states? I think I prefer the way it currently works, but I might not have appreciated and understood your suggestion fully.

Thanks for your interest in contributing and letting me know about this issue!