rdoc/classes/MuckActivity/InstanceMethods.html in muck-activities-0.1.9 vs rdoc/classes/MuckActivity/InstanceMethods.html in muck-activities-0.1.10
- old
+ new
@@ -53,14 +53,18 @@
<td class="class-name-in-header">MuckActivity::InstanceMethods</td>
</tr>
<tr class="top-aligned-row">
<td><strong>In:</strong></td>
<td>
- <a href="../../files/lib/muck_activities_rb.html">
- lib/muck_activities.rb
+ <a href="../../files/lib/muck_activities/active_record/acts/muck_activity_rb.html">
+ lib/muck_activities/active_record/acts/muck_activity.rb
</a>
<br />
+ <a href="../../files/lib/muck_activities/muck_activity_rb.html">
+ lib/muck_activities/muck_activity.rb
+ </a>
+ <br />
</td>
</tr>
</table>
</div>
@@ -78,13 +82,16 @@
<div id="method-list">
<h3 class="section-bar">Methods</h3>
<div class="name-list">
- <a href="#M000004">add_activity</a>
- <a href="#M000006">can_view?</a>
- <a href="#M000005">status</a>
+ <a href="#M000007">add_activity</a>
+ <a href="#M000010">add_activity</a>
+ <a href="#M000009">can_view?</a>
+ <a href="#M000012">can_view?</a>
+ <a href="#M000008">status</a>
+ <a href="#M000011">status</a>
</div>
</div>
</div>
@@ -102,22 +109,22 @@
<!-- if method_list -->
<div id="methods">
<h3 class="section-bar">Public Instance methods</h3>
- <div id="method-M000004" class="method-detail">
- <a name="M000004"></a>
+ <div id="method-M000007" class="method-detail">
+ <a name="M000007"></a>
<div class="method-heading">
- <a href="#M000004" class="method-signature">
+ <a href="#M000007" class="method-signature">
<span class="method-name">add_activity</span><span class="method-args">(feed_to, source, item, template, title = '', content = '', check_method = nil)</span>
</a>
</div>
<div class="method-description">
<p>
-<tt><a href="InstanceMethods.html#M000004">add_activity</a></tt> adds an
+<tt><a href="InstanceMethods.html#M000007">add_activity</a></tt> adds an
activity to all activites feeds that belong to the objects found in
feed_to.
</p>
<ul>
<li><tt>feed_to</tt>: an array of objects that have <tt>has_activities</tt>
@@ -154,77 +161,202 @@
feed.
</li>
</ul>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000004-source">
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000007-source">
<pre>
- <span class="ruby-comment cmt"># File lib/muck_activities.rb, line 48</span>
-48: <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>)
-49: <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>)
-50: <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>)
-51: <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>
-52: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">check_method</span>
-53: <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>)
-54: <span class="ruby-keyword kw">else</span>
-55: <span class="ruby-identifier">ft</span>.<span class="ruby-identifier">activities</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">activity</span>
-56: <span class="ruby-keyword kw">end</span>
-57: <span class="ruby-keyword kw">end</span>
-58: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/muck_activities/active_record/acts/muck_activity.rb, line 45</span>
+45: <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>)
+46: <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>)
+47: <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>)
+48: <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>
+49: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">check_method</span>
+50: <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>)
+51: <span class="ruby-keyword kw">else</span>
+52: <span class="ruby-identifier">ft</span>.<span class="ruby-identifier">activities</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">activity</span>
+53: <span class="ruby-keyword kw">end</span>
+54: <span class="ruby-keyword kw">end</span>
+55: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000006" class="method-detail">
- <a name="M000006"></a>
+ <div id="method-M000010" class="method-detail">
+ <a name="M000010"></a>
<div class="method-heading">
- <a href="#M000006" class="method-signature">
+ <a href="#M000010" class="method-signature">
+ <span class="method-name">add_activity</span><span class="method-args">(feed_to, source, item, template, title = '', content = '', check_method = nil)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+<tt><a href="InstanceMethods.html#M000007">add_activity</a></tt> adds an
+activity to all activites feeds that belong to the objects found in
+feed_to.
+</p>
+<ul>
+<li><tt>feed_to</tt>: an array of objects that have <tt>has_activities</tt>
+declared on them. The generated activity will be pushed into the feed of
+each of these objects.
+
+</li>
+<li><tt>source</tt>: the object that peformed the activity ie a user or group
+
+</li>
+<li><tt>item</tt>: an object that will be used to generated the entry in an
+activity feed
+
+</li>
+<li><tt>template</tt>: name of an partial that will be used to generated the
+entry in the activity feed. Place templates in
+/app/views/activity_templates
+
+</li>
+<li><tt>title</tt>: optional title that can be used in the template
+
+</li>
+<li><tt>content</tt>: option content that can be used in the template. Useful
+for activities that might not have
+
+<pre>
+ an item but instead might have a message or other text.
+</pre>
+</li>
+<li><tt>check_method</tt>: method that will be called on each item in the
+feed_to array. If the method evaluates to false the activity won‘t be
+added to the object‘s activity feed. An example usage would be
+letting users configure which items they want to have in their activity
+feed.
+
+</li>
+</ul>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000010-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/muck_activities/muck_activity.rb, line 45</span>
+45: <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>)
+46: <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>)
+47: <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>)
+48: <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>
+49: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">check_method</span>
+50: <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>)
+51: <span class="ruby-keyword kw">else</span>
+52: <span class="ruby-identifier">ft</span>.<span class="ruby-identifier">activities</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">activity</span>
+53: <span class="ruby-keyword kw">end</span>
+54: <span class="ruby-keyword kw">end</span>
+55: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000009" class="method-detail">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+ <a href="#M000009" class="method-signature">
<span class="method-name">can_view?</span><span class="method-args">(check_object)</span>
</a>
</div>
<div class="method-description">
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000006-source">
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000009-source">
<pre>
- <span class="ruby-comment cmt"># File lib/muck_activities.rb, line 66</span>
-66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_view?</span>(<span class="ruby-identifier">check_object</span>)
-67: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">check_object</span>
-68: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/muck_activities/active_record/acts/muck_activity.rb, line 63</span>
+63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_view?</span>(<span class="ruby-identifier">check_object</span>)
+64: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">check_object</span>
+65: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
- <div id="method-M000005" class="method-detail">
- <a name="M000005"></a>
+ <div id="method-M000012" class="method-detail">
+ <a name="M000012"></a>
<div class="method-heading">
- <a href="#M000005" class="method-signature">
+ <a href="#M000012" class="method-signature">
+ <span class="method-name">can_view?</span><span class="method-args">(check_object)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000012-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/muck_activities/muck_activity.rb, line 63</span>
+63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">can_view?</span>(<span class="ruby-identifier">check_object</span>)
+64: <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">check_object</span>
+65: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000008" class="method-detail">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+ <a href="#M000008" class="method-signature">
<span class="method-name">status</span><span class="method-args">()</span>
</a>
</div>
<div class="method-description">
<p>
-<tt><a href="InstanceMethods.html#M000005">status</a></tt> returns the
+<tt><a href="InstanceMethods.html#M000008">status</a></tt> returns the
first activity item from the user‘s activity feed that is a <a
-href="InstanceMethods.html#M000005">status</a> update. Used for displaying
-the last <a href="InstanceMethods.html#M000005">status</a> update the user
+href="InstanceMethods.html#M000008">status</a> update. Used for displaying
+the last <a href="InstanceMethods.html#M000008">status</a> update the user
made
</p>
<p><a class="source-toggle" href="#"
- onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
- <div class="method-source-code" id="M000005-source">
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000008-source">
<pre>
- <span class="ruby-comment cmt"># File lib/muck_activities.rb, line 62</span>
-62: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
-63: <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>)
-64: <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># File lib/muck_activities/active_record/acts/muck_activity.rb, line 59</span>
+59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
+60: <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>)
+61: <span class="ruby-keyword kw">end</span>
+</pre>
+ </div>
+ </div>
+ </div>
+
+ <div id="method-M000011" class="method-detail">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+ <a href="#M000011" class="method-signature">
+ <span class="method-name">status</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+<tt><a href="InstanceMethods.html#M000008">status</a></tt> returns the
+first activity item from the user‘s activity feed that is a <a
+href="InstanceMethods.html#M000008">status</a> update. Used for displaying
+the last <a href="InstanceMethods.html#M000008">status</a> update the user
+made
+</p>
+ <p><a class="source-toggle" href="#"
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
+ <div class="method-source-code" id="M000011-source">
+<pre>
+ <span class="ruby-comment cmt"># File lib/muck_activities/muck_activity.rb, line 59</span>
+59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">status</span>
+60: <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>)
+61: <span class="ruby-keyword kw">end</span>
</pre>
</div>
</div>
</div>
\ No newline at end of file