Skip to content

Commit

Permalink
Cleanup client app bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ericf committed Jul 19, 2013
1 parent 6d07e2f commit 9d09c23
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions views/layouts/main.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,33 @@
{{{state}}}
app.yui.use('pnm-app', 'ios-oc-fix', function (Y) {
var routes = PNM.ROUTES;
obj = new Y.PNM.App({
container : '#wrap',
viewContainer: '#main',
var routeConfigs = PNM.ROUTES,
app;
transitions : true,
serverRouting: true
});
app = new Y.PNM.App({
container : '#wrap',
viewContainer: '#main',
transitions : true,
serverRouting: true
});
// Setup routes.
Y.Array.each(obj.namedRoutes, function (route, i) {
obj.route(routes[route.name].path, route.callbacks);
obj.get('routes')[i].name = route.name;
Y.Array.each(app.namedRoutes, function (route, i) {
var routeConfig = routeConfigs[route.name];
if (routeConfig) {
app.route(routeConfig.path, route.callbacks);
app.get('routes')[i].name = route.name;
}
});
// Determine if the user needs to be located. When the app is saved to
// the home screen in iOS, always route to "/"" so geolocation lookup
// is preformed.
if (Y.config.win.navigator.standalone) {
obj.locate();
app.locate();
} else {
obj.render({rendered: true}).dispatch();
app.render({rendered: true}).dispatch();
}
});
Expand Down

0 comments on commit 9d09c23

Please sign in to comment.