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

384 lines
No EOL
15 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>ProjectsHelper</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>
ProjectsHelper
</h1>
<ul class="files">
<li><a href="../files/app/helpers/projects_helper_rb.html">app/helpers/projects_helper.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>G</dt>
<dd>
<ul>
<li>
<a href="#method-i-grouper_project_members">grouper_project_members</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-link_to_member">link_to_member</a>,
</li>
<li>
<a href="#method-i-link_to_project">link_to_project</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-project_title">project_title</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-remove_from_team_message">remove_from_team_message</a>
</li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li>
<a href="#method-i-tm_path">tm_path</a>
</li>
</ul>
</dd>
</dl>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-grouper_project_members">
<b>grouper_project_members</b>(project)
<a href="../classes/ProjectsHelper.html#method-i-grouper_project_members" name="method-i-grouper_project_members" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-grouper_project_members_source')" id="l_method-i-grouper_project_members_source">show</a>
</p>
<div id="method-i-grouper_project_members_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/projects_helper.rb, line 2</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">grouper_project_members</span>(<span class="ruby-identifier">project</span>)
<span class="ruby-ivar">@project</span>.<span class="ruby-identifier">users_projects</span>.<span class="ruby-identifier">sort_by</span>(&amp;<span class="ruby-value">:project_access</span>).<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">group_by</span>(&amp;<span class="ruby-value">:project_access</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-link_to_member">
<b>link_to_member</b>(project, author)
<a href="../classes/ProjectsHelper.html#method-i-link_to_member" name="method-i-link_to_member" 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_member_source')" id="l_method-i-link_to_member_source">show</a>
</p>
<div id="method-i-link_to_member_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/projects_helper.rb, line 23</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">link_to_member</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">author</span>)
<span class="ruby-keyword">return</span> <span class="ruby-string">&quot;(deleted)&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">author</span>
<span class="ruby-comment"># Build avatar image tag</span>
<span class="ruby-identifier">avatar</span> = <span class="ruby-identifier">image_tag</span>(<span class="ruby-identifier">gravatar_icon</span>(<span class="ruby-identifier">author</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:email</span>)), <span class="ruby-identifier">width</span><span class="ruby-operator">:</span> <span class="ruby-number">16</span>, <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;lil_av&quot;</span>)
<span class="ruby-comment"># Build name strong tag</span>
<span class="ruby-keyword ruby-title">name</span> = <span class="ruby-identifier">content_tag</span> <span class="ruby-value">:strong</span>, <span class="ruby-identifier">author</span>.<span class="ruby-identifier">name</span>, <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-string">'author'</span>
<span class="ruby-keyword ruby-title">author_html</span> = <span class="ruby-identifier">avatar</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">name</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">author</span>)
<span class="ruby-identifier">content_tag</span> <span class="ruby-value">:span</span>, <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-string">'member-link'</span> <span class="ruby-keyword ruby-title">do</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">tm</span>
<span class="ruby-identifier">link_to</span> <span class="ruby-identifier">author_html</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">class</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;author_link&quot;</span>
<span class="ruby-keyword ruby-title">else</span>
<span class="ruby-identifier">author_html</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-link_to_project">
<b>link_to_project</b>(project)
<a href="../classes/ProjectsHelper.html#method-i-link_to_project" name="method-i-link_to_project" 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_project_source')" id="l_method-i-link_to_project_source">show</a>
</p>
<div id="method-i-link_to_project_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/projects_helper.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">link_to_project</span> <span class="ruby-identifier">project</span>
<span class="ruby-identifier">link_to</span> <span class="ruby-identifier">project</span> <span class="ruby-keyword">do</span>
<span class="ruby-identifier">title</span> = <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:strong</span>, <span class="ruby-identifier">project</span>.<span class="ruby-identifier">name</span>)
<span class="ruby-keyword">if</span> <span class="ruby-identifier">project</span>.<span class="ruby-identifier">namespace</span>
<span class="ruby-identifier">namespace</span> = <span class="ruby-identifier">content_tag</span>(<span class="ruby-value">:span</span>, <span class="ruby-node">&quot;#{project.namespace.human_name} / &quot;</span>, <span class="ruby-keyword">class</span><span class="ruby-operator">:</span> <span class="ruby-string">'tiny'</span>)
<span class="ruby-keyword ruby-title">title</span> = <span class="ruby-identifier">namespace</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">title</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">title</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-project_title">
<b>project_title</b>(project)
<a href="../classes/ProjectsHelper.html#method-i-project_title" name="method-i-project_title" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-project_title_source')" id="l_method-i-project_title_source">show</a>
</p>
<div id="method-i-project_title_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/projects_helper.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">project_title</span> <span class="ruby-identifier">project</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">project</span>.<span class="ruby-identifier">group</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">name_with_namespace</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">project</span>.<span class="ruby-identifier">name</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-remove_from_team_message">
<b>remove_from_team_message</b>(project, member)
<a href="../classes/ProjectsHelper.html#method-i-remove_from_team_message" name="method-i-remove_from_team_message" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-remove_from_team_message_source')" id="l_method-i-remove_from_team_message_source">show</a>
</p>
<div id="method-i-remove_from_team_message_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/projects_helper.rb, line 6</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">remove_from_team_message</span>(<span class="ruby-identifier">project</span>, <span class="ruby-identifier">member</span>)
<span class="ruby-node">&quot;You are going to remove #{member.user_name} from #{project.name}. Are you sure?&quot;</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-tm_path">
<b>tm_path</b>(team_member)
<a href="../classes/ProjectsHelper.html#method-i-tm_path" name="method-i-tm_path" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-tm_path_source')" id="l_method-i-tm_path_source">show</a>
</p>
<div id="method-i-tm_path_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/helpers/projects_helper.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">tm_path</span> <span class="ruby-identifier">team_member</span>
<span class="ruby-identifier">project_team_member_path</span>(<span class="ruby-ivar">@project</span>, <span class="ruby-identifier">team_member</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>