From d02afd94d41d46122306d9a2747c3d386def4fac Mon Sep 17 00:00:00 2001 From: Guillaume Dott Date: Wed, 18 Nov 2015 16:18:59 +0100 Subject: [PATCH] Move partials into separate directory --- lib/librarix/application.rb | 6 +----- lib/librarix/views/application.js | 0 lib/librarix/views/index.slim | 2 +- lib/librarix/views/movie.slim | 2 -- lib/librarix/views/{ => partials}/list.slim | 2 +- lib/librarix/views/partials/movie.slim | 2 ++ lib/librarix/views/{ => partials}/movie/compact.slim | 0 lib/librarix/views/{ => partials}/movie/default.slim | 0 lib/librarix/views/{ => partials}/movie/poster.slim | 0 lib/librarix/views/search.slim | 2 +- 10 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 lib/librarix/views/application.js rename lib/librarix/views/{ => partials}/list.slim (53%) create mode 100644 lib/librarix/views/partials/movie.slim rename lib/librarix/views/{ => partials}/movie/compact.slim (100%) rename lib/librarix/views/{ => partials}/movie/default.slim (100%) rename lib/librarix/views/{ => partials}/movie/poster.slim (100%) diff --git a/lib/librarix/application.rb b/lib/librarix/application.rb index f1d9d9c..3316913 100644 --- a/lib/librarix/application.rb +++ b/lib/librarix/application.rb @@ -42,11 +42,7 @@ module Librarix Tmdb::Movie.find(params['search']) end - if request.xhr? - slim :list, layout: false, locals: {movies: movies} - else - slim :search, locals: {movies: movies} - end + slim :search, locals: {movies: movies} end post '/add' do diff --git a/lib/librarix/views/application.js b/lib/librarix/views/application.js deleted file mode 100644 index e69de29..0000000 diff --git a/lib/librarix/views/index.slim b/lib/librarix/views/index.slim index a6897d0..f97be86 100644 --- a/lib/librarix/views/index.slim +++ b/lib/librarix/views/index.slim @@ -24,7 +24,7 @@ form method="get" action="/" id="filter" - filter.movies.each do |group, movies| - unless group == :all h1 = group - == slim :list, locals: {movies: movies} + == slim :'partials/list', locals: {movies: movies} - if filter.maybe_search? p | Search for diff --git a/lib/librarix/views/movie.slim b/lib/librarix/views/movie.slim index 45c179f..e69de29 100644 --- a/lib/librarix/views/movie.slim +++ b/lib/librarix/views/movie.slim @@ -1,2 +0,0 @@ -.movie data-id="#{movie.id}" - == slim :"movie/#{template}", locals: {movie: movie} diff --git a/lib/librarix/views/list.slim b/lib/librarix/views/partials/list.slim similarity index 53% rename from lib/librarix/views/list.slim rename to lib/librarix/views/partials/list.slim index 9a5258e..73601cb 100644 --- a/lib/librarix/views/list.slim +++ b/lib/librarix/views/partials/list.slim @@ -1,4 +1,4 @@ ul.movies class="#{template}" - movies.each do |movie| li - == slim :movie, locals: {movie: movie} + == slim :'partials/movie', locals: {movie: movie} diff --git a/lib/librarix/views/partials/movie.slim b/lib/librarix/views/partials/movie.slim new file mode 100644 index 0000000..b4b2557 --- /dev/null +++ b/lib/librarix/views/partials/movie.slim @@ -0,0 +1,2 @@ +.movie data-id="#{movie.id}" + == slim :"partials/movie/#{template}", locals: {movie: movie} diff --git a/lib/librarix/views/movie/compact.slim b/lib/librarix/views/partials/movie/compact.slim similarity index 100% rename from lib/librarix/views/movie/compact.slim rename to lib/librarix/views/partials/movie/compact.slim diff --git a/lib/librarix/views/movie/default.slim b/lib/librarix/views/partials/movie/default.slim similarity index 100% rename from lib/librarix/views/movie/default.slim rename to lib/librarix/views/partials/movie/default.slim diff --git a/lib/librarix/views/movie/poster.slim b/lib/librarix/views/partials/movie/poster.slim similarity index 100% rename from lib/librarix/views/movie/poster.slim rename to lib/librarix/views/partials/movie/poster.slim diff --git a/lib/librarix/views/search.slim b/lib/librarix/views/search.slim index 71a372f..0256e81 100644 --- a/lib/librarix/views/search.slim +++ b/lib/librarix/views/search.slim @@ -7,4 +7,4 @@ form method="get" action="/search" id="search" input type="submit" value="Search" div - == slim :list, locals: {movies: movies} + == slim :'partials/list', locals: {movies: movies}