How to create generic popup for across the app? - ember.js

I am trying to create a popup which is available and controlled by across application.
so I keep the html assets in app template. and the I would like to show and hide the popup any page from the app.
I understand that, It can achivable by service. but I don't have much idea to implement this. any one suggest me the right way?
Required is : show popup from any page, close pupup on click of close button in the popup.
here is my Twiddle
In case of angular it can be achieved from factory object.

I would probably do this:
create a component for the popup
create a service for the popup that that exposes methods for setting a property called "isOpen" to true/false. Other parts of the app can use the methods for opening and closing the popup.
Inject the popup service into the application controller
Add it to the application template in an {{if popupService.isOpen}} block
Good luck, remember to write lots of tests, make sure each part is working before you go to the next step, and remember to consult the guides often ;-)

Related

How to Disable `back` and `forward` button of the browser window

In my applicaiton, I requried couple of things to be added.
No forward/Back Browser button should work for reach a hash.
Instead of brower back forward, there should be a back and forward button has to added in the applicaiton itself.
how to achive this both?
I am looking for a component to use globally for both 2 requriements.
Thanks in advance.
Disabling the native back/forward buttons of the browser in Ember.js is quite unusual but could possibly be achieved by using the NoneLocation class. To enable that open the config/environment.js file of your app and change the locationType property to none.
If you want to display back/forward buttons in your app you can use the History API and specifically window.history.back() and window.history.forward()

Create a web page in odoo 8

I create a web page in odoo 8,
I created a template in /mymodule/views/my_template.xml
<template id="dms_web_client.webclient_bootstrap1" name="FTP server Webclient">
<t t-call="website.layout">
<a id="create_new_directory" href="#" data-action="new_dir">New Directory</a>
</t>
</template>
When I click on a link New Directory I need to open up a pop up with a text box and file browse and save & cancel button. Like create a new page in website module.
I don't know what to do next. Please help.
If you need to interact with other models within your module (or even Odoo in general), you're probably going to want to create a controller, which can contain python code and allow your web page to interact with models. On a simple level, a controller can go in your main folder (ie /mymodule/my_template_controller.py) and be declared in your init.py file (import my_template_controller). You can then set a route that matches your template id and create forms that post to the controller, allowing python code to be run and models to be interacted with. That can allow you to have your file browse and save and cancel button.
As far as the front end, you can use html, css, and Javascript like any normal website and they can be declared via normal links in the page header.
Odoo does have some documentation, but it is pretty poor, unfortunately. It took me a long time to decipher how to fully build a web application within it. However, it works great once you figure it out and it generally follows the guidelines of any other model/controller/view application.
http://www.odoo.com/documentation/9.0/howtos/website.html
https://www.odoo.com/documentation/9.0/reference/http.html

¿How to use routes inside a Modal in Emberjs?

sorry for my English. I will try to explain better I can.
I have an application in EmberJS, this application have its routes. Also, when I click in a button, I should show a Modal Window and change the route. That problem was resolved. The problem is. This modal window must to be a kindly of wizard, so when the user click on next, I should to change the route and show inside the modal the correct content, when the user click in next again, the route must to change again but the new content should be showed into the modal too.
The problem seems to be, ember takes my application outlet and show the new content inside that outlet, not inside of the outlet defined into the modal.
How I achieve this?

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.

Reload googlemaps after user clicks a link in Django

I am doing a project in Django and i want to have some google maps displayed in my site. So, i installed django-easy-maps and successfully used it in a sample template. So, i am ready with my maps.
The interface i want to implement is this
http://i49.tinypic.com/sowm74.png
I want to display the maps where the Hellow World! container is and with different links on the sidebar i want to refresh the map being displayed on user click without reloading the page.
I did some researching and it seems Ajax is the solution...
Can anybody tell me how i might achieve this (with or without Ajax ) ?
Sorry for sounding like a noob but i am fairly new to this.
The basic steps are:
Create a view for the Google Maps section to the right. This view does not return a full HTML page but only the HTML for that section (which contains your Google Maps map).
When the user clicks on a link on the left, use JavaScript to perform an ajax call to request that page. In short this means: attach an event handler to the onclick event of those links and in code you can perform an ajax call .Many people use a JavaScript library for this purpose, such as jQuery (which has $.ajax()).
You can then use JavaScript to put the received HTML inside the container on the right (using $.html()).