aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/admin/blog/posts/_form.html.erb
blob: bf964e931d352f1be566367b4d22c4fb1f88d31b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<% form_for [:admin, @blog_post] do |f| -%>
  <% if Rails.version < '3.0.0'%>
    <%= f.error_messages %>
  <% else %>
    <%= render :partial => "/shared/admin/error_messages",
               :locals => {
                 :object => f.object,
                 :include_object_name => true
               } %>
  <% end %>

  <div class='field'>
    <%= f.label :title -%>
    <%= f.text_field :title, :class => 'larger widest' -%>
  </div>

  <div class='field'>
    <%= f.label :body -%>
    <%= f.text_area :body, :rows => 20, :class => 'wymeditor widest' -%>
  </div>
  <div id='more_options_field'>
    <p>
      <%= link_to t('.advanced_options'), "#",
                  :id => 'toggle_advanced_options',
                  :title => t('.toggle_advanced_options') %>
    </p>
    <span id='draft_field'>
      <%= f.check_box :draft %>
      <%= f.label :draft, t('.save_as_draft'), :class => "stripped" %>
    </span>
  </div>
  <div id='more_options' style="display:none;">
    <div class="hemisquare">
      <h3><%= t('admin.blog.submenu.categories.title') %></h3>
      <ul class='blog_categories'>
        <% @blog_categories.each do |category| %>
          <li>
             <%= check_box_tag 'blog_post[category_ids][]', category.id,
                               @blog_post.categories.include?(category),
                               :id => (id="blog_post_category_ids_#{category.id}") %>
             <%= label_tag 'blog_post[category_ids][]', category.title,
                           :class => 'stripped',
                           :for => id %>
          </li>
        <% end %>
      </ul>
    </div>
    <div class='hemisquare right_side'>
    </div>
  </div>
  <%= render :partial => "/shared/admin/form_actions",
              :locals => {
                :f => f,
                :continue_editing => true,
                :delete_title => t('admin.blog.posts.post.delete')
              } %>
<% end -%>
<% content_for :head do %>
  <style type='text/css'>
    ul.blog_categories, ul.blog_categories li {
      list-style: none;
      margin: 0px;
      padding: 0px;
    }
  </style>
  <script type='text/javascript'>
    $(document).ready(function(){
      $('#toggle_advanced_options').click(function(e){
        e.preventDefault();

        $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);

        $('html,body').animate({
          scrollTop: $('#toggle_advanced_options').parent().offset().top
        }, 250);
      });
    });
  </script>
<% end %>