teacup-rails 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
+ ![teacup](https://raw.github.com/goodeggs/teacup/master/docs/teacup.jpg)
2
+
1
3
  # Teacup::Rails
2
4
 
3
- TODO: Write a gem description
5
+ Teacup::Rails makes [Teacup](http://goodeggs.github.com/teacup) native CoffeeScript templates
6
+ available to the Rails asset pipeline.
4
7
 
5
8
  ## Installation
6
9
 
@@ -16,9 +19,49 @@ Or install it yourself as:
16
19
 
17
20
  $ gem install teacup-rails
18
21
 
22
+ Make Teacup available to your JavaScript application by requiring it in `app/assets/javascripts/application.js`
23
+ before your application files.
24
+
25
+ ``` javascript
26
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
27
+ // listed below.
28
+
29
+ //= require jquery
30
+ //= require jquery_ujs
31
+ //= require teacup
32
+ //= require_tree .
33
+ ```
34
+
19
35
  ## Usage
20
36
 
21
- TODO: Write usage instructions here
37
+ Teacup exports one reference to the global scope as `window.teacup`. Import the tags you need to render your view.
38
+
39
+ ```coffeescript
40
+ {renderable, h1, table, tr, th, td, a} = teacup
41
+ template = renderable ({posts})->
42
+ h1 'Listing posts'
43
+ table "#posts-table", ->
44
+ tr ->
45
+ th 'Title'
46
+ th 'Content'
47
+ for post in posts
48
+ tr '.post-row', ->
49
+ td post.title
50
+ td post.content
51
+ a href: '#/new', 'New Post'
52
+
53
+ class IndexView extends Backbone.View
54
+ template: template
55
+
56
+ constructor: ({@posts}) ->
57
+ super()
58
+
59
+ render: =>
60
+ @$el.html @template(posts: @posts.toJSON())
61
+ @
62
+ ```
63
+
64
+ See [Teacup Examples](http://goodeggs.github.com/teacup/#examples) for more usage examples.
22
65
 
23
66
  ## Contributing
24
67
 
@@ -1,7 +1,9 @@
1
+ require 'rails'
1
2
  require "teacup-rails/version"
2
3
 
3
4
  module Teacup
4
5
  module Rails
5
- # Your code goes here...
6
+ class Engine < ::Rails::Engine
7
+ end
6
8
  end
7
9
  end
@@ -1,5 +1,5 @@
1
1
  module Teacup
2
2
  module Rails
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teacup-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: