muck-activity 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/locales/ar.yml +23 -0
- data/locales/bg.yml +23 -0
- data/locales/ca.yml +23 -0
- data/locales/cs.yml +23 -0
- data/locales/da.yml +23 -0
- data/locales/de.yml +23 -0
- data/locales/el.yml +23 -0
- data/locales/es.yml +23 -0
- data/locales/fr.yml +23 -0
- data/locales/it.yml +23 -0
- data/locales/iw.yml +23 -0
- data/locales/ja.yml +23 -0
- data/locales/ko.yml +23 -0
- data/locales/lt.yml +23 -0
- data/locales/lv.yml +23 -0
- data/locales/nl.yml +23 -0
- data/locales/no.yml +24 -0
- data/locales/pl.yml +23 -0
- data/locales/pt.yml +23 -0
- data/locales/ro.yml +23 -0
- data/locales/ru.yml +23 -0
- data/locales/sk.yml +23 -0
- data/locales/sl.yml +23 -0
- data/locales/sr.yml +23 -0
- data/locales/sv.yml +23 -0
- data/locales/tl.yml +23 -0
- data/locales/uk.yml +23 -0
- data/locales/vi.yml +23 -0
- data/locales/zh-CN.yml +23 -0
- data/locales/zh-TW.yml +23 -0
- data/locales/zh.yml +23 -0
- data/muck-activity.gemspec +182 -0
- data/pkg/muck-activity-0.1.2.gem +0 -0
- data/rdoc/classes/ActionController.html +107 -0
- data/rdoc/classes/ActionController/Routing.html +107 -0
- data/rdoc/classes/ActionController/Routing/RouteSet.html +148 -0
- data/rdoc/classes/MuckActivity/ActMethods.html +189 -0
- data/rdoc/classes/MuckActivity/InstanceMethods.html +244 -0
- data/rdoc/classes/MuckActivity/Tasks.html +146 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_rdoc.html +204 -0
- data/rdoc/files/lib/muck_activity/initialize_routes_rb.html +101 -0
- data/rdoc/files/lib/muck_activity/tasks_rb.html +110 -0
- data/rdoc/files/lib/muck_activity_rb.html +108 -0
- data/rdoc/fr_class_index.html +32 -0
- data/rdoc/fr_file_index.html +30 -0
- data/rdoc/fr_method_index.html +33 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- metadata +51 -2
@@ -0,0 +1,244 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: MuckActivity::InstanceMethods</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">MuckActivity::InstanceMethods</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/muck_activity_rb.html">
|
59
|
+
lib/muck_activity.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div id="method-list">
|
80
|
+
<h3 class="section-bar">Methods</h3>
|
81
|
+
|
82
|
+
<div class="name-list">
|
83
|
+
<a href="#M000004">add_activity</a>
|
84
|
+
<a href="#M000006">can_view?</a>
|
85
|
+
<a href="#M000005">status</a>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if includes -->
|
93
|
+
|
94
|
+
<div id="section">
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if method_list -->
|
104
|
+
<div id="methods">
|
105
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
106
|
+
|
107
|
+
<div id="method-M000004" class="method-detail">
|
108
|
+
<a name="M000004"></a>
|
109
|
+
|
110
|
+
<div class="method-heading">
|
111
|
+
<a href="#M000004" class="method-signature">
|
112
|
+
<span class="method-name">add_activity</span><span class="method-args">(feed_to, source, item, template, title = '', content = '', check_method = nil)</span>
|
113
|
+
</a>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="method-description">
|
117
|
+
<p>
|
118
|
+
<tt><a href="InstanceMethods.html#M000004">add_activity</a></tt> adds an
|
119
|
+
activity to all activites feeds that belong to the objects found in
|
120
|
+
feed_to.
|
121
|
+
</p>
|
122
|
+
<ul>
|
123
|
+
<li><tt>feed_to</tt>: an array of objects that have <tt>has_activities</tt>
|
124
|
+
declared on them. The generated activity will be pushed into the feed of
|
125
|
+
each of these objects.
|
126
|
+
|
127
|
+
</li>
|
128
|
+
<li><tt>source</tt>: the object that peformed the activity ie a user or group
|
129
|
+
|
130
|
+
</li>
|
131
|
+
<li><tt>item</tt>: an object that will be used to generated the entry in an
|
132
|
+
activity feed
|
133
|
+
|
134
|
+
</li>
|
135
|
+
<li><tt>template</tt>: name of an partial that will be used to generated the
|
136
|
+
entry in the activity feed. Place templates in
|
137
|
+
/app/views/activity_templates
|
138
|
+
|
139
|
+
</li>
|
140
|
+
<li><tt>title</tt>: optional title that can be used in the template
|
141
|
+
|
142
|
+
</li>
|
143
|
+
<li><tt>content</tt>: option content that can be used in the template. Useful
|
144
|
+
for activities that might not have
|
145
|
+
|
146
|
+
<pre>
|
147
|
+
an item but instead might have a message or other text.
|
148
|
+
</pre>
|
149
|
+
</li>
|
150
|
+
<li><tt>check_method</tt>: method that will be called on each item in the
|
151
|
+
feed_to array. If the method evaluates to false the activity won‘t be
|
152
|
+
added to the object‘s activity feed. An example usage would be
|
153
|
+
letting users configure which items they want to have in their activity
|
154
|
+
feed.
|
155
|
+
|
156
|
+
</li>
|
157
|
+
</ul>
|
158
|
+
<p><a class="source-toggle" href="#"
|
159
|
+
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
160
|
+
<div class="method-source-code" id="M000004-source">
|
161
|
+
<pre>
|
162
|
+
<span class="ruby-comment cmt"># File lib/muck_activity.rb, line 47</span>
|
163
|
+
47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_activity</span>(<span class="ruby-identifier">feed_to</span>, <span class="ruby-identifier">source</span>, <span class="ruby-identifier">item</span>, <span class="ruby-identifier">template</span>, <span class="ruby-identifier">title</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">content</span> = <span class="ruby-value str">''</span>, <span class="ruby-identifier">check_method</span> = <span class="ruby-keyword kw">nil</span>)
|
164
|
+
48: <span class="ruby-identifier">feed_to</span> = [<span class="ruby-identifier">feed_to</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">feed_to</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>)
|
165
|
+
49: <span class="ruby-identifier">activity</span> = <span class="ruby-constant">Activity</span>.<span class="ruby-identifier">create</span>(<span class="ruby-identifier">:item</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">item</span>, <span class="ruby-identifier">:source</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">source</span>, <span class="ruby-identifier">:template</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">template</span>, <span class="ruby-identifier">:title</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">title</span>, <span class="ruby-identifier">:content</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">content</span>)
|
166
|
+
50: <span class="ruby-identifier">feed_to</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ft</span><span class="ruby-operator">|</span>
|
167
|
+
51: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">check_method</span>
|
168
|
+
52: <span class="ruby-identifier">ft</span>.<span class="ruby-identifier">activities</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">activity</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ft</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">check_method</span>)
|
169
|
+
53: <span class="ruby-keyword kw">else</span>
|
170
|
+
54: <span class="ruby-identifier">ft</span>.<span class="ruby-identifier">activities</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">activity</span>
|
171
|
+
55: <span class="ruby-keyword kw">end</span>
|
172
|
+
56: <span class="ruby-keyword kw">end</span>
|
173
|
+
57: <span class="ruby-keyword kw">end</span>
|
174
|
+
</pre>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
<div id="method-M000006" class="method-detail">
|
180
|
+
<a name="M000006"></a>
|
181
|
+
|
182
|
+
<div class="method-heading">
|
183
|
+
<a href="#M000006" class="method-signature">
|
184
|
+
<span class="method-name">can_view?</span><span class="method-args">(check_object)</span>
|
185
|
+
</a>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div class="method-description">
|
189
|
+
<p><a class="source-toggle" href="#"
|
190
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
191
|
+
<div class="method-source-code" id="M000006-source">
|
192
|
+
<pre>
|
193
|
+
<span class="ruby-comment cmt"># File lib/muck_activity.rb, line 65</span>
|
194
|
+
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_view?</span>(<span class="ruby-identifier">check_object</span>)
|
195
|
+
66: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">check_object</span>
|
196
|
+
67: <span class="ruby-keyword kw">end</span>
|
197
|
+
</pre>
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
|
202
|
+
<div id="method-M000005" class="method-detail">
|
203
|
+
<a name="M000005"></a>
|
204
|
+
|
205
|
+
<div class="method-heading">
|
206
|
+
<a href="#M000005" class="method-signature">
|
207
|
+
<span class="method-name">status</span><span class="method-args">()</span>
|
208
|
+
</a>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div class="method-description">
|
212
|
+
<p>
|
213
|
+
<tt><a href="InstanceMethods.html#M000005">status</a></tt> returns the
|
214
|
+
first activity item from the user‘s activity feed that is a <a
|
215
|
+
href="InstanceMethods.html#M000005">status</a> update. Used for displaying
|
216
|
+
the last <a href="InstanceMethods.html#M000005">status</a> update the user
|
217
|
+
made
|
218
|
+
</p>
|
219
|
+
<p><a class="source-toggle" href="#"
|
220
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
221
|
+
<div class="method-source-code" id="M000005-source">
|
222
|
+
<pre>
|
223
|
+
<span class="ruby-comment cmt"># File lib/muck_activity.rb, line 61</span>
|
224
|
+
61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
|
225
|
+
62: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">activities</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">:first</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> [<span class="ruby-value str">'is_status_update = true'</span>], <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'created_at DESC'</span>)
|
226
|
+
63: <span class="ruby-keyword kw">end</span>
|
227
|
+
</pre>
|
228
|
+
</div>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
|
232
|
+
|
233
|
+
</div>
|
234
|
+
|
235
|
+
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
<div id="validator-badges">
|
240
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
</body>
|
244
|
+
</html>
|
@@ -0,0 +1,146 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: MuckActivity::Tasks</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">MuckActivity::Tasks</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/muck_activity/tasks_rb.html">
|
59
|
+
lib/muck_activity/tasks.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
::Rake::TaskLib
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000007">new</a>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
<div id="methods">
|
109
|
+
<h3 class="section-bar">Public Class methods</h3>
|
110
|
+
|
111
|
+
<div id="method-M000007" class="method-detail">
|
112
|
+
<a name="M000007"></a>
|
113
|
+
|
114
|
+
<div class="method-heading">
|
115
|
+
<a href="#M000007" class="method-signature">
|
116
|
+
<span class="method-name">new</span><span class="method-args">()</span>
|
117
|
+
</a>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p><a class="source-toggle" href="#"
|
122
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
123
|
+
<div class="method-source-code" id="M000007-source">
|
124
|
+
<pre>
|
125
|
+
<span class="ruby-comment cmt"># File lib/muck_activity/tasks.rb, line 7</span>
|
126
|
+
7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
127
|
+
8: <span class="ruby-identifier">define</span>
|
128
|
+
9: <span class="ruby-keyword kw">end</span>
|
129
|
+
</pre>
|
130
|
+
</div>
|
131
|
+
</div>
|
132
|
+
</div>
|
133
|
+
|
134
|
+
|
135
|
+
</div>
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
<div id="validator-badges">
|
142
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
143
|
+
</div>
|
144
|
+
|
145
|
+
</body>
|
146
|
+
</html>
|
data/rdoc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thu, 11 Jun 2009 23:59:14 -0600
|
@@ -0,0 +1,204 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: README.rdoc</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>README.rdoc</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>README.rdoc
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Thu Jun 11 23:20:30 -0600 2009</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<h1>MuckActivity</h1>
|
73
|
+
<h2>Installation</h2>
|
74
|
+
<p>
|
75
|
+
The muck activity engine is part of the muck framework and relies upon the
|
76
|
+
muck_engine. The main engine can be found here: <a
|
77
|
+
href="http://github.com/jbasdf/muck_engine">github.com/jbasdf/muck_engine</a>
|
78
|
+
</p>
|
79
|
+
<p>
|
80
|
+
The easiest way to get started with muck is to generate your application
|
81
|
+
using a template:
|
82
|
+
</p>
|
83
|
+
<pre>
|
84
|
+
$ rails <your-app> -m http://github.com/jbasdf/rails-templates/raw/master/muck.rb
|
85
|
+
</pre>
|
86
|
+
<p>
|
87
|
+
Add optional functionality with the following command:
|
88
|
+
</p>
|
89
|
+
<pre>
|
90
|
+
$ rake rails:template LOCATION=http://github.com/jbasdf/rails-templates/raw/master/mucktoo.rb
|
91
|
+
</pre>
|
92
|
+
<h2>Usage</h2>
|
93
|
+
<p>
|
94
|
+
This engine implements simple activity tracking.
|
95
|
+
</p>
|
96
|
+
<p>
|
97
|
+
Models that can have activity feed should call ‘has_activities‘
|
98
|
+
</p>
|
99
|
+
<pre>
|
100
|
+
Example:
|
101
|
+
class User
|
102
|
+
has_activities
|
103
|
+
end
|
104
|
+
</pre>
|
105
|
+
<p>
|
106
|
+
Adding an item to the activity feed requires
|
107
|
+
‘acts_as_activity_source’ which then profiles the method
|
108
|
+
‘add_activity‘
|
109
|
+
</p>
|
110
|
+
<pre>
|
111
|
+
add_activity(feed_to, actor, item, template, check_method)
|
112
|
+
|
113
|
+
feed_to - contains an array of objects (typically users) that have use acts_as_activity_user
|
114
|
+
actor - the user performing the action
|
115
|
+
item - a reference to the object that
|
116
|
+
template - the template (partial) to use to render the activity
|
117
|
+
check_method - and optional method to call on each object in the feed_to array that determines whether or not to add the activity
|
118
|
+
|
119
|
+
Example:
|
120
|
+
add_activity(user.feed_to, user, comment, 'comment')
|
121
|
+
</pre>
|
122
|
+
<h3>Authorization</h3>
|
123
|
+
<p>
|
124
|
+
By default ‘has_activities’ will add a simple
|
125
|
+
‘can_view?’ method:
|
126
|
+
</p>
|
127
|
+
<pre>
|
128
|
+
def can_view?(check_object)
|
129
|
+
self == check_object
|
130
|
+
end
|
131
|
+
</pre>
|
132
|
+
<p>
|
133
|
+
This method determines whether or not the check_object has access to the
|
134
|
+
current object‘s activity feeds. For example, if the intent is to
|
135
|
+
recover the activities for a given user where the user is
|
136
|
+
’@parent’ thus:
|
137
|
+
</p>
|
138
|
+
<pre>
|
139
|
+
@parent.can_view?(current_user)
|
140
|
+
</pre>
|
141
|
+
<p>
|
142
|
+
The can view method will determine whether or not the current_user has the
|
143
|
+
right to view the activity feed.
|
144
|
+
</p>
|
145
|
+
<p>
|
146
|
+
In most instances you will need to override this method to implement proper
|
147
|
+
security. For example, for a group that has an activity feed you might add
|
148
|
+
a can_view? method like this:
|
149
|
+
</p>
|
150
|
+
<pre>
|
151
|
+
def can_view?(check_object)
|
152
|
+
self.member?(check_object) || (check_object.is_a?(User) && check_object.admin?)
|
153
|
+
end
|
154
|
+
</pre>
|
155
|
+
<h2>Live Updates</h2>
|
156
|
+
<p>
|
157
|
+
If you would like to add live updates to the user‘s activity feed you
|
158
|
+
can do so by adding an entry to GlobalConfig.yml (configuration file added
|
159
|
+
by muck)
|
160
|
+
</p>
|
161
|
+
<pre>
|
162
|
+
enable_live_activity_updates: true
|
163
|
+
live_activity_update_interval: 5
|
164
|
+
</pre>
|
165
|
+
<p>
|
166
|
+
Note that this will poll the server every 5 seconds and so will increase
|
167
|
+
server load and bandwidth usage.
|
168
|
+
</p>
|
169
|
+
<p>
|
170
|
+
Copyright (c) 2009 Justin Ball, released under the MIT license
|
171
|
+
</p>
|
172
|
+
|
173
|
+
</div>
|
174
|
+
|
175
|
+
|
176
|
+
</div>
|
177
|
+
|
178
|
+
|
179
|
+
</div>
|
180
|
+
|
181
|
+
|
182
|
+
<!-- if includes -->
|
183
|
+
|
184
|
+
<div id="section">
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
<!-- if method_list -->
|
194
|
+
|
195
|
+
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
<div id="validator-badges">
|
200
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
201
|
+
</div>
|
202
|
+
|
203
|
+
</body>
|
204
|
+
</html>
|