Files
fetsite/doc/app/LikeVoteable/InstanceMethods.html

497 lines
19 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Module: LikeVoteable::InstanceMethods</title>
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
</head>
<body id="top" class="module">
<div id="metadata">
<div id="home-metadata">
<div id="home-section" class="section">
<h3 class="section-header">
<a href="../index.html">Home</a>
<a href="../index.html#classes">Classes</a>
<a href="../index.html#methods">Methods</a>
</h3>
</div>
</div>
<div id="file-metadata">
<div id="file-list-section" class="section">
<h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
<li><a href="../lib/like_voteable_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
class="thickbox" title="lib/like_voteable.rb">lib/like_voteable.rb</a></li>
</ul>
</div>
</div>
</div>
<div id="class-metadata">
<!-- Method Quickref -->
<div id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-i-dislike">#dislike</a></li>
<li><a href="#method-i-like">#like</a></li>
</ul>
</div>
</div>
<div id="project-metadata">
<div id="fileindex-section" class="section project-section">
<h3 class="section-header">Files</h3>
<ul>
<li class="file"><a href="../doc/README_FOR_APP.html">README_FOR_APP</a></li>
</ul>
</div>
<div id="classindex-section" class="section project-section">
<h3 class="section-header">Class/Module Index
<span class="search-toggle"><img src="../images/find.png"
height="16" width="16" alt="[+]"
title="show/hide quicksearch" /></span></h3>
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
<fieldset>
<legend>Quicksearch</legend>
<input type="text" name="quicksearch" value=""
class="quicksearch-field" />
</fieldset>
</form>
<ul class="link-list">
<li><a href="../Flagable.html">Flagable</a></li>
<li><a href="../Flagable/ActsAsFlagableController.html">Flagable::ActsAsFlagableController</a></li>
<li><a href="../Flagable/ActsAsFlagableController/ClassMethods.html">Flagable::ActsAsFlagableController::ClassMethods</a></li>
<li><a href="../Flagable/ActsAsFlagableController/LocalClassMethods.html">Flagable::ActsAsFlagableController::LocalClassMethods</a></li>
<li><a href="../Flagable/ActsAsFlagableController/LocalInstanceMethods.html">Flagable::ActsAsFlagableController::LocalInstanceMethods</a></li>
<li><a href="../Flagable/ActsAsFlagableRecord.html">Flagable::ActsAsFlagableRecord</a></li>
<li><a href="../Flagable/ActsAsFlagableRecord/ClassMethods.html">Flagable::ActsAsFlagableRecord::ClassMethods</a></li>
<li><a href="../Flagable/ActsAsFlagableRecord/LocalInstanceMethods.html">Flagable::ActsAsFlagableRecord::LocalInstanceMethods</a></li>
<li><a href="../Flagable/FlagableHelper.html">Flagable::FlagableHelper</a></li>
<li><a href="../Survey.html">Survey</a></li>
<li><a href="../Survey/Answer.html">Survey::Answer</a></li>
<li><a href="../Survey/AnswersHelper.html">Survey::AnswersHelper</a></li>
<li><a href="../Survey/Choice.html">Survey::Choice</a></li>
<li><a href="../Survey/ChoicesController.html">Survey::ChoicesController</a></li>
<li><a href="../Survey/ChoicesHelper.html">Survey::ChoicesHelper</a></li>
<li><a href="../Survey/Question.html">Survey::Question</a></li>
<li><a href="../Survey/QuestionsController.html">Survey::QuestionsController</a></li>
<li><a href="../Survey/QuestionsHelper.html">Survey::QuestionsHelper</a></li>
<li><a href="../IsCommentable.html">IsCommentable</a></li>
<li><a href="../IsCommentable/InstanceMethods.html">IsCommentable::InstanceMethods</a></li>
<li><a href="../LikeVoteable.html">LikeVoteable</a></li>
<li><a href="../LikeVoteable/InstanceMethods.html">LikeVoteable::InstanceMethods</a></li>
<li><a href="../Users.html">Users</a></li>
<li><a href="../Users/OmniauthCallbacksController.html">Users::OmniauthCallbacksController</a></li>
<li><a href="../Ability.html">Ability</a></li>
<li><a href="../ApplicationController.html">ApplicationController</a></li>
<li><a href="../ApplicationHelper.html">ApplicationHelper</a></li>
<li><a href="../Attachment.html">Attachment</a></li>
<li><a href="../AttachmentUploader.html">AttachmentUploader</a></li>
<li><a href="../AttachmentsController.html">AttachmentsController</a></li>
<li><a href="../AttachmentsHelper.html">AttachmentsHelper</a></li>
<li><a href="../Beispiel.html">Beispiel</a></li>
<li><a href="../BeispieldateiUploader.html">BeispieldateiUploader</a></li>
<li><a href="../BeispieleController.html">BeispieleController</a></li>
<li><a href="../BeispieleHelper.html">BeispieleHelper</a></li>
<li><a href="../Calendar.html">Calendar</a></li>
<li><a href="../CalendarsController.html">CalendarsController</a></li>
<li><a href="../CalendarsHelper.html">CalendarsHelper</a></li>
<li><a href="../CalentriesController.html">CalentriesController</a></li>
<li><a href="../CalentriesHelper.html">CalentriesHelper</a></li>
<li><a href="../Calentry.html">Calentry</a></li>
<li><a href="../CheckboxAutocompleteInput.html">CheckboxAutocompleteInput</a></li>
<li><a href="../Comment.html">Comment</a></li>
<li><a href="../CommentsController.html">CommentsController</a></li>
<li><a href="../CommentsHelper.html">CommentsHelper</a></li>
<li><a href="../ConfigController.html">ConfigController</a></li>
<li><a href="../Confirmmailer.html">Confirmmailer</a></li>
<li><a href="../CrawlerController.html">CrawlerController</a></li>
<li><a href="../Crawlobject.html">Crawlobject</a></li>
<li><a href="../CrawlobjectHelper.html">CrawlobjectHelper</a></li>
<li><a href="../DateStringInput.html">DateStringInput</a></li>
<li><a href="../DatepickerInput.html">DatepickerInput</a></li>
<li><a href="../DatetimepickerInput.html">DatetimepickerInput</a></li>
<li><a href="../Document.html">Document</a></li>
<li><a href="../DocumentsController.html">DocumentsController</a></li>
<li><a href="../EmailsController.html">EmailsController</a></li>
<li><a href="../Fetprofile.html">Fetprofile</a></li>
<li><a href="../FetprofilesController.html">FetprofilesController</a></li>
<li><a href="../FetprofilesHelper.html">FetprofilesHelper</a></li>
<li><a href="../Fetznedition.html">Fetznedition</a></li>
<li><a href="../FetzneditionsController.html">FetzneditionsController</a></li>
<li><a href="../FetzneditionsHelper.html">FetzneditionsHelper</a></li>
<li><a href="../Foto.html">Foto</a></li>
<li><a href="../FotoUploader.html">FotoUploader</a></li>
<li><a href="../FotosController.html">FotosController</a></li>
<li><a href="../FotosHelper.html">FotosHelper</a></li>
<li><a href="../Frage.html">Frage</a></li>
<li><a href="../FragenController.html">FragenController</a></li>
<li><a href="../FragenHelper.html">FragenHelper</a></li>
<li><a href="../GalleriesController.html">GalleriesController</a></li>
<li><a href="../GalleriesHelper.html">GalleriesHelper</a></li>
<li><a href="../Gallery.html">Gallery</a></li>
<li><a href="../GremienController.html">GremienController</a></li>
<li><a href="../GremienHelper.html">GremienHelper</a></li>
<li><a href="../Gremium.html">Gremium</a></li>
<li><a href="../HomeController.html">HomeController</a></li>
<li><a href="../Key.html">Key</a></li>
<li><a href="../Lecturer.html">Lecturer</a></li>
<li><a href="../LecturersController.html">LecturersController</a></li>
<li><a href="../LecturersHelper.html">LecturersHelper</a></li>
<li><a href="../Lva.html">Lva</a></li>
<li><a href="../LvasController.html">LvasController</a></li>
<li><a href="../MailerHelper.html">MailerHelper</a></li>
<li><a href="../Meeting.html">Meeting</a></li>
<li><a href="../MeetingsController.html">MeetingsController</a></li>
<li><a href="../MeetingsHelper.html">MeetingsHelper</a></li>
<li><a href="../Meetingtyp.html">Meetingtyp</a></li>
<li><a href="../MeetingtypsController.html">MeetingtypsController</a></li>
<li><a href="../MeetingtypsHelper.html">MeetingtypsHelper</a></li>
<li><a href="../Membership.html">Membership</a></li>
<li><a href="../MembershipsController.html">MembershipsController</a></li>
<li><a href="../MembershipsHelper.html">MembershipsHelper</a></li>
<li><a href="../Modul.html">Modul</a></li>
<li><a href="../Modulgruppe.html">Modulgruppe</a></li>
<li><a href="../ModulgruppenController.html">ModulgruppenController</a></li>
<li><a href="../ModulgruppenHelper.html">ModulgruppenHelper</a></li>
<li><a href="../ModulsController.html">ModulsController</a></li>
<li><a href="../ModulsHelper.html">ModulsHelper</a></li>
<li><a href="../Neuigkeit.html">Neuigkeit</a></li>
<li><a href="../NeuigkeitenController.html">NeuigkeitenController</a></li>
<li><a href="../NewsMailer.html">NewsMailer</a></li>
<li><a href="../Nlink.html">Nlink</a></li>
<li><a href="../PagesHelper.html">PagesHelper</a></li>
<li><a href="../PictureUploader.html">PictureUploader</a></li>
<li><a href="../PluginsHelper.html">PluginsHelper</a></li>
<li><a href="../Role.html">Role</a></li>
<li><a href="../Rubrik.html">Rubrik</a></li>
<li><a href="../RubrikenController.html">RubrikenController</a></li>
<li><a href="../RubrikenHelper.html">RubrikenHelper</a></li>
<li><a href="../Semester.html">Semester</a></li>
<li><a href="../SemestersController.html">SemestersController</a></li>
<li><a href="../SemestersHelper.html">SemestersHelper</a></li>
<li><a href="../StudienController.html">StudienController</a></li>
<li><a href="../StudienHelper.html">StudienHelper</a></li>
<li><a href="../Studium.html">Studium</a></li>
<li><a href="../StudmodsHelper.html">StudmodsHelper</a></li>
<li><a href="../Thema.html">Thema</a></li>
<li><a href="../ThemenController.html">ThemenController</a></li>
<li><a href="../ThemenHelper.html">ThemenHelper</a></li>
<li><a href="../Themengruppe.html">Themengruppe</a></li>
<li><a href="../ThemengruppenController.html">ThemengruppenController</a></li>
<li><a href="../ThemengruppenHelper.html">ThemengruppenHelper</a></li>
<li><a href="../TinymceTextInput.html">TinymceTextInput</a></li>
<li><a href="../UploaderInput.html">UploaderInput</a></li>
<li><a href="../User.html">User</a></li>
<li><a href="../UsersController.html">UsersController</a></li>
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
</div>
</div>
<div id="documentation">
<h1 class="module">LikeVoteable::InstanceMethods</h1>
<div id="description" class="description">
</div><!-- description -->
<div id="5Buntitled-5D" class="documentation-section">
<!-- Methods -->
<div id="public-instance-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="dislike-method" class="method-detail ">
<a name="method-i-dislike"></a>
<div class="method-heading">
<span class="method-name">dislike</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="dislike-source">
<pre>
<span class="ruby-comment"># File lib/like_voteable.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">dislike</span>
<span class="ruby-ivar">@obj</span>=<span class="ruby-identifier">controller_name</span>.<span class="ruby-identifier">classify</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">disliked?</span>(<span class="ruby-ivar">@obj</span>)
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">undisliked_by</span> <span class="ruby-identifier">current_user</span>
<span class="ruby-keyword">else</span>
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">disliked_by</span> <span class="ruby-identifier">current_user</span>
<span class="ruby-keyword">end</span>
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">touch</span>
<span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> {
<span class="ruby-identifier">redirect_to</span> <span class="ruby-ivar">@obj</span>
}
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">js</span> {
<span class="ruby-identifier">render</span> <span class="ruby-value">:show</span>
}
<span class="ruby-comment">#</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- dislike-source -->
</div>
</div><!-- dislike-method -->
<div id="like-method" class="method-detail ">
<a name="method-i-like"></a>
<div class="method-heading">
<span class="method-name">like</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="like-source">
<pre>
<span class="ruby-comment"># File lib/like_voteable.rb, line 9</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">like</span>
<span class="ruby-ivar">@obj</span>=<span class="ruby-identifier">controller_name</span>.<span class="ruby-identifier">classify</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">liked?</span> <span class="ruby-ivar">@obj</span>
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">unliked_by</span> <span class="ruby-identifier">current_user</span>
<span class="ruby-keyword">else</span>
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">liked_by</span> <span class="ruby-identifier">current_user</span>
<span class="ruby-keyword">end</span>
<span class="ruby-ivar">@obj</span>.<span class="ruby-identifier">touch</span>
<span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> {
<span class="ruby-identifier">redirect_to</span> <span class="ruby-ivar">@obj</span>
}
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">js</span> {
<span class="ruby-identifier">render</span> <span class="ruby-value">:show</span>
}
<span class="ruby-comment">#</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- like-source -->
</div>
</div><!-- like-method -->
</div><!-- public-instance-method-details -->
</div><!-- 5Buntitled-5D -->
</div><!-- documentation -->
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator</a> 2</small>.</p>
</div>
</body>
</html>