<%= form_for(@topic, :html => { :multipart => true, :id => :topic }) do |f| %>
  <% if @topic.errors.any? %>
    <div id="error_explanation">
      <h2><%=t 'activerecord.errors.template.header', :count => @topic.errors.size, :model => @topic.class.model_name.human %></h2>
      <h4><%=t 'activerecord.errors.template.body', :count => @topic.errors.size %></h4>
      <ul>
        <% @topic.errors.full_messages.each do |msg| %>
          <li><%= msg %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :board %><br />
    <!--<%= f.select :category_id, Board.all.collect{|board|[board.name, board.id]} %>-->
    <%= f.hidden_field :category_id %>
  </div>
  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </div>
  <div class="field" style="margin-left: 30px">
    <%= f.fields_for :posts, @post do |post_fields| %>
      <%= post_fields.text_area :content, :id => :fastpostmessage %>
      <div class="field">
        <%= post_fields.label "附件" %><br />
        <%= post_fields.fields_for :attachments do |attachment_form| %>
          <div class="asset field">
            <% if attachment_form.object.data.exists? %>
              <%= attachment_form.object.data.original_filename %>
            <% else %>
              <%= attachment_form.file_field :data %>
            <% end %>
          </div>
        <% end %>
      </div>
    <% end %>
  </div>
  <!--<div class="field">
  <%= f.label :readperm %><br />
  <%= f.text_field :readperm %>
  </div>
  <div class="field">
  <%= f.label :private %><br />
  <%= f.check_box :private %>
  </div>-->
  <div class="ajax-fc-container" style="margin-left: 30px">You must enable javascript to see captcha here!</div>
  <%= f.hidden_field :displayorder %>
  <%= f.hidden_field :category_type %>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>
<script type="text/javascript">
  $(document).ready(function()	{
    $('#fastpostmessage').markItUp(mySettings);
  });
</script>
<script type="text/javascript" charset="utf-8">
  $(function() {
    $(".ajax-fc-container").captcha({
      borderColor: "silver",
      text: "验证码：请把<span>scissors</span>拖进圆圈"
    });
  });
</script>