Skip to content

Commit

Permalink
fixed merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
David Simmons committed Jan 22, 2012
2 parents 3d230a2 + b16ecb0 commit de4e240
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 22 deletions.
59 changes: 40 additions & 19 deletions app/assets/javascripts/bookshelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ $(function () {
function displayBooks() {
$book_rows = $('div.book');
$book_rows.each(function (index) {
//console.log($(this).find('img'));
$current_img = $(this).find('img')[0];
$current_img.src = books_o["books"][index]["cover_url"];
$current_img.setAttribute('data-index', index);
$current_img.style.visibility = 'visible';
//console.log($(this).find('img'));
$current_img = $(this).find('img')[0];
$current_img.src = books_o["books"][index]["cover_url"];
$current_img.setAttribute('data-index', index);
$current_img.style.visibility = 'visible';
});
}

Expand All @@ -35,33 +35,33 @@ $(function () {

function sortAuthor() {
books_o.books.sort(function (a, b) {
a = a.author,
a = a.author,
b = b.author;
return a.localeCompare(b);
return a.localeCompare(b);
});
};

function sortTitle(a, b) {
books_o.books.sort(function (a, b) {
a = a.title,
a = a.title,
b = b.title;
return a.localeCompare(b);
return a.localeCompare(b);
});
};

function sortGenre(a, b) {
books_o.books.sort(function (a, b) {
a = a.genre,
a = a.genre,
b = b.genre;
return a.localeCompare(b);
return a.localeCompare(b);
});
};

function sortPubDate(a, b) {
books_o.books.sort(function (a, b) {
a = a.published_date,
a = a.published_date,
b = b.published_date;
return a.localeCompare(b);
return a.localeCompare(b);
});
};

Expand All @@ -85,9 +85,20 @@ $(function () {
$('#book-detail-cover').find('img')[0].src = book.cover_url;
$('#book-detail').fadeIn();
}


function showSearch() {
$('#search-detail-icon').fadeIn();
$('#search-detail-title').text('Title');
$('#search-detail-author').text('Author');
$('#search-detail-desc').text('Description');
$('#search-detail-genre').text('Genre');
$('#search-detail-pubdate').text('Publication Date');
$('#search-detail-termbox').visible = true;
$('#search-detail').fadeIn();
}

function hideBook() {
$('#book-detail').fadeOut('slow');
$('#book-detail').fadeOut('slow');
}

$('#sort-icon-author').click(function () {
Expand All @@ -113,12 +124,22 @@ $(function () {
$('#show-book').click(function () {
showBook();
});

$('#hide-book').click(function() {
hideBook();

$('#hide-book').click(function () {
hideBook();
});

$('#search-icon').click(function () {
showSearch();
});

$('#search-detail-termBox').click(function () {
$('#search-detail-termBox-term').text('Kingsolver');
});

$('#search-books').click(function () {
$('#search-detail-icon').click(function () {
$('#search-detail').fadeOut('slow');
$('#search-detail-termBox-term').text('');
var booksFiltered = filterByAuthor(books_o, filterForAuthor);
displayFilteredBooks(booksFiltered);
});
Expand Down
37 changes: 36 additions & 1 deletion app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,39 @@ body {
#book-detail-cover {
float: left;
margin-left: 65px;
}
}

#search-detail {
display: none;
font-size: 30px;
text-align: right;
padding: 30px;
margin-right: auto;
background-color: white;
width: 700px;
height: 400px;
z-index: 100;
position: relative;
top: -500px;
left: 160px;
opacity: 0.9;
color: black;
}

#search-detail-termBox {
background-color: Blue;
width: 350px;
height: 100px;
z-index: 50;
position: relative;
float: right;
margin-right:50px;
margin-bottom:50px;
}

#search-detail-termBox-term {
font-size: 40px;
color: Yellow;
text-align: center;
margin-top:20px;
}
16 changes: 14 additions & 2 deletions app/views/bookshelf/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</div>
</div>
<div class="control_panel">
<%= image_tag "icon_search_telescope.png", :class => "control_panel_trailing_space" %><br />
<%= image_tag "icon_search_telescope.png", :class => "control_panel_trailing_space", :id => "search icon" %><br />
<%= image_tag "icon_show_book_planet.png", :id => "show-book", :class => "control_panel_trailing_space" %><br />
<%= image_tag "icon_sort_galaxy.png", :id => "sort-icon", :class => "control_panel_trailing_space" %><br />
<%= image_tag "icon_sort_solar_system_author_selected.png", :id => "sort-icon-author" %><br />
Expand All @@ -53,5 +53,17 @@
<div id="book-detail-genre"></div>
<div id="book-detail-pubdate"></div>
</div>
<div id="search-detail">
<div id="search-detail-icon">
<%= image_tag "icon_search.png", :id => "search-detail-icon" %>
</div>
<div id="search-detail-title"></div>
<div id="search-detail-author"></div>
<div id="search-detail-desc"></div>
<div id="search-detail-genre"></div>
<div id="search-detail-pubdate"></div>
<div id="search-detail-termBox">
<div id="search-detail-termBox-term"></div>
</div>
</div>
</div>

0 comments on commit de4e240

Please sign in to comment.