This commit is contained in:
Nicolas Bally 2018-03-22 10:38:18 +01:00
parent ee3d2bdbf6
commit 3053d1d93d
7 changed files with 116 additions and 29 deletions

View File

@ -4,9 +4,62 @@ $vert:#7BAE53;
$beige:#F1F0EE; $beige:#F1F0EE;
@import "qi_css/grid"; @import "qi_css/grid";
#couv{
height:770px;
background:center center no-repeat;
background-size:cover;
}
#bottom{
position:absolute;
bottom:0;
right:0;
left:0;
background:$grey;
.desc{
position:absolute;
right:0;
bottom:0;
left:230px;
height:136px;
color:white;
p{
font-size:18px;
font-weight:bold;
margin-bottom:5px;
}
}
#logo{
background:white;
width:160px;
padding:8px 20px;
img{
height:120px;
display:block;
margin:auto;
}
}
}
.page_inner{
padding:25px 50px;
font-size:14px;
h1{
text-transform:uppercase;
color:$vert;
margin-top:10px;
margin-bottom:0px;
padding:0;
font-size:25px;
}
}
body{ body{
-webkit-text-size-adjust: none;
font-weight:bold; font-weight:bold;
height:100%; height:100%;
width:102%; width:102%;
@ -32,8 +85,8 @@ html{
.page{ .page{
display: block; display: block;
clear: both; clear: both;
width:786px; width:788px;
position:relative;
min-height: 295mm; min-height: 295mm;
page-break-after: always; page-break-after: always;
@ -91,6 +144,7 @@ html{
.hr{ .hr{
margin:8px 0; margin:8px 0;
height:20px; height:20px;
margin-bottom:0;
background:$grey; background:$grey;
} }
} }
@ -158,7 +212,7 @@ html{
} }
.render_block{ .render_block{
padding:10px 0; padding:10px 0;
padding-top:0;
} }

View File

@ -43,14 +43,19 @@ class Public::PlumesController < ApplicationController
@plume = Plume.find(params[:id]) @plume = Plume.find(params[:id])
respond_to do |format| respond_to do |format|
format.html format.html do
render :layout => false
end
format.pdf do format.pdf do
render pdf: 'file_name', render pdf: 'file_name',
disposition: 'inline', # default 'inline' disposition: 'inline', # default 'inline'
layout: false, layout: false,
page_size: 'A4', #page_size: 'A4',
viewport_size: '800x600', zoom: 1,
page_width: 210, page_width: 210,
page_height:297,
viewport_size: '800x600',
template: "public/plumes/print.html.haml" , template: "public/plumes/print.html.haml" ,
margin: { top: 0, # default 10 (mm) margin: { top: 0, # default 10 (mm)
bottom: 0, bottom: 0,

View File

@ -2,6 +2,10 @@
%td=plume_article.title %td=plume_article.title
%td
=link_to "voir", public_plume_article_path(plume_article), :target => "plume_article_#{plume_article.id}"

View File

@ -25,6 +25,11 @@
#menu_item_informations #menu_item_informations
%p=link_to "Voir l'article", public_plume_article_path(@plume_article), :target => "plume_article_#{@plume_article.id}"
%p=link_to "Voir la plume", public_plume_path(@plume_article.plume), :target => "plume_#{@plume_article.plume.id}"
%p=link_to "Voir la plume (pdf)", print_public_plume_path(@plume_article.plume, :format => "pdf"), :target => "plume_pdf_#{@plume_article.plume.id}"
%h4 %h4
Infos sur l'article Infos sur l'article

View File

@ -1,6 +1,6 @@
#plume_event_show #plume_event_show
%h1 %h1
=@plume_event.title =@plume_event.title
%em=plume_event_human_date(@plume_event) %em=event_human_date(@plume_event)
.desc=simple_format @plume_event.description .desc=simple_format @plume_event.description

View File

@ -2,7 +2,7 @@
%td=plume.title %td=plume.title
%td %td
=link_to "voir", public_plume_path(plume) =link_to "voir", public_plume_path(plume), :target => "plume_#{plume.id}"
@ -10,5 +10,5 @@
= link_to i(:"trash-o"), [:admin, plume], :confirm => 'Voulez-vous vraiment supprimer cet plume ?', :method => :delete, :remote => true = link_to i(:"trash-o"), [:admin, plume], :confirm => 'Voulez-vous vraiment supprimer cet plume ?', :method => :delete, :remote => true
= link_to i(:pencil), edit_admin_plume_path(plume), :style => "padding:0px 0px 0px 0px;", :remote => true = link_to i(:pencil), edit_admin_plume_path(plume), :style => "padding:0px 0px 0px 0px;", :remote => true
= link_to i(:eye), edit_admin_plume_path(plume), :style => "padding:0px 0px 0px 0px;" = link_to i(:plus), edit_admin_plume_path(plume), :style => "padding:0px 0px 0px 0px;"

View File

@ -1,4 +1,3 @@
!!!
%html %html
%head %head
%meta{:charset => "utf-8"}/ %meta{:charset => "utf-8"}/
@ -16,6 +15,24 @@
.hr .hr
#couv{:style => "background-image:url('http://lepicvert.org/#{(@plume.image_file.file.url if @plume.image_file)}');"}
#bottom
#logo
=image_tag("http://lepicvert.org/logo.png")
.desc
%p
="N°#{@plume.number} - "
=@plume.p_version
Association pour la protection de la nature
%br
Membre de la FRAPNA Isère
%br
24 place de la Mairie - 38140 Reaumont
%br
04 76 91 34 33 - contact@lepicvert.asso.fr - www.lepicvert.org
.page .page
-i = 0 -i = 0
@ -37,10 +54,11 @@
-i = 0 -i = 0
=raw "</div><div class='page'>" =raw "</div><div class='page'>"
%h1=plume_article.title .page_inner
%h1=plume_article.title
.render_block .render_block
=render plume_article.block =render plume_article.block
-if plume_article.article_type == "page" -if plume_article.article_type == "page"
-i = 0 -i = 0
@ -50,7 +68,7 @@
-if i == 2 -if i == 2
-i = 0 -i = 0
=raw "</div><div class='page'>" =raw "</div><div class='page'>"
.page
.page_header .page_header
.right .right
=image_tag "http://lepicvert.org/plume-header.png" =image_tag "http://lepicvert.org/plume-header.png"
@ -59,13 +77,14 @@
="N°#{@plume.number}" ="N°#{@plume.number}"
.left Agenda .left Agenda
.clear .clear
-@plume.plume_events.each do |plume_event| .page_inner
.plume_event -@plume.plume_events.each do |plume_event|
%h2=plume_event.title .plume_event
.date %h2=plume_event.title
=raw event_human_date(plume_event) .date
.desc =raw event_human_date(plume_event)
=plume_event.description .desc
=plume_event.description
.page .page
.page_header .page_header
@ -80,12 +99,12 @@
-@breve_cat = @plume.plume_cats.where(:title => "Brèves").first -@breve_cat = @plume.plume_cats.where(:title => "Brèves").first
-if @breve_cat -if @breve_cat
-@breve_cat.plume_articles.each do |plume_article| .page_inner
.plume_breve -@breve_cat.plume_articles.each do |plume_article|
%h2=plume_article.title .plume_breve
%h2=plume_article.title
.render_block .render_block
=render plume_article.block =render plume_article.block
%div{:style => "width:100px;height:100px;background:red;position:absolute;top:0;right:0;"}