muck-activities 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +69 -0
- data/Rakefile +78 -0
- data/VERSION +1 -0
- data/app/controllers/muck/activities_controller.rb +152 -0
- data/app/helpers/muck_activity_helper.rb +67 -0
- data/app/models/activity.rb +62 -0
- data/app/models/activity_feed.rb +16 -0
- data/app/views/activities/_activity_feed.html.erb +18 -0
- data/app/views/activities/_cached_activities.html.erb +8 -0
- data/app/views/activities/_comment.html.erb +6 -0
- data/app/views/activities/_comments.html.erb +7 -0
- data/app/views/activities/_current_status.html.erb +14 -0
- data/app/views/activities/_current_status_wrapper.html.erb +4 -0
- data/app/views/activities/_delete.html.erb +11 -0
- data/app/views/activities/_status_update.html.erb +35 -0
- data/app/views/activities/_template_filter.html.erb +6 -0
- data/app/views/activity_templates/_status_update.html.erb +12 -0
- data/config/muck_activities_routes.rb +3 -0
- data/db/migrate/20090402033319_add_muck_activities.rb +36 -0
- data/install.rb +1 -0
- data/lib/muck_activities/initialize_routes.rb +8 -0
- data/lib/muck_activities/tasks.rb +28 -0
- data/lib/muck_activities.rb +76 -0
- data/locales/ar.yml +24 -0
- data/locales/bg.yml +24 -0
- data/locales/ca.yml +24 -0
- data/locales/cs.yml +24 -0
- data/locales/da.yml +24 -0
- data/locales/de.yml +24 -0
- data/locales/el.yml +24 -0
- data/locales/en.yml +25 -0
- data/locales/es.yml +24 -0
- data/locales/fr.yml +24 -0
- data/locales/it.yml +24 -0
- data/locales/iw.yml +24 -0
- data/locales/ja.yml +24 -0
- data/locales/ko.yml +24 -0
- data/locales/lt.yml +24 -0
- data/locales/lv.yml +24 -0
- data/locales/nl.yml +24 -0
- data/locales/no.yml +25 -0
- data/locales/pl.yml +24 -0
- data/locales/pt.yml +24 -0
- data/locales/ro.yml +24 -0
- data/locales/ru.yml +24 -0
- data/locales/sk.yml +24 -0
- data/locales/sl.yml +24 -0
- data/locales/sr.yml +24 -0
- data/locales/sv.yml +24 -0
- data/locales/tl.yml +24 -0
- data/locales/uk.yml +24 -0
- data/locales/vi.yml +24 -0
- data/locales/zh-CN.yml +24 -0
- data/locales/zh-TW.yml +24 -0
- data/locales/zh.yml +24 -0
- data/public/images/loading.gif +0 -0
- data/public/javascripts/muck_activities.js +65 -0
- data/rails/init.rb +4 -0
- data/rdoc/classes/ActionController/Routing/RouteSet.html +148 -0
- data/rdoc/classes/ActionController/Routing.html +107 -0
- data/rdoc/classes/ActionController.html +107 -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 +212 -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
- data/tasks/muck_activity_tasks.rake +1 -0
- data/test/factories.rb +41 -0
- data/test/functional/activities_controller_test.rb +64 -0
- data/test/shoulda_macros/controller.rb +43 -0
- data/test/test_helper.rb +38 -0
- data/test/unit/activity_feed_test.rb +5 -0
- data/test/unit/activity_test.rb +57 -0
- data/uninstall.rb +1 -0
- metadata +169 -0
@@ -0,0 +1,107 @@
|
|
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: ActionController</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">ActionController</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
</td>
|
59
|
+
</tr>
|
60
|
+
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
</div>
|
77
|
+
|
78
|
+
|
79
|
+
<!-- if includes -->
|
80
|
+
|
81
|
+
<div id="section">
|
82
|
+
|
83
|
+
<div id="class-list">
|
84
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
85
|
+
|
86
|
+
Module <a href="ActionController/Routing.html" class="link">ActionController::Routing</a><br />
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if method_list -->
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
<div id="validator-badges">
|
103
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</body>
|
107
|
+
</html>
|
@@ -0,0 +1,189 @@
|
|
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::ActMethods</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::ActMethods</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="#M000003">acts_as_activity_source</a>
|
84
|
+
<a href="#M000002">has_activities</a>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
<!-- if includes -->
|
92
|
+
<div id="includes">
|
93
|
+
<h3 class="section-bar">Included Modules</h3>
|
94
|
+
|
95
|
+
<div id="includes-list">
|
96
|
+
<span class="include-name"><a href="InstanceMethods.html">InstanceMethods</a></span>
|
97
|
+
<span class="include-name"><a href="InstanceMethods.html">InstanceMethods</a></span>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<!-- if method_list -->
|
111
|
+
<div id="methods">
|
112
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
113
|
+
|
114
|
+
<div id="method-M000003" class="method-detail">
|
115
|
+
<a name="M000003"></a>
|
116
|
+
|
117
|
+
<div class="method-heading">
|
118
|
+
<a href="#M000003" class="method-signature">
|
119
|
+
<span class="method-name">acts_as_activity_source</span><span class="method-args">()</span>
|
120
|
+
</a>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div class="method-description">
|
124
|
+
<p>
|
125
|
+
<tt><a href="ActMethods.html#M000003">acts_as_activity_source</a></tt>
|
126
|
+
gives the class it is called on a method called <tt>add_activity</tt> that
|
127
|
+
can add activities into a feed.
|
128
|
+
</p>
|
129
|
+
<p><a class="source-toggle" href="#"
|
130
|
+
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
131
|
+
<div class="method-source-code" id="M000003-source">
|
132
|
+
<pre>
|
133
|
+
<span class="ruby-comment cmt"># File lib/muck_activity.rb, line 24</span>
|
134
|
+
24: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_as_activity_source</span>
|
135
|
+
25: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">included_modules</span>.<span class="ruby-identifier">include?</span> <span class="ruby-constant">InstanceMethods</span>
|
136
|
+
26: <span class="ruby-identifier">include</span> <span class="ruby-constant">InstanceMethods</span>
|
137
|
+
27: <span class="ruby-keyword kw">end</span>
|
138
|
+
28: <span class="ruby-keyword kw">end</span>
|
139
|
+
</pre>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div id="method-M000002" class="method-detail">
|
145
|
+
<a name="M000002"></a>
|
146
|
+
|
147
|
+
<div class="method-heading">
|
148
|
+
<a href="#M000002" class="method-signature">
|
149
|
+
<span class="method-name">has_activities</span><span class="method-args">()</span>
|
150
|
+
</a>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
<p>
|
155
|
+
<tt><a href="ActMethods.html#M000002">has_activities</a></tt> gives the
|
156
|
+
class it is called on an activity feed and a method called
|
157
|
+
<tt>add_activity</tt> that can add activities into a feed. Retrieve
|
158
|
+
activity feed items via object.activities. ie @user.activities.
|
159
|
+
</p>
|
160
|
+
<p><a class="source-toggle" href="#"
|
161
|
+
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
162
|
+
<div class="method-source-code" id="M000002-source">
|
163
|
+
<pre>
|
164
|
+
<span class="ruby-comment cmt"># File lib/muck_activity.rb, line 14</span>
|
165
|
+
14: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_activities</span>
|
166
|
+
15: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">included_modules</span>.<span class="ruby-identifier">include?</span> <span class="ruby-constant">InstanceMethods</span>
|
167
|
+
16: <span class="ruby-identifier">has_many</span> <span class="ruby-identifier">:activity_feeds</span>, <span class="ruby-identifier">:as</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:ownable</span>
|
168
|
+
17: <span class="ruby-identifier">has_many</span> <span class="ruby-identifier">:activities</span>, <span class="ruby-identifier">:through</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">:activity_feeds</span>, <span class="ruby-identifier">:order</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'created_at desc'</span>
|
169
|
+
18: <span class="ruby-identifier">include</span> <span class="ruby-constant">InstanceMethods</span>
|
170
|
+
19: <span class="ruby-keyword kw">end</span>
|
171
|
+
20: <span class="ruby-keyword kw">end</span>
|
172
|
+
</pre>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
|
178
|
+
</div>
|
179
|
+
|
180
|
+
|
181
|
+
</div>
|
182
|
+
|
183
|
+
|
184
|
+
<div id="validator-badges">
|
185
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
</body>
|
189
|
+
</html>
|
@@ -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>
|