mcfiredrill/forttree

View on GitHub
app/views/layouts/_form.html.erb

Summary

Maintainability
Test Coverage
<% url = post_form.persisted? ? board_post_path(post_form.board.id, post_form.branch.id) : board_posts_path(post_form.board.id) %>
<%= form_for post_form, url: url, html: { multipart: true } do |f| %>
  <%= raw negative_captcha(@captcha) %>
  <% if post_form.errors.any? %>
    <div id="error_explanation">
      <h2><%="Uh oh, you got" + pluralize(leaf.errors.count, "error!")%></h2>
      <ul>
        <% leaf.errors.full_messages.each do |msg| %>
          <li><%=msg%></li>
        <% end %>
      </ul>
    </div>
  <% end %>
  <div class="postarea_container">
    <%= fields_for :leaf do |l| %>
      <div class="postarea">
        <table>
          <tr>
            <td class="fieldlabel"><%= negative_label_tag @captcha, :name, 'Name'  %></td>
            <td class="field"><%= negative_text_field_tag @captcha, :name, cols: 80, rows: 20, class: "formbox" %></td>
          </tr>
          <tr>
            <td class="fieldlabel"><%= negative_label_tag @captcha, :post, 'Post' %></td>
            <td class="field"><%= negative_text_area_tag @captcha,  :content, cols: 48, rows: 4, class: "formbox", id: 'leaf_content'  %></td>
          <tr>
          <tr>
            <td class="fieldlabel"><%= negative_label_tag @captcha, :photo, 'Photo' %></td>
            <td class="field"><%= negative_file_field_tag @captcha, :photo, class: "formbox" %></td>
          </tr>
        </table>
      </div>
    <% end %>
    <div class="actions">
      <%= f.submit(:class => 'submitbutton', :value => 'Post') %>
      <% if SMILEY_ASSIST == true %>
        <div id="smiley_toggle">
          <%= link_to "(´ε`)", "#", class: "smiley-helper-show" %>
        </div>
        <div id="smiley_helper" style="display:none">
          <h3>smiley assistant</h3>
          <%= link_to "(´ε`) click me to close", "#", class: "smiley-helper-show"  %>
          <br />
          <% faces.each do |f| %>
            <%= link_to f, "#", class: 'insert-emoticon', data: { text:  " #{f} " }  %>
            <br />
          <% end %>
        </div>
      <% end %>
    </div>
  </div>
<% end %>