How to load page in application.hbs? - ember.js

I want to load a connexion page then a home page with a navbar etc...
My problem is about {{partial}} and {{outlet}}.
I don't really understand because when I {{#link-to}} my next home page, connexion is still here... I don't know what instruction write in application.hbs in order to load Connexion.hbs then index.hbs with navbar... Can someone help and explain me ?
I just want to load connexion.hbs when I load my website, then I click on "sign in" I want to load another page with a navbar (I already have this code, thanks bootstrap) and home page. I just need some link between my pages.
EDIT : I changed my connexion.hbs route's path into / everything is ok now ! Thanks !

First: never use {{partial}}!
Next everything you put in the application route is visible the whole time! So thats usually only your navigation.
Different pages you want should be different routes. The first route visible is the index route.

Related

How to disable ember-fastboot after site already loaded locally?

This is related to a post I recently made regarding ember-fastboot and saving a webpage for offline viewing.
I am making a separate post because I believe this is more an ember-fastboot question and isn't specific to the website I am trying to save for offline viewing.
Basically, I am trying to find out how, on the local end, to completely override ember. That is, since I already have open in my browser the rendered page, what does one need to do in order to save the page such that when opened later locally as offline page, the page appears the same way it did when rendered in the first place?
It seems like I am in a paradox. I have a rendered page, with content such as a javascript media player. I save rendered page. I then open the locally saved, rendered page but then the ember javascript kicks in and alters the page, such that the javascript media player no longer loads, due to ember altering a div's class name to specify that the player is not booted! The thing is, once rendered, I don't need ember doing anything, as I am just interested in viewing a frozen copy of the rendered page with no interest in subsequent connections to the rendering server.
Anyway, hope someone can shed some light on this.
Thanks!
You could remove <script> tags from the index.html after saving it. That would prevent the app from starting, leaving the pre-rendered HTML intact.
You might need to split the JS bundle if you need a JS player to be running independently. Splitting the bundle is an advanced technique. If you need it, please ask a separate question.

Using Ember.js in Existing Application

I've done some example apps in Ember, and now I'm ready for using it in existing application. Its traditional web application (request-response, full reload and some ajax loaded content, no rest/api things)
So lets assume I've few page (urls) like
1 abc.com/home.php
2. abc.com/support.php ,
3. abc.com/support.php?call=meeting
and so on..
so is it possible to use just one url with ember app and rest leave as such untill its ready?
PS: I did try for support.php as this.route("support",{path:"/support.php"}) and have SupportController and support.hbs template but its not working. I'm not sure how to put it in jsfiddle.
Thanks
Include your ember app only on the page that needs it, so only on abc.com/support.php
As far as ember can see, when you go to abc.com/support.php you are on the index page (of the ember app), and you will need to use the index.hbs tempate.

ember.js panel update on route transition

I'm trying to set up an ember.js application where I have two panels side by side on a page. There's a link from one panel and when you click on it, it transitions to another route and the template for this route loads in the second panel -- but the first panel doesn't change. I haven't been able to get this working. I click on the link and the second panel loads, but the first panel is emptied. Can someone point me to a place that might have some more info on how to do this -- or a simplistic jsbin. Both would be incredibly helpful. Thank you!
In this case your second panel would best be served by being a child of the first panel.
App.Router.map(function() {
this.resource('panel1', function(){
this.resource('panel12');
this.resource('panel13');
})
});
Example: http://emberjs.jsbin.com/mimoteba/1/edit

Ember.js hybrid application - maybe embeded outlets

I am creating an Ember.js application which basically has a very simple UI: header, content, footer -- all this in the application layer.
But, when you see the site at first, you have a hybrid application -- google needs to reach parts of it, but login, registration, dashboard, and other pages, should be handled by Ember.
And I might have a bit of an issue, because if I render some views, say on the homepage, in some outlets, then those outlets are going to be different after login, on the user's dashboard.
I cannot show off the UI, but i could try to provide more details if needed.
My question would be how to handle this issue?
I used a bit of a hack for now: just before Ember initialize, I remove from the DOM the content rendered server-side.
This might be ugly, but it works. This way robots may reach the content I want them to reach, the users on the other hand will see something better.

Choose the start page django-cms

The django-cms always uses the top-most page as the start/landing page. I now want to have a navigation that looks like this foo-home-bar and home to be the landing page.
One way would be to add a dummy page at / that redirects to /home, but this seems a bit crude to me. Is there any better solution? I don't mind changing the code of the cms itself.
The easiest way, instead of creating a page that redirect is to just use django's redirect generic view.
set it in your top level urls.py
url(r'^$', RedirectView.as_view(url='/home/')),
and of course add the from django.views.generic.base import RedirectView import at the beginning and you should be all set.
('^$' only catches the root url and the RedirectView redirect wherever you want. I was a bit unsure about using it myself, but I saw a lot of major websites doing a redirect when you get on to their site...)
The first page you make seems to be the home page, simply add other root pages as needed and enable navigation on them. This is what i have done.
Our first page was test, and then some child pages. in the admin page you can click and drag the pages around to change the child/parent order. we renames test to home and shifted the child pages to another root page.
You can also override the default menu by make a template in menu/menu.html
In there you could override the order by adding in some if statements.
You could also hardcode it in your base.html having the menu something like:
<ul id=menu>
<li><a href="/foo/>foo></a></li>
<li>Home</li>
{% show_menu %}
<ul>
And just have bar and the other pages you wanted in the navigation but not foo or home.
The homepage has an icon on it that the other pages wont, denoting the root page I guess.
The page with the lowest-numbered tree_id in the cms_page table is the home page. This will normally be the first page that you created. If you want to make a different page your home page, you can manually change the tree_id values in your database (but unfortunately not by using the admin.)