post form layout

jamesperet 10 years ago
parent
commit
6397f1dc80
2 changed files with 23 additions and 12 deletions
  1. 1 1
      app/assets/javascripts/blog_posts.js.coffee
  2. 22 11
      app/views/blog_posts/_form.html.erb

+ 1 - 1
app/assets/javascripts/blog_posts.js.coffee

@@ -4,7 +4,7 @@ attachRatingHandler = ->
4 4
 
5 5
   # to set summernote object
6 6
   # You should change '#post_content' to your textarea input id
7
-  summer_note = $('#blog_post_content')
7
+  summer_note = $('#post_content')
8 8
 
9 9
   # to call summernote editor
10 10
   summer_note.summernote

+ 22 - 11
app/views/blog_posts/_form.html.erb

@@ -1,16 +1,27 @@
1
-<%= simple_form_for(@blog_post) do |f| %>
2
-  <%= f.error_notification %>
1
+<%= bootstrap_form_for(@blog_post) do |f| %>
2
+  <%= f.alert_message "Please fix the errors below."%>
3 3
 
4
-  <div class="form-inputs">
5
-    <%= f.input :title %>
6
-    <%= f.input :slug %>
7
-    <%= f.input :description %>
8
-    <%= f.file_field :image %>
9
-    <%= f.input :content, class: 'summernote', id: 'post_content' %>
10
-    <%= f.input :published %>
11
-  </div>
4
+<div class="controls controls-row">
5
+	<%= f.form_group :title, class: "span4", style: 'margin-left: 0px;' do %>
6
+	    <%= f.text_field :title, class: 'input-block-level' %>
7
+	<% end %>
8
+	<%= f.form_group :slug, class: "span3" do %>
9
+	    <%= f.text_field :slug, class: 'input-block-level' %>
10
+	<% end %>
11
+	<%= f.form_group :description, class: "span5" do %>
12
+	    <%= f.text_field :description, class: 'input-block-level' %>
13
+	<% end %>
14
+</div>
15
+
16
+
17
+	<div class="form-inputs">
18
+		
19
+		<%= f.file_field :image %>
20
+		<%= f.text_area :content, class: 'summernote', id: 'post_content' %>
21
+		<%= f.check_box :published %>
22
+	</div>
12 23
 
13 24
   <div class="form-actions">
14
-    <%= f.button :submit %>
25
+    <%= f.submit %>
15 26
   </div>
16 27
 <% end %>