[ 3 posts ]

Khoa Bui

  • Username: khoaminhbui
  • Joined: Tue Aug 09, 2011 6:11 am
  • Posts: 127
  • Location: Vietnam
  • Twitter: khoaminhbui
  • IRC: k_bui
  • Offline
  • Profile

Front controller: use Y.Router but keep URL unchanged?

Post Posted: Sat Jun 16, 2012 8:23 pm
+0-
I am working on a single page application, and need to implement a front controller on the front-end.
With the jobs:
- When user click on a toolbar icon or a menu item that would open a new page, the event will be handled by the front controller.
- The front controller then do stuff like prviledge checking, ..
- Call approriate function to display the view.

Looking at YUI to find supporting component, I find that Y.Router is good, but the problem is that i do not want the URL change, the URL would be always http://www.myHost.com/myApp.

How can I use Y.Router and keep the URL?

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: Front controller: use Y.Router but keep URL unchanged?

Post Posted: Sun Jun 17, 2012 11:24 am
+0-
You can use hash based URLs like http://www.myHost.com/myApp#foo/bar. That way it will still be a single page application and the user still has a URL that matches some state and the Back button of the browser still works.

You can do this by setting serverRouting to false in Y.App.

Eric Ferraiuolo

YUI Developer

  • Username: ericf
  • Joined: Mon Jan 12, 2009 8:26 pm
  • Posts: 380
  • Location: Boston, MA
  • Twitter: ericf
  • GitHub: ericf
  • Gists: ericf
  • IRC: eric_f
  • YUI Developer
  • Offline
  • Profile

Re: Front controller: use Y.Router but keep URL unchanged?

Post Posted: Thu Jun 21, 2012 5:29 am
+0-
Yup! This sounds like a perfect job for `Y.App`: http://yuilibrary.com/yui/docs/app/#app-component
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum