GithubHelp home page GithubHelp logo

alexxnica / plumage.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from twitter-archive/plumage.js

0.0 1.0 0.0 8.48 MB

Batteries Included App Framework for Data Intensive UIs

Home Page: http://twitter.github.io/plumage.js

License: MIT License

Ruby 0.03% JavaScript 85.00% HTML 3.58% CSS 11.39%

plumage.js's Introduction

Plumage.js Build Status Coverage Status

JS UI framework for complex UIs.

Installation

Currently need to bower install from local repo

git clone https://github.com/twitter/plumage.js.git

cd [my-js-project]
bower install plumagejs=../plumage.js

Someday it might be possible to bower install plumagejs, but not yet.

Getting Started

Add script tags for require.js, config.js (config for require.js) to your index.html

<script type="text/javascript" src="/bower_components/plumagejs/assets/scripts/vendor/require.js"></script>
<script type="text/javascript" src="/bower_components/plumagejs/assets/scripts/config.js"></script>
<!-- include your own require.js config here -->

In your js files, require plumage, and access plumage classes from the Plumage object.

define(['jquery', 'underscore', 'plumage'],
function($, _, Plumage) {
  return Plumage.model.Model.extend({
    urlRoot: '/mymodel'
  });
});

Hello Plumage

To get running, we'll need an App, a Router and a Controller.

controller/MyController.js

define(['jquery', 'underscore', 'plumage'],
function($, _, Plumage, ) {
  return Plumage.controller.BaseController.extend({
    sayHello: function() {
      alert('Hello Plumage!');
    }
  });
});

MyRouter.js

define(['jquery', 'underscore', 'plumage'],
function($, _, Plumage, ) {
  return Plumage.Router.extend({
    controllerRoutes: {
      '': {controller: 'MyController', method: 'sayHello'},
    }
  });
});

application.js

define(['jquery', 'underscore', 'plumage', 'MyRouter', 'controller/MyController'],
function($, _, Plumage, MyRouter) {
  myApp = new Plumage.App({
    initCSRFToken: true,
    controllers: [
      'MyController'
    ]
  });
  window.router = new MyRouter({app: myApp});
  return myApp;
});

Then require your application in your index.html and you're good to go.

<script type="text/javascript">require(['application']);</script>

Load the page and you should see the 'Hello Plumage!' alert.

Next Steps

Next you'll probably want some Models, Collections and Views. A good place to start is the source code of the Countries example.

License

Copyright 2014 Twitter, Inc. and other contributors

Licensed under the MIT License

plumage.js's People

Contributors

mclin avatar caniszczyk avatar austindizzy avatar

Watchers

 avatar

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.