Layout handling in travis-web was implemented in a dynamic way, so we
could change a main layout from any of the routes. This needed a
`rerender` call which was making things harder and needed some hacks. It
also broke a few transitions when upgrading to 1.8.1.
After examining our usage of layouts I've noticed that we don't need to
change the entire layout dynamically and instead we can set layout on
root routes (like "index", "profile" and other root routes).
We set job and build directly on repo controller for routes like job,
build and repo.index. We also need to clean that up when we exit to not
show for example download log button when we switch to different route.
When I started working on settings I had a bit different vision on tabs
and I've added that code prematurely. It seems that the best way to go
is to create separate routes and controllers for each tab - that way we
can just rely on Ember.js for customizing, not some custom code in tabs
helpers etc.
This commit changes a way we load accounts for profile view:
* instead of using several views with profile controllers, always use
one view to render hooks. This is achieved by redirecting to
individual account page from main profile page (for example when going
into /profile as a user drogus, the effective address will be
/profile/drogus)
* instead of using observers to wait for accounts to load I just use
promise in ProfileRoute#model which effectively ensures that accounts
are loaded at the time we want to select an individual account
* profile controller is split into profile and account controller
Specyfing "pane" as an outlet name here was a legacy thing. In current
form it doesn't give us anything and results in more code, as we need to
specify outlet everytime we want to render something there.
We use promise when fetching a repository which means that any nested
routes already have all the repository data loaded. Thanks to that there
is no need to setup observers, we can check what to render right away in
RepoIndexRoute
This is a leftover from previous version of auth code. The purpose of
this code was to redirect to index if we're on auth route and user is
already signed in. This may happen only when we use autoSignIn which is
synchronuous, so it should be fine to just check if user is signed in
and redirect to index there.
* don't use __container__
* register it as a factory on container and inject into routes and
controller
* avoid afterSignIn errors by checking on hooksTarget, ApplicationRoute
should register itself as a hooksTarget
* keep user info on auth
Rendering views outside of routes cycle seems problematic at the moment,
so redirection is our best bet. However, the way I initially did it in
cc90200 causes problems for people who don't have any own repositories
set up for Travis CI, but still want to log in and browse around -
rendering getting started page as a full page hides left sidebar with a
list of repositories.
This commit changes getting started page to render in the main outlet,
just as before redirection changes.
It would be nice to allow to just render getting started page, but
because of the way we manage layouts, it's hard to get it running
without weird bugs popping up now and then. This should be easier to
achieve once the templates are cleaned up to use better laout
management.
I found the commit that caused the bug that caused me to do the last
revert. I'm therefore reverting the previous revert and I will be
committing a revert that reverts the commit that introduced the bug. See
next commit.
This reverts commit db2d38a7af.
A better way is to provide Travis.Route, which will be used by default
when generating route objects.
There is also no need to define actions for all the routes as they are
needed only in ApplicationRoute (ie. when they're not handled by other
routes).
By default Ember.js will use either IndexLoadingRoute or index/loading
template. Before this commit we were specyfing IndexLoadingRoute, which
was renderring index_loading template. This is not needed as long as we
use index/loading template - the effect is the same, but we use a
default.