-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This page is concerned with both showing the book’s details and listing reviews. By extracting out partials we can more easily see the high-level structure, and have separate view specs to cover each aspect of the page.
- Loading branch information
Showing
4 changed files
with
55 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="book"> | ||
<div class="book-image"> | ||
<%= image_tag(book.sample_cover) %> | ||
</div> | ||
<div class="book-content"> | ||
<h1><%= book.title %></h1> | ||
<% if book.author.present? %> | ||
<h3>by <%= link_to book.author.name, book.author %></h3> | ||
<% end %> | ||
<% if book.has_summary? %> | ||
<% # doesn't yet handle paragraphs, line breaks yet %> | ||
<p class="summary"><%= book.summary %></p> | ||
<% end %> | ||
<p class="released-on"><%= l(book.released_on, format: :long) %></p> | ||
</div> | ||
</div> |
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,29 @@ | ||
<% # Markup for users Review feature %> | ||
<div class="comment"> | ||
<h2>Reviews</h2> | ||
</div> | ||
<% [*1..3].sample.times do %> | ||
<div class="comment"> | ||
<div class="comment-image"> | ||
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_1.png" alt="Logo image"> | ||
</div> | ||
<div class="comment-content"> | ||
<h1>Samuel L. Jackson</h1> | ||
<p>Yeah, I like animals better than people sometimes... Especially dogs. Dogs are the best. Every time you come home, they act like they haven't seen you in a year. And the good thing about dogs... is they got different dogs for different people.</p> | ||
<p class="comment-detail"><%= Time.current %></p> | ||
</div> | ||
</div> | ||
<div class="comment"> | ||
<div class="comment-image"> | ||
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_2.png" alt="Logo image"> | ||
</div> | ||
<div class="comment-content"> | ||
<h1>David H. Hanson</h1> | ||
<p>Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows.</p> | ||
<p class="comment-detail"><%= Time.current %></p> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% # Markup for users Review feature %> |
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,49 +1,4 @@ | ||
<div class="box"> | ||
<div class="book"> | ||
<div class="book-image"> | ||
<%= image_tag(book.sample_cover) %> | ||
</div> | ||
<div class="book-content"> | ||
<h1><%= book.title %></h1> | ||
<% if book.author.present? %> | ||
<h3>by <%= link_to book.author.name, book.author %></h3> | ||
<% end %> | ||
<% if book.has_summary? %> | ||
<% # doesn't yet handle paragraphs, line breaks yet %> | ||
<p class="summary"><%= book.summary %></p> | ||
<% end %> | ||
<p class="released-on"><%= l(book.released_on, format: :long) %></p> | ||
</div> | ||
</div> | ||
<% # Markup for users Review feature %> | ||
<div class="comment"> | ||
<h2>Reviews</h2> | ||
</div> | ||
<% [*1..3].sample.times do %> | ||
<div class="comment"> | ||
<div class="comment-image"> | ||
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_1.png" alt="Logo image"> | ||
</div> | ||
<div class="comment-content"> | ||
<h1>Samuel L. Jackson</h1> | ||
<p>Yeah, I like animals better than people sometimes... Especially dogs. Dogs are the best. Every time you come home, they act like they haven't seen you in a year. And the good thing about dogs... is they got different dogs for different people.</p> | ||
<p class="comment-detail"><%= Time.current %></p> | ||
</div> | ||
</div> | ||
<div class="comment"> | ||
<div class="comment-image"> | ||
<img src="https://raw.githubusercontent.com/thoughtbot/refills/master/source/images/placeholder_logo_2.png" alt="Logo image"> | ||
</div> | ||
<div class="comment-content"> | ||
<h1>David H. Hanson</h1> | ||
<p>Well, the way they make shows is, they make one show. That show's called a pilot. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows.</p> | ||
<p class="comment-detail"><%= Time.current %></p> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% # Markup for users Review feature %> | ||
<%= render "details", book: book %> | ||
<%= render "reviews", book: book %> | ||
</div> |
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