Backbone.js + Rails 3.1: How to create a CMS in the Admin namespace?

I’ve been trying to wrap my head around this for a while, and have done little research online. I can't be the only one, right?

How do you create a CMS in a namespace using Backbone?

On rails, this is relatively simple, but adding a trunk to the equation seems complicated.

Here is my basic application:

Relative gemstones

gem 'rails', '3.1.0.rc4'  
gem 'devise'  
gem 'rails-backbone', '0.5.0'

The basic structure of the application

/ 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

routes.rb

  namespace: admin do
    resources: posts
    root: to => "posts # index"
  end

resources: posts
root: to => "posts # index"

Do you need to create another “administrative” directory within the vertebrae and controllers, such as the rail structure? Like the rails, do they refer to the same “without name” mailing model?

, , , , - ?

, ... class Appname.Controllers.PostsController extends Backbone.Controller

?
class Appname.Controllers.Admin.PostsController extends Backbone.Controller

, .

+5
1

. Router. .

0

All Articles