From 7246e18377c95d56248a0cb6a1894fe0c9b21622 Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Thu, 19 Nov 2015 12:22:52 +0100 Subject: [PATCH] Add single movie page --- lib/librarix/views/movie.slim | 25 +++++++++++++++++++ .../views/partials/movie/compact.slim | 2 +- .../views/partials/movie/default.slim | 5 +++- lib/librarix/views/partials/movie/poster.slim | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lib/librarix/views/movie.slim b/lib/librarix/views/movie.slim index e69de29..dae49fc 100644 --- a/lib/librarix/views/movie.slim +++ b/lib/librarix/views/movie.slim @@ -0,0 +1,25 @@ +- content_for :title do + = movie.title + +.movie data-id="#{movie.id}" + .poster + - if movie.poster_path + img src="#{poster_url(movie.poster_path, 'w154')}" + .informations + h2 + a href="#{url("/movie/#{movie.id}")}" #{movie.original_title} + p = movie.release_date + p = movie.overview + .actions + - if movie.added? + - unless movie.viewed? + form method="post" action="/view" + input type="hidden" name="id" value="#{movie.id}" + button type="submit" data-action="view-movie" View + form method="post" action="/remove" + input type="hidden" name="id" value="#{movie.id}" + button type="submit" data-action="remove-movie" Remove + - else + form method="post" action="/add" + input type="hidden" name="id" value="#{movie.id}" + button type="submit" data-action="add-movie" Add diff --git a/lib/librarix/views/partials/movie/compact.slim b/lib/librarix/views/partials/movie/compact.slim index 7b903b7..a309e76 100644 --- a/lib/librarix/views/partials/movie/compact.slim +++ b/lib/librarix/views/partials/movie/compact.slim @@ -3,7 +3,7 @@ img src="#{poster_url(movie.poster_path, 'w92')}" .informations h2 - a href="https://www.themoviedb.org/movie/#{movie.id}" #{movie.original_title} + a href="#{url("/movie/#{movie.id}")}" #{movie.original_title} .actions - if movie.added? - unless movie.viewed? diff --git a/lib/librarix/views/partials/movie/default.slim b/lib/librarix/views/partials/movie/default.slim index 39a6f99..e4a0b51 100644 --- a/lib/librarix/views/partials/movie/default.slim +++ b/lib/librarix/views/partials/movie/default.slim @@ -3,9 +3,12 @@ img src="#{poster_url(movie.poster_path, 'w154')}" .informations h2 - a href="https://www.themoviedb.org/movie/#{movie.id}" #{movie.original_title} + a href="#{url("/movie/#{movie.id}")}" #{movie.original_title} p = movie.release_date p = movie.overview + ul.genres + - movie.genres.each do |genre| + li = genre['name'] .actions - if movie.added? - unless movie.viewed? diff --git a/lib/librarix/views/partials/movie/poster.slim b/lib/librarix/views/partials/movie/poster.slim index 3ee9fb2..f109443 100644 --- a/lib/librarix/views/partials/movie/poster.slim +++ b/lib/librarix/views/partials/movie/poster.slim @@ -3,4 +3,4 @@ img src="#{poster_url(movie.poster_path, 'w154')}" .informations h2 - a href="https://www.themoviedb.org/movie/#{movie.id}" #{movie.original_title} + a href="#{url("/movie/#{movie.id}")}" #{movie.original_title}