gitlabhq/doc/code/classes/EventsHelper.html
2012-12-30 14:43:00 +02:00

289 lines
12 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>EventsHelper</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<h1>
<span class="type">Module</span>
EventsHelper
</h1>
<ul class="files">
<li><a href="../files/app/helpers/events_helper_rb.html">app/helpers/events_helper.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>E</dt>
<dd>
<ul>
<li>
<a href="#method-i-event_action_name">event_action_name</a>,
</li>
<li>
<a href="#method-i-event_filter_link">event_filter_link</a>,
</li>
<li>
<a href="#method-i-event_image">event_image</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-link_to_author">link_to_author</a>
</li>
</ul>
</dd>
</dl>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-event_action_name">
<b>event_action_name</b>(event)
<a href="../classes/EventsHelper.html#method-i-event_action_name" name="method-i-event_action_name" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-event_action_name_source')" id="l_method-i-event_action_name_source">show</a>
</p>
<div id="method-i-event_action_name_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/events_helper.rb, line 13</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">event_action_name</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">target</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">target_type</span>
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">target_type</span>.<span class="ruby-identifier">titleize</span>.<span class="ruby-identifier">downcase</span>
<span class="ruby-keyword">else</span>
<span class="ruby-string">'project'</span>
<span class="ruby-keyword">end</span>
[<span class="ruby-identifier">event</span>.<span class="ruby-identifier">action_name</span>, <span class="ruby-identifier">target</span>].<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot; &quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-event_filter_link">
<b>event_filter_link</b>(key, tooltip)
<a href="../classes/EventsHelper.html#method-i-event_filter_link" name="method-i-event_filter_link" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-event_filter_link_source')" id="l_method-i-event_filter_link_source">show</a>
</p>
<div id="method-i-event_filter_link_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/events_helper.rb, line 37</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">event_filter_link</span> <span class="ruby-identifier">key</span>, <span class="ruby-identifier">tooltip</span>
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>
<span class="ruby-identifier">filter</span> = <span class="ruby-ivar">@event_filter</span>.<span class="ruby-identifier">options</span> <span class="ruby-identifier">key</span>
<span class="ruby-identifier">inactive</span> = <span class="ruby-keyword">if</span> <span class="ruby-ivar">@event_filter</span>.<span class="ruby-identifier">active?</span> <span class="ruby-identifier">key</span>
<span class="ruby-keyword">nil</span>
<span class="ruby-keyword">else</span>
<span class="ruby-string">'inactive'</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">content_tag</span> <span class="ruby-value">:div</span>, <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-node">&quot;filter_icon #{inactive}&quot;</span> <span class="ruby-keyword ruby-title">do</span>
<span class="ruby-identifier">link_to</span> <span class="ruby-identifier">dashboard_path</span>(<span class="ruby-identifier">event_filter</span><span class="ruby-operator">:</span> <span class="ruby-identifier">filter</span>), <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-string">'has_tooltip'</span>, <span class="ruby-string">'data-original-title'</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword ruby-title">tooltip</span> <span class="ruby-keyword">do</span>
<span class="ruby-identifier">image_tag</span> <span class="ruby-node">&quot;event_filter_#{key}.png&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-event_image">
<b>event_image</b>(event)
<a href="../classes/EventsHelper.html#method-i-event_image" name="method-i-event_image" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-event_image_source')" id="l_method-i-event_image_source">show</a>
</p>
<div id="method-i-event_image_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/events_helper.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">event_image</span> <span class="ruby-identifier">event</span>
<span class="ruby-identifier">event_image_path</span> = <span class="ruby-keyword">if</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">push?</span>
<span class="ruby-string">&quot;event_push.png&quot;</span>
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">merged?</span>
<span class="ruby-string">&quot;event_mr_merged.png&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">event_image_path</span>
<span class="ruby-identifier">content_tag</span> <span class="ruby-value">:div</span>, <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-string">'event_icon'</span> <span class="ruby-keyword ruby-title">do</span>
<span class="ruby-identifier">image_tag</span> <span class="ruby-identifier">event_image_path</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-link_to_author">
<b>link_to_author</b>(event)
<a href="../classes/EventsHelper.html#method-i-link_to_author" name="method-i-link_to_author" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-link_to_author_source')" id="l_method-i-link_to_author_source">show</a>
</p>
<div id="method-i-link_to_author_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/events_helper.rb, line 2</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">link_to_author</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">project</span> = <span class="ruby-identifier">event</span>.<span class="ruby-identifier">project</span>
<span class="ruby-identifier">tm</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">team_member_by_id</span>(<span class="ruby-identifier">event</span>.<span class="ruby-identifier">author_id</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">project</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">tm</span>
<span class="ruby-identifier">link_to</span> <span class="ruby-identifier">event</span>.<span class="ruby-identifier">author_name</span>, <span class="ruby-identifier">project_team_member_path</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">tm</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">author_name</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>