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

513 lines
17 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>ProfilesController</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">Class</span>
ProfilesController
<span class="parent">&lt;
<a href="ApplicationController.html">ApplicationController</a>
</span>
</h1>
<ul class="files">
<li><a href="../files/app/controllers/profiles_controller_rb.html">app/controllers/profiles_controller.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-account">account</a>
</li>
</ul>
</dd>
<dt>D</dt>
<dd>
<ul>
<li>
<a href="#method-i-design">design</a>
</li>
</ul>
</dd>
<dt>H</dt>
<dd>
<ul>
<li>
<a href="#method-i-history">history</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-reset_private_token">reset_private_token</a>
</li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li>
<a href="#method-i-show">show</a>
</li>
</ul>
</dd>
<dt>T</dt>
<dd>
<ul>
<li>
<a href="#method-i-token">token</a>
</li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li>
<a href="#method-i-update">update</a>,
</li>
<li>
<a href="#method-i-update_password">update_password</a>,
</li>
<li>
<a href="#method-i-update_username">update_username</a>
</li>
</ul>
</dd>
</dl>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-account">
<b>account</b>()
<a href="../classes/ProfilesController.html#method-i-account" name="method-i-account" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-account_source')" id="l_method-i-account_source">show</a>
</p>
<div id="method-i-account_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 11</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">account</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-design">
<b>design</b>()
<a href="../classes/ProfilesController.html#method-i-design" name="method-i-design" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-design_source')" id="l_method-i-design_source">show</a>
</p>
<div id="method-i-design_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 8</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">design</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-history">
<b>history</b>()
<a href="../classes/ProfilesController.html#method-i-history" name="method-i-history" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-history_source')" id="l_method-i-history_source">show</a>
</p>
<div id="method-i-history_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 49</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">history</span>
<span class="ruby-ivar">@events</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">recent_events</span>.<span class="ruby-identifier">page</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:page</span>]).<span class="ruby-identifier">per</span>(<span class="ruby-number">20</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-reset_private_token">
<b>reset_private_token</b>()
<a href="../classes/ProfilesController.html#method-i-reset_private_token" name="method-i-reset_private_token" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-reset_private_token_source')" id="l_method-i-reset_private_token_source">show</a>
</p>
<div id="method-i-reset_private_token_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">reset_private_token</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">reset_authentication_token!</span>
<span class="ruby-identifier">flash</span>[<span class="ruby-value">:notice</span>] = <span class="ruby-string">&quot;Token was successfully updated&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">account_profile_path</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-show">
<b>show</b>()
<a href="../classes/ProfilesController.html#method-i-show" name="method-i-show" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-show_source')" id="l_method-i-show_source">show</a>
</p>
<div id="method-i-show_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 5</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">show</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-token">
<b>token</b>()
<a href="../classes/ProfilesController.html#method-i-token" name="method-i-token" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-token_source')" id="l_method-i-token_source">show</a>
</p>
<div id="method-i-token_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 27</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">token</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-update">
<b>update</b>()
<a href="../classes/ProfilesController.html#method-i-update" name="method-i-update" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-update_source')" id="l_method-i-update_source">show</a>
</p>
<div id="method-i-update_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 14</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">update</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:user</span>])
<span class="ruby-identifier">flash</span>[<span class="ruby-value">:notice</span>] = <span class="ruby-string">&quot;Profile was successfully updated&quot;</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">flash</span>[<span class="ruby-value">:alert</span>] = <span class="ruby-string">&quot;Failed to update profile&quot;</span>
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span> <span class="ruby-value">:back</span> }
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">js</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-update_password">
<b>update_password</b>()
<a href="../classes/ProfilesController.html#method-i-update_password" name="method-i-update_password" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-update_password_source')" id="l_method-i-update_password_source">show</a>
</p>
<div id="method-i-update_password_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 30</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">update_password</span>
<span class="ruby-identifier">params</span>[<span class="ruby-value">:user</span>].<span class="ruby-identifier">reject!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!=</span> <span class="ruby-string">&quot;password&quot;</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">!=</span> <span class="ruby-string">&quot;password_confirmation&quot;</span>}
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@user</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:user</span>])
<span class="ruby-identifier">flash</span>[<span class="ruby-value">:notice</span>] = <span class="ruby-string">&quot;Password was successfully updated. Please login with it&quot;</span>
<span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">new_user_session_path</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">render</span> <span class="ruby-string">'account'</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-update_username">
<b>update_username</b>()
<a href="../classes/ProfilesController.html#method-i-update_username" name="method-i-update_username" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-update_username_source')" id="l_method-i-update_username_source">show</a>
</p>
<div id="method-i-update_username_source" class="dyn-source">
<pre><span class="ruby-comment"># File app/controllers/profiles_controller.rb, line 53</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">update_username</span>
<span class="ruby-ivar">@user</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">username</span><span class="ruby-operator">:</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:user</span>][<span class="ruby-value">:username</span>])
<span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">js</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html>