You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.7 KiB

<section class="movie-details">
<div class="image">
<%= image_tag @movie.image_file_name %>
<% if current_user %>
<div class="faves">
<%= fave_or_unfave_button(@movie, @favorite) %>
<div class="count">
<%= @fans.size %>
</div>
</div>
<% end %>
</div>
<div class="details">
<h1><%= @movie.title %></h1>
<h2>
<%= year_of(@movie) %> &bull; <%= @movie.rating %>
</h2>
<div class="reviews">
<%= average_stars(@movie) %>
<%= link_to pluralize(@movie.reviews.size, "review"), movie_reviews_path(@movie) %>
</div>
<p>
<%= @movie.description %>
</p>
<table>
<tr>
<th>Director:</th>
<td><%= @movie.director %></td>
</tr>
<tr>
<th>Duration:</th>
<td><%= @movie.duration %></td>
</tr>
<tr>
<th>Total Gross:</th>
<td><%= total_gross(@movie) %></td>
</tr>
</table>
<%= link_to "Write Review", new_movie_review_path(@movie), class: "review" %>
<section class="admin">
<% if current_user_admin? %>
<%= link_to "Edit", edit_movie_path(@movie), class: "button" %>
<%= link_to "Delete", movie_path(@movie), class: "button", data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } %>
<% end %>
</section>
</div>
<aside>
<% if @fans.present? %>
<h4>Fans</h4>
<ul>
<% @fans.each do |user| %>
<li>
<%= link_to user.name, user %>
</li>
<% end %>
</ul>
<% end %>
<% if @genres.present? %>
<h4>Genres</h4>
<ul>
<% @genres.each do |g| %>
<li><%= g.name %></li>
<% end %>
</ul>
<% end %>
</aside>
</section>