Skip to content

Commit

Permalink
<cj> Some more styling with post a book page and adding category migr…
Browse files Browse the repository at this point in the history
…ation.
  • Loading branch information
chandan committed Sep 16, 2010
1 parent 837c853 commit a213400
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 45 deletions.
2 changes: 1 addition & 1 deletion app/views/books/_book_form.html.haml
Expand Up @@ -6,7 +6,7 @@
= f.text_field 'name', :maxlength => 40 , :size=> 20
.form_row
.form_label
= f.label :author,"Author"
= f.label :author,"Author(s)"
.form_field
= f.text_field 'author', :maxlength => 40, :size => 20
.form_row
Expand Down
70 changes: 41 additions & 29 deletions app/views/books/index.html.haml
Expand Up @@ -10,32 +10,44 @@
.posted_books
.header
Posted books
%table
%thead
%tr
%th Title
%th Author
%th Mrp
%th Sale Price
%th Tags
%th Edit
%th Delete
%tbody
- @books.each do |book|
%tr{:id=>"#{book.id}"}
%td
= book.name
%td
= book.author
%td
= book.mrp
%td
= book.sale_price
%td
= book.tag_list
%td.edit_link
%a{:href=>"#",:url_to_post => "#{book_update_url(book.id)}"}
edit
%td
%a{:href=>"#{book_delete_url(book.id)}"}
delete
- @books.each do |book|
.book
.thumbnail
.content-middle
.row.title
.label
.value
= book.name
.row.isbn
.label
Isbn :
.row.author
.label
Author(s) :
.value
= book.author
.row.tags
.label
Tags :
.value
= book.tag_list
.content-right
.row.mrp
.label
Mrp : Rs
.value
= book.mrp
.row.sale_price
.label
Sale Price : Rs
.value
= book.sale_price
.row
.edit_link.label
%a{:href=>"#",:url_to_post => "#{book_update_url(book.id)}"}
edit
|
.delete_link.label
%a{:href=>"#{book_delete_url(book.id)}"}
delete

8 changes: 7 additions & 1 deletion db/schema.rb
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20100825171346) do
ActiveRecord::Schema.define(:version => 20100916125508) do

create_table "books", :force => true do |t|
t.string "name"
Expand All @@ -20,6 +20,12 @@
t.datetime "updated_at"
end

create_table "categories", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"
Expand Down
2 changes: 1 addition & 1 deletion public/javascripts/lib/books.js
Expand Up @@ -3,7 +3,7 @@ function Book() {
var post_a_book = $('.post_a_book');
var tag_list = post_a_book.find('#book_tag_list');

var posted_books = $('.posted_books tbody tr');
var posted_books = $('.posted_books');
var edit_link_selector = '.edit_link a';

// var add_button = $('#post_book');
Expand Down
6 changes: 4 additions & 2 deletions public/stylesheets/sass/config.scss
Expand Up @@ -3,7 +3,9 @@ $background-color: #343434;
$yellow-color: #FFC200;
$orange-color: #FF5B00;
$maroon-color: #B80028;
$light-gray-color: #e4e4e4;
$light-gray-color: #e2e2e2;
//$light-gray-color: #e4e4e4;
$lighter-gray-color: #f1eeee;
//$header-footer-color: #6b6464;
//$background-color: #6b6464;
//$header-footer-color: #7e7a7a;
Expand All @@ -27,6 +29,6 @@ $light-gray-color: #e4e4e4;

@mixin site_wide_font{
font-family: 'Soho', serif;
font-size: 14px;
font-size: 13px;
color: $header-footer-color
}
55 changes: 44 additions & 11 deletions public/stylesheets/sass/post_a_book.scss
@@ -1,10 +1,9 @@
@import "config.scss";


.header{
background-color: $yellow-color;
@include Reenie_Beanie_font;
padding: 5px;
padding: 1px;
}

#container{
Expand Down Expand Up @@ -33,16 +32,50 @@
}

}
.posted_books table{
.posted_books{
margin: 20px 0 0 0;
thead tr th{
width: 10%;
text-align: left;
}
tbody tr th{
width: 10%;
.book{
clear: both;
margin: 10px;
height: 90px;
background-color: $lighter-gray-color;
.row{
clear: both;
.label{
font-weight: bold;
float: left;
}
.value{
float: left;
}
}
.thumbnail{
background: url("/images/book_thumbnail_80_by_80.png") no-repeat;
float: left;
width: 80px;
height: 80px;
margin: 5px 40px 5px 20px;
}
.content-middle{
float: left;
width: 50%;
margin-top: 5px;
.title{
font-size: 1.2em;
font-weight: bold;
.label{
margin-bottom: 10px;
}
.value{
margin-bottom: 10px;
}
}

}
.content-right{
margin: 5px 20px 0 0;
float: right;
}
}
}


}

0 comments on commit a213400

Please sign in to comment.