Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone.js + Rails 3.1: How to create CMS within Admin namespace?
    text
    copied!<p>I've been trying to wrap my head around this for a while now, and have been researching on the web with little success. I can't be the only one, right?</p> <p>How do you create a CMS within a namespace using Backbone?</p> <p>In rails it is relatively simple, but adding backbone into the equation seems tricky.</p> <p>Here's my basic application so far:</p> <p>Relative Gems </p> <pre><code>gem 'rails', '3.1.0.rc4' gem 'devise' gem 'rails-backbone', '0.5.0'</code></pre> <p>Basic App Structure</p> <pre> /app /assets /javascripts /backbone /controllers - posts_controller.coffee /models - post.coffee /templates /posts - edit.jst.ejs - index.jst.ejs - new.jst.ejs - post.jst.ejs - show.jst.ejs /views /posts - edit_view.coffee - index_view.coffee - new_view.coffee - post_view.coffee - show_view.coffee /controllers /admin - admin_controller.rb - posts_controller.rb - application_controller.rb - posts_controller.rb /models - post.rb /views /admin /posts - index.html.haml /posts - index.html.haml </pre> <p>Routes.rb</p> <pre> namespace :admin do resources :posts root :to => "posts#index" end resources :posts root :to => "posts#index" </pre> <p>Do you have to create another "admin" directory within the backbone views and controllers like the rails structure? Like rails, do they reference the same 'un-namespaced' backbone post model?</p> <p>How would you then route your backbone structure to pull the correct views while limiting access to edit, new, delete duties - and how would they be referenced?</p> <p>For example, the normal backbone controller class is defined like...<br> <code>class Appname.Controllers.PostsController extends Backbone.Controller</code></p> <p>Would this be the proper way to define the namespaced controller?<br> <code>class Appname.Controllers.Admin.PostsController extends Backbone.Controller</code></p> <p>There are a lot of questions here, any help would be greatly appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload