KatanaCode/blogit

View on GitHub
doc/Blogit/ApplicationHelper.html

Summary

Maintainability
Test Coverage
<!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: Blogit::ApplicationHelper
  
    &mdash; Blogit - Add a blog to your Ruby on Rails application
  
</title>

  <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '../';
  framesUrl = "../frames.html#!Blogit/ApplicationHelper.html";
</script>


  <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="../_index.html">Index (A)</a> &raquo;
    <span class='title'><span class='object_link'><a href="../Blogit.html" title="Blogit (module)">Blogit</a></span></span>
     &raquo; 
    <span class="title">ApplicationHelper</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="../class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="../method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="../file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Module: Blogit::ApplicationHelper
  
  
  
</h1>

<dl class="box">
  
  
    
  
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">app/helpers/blogit/application_helper.rb</dd>
  
</dl>
<div class="clear"></div>








  
    <h2>
      Instance Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#actions-instance_method" title="#actions (instance method)">- (Object) <strong>actions</strong>(content_or_options = {}, options = {}, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A helper method for creating a div tag with class &#39;actions&#39;.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#errors_on-instance_method" title="#errors_on (instance method)">- (Object) <strong>errors_on</strong>(object, attribute) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>The first error message for an ActiveRecord::Base model instance attribute.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#field-instance_method" title="#field (instance method)">- (Object) <strong>field</strong>(content_or_options = {}, options = {}, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>A helper method for creating a div tag with class &#39;field&#39;.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#format_content-instance_method" title="#format_content (instance method)">- (Object) <strong>format_content</strong>(content = nil, &amp;block) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'><p>Format content using the <span class='object_link'><a href="Configuration.html#default_parser_class-instance_method" title="Blogit::Configuration#default_parser_class (method)">default_parser_class</a></span>.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="instance_method_details" class="method_details_list">
    <h2>Instance Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="actions-instance_method">
  
    - (<tt>Object</tt>) <strong>actions</strong>(content_or_options = {}, options = {}, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>A helper method for creating a div tag with class &#39;actions&#39;. Used as a wrapper
for form actions.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>content_or_options</span>
      
      
        <span class='type'></span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The content to include in the div when not using a block. The options Hash when using a block</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'></span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The options when not using a block</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>block</span>
      
      
        <span class='type'></span>
      
      
      
        &mdash;
        <div class='inline'><p>A block that returns HTML content to include in the div</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>an HTML safe String</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


64
65
66</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/helpers/blogit/application_helper.rb', line 64</span>

<span class='kw'>def</span> <span class='id identifier rubyid_actions'>actions</span><span class='lparen'>(</span><span class='id identifier rubyid_content_or_options'>content_or_options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_div_tag_with_default_class'>div_tag_with_default_class</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>actions</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_content_or_options'>content_or_options</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="errors_on-instance_method">
  
    - (<tt>Object</tt>) <strong>errors_on</strong>(object, attribute) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>The first error message for an ActiveRecord::Base model instance attribute</p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
      <pre class="example code"><code><span class='id identifier rubyid_errors_on'>errors_on</span><span class='lparen'>(</span><span class='ivar'>@user</span><span class='comma'>,</span> <span class='symbol'>:first_name</span><span class='rparen'>)</span>
<span class='comment'># =&gt; &quot;Can&#39;t be blank&quot;</span></code></pre>
    
  </div>
<p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>object</span>
      
      
        <span class='type'></span>
      
      
      
        &mdash;
        <div class='inline'><p>An ActiveRecord::Base instance to check</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>attribute</span>
      
      
        <span class='type'></span>
      
      
      
        &mdash;
        <div class='inline'><p>A Symbol or String with the attribute name to check errors on</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>a String with the error message</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


37
38
39
40</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/helpers/blogit/application_helper.rb', line 37</span>

<span class='kw'>def</span> <span class='id identifier rubyid_errors_on'>errors_on</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_error_message'>error_message</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
  <span class='id identifier rubyid_content_tag'>content_tag</span><span class='lparen'>(</span><span class='symbol'>:span</span><span class='comma'>,</span> <span class='id identifier rubyid_error_message'>error_message</span><span class='comma'>,</span> <span class='label'>class:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>blogit_error_message</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_error_message'>error_message</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="field-instance_method">
  
    - (<tt>Object</tt>) <strong>field</strong>(content_or_options = {}, options = {}, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>A helper method for creating a div tag with class &#39;field&#39;. Used for separating
form fields.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>content_or_options</span>
      
      
        <span class='type'></span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The content to include in the div when not using a block. The options Hash when using a block</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>options</span>
      
      
        <span class='type'></span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>The options when not using a block</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>block</span>
      
      
        <span class='type'></span>
      
      
      
        &mdash;
        <div class='inline'><p>A block that returns HTML content to include in the div</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>an HTML safe String</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


51
52
53</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/helpers/blogit/application_helper.rb', line 51</span>

<span class='kw'>def</span> <span class='id identifier rubyid_field'>field</span><span class='lparen'>(</span><span class='id identifier rubyid_content_or_options'>content_or_options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_div_tag_with_default_class'>div_tag_with_default_class</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>field</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_content_or_options'>content_or_options</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="format_content-instance_method">
  
    - (<tt>Object</tt>) <strong>format_content</strong>(content = nil, &amp;block) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p>Format content using the <span class='object_link'><a href="Configuration.html#default_parser_class-instance_method" title="Blogit::Configuration#default_parser_class (method)">default_parser_class</a></span></p>


  </div>
</div>
<div class="tags">
  
  <div class="examples">
    <p class="tag_title">Examples:</p>
    
      
      <pre class="example code"><code><span class='id identifier rubyid_format_content'>format_content</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'># This is a Markdown header</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
<span class='comment'># =&gt; &quot;&lt;h1&gt;This is a Markdown header&lt;/h1&gt;&quot;</span></code></pre>
    
      
      <pre class="example code"><code><span class='id identifier rubyid_format_content'>format_content</span> <span class='kw'>do</span> 
  <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>some text</span><span class='tstring_end'>&quot;</span></span>
<span class='kw'>end</span>
<span class='comment'># =&gt; &quot;&lt;p&gt;some text&lt;/p&gt;&quot;</span></code></pre>
    
  </div>
<p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>content</span>
      
      
        <span class='type'></span>
      
      
        <em class="default">(defaults to: <tt>nil</tt>)</em>
      
      
        &mdash;
        <div class='inline'><p>A String containing the content to be formatted (defaults: nil)</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>block</span>
      
      
        <span class='type'></span>
      
      
      
        &mdash;
        <div class='inline'><p>A Proc that returns a String of content to be formatted</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'></span>
      
      
      
        
        <div class='inline'><p>an HTML safe String.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


20
21
22
23
24</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'app/helpers/blogit/application_helper.rb', line 20</span>

<span class='kw'>def</span> <span class='id identifier rubyid_format_content'>format_content</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='id identifier rubyid_capture'>capture</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
  <span class='id identifier rubyid_parser'>parser</span>  <span class='op'>=</span> <span class='const'>Blogit</span><span class='op'>::</span><span class='id identifier rubyid_configuration'>configuration</span><span class='period'>.</span><span class='id identifier rubyid_default_parser_class'>default_parser_class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_content'>content</span><span class='rparen'>)</span>
  <span class='id identifier rubyid_parser'>parser</span><span class='period'>.</span><span class='id identifier rubyid_parsed'>parsed</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_html_safe'>html_safe</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Sat Oct 24 19:04:45 2015 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.6 (ruby-2.2.0).
</div>

  </body>
</html>