gitlab-org--gitlab-foss/doc/app/ApplicationHelper.html
Dmitriy Zaporozhets 1ea0dd0ffc App docs
2012-10-25 11:59:41 +03:00

1018 lines
44 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>module ApplicationHelper - Rails Application Documentation</title>
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "./";
</script>
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
<body id="top" class="module">
<nav id="metadata">
<nav id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./table_of_contents.html#classes">Classes</a>
<a href="./table_of_contents.html#methods">Methods</a>
</h3>
</nav>
<nav id="search-section" class="section project-section" class="initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<h3 class="section-header">
<input type="text" name="search" placeholder="Search" id="search-field"
title="Type to search, Up and Down to navigate, Enter to load">
</h3>
</form>
<ul id="search-results" class="initially-hidden"></ul>
</nav>
<div id="file-metadata">
<nav id="file-list-section" class="section">
<h3 class="section-header">Defined In</h3>
<ul>
<li>app/helpers/application_helper.rb
</ul>
</nav>
</div>
<div id="class-metadata">
<!-- Method Quickref -->
<nav id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-i-app_theme">#app_theme</a>
<li><a href="#method-i-authbutton">#authbutton</a>
<li><a href="#method-i-current_action-3F">#current_action?</a>
<li><a href="#method-i-current_controller-3F">#current_controller?</a>
<li><a href="#method-i-emoji_autocomplete_source">#emoji_autocomplete_source</a>
<li><a href="#method-i-gravatar_icon">#gravatar_icon</a>
<li><a href="#method-i-grouped_options_refs">#grouped_options_refs</a>
<li><a href="#method-i-hexdigest">#hexdigest</a>
<li><a href="#method-i-last_commit">#last_commit</a>
<li><a href="#method-i-ldap_enable-3F">#ldap_enable?</a>
<li><a href="#method-i-project_last_activity">#project_last_activity</a>
<li><a href="#method-i-request_protocol">#request_protocol</a>
<li><a href="#method-i-search_autocomplete_source">#search_autocomplete_source</a>
<li><a href="#method-i-show_last_push_widget-3F">#show_last_push_widget?</a>
<li><a href="#method-i-web_app_url">#web_app_url</a>
</ul>
</nav>
</div>
<div id="project-metadata">
<nav id="fileindex-section" class="section project-section">
<h3 class="section-header">Pages</h3>
<ul>
<li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a>
</ul>
</nav>
<nav id="classindex-section" class="section project-section">
<h3 class="section-header">Class and Module Index</h3>
<ul class="link-list">
<li><a href="./Gitlab.html">Gitlab</a>
<li><a href="./Gitlab/API.html">Gitlab::API</a>
<li><a href="./Gitlab/APIHelpers.html">Gitlab::APIHelpers</a>
<li><a href="./Gitlab/AppLogger.html">Gitlab::AppLogger</a>
<li><a href="./Gitlab/Auth.html">Gitlab::Auth</a>
<li><a href="./Gitlab/Encode.html">Gitlab::Encode</a>
<li><a href="./Gitlab/Entities.html">Gitlab::Entities</a>
<li><a href="./Gitlab/Entities/Hook.html">Gitlab::Entities::Hook</a>
<li><a href="./Gitlab/Entities/Issue.html">Gitlab::Entities::Issue</a>
<li><a href="./Gitlab/Entities/Milestone.html">Gitlab::Entities::Milestone</a>
<li><a href="./Gitlab/Entities/Project.html">Gitlab::Entities::Project</a>
<li><a href="./Gitlab/Entities/ProjectMember.html">Gitlab::Entities::ProjectMember</a>
<li><a href="./Gitlab/Entities/ProjectSnippet.html">Gitlab::Entities::ProjectSnippet</a>
<li><a href="./Gitlab/Entities/RepoCommit.html">Gitlab::Entities::RepoCommit</a>
<li><a href="./Gitlab/Entities/RepoObject.html">Gitlab::Entities::RepoObject</a>
<li><a href="./Gitlab/Entities/SSHKey.html">Gitlab::Entities::SSHKey</a>
<li><a href="./Gitlab/Entities/User.html">Gitlab::Entities::User</a>
<li><a href="./Gitlab/Entities/UserBasic.html">Gitlab::Entities::UserBasic</a>
<li><a href="./Gitlab/Entities/UserLogin.html">Gitlab::Entities::UserLogin</a>
<li><a href="./Gitlab/FileEditor.html">Gitlab::FileEditor</a>
<li><a href="./Gitlab/GitLogger.html">Gitlab::GitLogger</a>
<li><a href="./Gitlab/Gitolite.html">Gitlab::Gitolite</a>
<li><a href="./Gitlab/Gitolite/AccessDenied.html">Gitlab::Gitolite::AccessDenied</a>
<li><a href="./Gitlab/GitoliteConfig.html">Gitlab::GitoliteConfig</a>
<li><a href="./Gitlab/GitoliteConfig/PullError.html">Gitlab::GitoliteConfig::PullError</a>
<li><a href="./Gitlab/GitoliteConfig/PushError.html">Gitlab::GitoliteConfig::PushError</a>
<li><a href="./Gitlab/GraphCommit.html">Gitlab::GraphCommit</a>
<li><a href="./Gitlab/InlineDiff.html">Gitlab::InlineDiff</a>
<li><a href="./Gitlab/Issues.html">Gitlab::Issues</a>
<li><a href="./Gitlab/Logger.html">Gitlab::Logger</a>
<li><a href="./Gitlab/Markdown.html">Gitlab::Markdown</a>
<li><a href="./Gitlab/Merge.html">Gitlab::Merge</a>
<li><a href="./Gitlab/Milestones.html">Gitlab::Milestones</a>
<li><a href="./Gitlab/Projects.html">Gitlab::Projects</a>
<li><a href="./Gitlab/Satellite.html">Gitlab::Satellite</a>
<li><a href="./Gitlab/Session.html">Gitlab::Session</a>
<li><a href="./Gitlab/Theme.html">Gitlab::Theme</a>
<li><a href="./Gitlab/Users.html">Gitlab::Users</a>
<li><a href="./Admin.html">Admin</a>
<li><a href="./Admin/DashboardController.html">Admin::DashboardController</a>
<li><a href="./Admin/GroupsController.html">Admin::GroupsController</a>
<li><a href="./Admin/HooksController.html">Admin::HooksController</a>
<li><a href="./Admin/LogsController.html">Admin::LogsController</a>
<li><a href="./Admin/ProjectsController.html">Admin::ProjectsController</a>
<li><a href="./Admin/ResqueController.html">Admin::ResqueController</a>
<li><a href="./Admin/TeamMembersController.html">Admin::TeamMembersController</a>
<li><a href="./Admin/UsersController.html">Admin::UsersController</a>
<li><a href="./Notes.html">Notes</a>
<li><a href="./Notes/CreateContext.html">Notes::CreateContext</a>
<li><a href="./Notes/LoadContext.html">Notes::LoadContext</a>
<li><a href="./Redcarpet.html">Redcarpet</a>
<li><a href="./Redcarpet/Render.html">Redcarpet::Render</a>
<li><a href="./Redcarpet/Render/GitlabHTML.html">Redcarpet::Render::GitlabHTML</a>
<li><a href="./ExtractsPath.html">ExtractsPath</a>
<li><a href="./ExtractsPath/InvalidPathError.html">ExtractsPath::InvalidPathError</a>
<li><a href="./FileSizeValidator.html">FileSizeValidator</a>
<li><a href="./FileSizeValidator/Helper.html">FileSizeValidator::Helper</a>
<li><a href="./Grack.html">Grack</a>
<li><a href="./Grack/Auth.html">Grack::Auth</a>
<li><a href="./IssueCommonality.html">IssueCommonality</a>
<li><a href="./IssueCommonality/ClassMethods.html">IssueCommonality::ClassMethods</a>
<li><a href="./StaticModel.html">StaticModel</a>
<li><a href="./StaticModel/ClassMethods.html">StaticModel::ClassMethods</a>
<li><a href="./Ability.html">Ability</a>
<li><a href="./Account.html">Account</a>
<li><a href="./ActivityObserver.html">ActivityObserver</a>
<li><a href="./AdminController.html">AdminController</a>
<li><a href="./ApplicationController.html">ApplicationController</a>
<li><a href="./ApplicationDecorator.html">ApplicationDecorator</a>
<li><a href="./ApplicationHelper.html">ApplicationHelper</a>
<li><a href="./AttachmentUploader.html">AttachmentUploader</a>
<li><a href="./Authority.html">Authority</a>
<li><a href="./BaseContext.html">BaseContext</a>
<li><a href="./BlameController.html">BlameController</a>
<li><a href="./BlobController.html">BlobController</a>
<li><a href="./Commit.html">Commit</a>
<li><a href="./CommitController.html">CommitController</a>
<li><a href="./CommitDecorator.html">CommitDecorator</a>
<li><a href="./CommitLoadContext.html">CommitLoadContext</a>
<li><a href="./CommitsController.html">CommitsController</a>
<li><a href="./CommitsHelper.html">CommitsHelper</a>
<li><a href="./CompareController.html">CompareController</a>
<li><a href="./DashboardController.html">DashboardController</a>
<li><a href="./DeployKeysController.html">DeployKeysController</a>
<li><a href="./ErrorsController.html">ErrorsController</a>
<li><a href="./Event.html">Event</a>
<li><a href="./EventDecorator.html">EventDecorator</a>
<li><a href="./EventsHelper.html">EventsHelper</a>
<li><a href="./GitHost.html">GitHost</a>
<li><a href="./GitlabMarkdownHelper.html">GitlabMarkdownHelper</a>
<li><a href="./Group.html">Group</a>
<li><a href="./GroupsController.html">GroupsController</a>
<li><a href="./HelpController.html">HelpController</a>
<li><a href="./HooksController.html">HooksController</a>
<li><a href="./Issue.html">Issue</a>
<li><a href="./IssueObserver.html">IssueObserver</a>
<li><a href="./IssuesBulkUpdateContext.html">IssuesBulkUpdateContext</a>
<li><a href="./IssuesController.html">IssuesController</a>
<li><a href="./IssuesHelper.html">IssuesHelper</a>
<li><a href="./IssuesListContext.html">IssuesListContext</a>
<li><a href="./Key.html">Key</a>
<li><a href="./KeyObserver.html">KeyObserver</a>
<li><a href="./KeysController.html">KeysController</a>
<li><a href="./LabelsController.html">LabelsController</a>
<li><a href="./MergeRequest.html">MergeRequest</a>
<li><a href="./MergeRequestObserver.html">MergeRequestObserver</a>
<li><a href="./MergeRequestsController.html">MergeRequestsController</a>
<li><a href="./MergeRequestsHelper.html">MergeRequestsHelper</a>
<li><a href="./MergeRequestsLoadContext.html">MergeRequestsLoadContext</a>
<li><a href="./Milestone.html">Milestone</a>
<li><a href="./MilestonesController.html">MilestonesController</a>
<li><a href="./Note.html">Note</a>
<li><a href="./NoteObserver.html">NoteObserver</a>
<li><a href="./NotesController.html">NotesController</a>
<li><a href="./NotesHelper.html">NotesHelper</a>
<li><a href="./Notify.html">Notify</a>
<li><a href="./OmniauthCallbacksController.html">OmniauthCallbacksController</a>
<li><a href="./PostReceive.html">PostReceive</a>
<li><a href="./ProfileController.html">ProfileController</a>
<li><a href="./ProfileHelper.html">ProfileHelper</a>
<li><a href="./Project.html">Project</a>
<li><a href="./ProjectHook.html">ProjectHook</a>
<li><a href="./ProjectObserver.html">ProjectObserver</a>
<li><a href="./ProjectResourceController.html">ProjectResourceController</a>
<li><a href="./ProjectsController.html">ProjectsController</a>
<li><a href="./ProjectsHelper.html">ProjectsHelper</a>
<li><a href="./ProtectedBranch.html">ProtectedBranch</a>
<li><a href="./ProtectedBranchesController.html">ProtectedBranchesController</a>
<li><a href="./PushEvent.html">PushEvent</a>
<li><a href="./PushObserver.html">PushObserver</a>
<li><a href="./RefsController.html">RefsController</a>
<li><a href="./RepositoriesController.html">RepositoriesController</a>
<li><a href="./Repository.html">Repository</a>
<li><a href="./SearchContext.html">SearchContext</a>
<li><a href="./SearchController.html">SearchController</a>
<li><a href="./Snippet.html">Snippet</a>
<li><a href="./SnippetsController.html">SnippetsController</a>
<li><a href="./SnippetsHelper.html">SnippetsHelper</a>
<li><a href="./SystemHook.html">SystemHook</a>
<li><a href="./SystemHookObserver.html">SystemHookObserver</a>
<li><a href="./SystemHookWorker.html">SystemHookWorker</a>
<li><a href="./TabHelper.html">TabHelper</a>
<li><a href="./TagsHelper.html">TagsHelper</a>
<li><a href="./Team.html">Team</a>
<li><a href="./TeamMembersController.html">TeamMembersController</a>
<li><a href="./TestHookContext.html">TestHookContext</a>
<li><a href="./Tree.html">Tree</a>
<li><a href="./TreeController.html">TreeController</a>
<li><a href="./TreeDecorator.html">TreeDecorator</a>
<li><a href="./TreeHelper.html">TreeHelper</a>
<li><a href="./User.html">User</a>
<li><a href="./UserObserver.html">UserObserver</a>
<li><a href="./UsersProject.html">UsersProject</a>
<li><a href="./UsersProjectObserver.html">UsersProjectObserver</a>
<li><a href="./Votes.html">Votes</a>
<li><a href="./WebHook.html">WebHook</a>
<li><a href="./Wiki.html">Wiki</a>
<li><a href="./WikisController.html">WikisController</a>
</ul>
</nav>
</div>
</nav>
<div id="documentation">
<h1 class="module">module ApplicationHelper</h1>
<div id="description" class="description">
</div><!-- description -->
<section id="5Buntitled-5D" class="documentation-section">
<!-- Methods -->
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="method-i-app_theme" class="method-detail ">
<div class="method-heading">
<span class="method-name">app_theme</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="app_theme-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 125</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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><!-- app_theme-source -->
</div>
</div><!-- app_theme-method -->
<div id="method-i-authbutton" class="method-detail ">
<div class="method-heading">
<span class="method-name">authbutton</span><span
class="method-args">(provider, size = 64)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="authbutton-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 150</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">authbutton</span>(<span class="ruby-identifier">provider</span>, <span class="ruby-identifier">size</span> = <span class="ruby-value">64</span>)
<span class="ruby-identifier">file_name</span> = <span class="ruby-node">&quot;#{provider.to_s.split('_').first}_#{size}.png&quot;</span>
<span class="ruby-identifier">image_tag</span>(<span class="ruby-node">&quot;authbuttons/#{file_name}&quot;</span>,
<span class="ruby-identifier">alt</span><span class="ruby-operator">:</span> <span class="ruby-node">&quot;Sign in with #{provider.to_s.titleize}&quot;</span>)
<span class="ruby-keyword">end</span></pre>
</div><!-- authbutton-source -->
</div>
</div><!-- authbutton-method -->
<div id="method-i-current_action-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">current_action?</span><span
class="method-args">(*args)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-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"># =&gt; true</span>
<span class="ruby-identifier">current_action?</span>(:<span class="ruby-identifier">create</span>) <span class="ruby-comment"># =&gt; 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"># =&gt; true</span>
</pre>
<div class="method-source-code" id="current_action-3F-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 29</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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><!-- current_action-3F-source -->
</div>
</div><!-- current_action-3F-method -->
<div id="method-i-current_controller-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">current_controller?</span><span
class="method-args">(*args)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-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"># =&gt; true</span>
<span class="ruby-identifier">current_controller?</span>(:<span class="ruby-identifier">commits</span>) <span class="ruby-comment"># =&gt; 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"># =&gt; true</span>
</pre>
<div class="method-source-code" id="current_controller-3F-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 15</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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><!-- current_controller-3F-source -->
</div>
</div><!-- current_controller-3F-method -->
<div id="method-i-emoji_autocomplete_source" class="method-detail ">
<div class="method-heading">
<span class="method-name">emoji_autocomplete_source</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="emoji_autocomplete_source-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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><!-- emoji_autocomplete_source-source -->
</div>
</div><!-- emoji_autocomplete_source-method -->
<div id="method-i-gravatar_icon" class="method-detail ">
<div class="method-heading">
<span class="method-name">gravatar_icon</span><span
class="method-args">(user_email = '', size = 40)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="gravatar_icon-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 33</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">gravatar_icon</span>(<span class="ruby-identifier">user_email</span> = <span class="ruby-string">''</span>, <span class="ruby-identifier">size</span> = <span class="ruby-value">40</span>)
<span class="ruby-keyword">if</span> <span class="ruby-constant">Gitlab</span>.<span class="ruby-identifier">config</span>.<span class="ruby-identifier">disable_gravatar?</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_prefix</span> = <span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;https://secure&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;http://www&quot;</span>
<span class="ruby-identifier">user_email</span>.<span class="ruby-identifier">strip!</span>
<span class="ruby-node">&quot;#{gravatar_prefix}.gravatar.com/avatar/#{Digest::MD5.hexdigest(user_email.downcase)}?s=#{size}&amp;d=identicon&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- gravatar_icon-source -->
</div>
</div><!-- gravatar_icon-method -->
<div id="method-i-grouped_options_refs" class="method-detail ">
<div class="method-heading">
<span class="method-name">grouped_options_refs</span><span
class="method-args">(destination = :tree)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="grouped_options_refs-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 61</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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">&quot;Branch&quot;</span>, <span class="ruby-ivar">@project</span>.<span class="ruby-identifier">branch_names</span> ],
[ <span class="ruby-string">&quot;Tag&quot;</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">&amp;&amp;</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">&amp;&amp;</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">&lt;&lt;</span> [<span class="ruby-string">&quot;Commit&quot;</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><!-- grouped_options_refs-source -->
</div>
</div><!-- grouped_options_refs-method -->
<div id="method-i-hexdigest" class="method-detail ">
<div class="method-heading">
<span class="method-name">hexdigest</span><span
class="method-args">(string)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="hexdigest-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 137</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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><!-- hexdigest-source -->
</div>
</div><!-- hexdigest-method -->
<div id="method-i-last_commit" class="method-detail ">
<div class="method-heading">
<span class="method-name">last_commit</span><span
class="method-args">(project)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="last_commit-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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">&quot; ago&quot;</span>
<span class="ruby-keyword">else</span>
<span class="ruby-string">&quot;Never&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">rescue</span>
<span class="ruby-string">&quot;Never&quot;</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- last_commit-source -->
</div>
</div><!-- last_commit-method -->
<div id="method-i-ldap_enable-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">ldap_enable?</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="ldap_enable-3F-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 121</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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><!-- ldap_enable-3F-source -->
</div>
</div><!-- ldap_enable-3F-method -->
<div id="method-i-project_last_activity" class="method-detail ">
<div class="method-heading">
<span class="method-name">project_last_activity</span><span
class="method-args">(project)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="project_last_activity-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 141</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">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">&amp;&amp;</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">&quot; ago&quot;</span>
<span class="ruby-keyword">else</span>
<span class="ruby-string">&quot;Never&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- project_last_activity-source -->
</div>
</div><!-- project_last_activity-method -->
<div id="method-i-request_protocol" class="method-detail ">
<div class="method-heading">
<span class="method-name">request_protocol</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="request_protocol-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">request_protocol</span>
<span class="ruby-identifier">request</span>.<span class="ruby-identifier">ssl?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;https&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;http&quot;</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- request_protocol-source -->
</div>
</div><!-- request_protocol-method -->
<div id="method-i-search_autocomplete_source" class="method-detail ">
<div class="method-heading">
<span class="method-name">search_autocomplete_source</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="search_autocomplete_source-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 77</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">search_autocomplete_source</span>
<span class="ruby-identifier">projects</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">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</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">default_nav</span> = [
{ <span class="ruby-identifier">label</span><span class="ruby-operator">:</span> <span class="ruby-string">&quot;My Profile&quot;</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">&quot;My SSH Keys&quot;</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">&quot;My Dashboard&quot;</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">&quot;Admin Section&quot;</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">&quot;Workflow Help&quot;</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">&quot;Permissions Help&quot;</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">&quot;Web Hooks Help&quot;</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">&quot;System Hooks Help&quot;</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">&quot;API Help&quot;</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">&quot;Markdown Help&quot;</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">&quot;SSH Keys Help&quot;</span>, <span class="ruby-identifier">url</span><span class="ruby-operator">:</span> <span class="ruby-identifier">help_ssh_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">&amp;&amp;</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">&quot;#{@project.name} Issues&quot;</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">&quot;#{@project.name} Commits&quot;</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">&quot;#{@project.name} Merge Requests&quot;</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">&quot;#{@project.name} Milestones&quot;</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">&quot;#{@project.name} Snippets&quot;</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">&quot;#{@project.name} Team&quot;</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">&quot;#{@project.name} Tree&quot;</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">&quot;#{@project.name} Wall&quot;</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">&quot;#{@project.name} Wiki&quot;</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">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><!-- search_autocomplete_source-source -->
</div>
</div><!-- search_autocomplete_source-method -->
<div id="method-i-show_last_push_widget-3F" class="method-detail ">
<div class="method-heading">
<span class="method-name">show_last_push_widget?</span><span
class="method-args">(event)</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="show_last_push_widget-3F-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">show_last_push_widget?</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">event</span> <span class="ruby-operator">&amp;&amp;</span>
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">last_push_to_non_root?</span> <span class="ruby-operator">&amp;&amp;</span>
<span class="ruby-operator">!</span><span class="ruby-identifier">event</span>.<span class="ruby-identifier">rm_ref?</span> <span class="ruby-operator">&amp;&amp;</span>
<span class="ruby-identifier">event</span>.<span class="ruby-identifier">project</span> <span class="ruby-operator">&amp;&amp;</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><!-- show_last_push_widget-3F-source -->
</div>
</div><!-- show_last_push_widget-3F-method -->
<div id="method-i-web_app_url" class="method-detail ">
<div class="method-heading">
<span class="method-name">web_app_url</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="web_app_url-source">
<pre><span class="ruby-comment"># File app/helpers/application_helper.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">web_app_url</span>
<span class="ruby-node">&quot;#{request_protocol}://#{Gitlab.config.web_host}/&quot;</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- web_app_url-source -->
</div>
</div><!-- web_app_url-method -->
</section><!-- public-instance-method-details -->
</section><!-- 5Buntitled-5D -->
</div><!-- documentation -->
<footer id="validator-badges">
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>