-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
235 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,134 @@ | ||
.page-books { | ||
&.index { | ||
.books-search { | ||
text-align: center; | ||
max-width: 35em; | ||
margin: 2em auto; | ||
padding: 2em; | ||
|
||
input { | ||
width: 100%; | ||
font-size: 1em; | ||
padding: .5em 1.3em; | ||
background: transparent; | ||
border: 1px solid #ddd; | ||
border-radius: 2em; | ||
|
||
&:focus { | ||
border-color: #A5CEF5; | ||
} | ||
.books-search { | ||
text-align: center; | ||
max-width: 35em; | ||
margin: 2em auto; | ||
padding: 2em; | ||
|
||
input { | ||
width: 100%; | ||
font-size: 1em; | ||
padding: .5em 1.3em; | ||
background: transparent; | ||
border: 1px solid #ddd; | ||
border-radius: 2em; | ||
|
||
&:focus { | ||
border-color: #A5CEF5; | ||
} | ||
} | ||
|
||
.results { | ||
text-align: left; | ||
|
||
.results { | ||
text-align: left; | ||
|
||
.ui-widget-content { | ||
background: #fff; | ||
font-size: .9em; | ||
padding: .5em 0; | ||
border-color: #ddd; | ||
box-shadow: 0 .1em .2em rgba(187, 187, 187, 0.64); | ||
line-height: 1.2; | ||
max-height: 20em; | ||
.ui-widget-content { | ||
background: #fff; | ||
font-size: .9em; | ||
padding: .5em 0; | ||
border-color: #ddd; | ||
box-shadow: 0 .1em .2em rgba(187, 187, 187, 0.64); | ||
line-height: 1.2; | ||
max-height: 20em; | ||
overflow: hidden; | ||
overflow-y: auto; | ||
} | ||
|
||
.ui-menu-item { | ||
font-family: 'Helvetica Neue', Helvetica, sans-serif; | ||
padding: .4em .6em .4em 6.2em; | ||
position: relative; | ||
border: 0; | ||
border-left: 5px solid transparent; | ||
position: relative; | ||
height: 6.5em; | ||
|
||
.img { | ||
position: absolute; | ||
width: 5em; | ||
height: 6em; | ||
top: .4em; | ||
left: .6em; | ||
overflow: hidden; | ||
overflow-y: auto; | ||
} | ||
|
||
.ui-menu-item { | ||
font-family: 'Helvetica Neue', Helvetica, sans-serif; | ||
padding: .4em .6em .4em 6.2em; | ||
position: relative; | ||
border: 0; | ||
border-left: 5px solid transparent; | ||
position: relative; | ||
height: 6.5em; | ||
|
||
.img { | ||
position: absolute; | ||
width: 5em; | ||
height: 6em; | ||
top: .4em; | ||
left: .6em; | ||
overflow: hidden; | ||
|
||
img { | ||
max-width: 100%; | ||
} | ||
img { | ||
max-width: 100%; | ||
} | ||
} | ||
|
||
.title { | ||
display: block; | ||
color: #555; | ||
} | ||
.title { | ||
display: block; | ||
color: #555; | ||
} | ||
|
||
.author { | ||
display: block; | ||
font-size: .8em; | ||
text-transform: uppercase; | ||
color: #aaa; | ||
margin-top: .6em; | ||
letter-spacing: 1px; | ||
} | ||
.author { | ||
display: block; | ||
font-size: .8em; | ||
text-transform: uppercase; | ||
color: #aaa; | ||
margin-top: .6em; | ||
letter-spacing: 1px; | ||
} | ||
|
||
.price { | ||
display: block; | ||
font-size: .8em; | ||
color: #aaa; | ||
margin-top: .5em; | ||
} | ||
.price { | ||
display: block; | ||
font-size: .8em; | ||
color: #aaa; | ||
margin-top: .5em; | ||
} | ||
} | ||
|
||
.ui-state-focus { | ||
background: #fff; | ||
border-left-color: #08c; | ||
font-weight: 300; | ||
.ui-state-focus { | ||
background: #fff; | ||
border-left-color: #08c; | ||
font-weight: 300; | ||
|
||
.title { | ||
color: #08c; | ||
} | ||
.title { | ||
color: #08c; | ||
} | ||
|
||
.price, | ||
.author { | ||
color: #08c; | ||
} | ||
.price, | ||
.author { | ||
color: #08c; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.books-list { | ||
.book { | ||
padding-left: 12em; | ||
height: 13em; | ||
position: relative; | ||
line-height: 1.2; | ||
} | ||
|
||
.img { | ||
position: absolute; | ||
left: 0; | ||
width: 10em; | ||
|
||
img { | ||
max-width: 100%; | ||
} | ||
} | ||
|
||
.title { | ||
font-size: 1.3em; | ||
} | ||
|
||
.author { | ||
color: #888; | ||
margin-bottom: .4em; | ||
} | ||
|
||
.details { | ||
color: #aaa; | ||
font-size: .9em; | ||
|
||
span { | ||
display: inline-block; | ||
margin-right: 1em; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ a { | |
float: right; | ||
text-decoration: underline; | ||
font-size: .9em; | ||
display: inline-block; | ||
margin-left: 1em; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
class HandlersController < ApplicationController | ||
def index | ||
@books = [] | ||
@books << Book.new(title: 'Da Vinci Code', author: 'Dan Brown') | ||
@books << Book.new(title: 'Name of the Rose', author: 'Umberto Eco') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
csv << ['Title', 'Author', 'Price', 'Publication date', 'Image url'] | ||
|
||
@books.each do |book| | ||
csv << [ | ||
book.title, | ||
book.author, | ||
number_to_currency(book.price), | ||
book.published_at.strftime('%B %Y'), | ||
book.image_url | ||
] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,26 @@ | ||
<article class="app-cont"> | ||
<article class="app-cont books-list"> | ||
|
||
<section class="app-title cf"> | ||
<h1>Books</h1> | ||
<%= link_to 'New Book', new_book_path %> | ||
<%= link_to 'Download (CSV)', books_path(:format => :csv) %> | ||
</section> | ||
|
||
<section class="app-content"> | ||
<div class="books-search"> | ||
<input type="text" id="books-search-txt" autofocus> | ||
<div class="results" id="books-search-results"></div> | ||
</div> | ||
<% @books.each do |book| %> | ||
<div class="book"> | ||
<p class="img"> | ||
<%= image_tag book.image_url %> | ||
</p> | ||
<h3 class="title"><%= book.title %></h3> | ||
<h4 class="author">by <%= book.author %></h4> | ||
<p class="details"> | ||
<span><%= number_to_currency(book.price) %></span> | ||
<span>Published on <%= book.published_at.strftime('%B %Y') %></span> | ||
</p> | ||
</div> | ||
<% end %> | ||
</section> | ||
|
||
</article> | ||
|
||
<%= content_for :script do %> | ||
new app.Books; | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<article class="app-cont"> | ||
|
||
<section class="app-title cf"> | ||
<h1>Books</h1> | ||
<%= link_to 'New Book', new_book_path %> | ||
</section> | ||
|
||
<section class="app-content"> | ||
<div class="books-search"> | ||
<input type="text" id="books-search-txt" autofocus> | ||
<div class="results" id="books-search-results"></div> | ||
</div> | ||
</section> | ||
|
||
</article> | ||
|
||
<%= content_for :script do %> | ||
new app.Books; | ||
<% end %> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
csv << ['Title', 'Author'] | ||
|
||
@books.each do |book| | ||
csv << [ | ||
book.title, | ||
book.author | ||
] | ||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
<header class="app-header"> | ||
<div class="inner app-cont"> | ||
<div class="inner app-cont cf"> | ||
<h1 class="logo"> | ||
<%= link_to 'amazing', root_path %> | ||
<%= link_to 'amazing books', root_path %> | ||
</h1> | ||
|
||
<nav class="nav"> | ||
<li><%= link_to 'Search', search_books_path %></li> | ||
</nav> | ||
</div> | ||
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ActionView::Template.register_template_handler :md, MarkdownHandler | ||
ActionView::Template.register_template_handler :am, CsvHandler::Handler |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.