Subapplication

38 views
Skip to first unread message

Eugene Chernyshov

unread,
Dec 2, 2011, 10:27:37 AM12/2/11
to Sammy.js
I have some portal-like site with top level routes (login, register,
profile, main-page). And also there are some bottom level routes
(create image, list images by page, and so on) inside main-page route.
Should I use multiple applications (one inside other)? Give me some
tip please cause I'm very new to sammy.

RAFIDINIAINA Francky

unread,
Dec 3, 2011, 1:43:56 AM12/3/11
to sam...@googlegroups.com
Hi Eugene,

I would recommend you to rewrite your paths in a RESTfull manner.
In your case I would identify 3 resources: Page, User, Image.
Image belongs to a page. So organise your Sammy paths like this

get 'pages'      => list
get 'page/:id'   => show
get 'pages/new'   => new
post 'pages'    => create
get 'page/edit/:id'   => edit
put 'page/:id'   => update
delete 'page/:id' => destroy

get 'users/login' and so on for user resource

get 'page/:page_id/images' => list images of a page
get 'page/:page_id/image/:id' => shows an image taht belongs to a page
.. and so on for image resource

I recommend you for your inspiration http://guides.rubyonrails.org/routing.html

By doing so, all your routes are defined physically in the same level but conceptually,  it will satisty you nesting needs.

G'day !


2011/12/2 Eugene Chernyshov <chernysh...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Sammy.js" group.
To post to this group, send email to sam...@googlegroups.com.
To unsubscribe from this group, send email to sammyjs+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sammyjs?hl=en.


Eugene Chernyshov

unread,
Dec 3, 2011, 1:48:08 PM12/3/11
to Sammy.js
Thx for your answer. I have some advanced experience in server-side
WSGI sites development and I can do things RESTfull way. But I want
some fancy transition effects. So when I change top level route I want
page to be changed with fadeOut/fadeIn. While changing bottom level
route (pages) appears like horizontal scrolling AND I want to keep top
level elements (like menu-bar) unchanged in that case.

On 3 дек, 08:43, RAFIDINIAINA Francky <rfran...@gmail.com> wrote:
> Hi Eugene,
>
> I would recommend you to rewrite your paths in a RESTfull manner.
> In your case I would identify 3 resources: Page, User, Image.
> Image belongs to a page. So organise your Sammy paths like this
>
> get 'pages'      => list
> get 'page/:id'   => show
> get 'pages/new'   => new
> post 'pages'    => create
> get 'page/edit/:id'   => edit
> put 'page/:id'   => update
> delete 'page/:id' => destroy
>
> get 'users/login' and so on for user resource
>
> get 'page/:page_id/images' => list images of a page
> get 'page/:page_id/image/:id' => shows an image taht belongs to a page
> .. and so on for image resource
>

> I recommend you for your inspirationhttp://guides.rubyonrails.org/routing.html


>
> By doing so, all your routes are defined physically in the same level but
> conceptually,  it will satisty you nesting needs.
>
> G'day !
>

> 2011/12/2 Eugene Chernyshov <chernyshov.eug...@gmail.com>

Aleksandar Radulovic

unread,
Dec 5, 2011, 6:43:34 AM12/5/11
to sam...@googlegroups.com
I would recommend using "pages" for all of those routes, imho that's
more RESTful.

-alex

--
a lex 13 x
http://a13x.net | @a13xnet

Reply all
Reply to author
Forward
0 new messages