From 0e7b226c86b038c9ee97ef48ca96607a7e042e43 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 22 Mar 2018 15:28:46 +0100 Subject: [PATCH] suite --- app/assets/stylesheets/plume_print.css.scss | 12 ++++++-- app/assets/stylesheets/public.scss | 13 ++++++--- app/models/block_content.rb | 1 + app/views/admin/plume_articles/edit.html.haml | 12 ++++++++ app/views/admin/plume_cats/edit.html.haml | 8 ++--- app/views/admin/plumes/_plume.html.haml | 5 +++- app/views/admin/plumes/edit.html.haml | 2 +- app/views/layouts/plume.html.haml | 2 +- app/views/layouts/public.html.haml | 2 +- .../portlet/block_contents/_form.html.haml | 13 ++++++++- .../portlet/image_contents/_form.html.haml | 9 +++++- .../render_public/_blockcontent.html.haml | 29 +++++++++++++++++-- .../render_public/_imagecontent.html.haml | 9 +++++- app/views/public/plumes/print.html.haml | 2 +- ...80322135213_add_infos_to_image_contents.rb | 11 +++++++ ...80322141536_add_infos_to_block_contents.rb | 22 ++++++++++++++ db/schema.rb | 23 ++++++++++++++- 17 files changed, 154 insertions(+), 21 deletions(-) create mode 100644 db/migrate/20180322135213_add_infos_to_image_contents.rb create mode 100644 db/migrate/20180322141536_add_infos_to_block_contents.rb diff --git a/app/assets/stylesheets/plume_print.css.scss b/app/assets/stylesheets/plume_print.css.scss index de75020..03f48f5 100644 --- a/app/assets/stylesheets/plume_print.css.scss +++ b/app/assets/stylesheets/plume_print.css.scss @@ -10,7 +10,12 @@ $beige:#F1F0EE; background-size:cover; } - +.credits{ + text-align:center; + font-size:0.9em; + color:rgba(0,0,0,0.6); + padding:2px 0; +} #bottom{ position:absolute; bottom:0; @@ -45,7 +50,9 @@ $beige:#F1F0EE; .page_inner{ padding:25px 50px; + padding-bottom:0; font-size:14px; + font-weight:300; h1{ text-transform:uppercase; @@ -60,7 +67,7 @@ $beige:#F1F0EE; body{ -webkit-text-size-adjust: none; - font-weight:bold; + font-weight:normal; height:100%; width:102%; padding:0; @@ -98,6 +105,7 @@ html{ background:$beige; padding:10px 20px; padding-top:20px; + font-weight:700; img{ width:80px; diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index 2e812f8..c24d355 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -9,7 +9,12 @@ @import "qi_css/grid"; - +.credits{ + text-align:center; + font-size:0.9em; + color:rgba(0,0,0,0.6); + padding:2px 0; +} .observer-et-photographier-la-faune-sans-deranger{ .couv{ @@ -35,8 +40,8 @@ a{ } body{ - font-family:"Museo sans"; - font-weight:300; + font-family:"Lato", arial, sans-serif; + line-height:1.4em; text-align:justify; @@ -318,7 +323,7 @@ text-align:center; h1,h2,h3,h4{ text-align:left; -font-weight: 400; +font-weight: 700; font-family:$header_font, Arial, sans-serif; color:#69952f; text-transform:uppercase; diff --git a/app/models/block_content.rb b/app/models/block_content.rb index 65fe4e1..8fc55e7 100644 --- a/app/models/block_content.rb +++ b/app/models/block_content.rb @@ -2,6 +2,7 @@ class BlockContent < ActiveRecord::Base has_one :portlet, :as => :content, :dependent => :destroy has_many :blocks, :as => :blockable, :dependent => :destroy + belongs_to :image_file validates :nbr_columns, :presence => true diff --git a/app/views/admin/plume_articles/edit.html.haml b/app/views/admin/plume_articles/edit.html.haml index 90af669..8ba6196 100644 --- a/app/views/admin/plume_articles/edit.html.haml +++ b/app/views/admin/plume_articles/edit.html.haml @@ -1,3 +1,15 @@ +.qi_header + %h1 + =link_to "Plumes", admin_plumes_path + %span + =link_to edit_admin_plume_path(@plume_article.plume) do + ="Plume N° "+@plume_article.plume.number.to_s + ="- "+@plume_article.plume.p_version + %span + =link_to edit_admin_plume_cat_path(@plume_article.plume_cat) do + =@plume_article.plume_cat.title + + #toolbar-text #menu_item_block_edit{:style => "margin-right:330px;margin-top:45px;"} diff --git a/app/views/admin/plume_cats/edit.html.haml b/app/views/admin/plume_cats/edit.html.haml index df9eb99..b2d78e8 100644 --- a/app/views/admin/plume_cats/edit.html.haml +++ b/app/views/admin/plume_cats/edit.html.haml @@ -3,11 +3,11 @@ .qi_header .right= link_to 'Ajouter un article', new_admin_plume_article_path(:plume_cat_id => @plume_cat.id), :class => "btn btn-primary", :remote => true %h1 - Plumes + =link_to "Plumes", admin_plumes_path %span - - ="Plume N° "+@plume.number.to_s - ="- "+@plume.p_version + =link_to edit_admin_plume_path(@plume) do + ="Plume N° "+@plume.number.to_s + ="- "+@plume.p_version diff --git a/app/views/admin/plumes/_plume.html.haml b/app/views/admin/plumes/_plume.html.haml index c6c02b2..5e2f235 100644 --- a/app/views/admin/plumes/_plume.html.haml +++ b/app/views/admin/plumes/_plume.html.haml @@ -2,7 +2,10 @@ %td=plume.title %td - =link_to "voir", public_plume_path(plume), :target => "plume_#{plume.id}" + =link_to "Voir", public_plume_path(plume), :target => "plume_#{plume.id}" + ="-" + =link_to "Voir la plume (pdf)", print_public_plume_path(plume, :format => "pdf"), :target => "plume_pdf_#{plume.id}" + diff --git a/app/views/admin/plumes/edit.html.haml b/app/views/admin/plumes/edit.html.haml index 6478545..b1a5ef8 100644 --- a/app/views/admin/plumes/edit.html.haml +++ b/app/views/admin/plumes/edit.html.haml @@ -1,7 +1,7 @@ .qi_header %h1 - Plumes + =link_to "Plumes", admin_plumes_path %span ="Plume N° "+@plume.number.to_s diff --git a/app/views/layouts/plume.html.haml b/app/views/layouts/plume.html.haml index a5c34d6..6fd436c 100644 --- a/app/views/layouts/plume.html.haml +++ b/app/views/layouts/plume.html.haml @@ -18,7 +18,7 @@ = stylesheet_link_tag '/fonts/Stylograph/stylesheet.css' - + =javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false®ion=FR" %body diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index ca3996a..b603964 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -18,7 +18,7 @@ = stylesheet_link_tag '/fonts/Stylograph/stylesheet.css' - + =javascript_include_tag "http://maps.google.com/maps/api/js?sensor=false®ion=FR" %body diff --git a/app/views/portlet/block_contents/_form.html.haml b/app/views/portlet/block_contents/_form.html.haml index bff1406..e6bb6c2 100644 --- a/app/views/portlet/block_contents/_form.html.haml +++ b/app/views/portlet/block_contents/_form.html.haml @@ -81,4 +81,15 @@ -if BlockContent::STYLES.size > 0 Style : = f.select :style, BlockContent::STYLES - + =f.inputs do + = f.input :center, :label => "Centrer le bloc au milieu de la page" + = f.input :image_file_id, :label => "Image de fond :" , :as => :qi_image_select + = f.input :background_color, :label => "couleur de fond :" + = f.input :margin_top, :label => "Marge haut :" + = f.input :margin_bottom, :label => "Marge bas :" + = f.input :margin_left, :label => "Marge gauche :" + = f.input :margin_right, :label => "Marge droite :" + = f.input :padding_top, :label => "Marge intérieure haut :" + = f.input :padding_bottom, :label => "Marge intérieure bas :" + = f.input :padding_left, :label => "Marge intérieure gauche :" + = f.input :padding_right, :label => "Marge intérieure droite :" diff --git a/app/views/portlet/image_contents/_form.html.haml b/app/views/portlet/image_contents/_form.html.haml index 4ac7c09..b092150 100644 --- a/app/views/portlet/image_contents/_form.html.haml +++ b/app/views/portlet/image_contents/_form.html.haml @@ -7,7 +7,8 @@ = form.input :alt, :label => "Texte alternatif :" - + =# form.input :with_legend,:as => :boolean , :label => "Afficher la légende ?" + = form.input :credits, :label => "Crédit photo" = form.input :alignement, :label => "Alignement :", :as => :select, :collection => ImageContent::ALIGNS, :include_blank => false = form.input :style, :label => "Style :", :as => :select, :collection => ImageContent::STYLES, :include_blank => false = form.input :width, :label => "Largeur :" @@ -25,5 +26,11 @@ = form.inputs do = form.input :cible, :label => "Cible :" , :as => :qi_cible_select = form.input :popup, :label => "Ouvrir dans une popup ?", :as => :boolean + + + = form.input :margin_top, :label => "Marge haut :" + = form.input :margin_bottom, :label => "Marge bas :" + = form.input :margin_left, :label => "Marge gauche :" + = form.input :margin_right, :label => "Marge droite :" diff --git a/app/views/portlets/render_public/_blockcontent.html.haml b/app/views/portlets/render_public/_blockcontent.html.haml index 32e89ed..cd0b3f5 100644 --- a/app/views/portlets/render_public/_blockcontent.html.haml +++ b/app/views/portlets/render_public/_blockcontent.html.haml @@ -17,12 +17,37 @@ - css_class = "beton" if input.style == 7 - css_class = "content_center" if input.style == 8 - =raw "
" if !admin + -css_style = "" + -css_columns = "" + + + -css_style += "background-color:#{input.background_color};" if input.background_color? + + - if input.image_file + -url = input.image_file.file.large.url + -if input.image_file and input.image_file.photograph + -@page_images_credits << input.image_file.photograph + + + -css_style += "background-image:url('#{url}');background-size:100%;background-size:cover;background-position:center center;" + + -css_columns += "padding-top:#{input.padding_top}px;" if input.padding_top? + -css_columns += "padding-bottom:#{input.padding_bottom}px;" if input.padding_bottom? + -css_columns += "padding-left:#{input.padding_left}px;" if input.padding_left? + -css_columns += "padding-right:#{input.padding_right}px;" if input.padding_right? + + -css_style += "margin-top:#{input.margin_top}px;" if input.margin_top? + -css_style += "margin-bottom:#{input.margin_bottom}px;" if input.margin_bottom? + -css_style += "margin-left:#{input.margin_left}px;" if input.margin_left? + -css_style += "margin-right:#{input.margin_right}px;" if input.margin_right? + + + =raw "
" if !admin =raw "
" if input.style > 1 or input.style < 10 .row -for i in 1..input.nbr_columns.to_i - %div{:class => "columns span_"+eval("input.row#{i}").to_s} + %div{:class => "columns span_"+eval("input.row#{i}").to_s, :style => css_columns} -if admin =render :partial => "admin/blocks/block", :locals => {:admin => false,:block => input.blocks[i-1], :sortable => false} -else diff --git a/app/views/portlets/render_public/_imagecontent.html.haml b/app/views/portlets/render_public/_imagecontent.html.haml index aa4c934..6342e8f 100644 --- a/app/views/portlets/render_public/_imagecontent.html.haml +++ b/app/views/portlets/render_public/_imagecontent.html.haml @@ -41,6 +41,10 @@ -styleimg="" -styleimg += "width:"+input.width.to_s+"px;" if input.width? -styleimg += "height:"+input.height.to_s+"px;" if input.height? +-style += "margin-top:#{input.margin_top}px;" if input.margin_top? +-style += "margin-bottom:#{input.margin_bottom}px;" if input.margin_bottom? +-style += "margin-left:#{input.margin_left}px;" if input.margin_left? +-style += "margin-right:#{input.margin_right}px;" if input.margin_right? =raw '
' if style @@ -58,5 +62,8 @@ -else =image_tag(url, :alt => input.alt.to_s, :style => styleimg ) - +-if input.credits? + .credits + © + =input.credits =raw '
' if style \ No newline at end of file diff --git a/app/views/public/plumes/print.html.haml b/app/views/public/plumes/print.html.haml index 7762492..5a76f08 100644 --- a/app/views/public/plumes/print.html.haml +++ b/app/views/public/plumes/print.html.haml @@ -3,7 +3,7 @@ %meta{:charset => "utf-8"}/ %meta{:name=>"viewport", :content=>"width=device-width,initial-scale=1"} =# wicked_pdf_javascript_include_tag "number_pages" - + = wicked_pdf_stylesheet_link_tag 'plume_print' %body{:onload => "number_pages"} .page diff --git a/db/migrate/20180322135213_add_infos_to_image_contents.rb b/db/migrate/20180322135213_add_infos_to_image_contents.rb new file mode 100644 index 0000000..0efd921 --- /dev/null +++ b/db/migrate/20180322135213_add_infos_to_image_contents.rb @@ -0,0 +1,11 @@ +class AddInfosToImageContents < ActiveRecord::Migration + def change + add_column :image_contents, :with_legend, :boolean + add_column :image_contents, :credits, :string + add_column :image_contents, :margin_top, :integer + add_column :image_contents, :margin_bottom, :integer + add_column :image_contents, :margin_left, :integer + add_column :image_contents, :margin_right, :integer + + end +end diff --git a/db/migrate/20180322141536_add_infos_to_block_contents.rb b/db/migrate/20180322141536_add_infos_to_block_contents.rb new file mode 100644 index 0000000..293cfbf --- /dev/null +++ b/db/migrate/20180322141536_add_infos_to_block_contents.rb @@ -0,0 +1,22 @@ +class AddInfosToBlockContents < ActiveRecord::Migration + def change + add_column :block_contents, :image_file_id, :integer + add_column :block_contents, :margin_top, :integer + add_column :block_contents, :margin_bottom, :integer + add_column :block_contents, :margin_left, :integer + add_column :block_contents, :margin_right, :integer + add_column :block_contents, :padding_top, :integer + add_column :block_contents, :padding_bottom, :integer + add_column :block_contents, :padding_left, :integer + add_column :block_contents, :padding_right, :integer + add_column :block_contents, :parallax, :boolean + add_column :block_contents, :center, :boolean + add_column :block_contents, :center_width, :integer + add_column :block_contents, :background_color, :string + add_column :block_contents, :gradient_start, :string + add_column :block_contents, :gradient_stop, :string + + + + end +end diff --git a/db/schema.rb b/db/schema.rb index 7740c87..e19f9b5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180320123351) do +ActiveRecord::Schema.define(version: 20180322141536) do create_table "admins", force: true do |t| t.string "email", default: "", null: false @@ -107,6 +107,21 @@ ActiveRecord::Schema.define(version: 20180320123351) do t.integer "row4" t.datetime "created_at" t.datetime "updated_at" + t.integer "image_file_id" + t.integer "margin_top" + t.integer "margin_bottom" + t.integer "margin_left" + t.integer "margin_right" + t.integer "padding_top" + t.integer "padding_bottom" + t.integer "padding_left" + t.integer "padding_right" + t.boolean "parallax" + t.boolean "center" + t.integer "center_width" + t.string "background_color" + t.string "gradient_start" + t.string "gradient_stop" end create_table "blocks", force: true do |t| @@ -397,6 +412,12 @@ ActiveRecord::Schema.define(version: 20180320123351) do t.boolean "popup" t.datetime "created_at" t.datetime "updated_at" + t.boolean "with_legend" + t.string "credits" + t.integer "margin_top" + t.integer "margin_bottom" + t.integer "margin_left" + t.integer "margin_right" end create_table "image_files", force: true do |t|