Durandal: Manually remove view from DOM - dom

i am creating a single page application using HotTowel SPA, which uses Durandal 2.0
I have two views, named Dashboard and Settings.
When i load the website, the Dashboard view gets loaded. When i click on Settings, the Dashboard view gets deactivated, and when i click on Dashboard, it gets activated again.
I have a method on my Settings View. When this method is called, i want the Dashboard view to be removed from the DOM. so that when I click on Dashboard again, it has to reload the view (just like it does when you reload the webpage), in stead of just activating it.
So is there a way to detach a view manually?

You can cacheViews to false on the composition binding. See about 3/4 down the Using Composition
page.
In the shell.html file (I presume it's the same in HotTowel), there will be a line like:
<div class="container-fluid page-host" data-bind="router: { transition:'entrance', cacheViews:false }"></div>

Related

How to check if a page component is created by a navController or a modalController

I have a lazy loaded IonicPage Component.
Which can be called in two ways:
navController.push('pageName');
modalController.create('pageName');
Both work well.
Is there a way I can check from within the IonicPage Component to see if it has been created by the navController or the modalController?
Plan B. I can pass a navParam with both e.g. isModal=true to fix this, but I am curious if there is an easier way to check how a page is created.
Context: The page is a component with a list of say users. If the component is loaded as a page (see 1. above) then when we click on an user you can edit its details. But when the component is presented as a modal and we click on it, the details of the clicked user is passed back to the previous page for processing.

Ionic Lifecycle: ionViewDidLoad

I'm using this hook on my Home to get and store some data for my app.
In many articles and tutorials over the net is been sad the ionViewDidLoad hook will fire only ONCE after the view is cached.
But I tested switching pages with navCtrl.setRoot then go back to Home...
The ionViewDidLoad is called again. Did I understand it all wrong? Am I doing it wrongly? I should put a "test" before my commands on ionViewDidLoad?
Any help or explanation for this...
ionViewDidLoad does get called only per page creation. This view is cached when navigation occurs through push() i.e this page is still there in the stack. If navigation happens back to this page via pop(), the hook is not called again.
You are currently using setRoot() to test. This will clear the navigation stack i.e all views are in the current stack are destroyed. The current view is also destroyed when you call pop() on the current page.
Check View Creation and Lifecycle hook section in the docs

How to hook GWT navigation from a userscript?

I'm writing a userscript for a GWT-based site.
My script uses URL of the page as input. It should be update each page of the site with additional information.
Unfortunately, as view changes in GWT are implemented via rerendering (only location anchor in browser address-bar is being changed), clicks on internal links are not recognized as page loads and Greasemonkey does not invoke my script, leaving new views unmodified.
Is there a way to hook in GWT-based navigation from an userscript? I need a way to modify each "change" Gerrit navigates to.
Complete workflow should look like:
User scans through the list of issues
User clicks on a link . (Address bar will assume a location of a change being clicked, for example https://git.eclipse.org/r/#/c/38781/)
Page is modified by userscript to contain information about new view (in our case /c/38781/)
Greasemonkey is only invoked at the first step of this workflow, and I don't know ho to detect second one to be able to trigger the third.
I've tried to observe DOM changes on the page, but my listeners are never called probably due to the fact GWT renders some parts via innerHTML property, without explicit child manipulation.

Tab in Zend Framework?

I am making a social website that each user can view his own or other user's profile. I created a user controller to handle the identity and blog, status, profile controller to retrieve information. My question is how can I make the three sub controllers ( blog, status, profile) under the user controller, like a tab view?
If you want to have Tabs in your application you should pick first an ajax framework to create andload content into them:
Assuming you are willing to use jquery:
Tabs supports loading tab content via Ajax in an unobtrusive manner.
The HTML you need is slightly different from the one that is used for static tabs: A list of links pointing to existing resources (from where the content gets loaded) and no additional containers at all (unobtrusive!). The containers' markup is going to be created on the fly:
<div id="example">
<ul>
<li><span>USER</span></li>
<li><span>his blogs</span></li>
<li><span>Whatever</span></li>
</ul>
</div>
For more info: http://jqueryui.com/demos/tabs/#Events
And the tab content will be loaded through those "controllers" which are in fact generating view scripts.
To disable the layout on your views which should be integrated inside the Tabs-panels, if the mode is simple, you can add in ZF1
$this->_helper->layout()->disableLayout();

joomla : set session from javascript

i have a persistent bar in my website and this bar can be slide in and out using mootool.. but i have problem with the user navigating to other page. it always load the default bar which is slide out...Example,if the user had click to slide in the bar, and when he navigate to other page, the bar will goes to default state which is slide out.
how can I tackle this issue?
I am using Joomla 1.5 and the mod_php module that allow me to enter all HTML, PHP and Javascript in one module.
YOu can exploit the window.name property to keep a persistent variable, however the best way to do it is either store session information in the database in a cookie.
* EDIT *
Just noticed you are using Mootools. Mootools has a built in cookie object you can use to store the state of the bar. Here is the documentation -
http://mootools.net/docs/core/Utilities/Cookie