From 44a3a33a09c38d3143b04cede6e467c55b1acb5c Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Sat, 25 Mar 2017 13:22:54 +0100 Subject: [PATCH] testimonies --- app/assets/stylesheets/public.scss | 31 +++++++++++++++++++ .../public/testimonies_controller.rb | 5 +++ app/views/layouts/public.html.haml | 4 ++- .../public/testimonies/_testimony.html.haml | 11 ++++--- app/views/public/testimonies/index.haml | 4 +++ config/routes.rb | 2 +- 6 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 app/views/public/testimonies/index.haml diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index db7bd88..feec0a9 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -340,3 +340,34 @@ ul, ol{ padding: 0; margin: 0 0 10px 25px; } + + + +#testimony_index{ + + .testimony{ + + padding:1px; + clear:both; + img{ + float:left; + width:150px; + + margin-bottom:1em; + margin-right:1em; + } + margin:1em 0; + margin-bottom:3em; + blockquote{ + margin-top:30px; + a{ + color:black;} + margin-bottom:0.5em; + } + + .author{ + text-align:right; + } + } +} + diff --git a/app/controllers/public/testimonies_controller.rb b/app/controllers/public/testimonies_controller.rb index f09c649..f6a60bd 100644 --- a/app/controllers/public/testimonies_controller.rb +++ b/app/controllers/public/testimonies_controller.rb @@ -25,5 +25,10 @@ class Public::TestimoniesController < ApplicationController end + + + def index + @testimonies = Testimony.all + end end diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 800e07e..892de26 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -58,7 +58,9 @@ =image_tag("front/right.png", :class => "next-testimony") .author=link_to testimony.author, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug) - + %br + %br + %div{:style => "text-align:right;"}=link_to "Tous les témoignages", testimonies_path :coffeescript diff --git a/app/views/public/testimonies/_testimony.html.haml b/app/views/public/testimonies/_testimony.html.haml index 40fef0c..37e5826 100644 --- a/app/views/public/testimonies/_testimony.html.haml +++ b/app/views/public/testimonies/_testimony.html.haml @@ -1,6 +1,7 @@ -#testimony_header - =link_to image_tag(testimony.image_file.image.url(:square)), testimony_link(testimony) if testimony.image_file - .quote - =link_to testimony.quote, testimony_link(testimony) +.testimony + =link_to image_tag(testimony.image_file.file.square.url()), testimony_path(testimony) if testimony.image_file + %blockquote + =link_to testimony.quote, testimony_path(testimony) - .author=link_to testimony.author, testimony_link(testimony) + .author=link_to testimony.author+" - lire la suite >", testimony_path(testimony) + .clear{:style => "clear:both;"} diff --git a/app/views/public/testimonies/index.haml b/app/views/public/testimonies/index.haml new file mode 100644 index 0000000..3526982 --- /dev/null +++ b/app/views/public/testimonies/index.haml @@ -0,0 +1,4 @@ +#testimony_index + + %h1 Témoignages + =render @testimonies \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2793daf..621411b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,7 +18,7 @@ CMSnb::Application.routes.draw do get 'rubriques/:id.html' => "public/portfolios#show", :as => "public_portfolio" get 'vos-temoignages/:slug.:f' => 'public/testimonies#show', :as => :testimony, :f => "html" - + get 'vos-temoignages.:f' => 'public/testimonies#index', :as => :testimonies, :f => "html" namespace :student do root :to => "topics#index", :id => 1 resources :student_topics