890 lines
No EOL
43 KiB
HTML
890 lines
No EOL
43 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>ApplicationHelper</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>
|
|
ApplicationHelper
|
|
|
|
</h1>
|
|
<ul class="files">
|
|
|
|
<li><a href="../files/app/helpers/application_helper_rb.html">app/helpers/application_helper.rb</a></li>
|
|
|
|
</ul>
|
|
</div>
|
|
<div id="bodyContent">
|
|
<div id="content">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Method ref -->
|
|
<div class="sectiontitle">Methods</div>
|
|
<dl class="methods">
|
|
|
|
<dt>A</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-app_theme">app_theme</a>,
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-authbutton">authbutton</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>C</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-current_action-3F">current_action?</a>,
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-current_controller-3F">current_controller?</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>E</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-emoji_autocomplete_source">emoji_autocomplete_source</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>G</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-gravatar_icon">gravatar_icon</a>,
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-grouped_options_refs">grouped_options_refs</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>H</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-hexdigest">hexdigest</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>L</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-last_commit">last_commit</a>,
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-ldap_enable-3F">ldap_enable?</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>P</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-project_last_activity">project_last_activity</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>R</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-request_protocol">request_protocol</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>S</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-search_autocomplete_source">search_autocomplete_source</a>,
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-show_last_push_widget-3F">show_last_push_widget?</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>U</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-user_color_scheme_class">user_color_scheme_class</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
<dt>W</dt>
|
|
<dd>
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
<a href="#method-i-web_app_url">web_app_url</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Methods -->
|
|
|
|
<div class="sectiontitle">Instance Public methods</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-app_theme">
|
|
|
|
<b>app_theme</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-app_theme" name="method-i-app_theme" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-app_theme_source')" id="l_method-i-app_theme_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-app_theme_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 130</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">app_theme</span>
|
|
<span class="ruby-constant">Gitlab</span><span class="ruby-operator">::</span><span class="ruby-constant">Theme</span>.<span class="ruby-identifier">css_class_by_id</span>(<span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:theme_id</span>))
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-authbutton">
|
|
|
|
<b>authbutton</b>(provider, size = 64)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-authbutton" name="method-i-authbutton" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-authbutton_source')" id="l_method-i-authbutton_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-authbutton_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 159</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">authbutton</span>(<span class="ruby-identifier">provider</span>, <span class="ruby-identifier">size</span> = <span class="ruby-number">64</span>)
|
|
<span class="ruby-identifier">file_name</span> = <span class="ruby-node">"#{provider.to_s.split('_').first}_#{size}.png"</span>
|
|
<span class="ruby-identifier">image_tag</span>(<span class="ruby-node">"authbuttons/#{file_name}"</span>,
|
|
<span class="ruby-identifier">alt</span><span class="ruby-operator">:</span> <span class="ruby-node">"Sign in with #{provider.to_s.titleize}"</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-current_action-3F">
|
|
|
|
<b>current_action?</b>(*args)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-current_action-3F" name="method-i-current_action-3F" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
<p>Check if a partcular action is the current one</p>
|
|
|
|
<p>args - One or more action names to check</p>
|
|
|
|
<p>Examples</p>
|
|
|
|
<pre class="ruby"><span class="ruby-comment"># On Projects#new</span>
|
|
<span class="ruby-identifier">current_action?</span>(:<span class="ruby-identifier">new</span>) <span class="ruby-comment"># => true</span>
|
|
<span class="ruby-identifier">current_action?</span>(:<span class="ruby-identifier">create</span>) <span class="ruby-comment"># => false</span>
|
|
<span class="ruby-identifier">current_action?</span>(:<span class="ruby-identifier">new</span>, :<span class="ruby-identifier">create</span>) <span class="ruby-comment"># => true</span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-current_action-3F_source')" id="l_method-i-current_action-3F_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-current_action-3F_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 30</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_action?</span>(*<span class="ruby-identifier">args</span>)
|
|
<span class="ruby-identifier">args</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">action_name</span> }
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-current_controller-3F">
|
|
|
|
<b>current_controller?</b>(*args)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-current_controller-3F" name="method-i-current_controller-3F" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
<p>Check if a particular controller is the current one</p>
|
|
|
|
<p>args - One or more controller names to check</p>
|
|
|
|
<p>Examples</p>
|
|
|
|
<pre class="ruby"><span class="ruby-comment"># On TreeController</span>
|
|
<span class="ruby-identifier">current_controller?</span>(:<span class="ruby-identifier">tree</span>) <span class="ruby-comment"># => true</span>
|
|
<span class="ruby-identifier">current_controller?</span>(:<span class="ruby-identifier">commits</span>) <span class="ruby-comment"># => false</span>
|
|
<span class="ruby-identifier">current_controller?</span>(:<span class="ruby-identifier">commits</span>, :<span class="ruby-identifier">tree</span>) <span class="ruby-comment"># => true</span>
|
|
</pre>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-current_controller-3F_source')" id="l_method-i-current_controller-3F_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-current_controller-3F_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 16</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">current_controller?</span>(*<span class="ruby-identifier">args</span>)
|
|
<span class="ruby-identifier">args</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">controller</span>.<span class="ruby-identifier">controller_name</span> }
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-emoji_autocomplete_source">
|
|
|
|
<b>emoji_autocomplete_source</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-emoji_autocomplete_source" name="method-i-emoji_autocomplete_source" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-emoji_autocomplete_source_source')" id="l_method-i-emoji_autocomplete_source_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-emoji_autocomplete_source_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 120</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">emoji_autocomplete_source</span>
|
|
<span class="ruby-comment"># should be an array of strings</span>
|
|
<span class="ruby-comment"># so to_s can be called, because it is sufficient and to_json is too slow</span>
|
|
<span class="ruby-constant">Emoji</span>.<span class="ruby-identifier">names</span>.<span class="ruby-identifier">to_s</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-gravatar_icon">
|
|
|
|
<b>gravatar_icon</b>(user_email = '', size = nil)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-gravatar_icon" name="method-i-gravatar_icon" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-gravatar_icon_source')" id="l_method-i-gravatar_icon_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-gravatar_icon_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 34</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">gravatar_icon</span>(<span class="ruby-identifier">user_email</span> = <span class="ruby-string">''</span>, <span class="ruby-identifier">size</span> = <span class="ruby-keyword">nil</span>)
|
|
<span class="ruby-identifier">size</span> = <span class="ruby-number">40</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">size</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">size</span> <span class="ruby-operator"><=</span> <span class="ruby-number">0</span>
|
|
|
|
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">gravatar</span>.<span class="ruby-identifier">enabled</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">user_email</span>.<span class="ruby-identifier">blank?</span>
|
|
<span class="ruby-string">'no_avatar.png'</span>
|
|
<span class="ruby-keyword">else</span>
|
|
<span class="ruby-identifier">gravatar_url</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span> <span class="ruby-operator">?</span> <span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">gravatar</span>.<span class="ruby-identifier">ssl_url</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">gravatar</span>.<span class="ruby-identifier">plain_url</span>
|
|
<span class="ruby-identifier">user_email</span>.<span class="ruby-identifier">strip!</span>
|
|
<span class="ruby-identifier">sprintf</span>(<span class="ruby-identifier">gravatar_url</span>, {<span class="ruby-value">:hash</span> =<span class="ruby-operator">></span> <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-identifier">user_email</span>.<span class="ruby-identifier">downcase</span>), <span class="ruby-value">:email</span> =<span class="ruby-operator">></span> <span class="ruby-constant">URI</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">user_email</span>), <span class="ruby-value">:size</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">size</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-grouped_options_refs">
|
|
|
|
<b>grouped_options_refs</b>(destination = :tree)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-grouped_options_refs" name="method-i-grouped_options_refs" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-grouped_options_refs_source')" id="l_method-i-grouped_options_refs_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-grouped_options_refs_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 64</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">grouped_options_refs</span>(<span class="ruby-identifier">destination</span> = <span class="ruby-value">:tree</span>)
|
|
<span class="ruby-identifier">options</span> = [
|
|
[<span class="ruby-string">"Branch"</span>, <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">branch_names</span> ],
|
|
[ <span class="ruby-string">"Tag"</span>, <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">tag_names</span> ]
|
|
]
|
|
|
|
<span class="ruby-comment"># If reference is commit id -</span>
|
|
<span class="ruby-comment"># we should add it to branch/tag selectbox</span>
|
|
<span class="ruby-keyword">if</span>(<span class="ruby-ivar">@ref</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-ivar">@ref</span>) <span class="ruby-operator">&&</span>
|
|
<span class="ruby-ivar">@ref</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r^[0-9a-zA-Z]{6,52}$/</span>)
|
|
<span class="ruby-identifier">options</span> <span class="ruby-operator"><<</span> [<span class="ruby-string">"Commit"</span>, [<span class="ruby-ivar">@ref</span>]]
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
<span class="ruby-identifier">grouped_options_for_select</span>(<span class="ruby-identifier">options</span>, <span class="ruby-ivar">@ref</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">default_branch</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-hexdigest">
|
|
|
|
<b>hexdigest</b>(string)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-hexdigest" name="method-i-hexdigest" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-hexdigest_source')" id="l_method-i-hexdigest_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-hexdigest_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 146</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">hexdigest</span>(<span class="ruby-identifier">string</span>)
|
|
<span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">SHA1</span>.<span class="ruby-identifier">hexdigest</span> <span class="ruby-identifier">string</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-last_commit">
|
|
|
|
<b>last_commit</b>(project)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-last_commit" name="method-i-last_commit" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-last_commit_source')" id="l_method-i-last_commit_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-last_commit_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 54</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last_commit</span>(<span class="ruby-identifier">project</span>)
|
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">project</span>.<span class="ruby-identifier">repo_exists?</span>
|
|
<span class="ruby-identifier">time_ago_in_words</span>(<span class="ruby-identifier">project</span>.<span class="ruby-identifier">commit</span>.<span class="ruby-identifier">committed_date</span>) <span class="ruby-operator">+</span> <span class="ruby-string">" ago"</span>
|
|
<span class="ruby-keyword">else</span>
|
|
<span class="ruby-string">"Never"</span>
|
|
<span class="ruby-keyword">end</span>
|
|
<span class="ruby-keyword">rescue</span>
|
|
<span class="ruby-string">"Never"</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-ldap_enable-3F">
|
|
|
|
<b>ldap_enable?</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-ldap_enable-3F" name="method-i-ldap_enable-3F" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-ldap_enable-3F_source')" id="l_method-i-ldap_enable-3F_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-ldap_enable-3F_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 126</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">ldap_enable?</span>
|
|
<span class="ruby-constant">Devise</span>.<span class="ruby-identifier">omniauth_providers</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value">:ldap</span>)
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-project_last_activity">
|
|
|
|
<b>project_last_activity</b>(project)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-project_last_activity" name="method-i-project_last_activity" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-project_last_activity_source')" id="l_method-i-project_last_activity_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-project_last_activity_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 150</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">project_last_activity</span> <span class="ruby-identifier">project</span>
|
|
<span class="ruby-identifier">activity</span> = <span class="ruby-identifier">project</span>.<span class="ruby-identifier">last_activity</span>
|
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">activity</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">activity</span>.<span class="ruby-identifier">created_at</span>
|
|
<span class="ruby-identifier">time_ago_in_words</span>(<span class="ruby-identifier">activity</span>.<span class="ruby-identifier">created_at</span>) <span class="ruby-operator">+</span> <span class="ruby-string">" ago"</span>
|
|
<span class="ruby-keyword">else</span>
|
|
<span class="ruby-string">"Never"</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-request_protocol">
|
|
|
|
<b>request_protocol</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-request_protocol" name="method-i-request_protocol" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-request_protocol_source')" id="l_method-i-request_protocol_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-request_protocol_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 46</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">request_protocol</span>
|
|
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span> <span class="ruby-operator">?</span> <span class="ruby-string">"https"</span> <span class="ruby-operator">:</span> <span class="ruby-string">"http"</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-search_autocomplete_source">
|
|
|
|
<b>search_autocomplete_source</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-search_autocomplete_source" name="method-i-search_autocomplete_source" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-search_autocomplete_source_source')" id="l_method-i-search_autocomplete_source_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-search_autocomplete_source_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 80</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">search_autocomplete_source</span>
|
|
<span class="ruby-identifier">projects</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">authorized_projects</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> { <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">name_with_namespace</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_path</span>(<span class="ruby-identifier">p</span>) } }
|
|
<span class="ruby-identifier">groups</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">authorized_groups</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">group</span><span class="ruby-operator">|</span> { <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"<group> #{group.name}"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">group_path</span>(<span class="ruby-identifier">group</span>) } }
|
|
|
|
<span class="ruby-identifier">default_nav</span> = [
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"My Profile"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">profile_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"My SSH Keys"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">keys_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"My Dashboard"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">root_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"Admin Section"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">admin_root_path</span> },
|
|
]
|
|
|
|
<span class="ruby-identifier">help_nav</span> = [
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"Workflow Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_workflow_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"Permissions Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_permissions_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"Web Hooks Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_web_hooks_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"System Hooks Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_system_hooks_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"API Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_api_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"Markdown Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_markdown_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"SSH Keys Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_ssh_path</span> },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">"Gitlab Rake Tasks Help"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_raketasks_path</span> },
|
|
]
|
|
|
|
<span class="ruby-identifier">project_nav</span> = []
|
|
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@project</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@project</span>.<span class="ruby-identifier">new_record?</span>
|
|
<span class="ruby-identifier">project_nav</span> = [
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Issues"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_issues_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Commits"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_commits_path</span>(<span class="ruby-ivar">@project</span>, <span class="ruby-ivar">@ref</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">root_ref</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Merge Requests"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_merge_requests_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Milestones"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_milestones_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Snippets"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_snippets_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Team"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_team_index_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Tree"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_tree_path</span>(<span class="ruby-ivar">@project</span>, <span class="ruby-ivar">@ref</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">root_ref</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Wall"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">wall_project_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-node">"#{@project.name} Wiki"</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">project_wikis_path</span>(<span class="ruby-ivar">@project</span>) },
|
|
]
|
|
<span class="ruby-keyword">end</span>
|
|
|
|
[<span class="ruby-identifier">groups</span>, <span class="ruby-identifier">projects</span>, <span class="ruby-identifier">default_nav</span>, <span class="ruby-identifier">project_nav</span>, <span class="ruby-identifier">help_nav</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">to_json</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-show_last_push_widget-3F">
|
|
|
|
<b>show_last_push_widget?</b>(event)
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-show_last_push_widget-3F" name="method-i-show_last_push_widget-3F" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-show_last_push_widget-3F_source')" id="l_method-i-show_last_push_widget-3F_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-show_last_push_widget-3F_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 138</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">show_last_push_widget?</span>(<span class="ruby-identifier">event</span>)
|
|
<span class="ruby-identifier">event</span> <span class="ruby-operator">&&</span>
|
|
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">last_push_to_non_root?</span> <span class="ruby-operator">&&</span>
|
|
<span class="ruby-operator">!</span><span class="ruby-identifier">event</span>.<span class="ruby-identifier">rm_ref?</span> <span class="ruby-operator">&&</span>
|
|
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">project</span> <span class="ruby-operator">&&</span>
|
|
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">project</span>.<span class="ruby-identifier">merge_requests_enabled</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-user_color_scheme_class">
|
|
|
|
<b>user_color_scheme_class</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-user_color_scheme_class" name="method-i-user_color_scheme_class" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-user_color_scheme_class_source')" id="l_method-i-user_color_scheme_class_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-user_color_scheme_class_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 134</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">user_color_scheme_class</span>
|
|
<span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">dark_scheme</span> <span class="ruby-operator">?</span> <span class="ruby-value">:black</span> <span class="ruby-operator">:</span> <span class="ruby-value">:white</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="method">
|
|
<div class="title method-title" id="method-i-web_app_url">
|
|
|
|
<b>web_app_url</b>()
|
|
|
|
<a href="../classes/ApplicationHelper.html#method-i-web_app_url" name="method-i-web_app_url" class="permalink">Link</a>
|
|
</div>
|
|
|
|
|
|
<div class="description">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="sourcecode">
|
|
|
|
<p class="source-link">
|
|
Source:
|
|
<a href="javascript:toggleSource('method-i-web_app_url_source')" id="l_method-i-web_app_url_source">show</a>
|
|
|
|
</p>
|
|
<div id="method-i-web_app_url_source" class="dyn-source">
|
|
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 50</span>
|
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">web_app_url</span>
|
|
<span class="ruby-node">"#{request_protocol}://#{Gitlab.config.gitlab.host}/"</span>
|
|
<span class="ruby-keyword">end</span></pre>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html> |