From e9bc3c403200b83c755eaa299090bf9a750d1341 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 22 Mar 2018 19:12:28 +0100 Subject: [PATCH] suite --- app/assets/stylesheets/plume_print.css.scss | 39 +++++++++++++++++++-- app/models/plume.rb | 35 ++++++++++++++++++ app/views/public/plumes/print.html.haml | 19 ++++++++++ app/views/public/plumes/show.html.haml | 19 +++++----- 4 files changed, 100 insertions(+), 12 deletions(-) diff --git a/app/assets/stylesheets/plume_print.css.scss b/app/assets/stylesheets/plume_print.css.scss index 52c2948..4e74549 100644 --- a/app/assets/stylesheets/plume_print.css.scss +++ b/app/assets/stylesheets/plume_print.css.scss @@ -5,8 +5,10 @@ $beige:#F1F0EE; @import "qi_css/grid"; #couv{ - height:770px; - background:center center no-repeat; + height:685px; + + margin-top:85px; + background:rgba(0,0,0,0.8) center center no-repeat; background-size:cover; } @@ -21,7 +23,40 @@ text-decoration:none; } } +#plume_sub_header{ + position:absolute; + top:210px; + left:0; + right:0; + background:white; + padding:5px 30px; + + .p_column{ + float:left; + width:33.33%; + + + .plume_cat{ + text-transform:uppercase; + color:$vert; + font-size:23px; + margin-top:0px; + font-weight:bold; + margin-bottom:0px; + } + h2{ + font-size:18px; + margin:0px 0; + font-weight:bold; + color:black; + text-transform:none; + margin-bottom:8px; + padding-right:30px; + } + + } +} .agenda{ background:$beige; margin:20px -20px; diff --git a/app/models/plume.rb b/app/models/plume.rb index 993511f..8484d44 100644 --- a/app/models/plume.rb +++ b/app/models/plume.rb @@ -6,4 +6,39 @@ class Plume < ActiveRecord::Base has_many :plume_articles, :through => :plume_cats has_many :plume_events + + def v_une_1 + cat = self.plume_cats.where(:title => "édito").first + if cat + return cat.plume_articles.first + + else + return nil + end + + end + + def v_une_2 + cat = self.plume_cats.where(:title => "Dossier").first + if cat + return cat.plume_articles.first + + else + return nil + end + + end + + def v_une_3 + cat = self.plume_cats.where(:title => "Grain de sable").first + if cat + return cat.plume_articles.first + + else + return nil + end + + end + + end diff --git a/app/views/public/plumes/print.html.haml b/app/views/public/plumes/print.html.haml index 0aefc62..0348159 100644 --- a/app/views/public/plumes/print.html.haml +++ b/app/views/public/plumes/print.html.haml @@ -17,6 +17,25 @@ .hr + + #plume_sub_header + -id = [] + + -id << @plume.v_une_1.id if @plume.v_une_1 + + -id << @plume.v_une_2.id if @plume.v_une_2 + -id << @plume.v_une_3.id if @plume.v_une_3 + + + + -@plume.plume_articles.where(:id => id).each do |article| + .p_column + + -if article.plume_cat + .plume_cat= article.plume_cat.title + %h2=article.title + + #couv{:style => "background-image:url('http://lepicvert.org/#{(@plume.image_file.file.url if @plume.image_file)}');"} #bottom diff --git a/app/views/public/plumes/show.html.haml b/app/views/public/plumes/show.html.haml index 7cbb071..a85d635 100644 --- a/app/views/public/plumes/show.html.haml +++ b/app/views/public/plumes/show.html.haml @@ -7,14 +7,12 @@ .right_plume -id = [] - -cat = @plume.plume_cats.where(:title => "édito").first - -if cat - -id << cat.plume_articles.first.id if cat.plume_articles.first + + -id << @plume.v_une_1.id if @plume.v_une_1 + + -id << @plume.v_une_2.id if @plume.v_une_2 - -cat = @plume.plume_cats.where(:title => "Dossier").first - -if cat - -id << cat.plume_articles.first.id if cat.plume_articles.first - + -@plume.plume_articles.where(:id => id).each do |article| =link_to public_plume_article_path(article) do @@ -32,9 +30,10 @@ .clear -id = [] - -cat = @plume.plume_cats.where(:title => "Grain de sable").first - -if cat - -id << cat.plume_articles.first.id if cat.plume_articles.first + + -id << @plume.v_une_3.id if @plume.v_une_3 + + -@plume.plume_articles.where(:id => id).each do |article| =link_to public_plume_article_path(article) do