Last active
August 29, 2015 14:11
-
-
Save andrekibbe/f70a1ff9c3745e99c2d8 to your computer and use it in GitHub Desktop.
Improved Back buttons for edit.html.erb & show.html.erb
This file contains hidden or 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
| # For Alex Yang's Udemy course: The Startup's Guide to Ruby on Rails | |
| # https://www.udemy.com/the-startups-guide-to-web-development-with-ruby-on-rails | |
| <h1>Editing listing</h1> | |
| <%= render 'form' %> | |
| <%= link_to 'Show', @listing, class: "btn btn-link" %> | | |
| # Change from listing_path shown in Lecture 30 and previous lectures | |
| <%= link_to 'Back', seller_path, class: "btn btn-link"%> |
This file contains hidden or 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
| # For Alex Yang's Udemy course: The Startup's Guide to Ruby on Rails | |
| # https://www.udemy.com/the-startups-guide-to-web-development-with-ruby-on-rails | |
| <div class="row"> | |
| <div class="col-md-6"> | |
| <div class="thumbnail"> | |
| <%= image_tag @listing.image.url %> | |
| </div> | |
| </div> | |
| <div class="col-md-6"> | |
| <h3><%= @listing.name %></h3> | |
| <p><%= number_to_currency(@listing.price) %></p> | |
| <p><%= @listing.description %></p> | |
| </div> | |
| </div> | |
| <% if current_user == @listing.user %> | |
| <%= link_to 'Edit', edit_listing_path(@listing), class: "btn btn-link" %> | | |
| # Direct signed-in users to seller_path rather than listings_path | |
| <%= link_to 'Back', seller_path, class: "btn btn-link" %> | |
| <% else %> | |
| # Change from listing_path shown in Lecture 30 and previous lectures | |
| <%= link_to 'Back', listings_path, class: "btn btn-link" %> | |
| <% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment