jibe 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +48 -10
- data/lib/jibe/version.rb +1 -1
- data/lib/jibe.rb +0 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1934e5d8e1c100412827dd32a8028beeafd68f4d
|
4
|
+
data.tar.gz: ca820173bb5bcf6d1e108165185fc4fd628036d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6862898be25bd60e735de6aaa75d495a174972a87038ea25c8a7d243ec2de6bd15da7bc29207d9ad87482ea58820fa67323be63a4d1b9df21c090ffc877e4b1
|
7
|
+
data.tar.gz: 6ba56ba5725a7d1f352749d7e31be75e451672498122572d6d4a3d139109dcb29729e6cd1cc0df6b140b45ddd69eb636ba7797eb1f014888a7c8b1ea1dd3faf5
|
data/README.md
CHANGED
@@ -1,28 +1,66 @@
|
|
1
1
|
# Jibe
|
2
2
|
|
3
|
-
|
3
|
+
Jibe keeps simple data 'n sync with very little setup. For now, it relies on Pusher.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
Add
|
7
|
+
First, Add `gem 'jibe'` to your application's Gemfile and `bundle`.
|
8
8
|
|
9
|
-
|
9
|
+
Then, [Set up Pusher.](https://github.com/pusher/pusher-gem) You'll also need to throw your pusher key into a meta tag named `pusher-key`.
|
10
10
|
|
11
|
-
|
11
|
+
Add `//= require jibe` to your `application.js` file.
|
12
12
|
|
13
|
-
|
13
|
+
Add `jibe` to your model.
|
14
14
|
|
15
|
-
|
15
|
+
```
|
16
|
+
class Comment < ActiveRecord::Base
|
17
|
+
jibe
|
18
|
+
end
|
19
|
+
```
|
16
20
|
|
17
|
-
|
21
|
+
Replace a collection render call:
|
18
22
|
|
19
|
-
|
23
|
+
```
|
24
|
+
<table>
|
25
|
+
<%= render @comments %>
|
26
|
+
</table>
|
27
|
+
```
|
20
28
|
|
21
|
-
|
29
|
+
with:
|
30
|
+
|
31
|
+
```
|
32
|
+
<table>
|
33
|
+
<%= jibe @comments %>
|
34
|
+
</table>
|
35
|
+
```
|
36
|
+
|
37
|
+
Now, all those `@comments` will stay in sync. At this point, its probably worth adding `remote: true` to your forms.
|
38
|
+
|
39
|
+
## Options
|
40
|
+
|
41
|
+
```
|
42
|
+
<%=
|
43
|
+
jibe @comments,
|
44
|
+
strategy: "prepend", # by default, new tasks are appended
|
45
|
+
scope: "completed", # useful in conjunction with JS callbacks
|
46
|
+
restrict_to: [@folder, current_user] # limit access
|
47
|
+
%>
|
48
|
+
```
|
49
|
+
|
50
|
+
You can hijack the `beforeCreate`, `afterCreate`, `beforeUpdate`, `afterUpdate`, `beforeDestroy`, `afterDestroy` events. This is helpful for transitions.
|
51
|
+
|
52
|
+
```
|
53
|
+
Jibe.events["comments"] =
|
54
|
+
beforeCreate: (partial, data, scope) ->
|
55
|
+
# partial = the DOM node
|
56
|
+
# data = the model's attributes (override with jibe_data method in your model)
|
57
|
+
# scope = an optional scope based on the jibe tag in your view
|
58
|
+
|
59
|
+
```
|
22
60
|
|
23
61
|
## Contributing
|
24
62
|
|
25
|
-
1. Fork it ( https://github.com/
|
63
|
+
1. Fork it ( https://github.com/dallasread/jibe/fork )
|
26
64
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
65
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
66
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/jibe/version.rb
CHANGED
data/lib/jibe.rb
CHANGED