Code Monkey home page Code Monkey logo

demo-rails-angularjs's Introduction

Welcome to DEMO Rails AngularJS

The intention of this project is to connect rails with Angular JS. AngularJS to replace the traditional rails view layer. Rails could of course be any API service, sinatra etc. I’m using rails as I know it (kind of) and it makes backend tasks easier, like email porocessing, queues and so on.

Some aims/thoughts

Rails serves json via api’s, possibly looking at Grape. Lean on Rails comfort for server tasks, e.g. email, workflow, db access and so on. Lean on the asset pipeline to comine and minify. Which requires:

Embedding angularJS within the assets.

Aiming to use an organisation by modules and not layers. Appears difficult to achieve, layers works and it’s in keeping with Rails, even if it’s not where I’m at…

Alternatives to the asset pipline would be to utilise the likes of grunt and yoman. These tools can manage the angularJS app outside of rails, but compile into the public dir. This would then be easy when sat behind the likes of nginx.

Pros:
    Also convienent to pass AngularJS app to non rails developer.
Cons:
    Another component to manage and possibly CORS.

Or rather:

avoid learning node as a json api server
avoid 2 seperate applications
avoid cross domain requests

There are a number of ways to do the above, there are some points, where I’m not even certain if the approach is right, but it’s a path…

Getting Started

  1. Should be viable to clone, migrate and then launch local server. All requests should invoke the home.index which really hands off right away to Angular.

With thanks

To the many people who have blogged about AngularJS and those who’ve listened to my questions.

I’d like to thank:

The guys behind angular-app, https://github.com/angular-app/angular-app. It's a cracking reference app and I've leant on it heavily.

Nils of http://nils-blum-oeste.net/ for a collection of vital articles on token_auth wrapping.

Description of Contents

The basic goal is a rails 3.2 app, with devise, active_admin, bootstrap, angular and api services (public and auth’d with token_auth).

The initial and relevant directory structure of this application is:

|-- app
|   |-- admin
|       |-- admin_user.rb
|       |-- dashboard.rb
|       |-- site.rb
|       `-- user.rb
|   |-- assets
|       |-- images
|       |-- javascripts
|           |-- active_admin.js
|           |-- app
|               |-- app.js
|               |-- assets.js.erb
|               |-- controllers
|                   |-- app_ctrl.js
|                   `-- info_ctrl.js
|               |-- controllers.js
|               |-- directives.js
|               |-- filters.js
|               `-- services.js
|           `-- application.js
|       |-- stylesheets
|           |-- application.css.scss
|           `-- overrides.css.scss
|       `-- templates
|           |-- info.html
|           `-- login.html
|   |-- controllers
|       |-- api
|           `-- v1
|               |-- info_controller.rb
|               |-- sessions_controller.rb
|               `-- sites_controller.rb
|       |-- application_controller.rb
|       `-- home_controller.rb
|   |-- helpers
|      `-- application_helper.rb
|   |-- mailers
|   |-- models
|       |-- admin_user.rb
|       |-- site.rb
|       `-- user.rb
|   `-- views
|       |-- home
|           `-- index.html.erb
|       `-- layouts
|           `-- application.html.erb
|-- public
|   |-- 404.html
|   |-- 422.html
|   |-- 500.html
|   |-- favicon.ico
|   `-- robots.txt
`-- vendor
    |-- assets
        |-- javascripts
            |-- angular-resource.js
            |-- angular.js
            |-- jquery.js
            |-- ui-bootstrap.js
            `-- ui-bootstrap-tpls.js
        `-- stylesheets
    `-- plugins

demo-rails-angularjs's People

Contributors

colindensem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

demo-rails-angularjs's Issues

Admin interface/url

Looking forward to digging into things, just wondering if the admin area works of if that needs to be added?

Thanks
Al

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.