From fdadb33a65e52b4d1476d8593e74831341cd1e0a Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Fri, 31 Oct 2014 14:24:03 +0100 Subject: [PATCH] images --- app/assets/stylesheets/public.scss | 3 ++ app/models/block_content.rb | 2 +- app/models/image_content.rb | 4 +-- .../render_public/_blockcontent.html.haml | 1 + .../render_public/_imagecontent.html.haml | 29 ++++++++++++------- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/public.scss b/app/assets/stylesheets/public.scss index c7554b9..c2c58a2 100644 --- a/app/assets/stylesheets/public.scss +++ b/app/assets/stylesheets/public.scss @@ -394,6 +394,9 @@ background:rgba(176,201,49,1); .rose_background{ background:rgba(230,0,125,1); } +.content_center{ +text-align:center; +} .beton{ diff --git a/app/models/block_content.rb b/app/models/block_content.rb index 8190508..65fe4e1 100644 --- a/app/models/block_content.rb +++ b/app/models/block_content.rb @@ -5,7 +5,7 @@ class BlockContent < ActiveRecord::Base validates :nbr_columns, :presence => true - STYLES = [["normal",1],["fond gris foncé",2],["fond gris clair",3],["fond bleu",4],["fond jaune",5],["fond vert",6],["fond béton",7]] + STYLES = [["normal",1],["fond gris foncé",2],["fond gris clair",3],["fond bleu",4],["fond jaune",5],["fond vert",6],["fond béton",7],["Contenu centré",8]] diff --git a/app/models/image_content.rb b/app/models/image_content.rb index c746f19..e38df16 100644 --- a/app/models/image_content.rb +++ b/app/models/image_content.rb @@ -3,8 +3,8 @@ class ImageContent < ActiveRecord::Base belongs_to :image_file has_one :portlet, :as => :content, :dependent => :destroy - STYLES = [["Grande","5"],["Taille moyenne","1"], ["Petite taille","2"], ["Petit carré","3"], ["Miniature","4"]] - ALIGNS = [["centré","center"], ["gauche","left"],["droite","right"]] + STYLES = [["Grande","5"],["Taille moyenne","1"], ["Petite taille","2"], ["Petit carré","3"], ["Miniature","4"],["Orginale","6"]] + ALIGNS = [["centré","center"], ["gauche","left"],["droite","right"],["Aucun","none"]] belongs_to :cible, :polymorphic => true accepts_nested_attributes_for :cible diff --git a/app/views/portlets/render_public/_blockcontent.html.haml b/app/views/portlets/render_public/_blockcontent.html.haml index 64e3caa..1c0509d 100644 --- a/app/views/portlets/render_public/_blockcontent.html.haml +++ b/app/views/portlets/render_public/_blockcontent.html.haml @@ -15,6 +15,7 @@ - css_class = "yellow_background" if input.style == 5 - css_class = "green_background" if input.style == 6 - css_class = "beton" if input.style == 7 + - css_class = "content_center" if input.style == 8 =raw "
" if !admin diff --git a/app/views/portlets/render_public/_imagecontent.html.haml b/app/views/portlets/render_public/_imagecontent.html.haml index 9d107fd..840fbda 100644 --- a/app/views/portlets/render_public/_imagecontent.html.haml +++ b/app/views/portlets/render_public/_imagecontent.html.haml @@ -15,6 +15,8 @@ -elsif input.style== "5" -url =input.image_file.file.large.url + -elsif input.style== "6" + -url =input.image_file.file.url @@ -31,6 +33,8 @@ -style = "float:left;" if input.alignement == "left" +-style = false if input.alignement == "none" + - if input.cible -link = input.cible.cible_url @@ -38,18 +42,21 @@ -styleimg += "width:"+input.width.to_s+"px;" if input.width? -styleimg += "height:"+input.height.to_s+"px;" if input.height? -.img{:style =>style} - -if admin - = image_tag(url, :alt => input.alt.to_s, :style => styleimg ) - -else +=raw '
' if style + +-if admin + = image_tag(url, :alt => input.alt.to_s, :style => styleimg ) +-else + + -if link - -if link + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), link, :title => input.alt.to_s, :target => (input.popup ? "_blank" : "") + - =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), link, :title => input.alt.to_s, :target => (input.popup ? "_blank" : "") + -elsif input.expandable + =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), (input.image_file ? input.image_file.file.large.url : ""), :title => input.alt.to_s, :class => "expandable_image" - - -elsif input.expandable - =link_to image_tag(url, :alt => input.alt.to_s, :style => styleimg ), (input.image_file ? input.image_file.file.large.url : ""), :title => input.alt.to_s, :class => "expandable_image" + -else + =image_tag(url, :alt => input.alt.to_s, :style => styleimg ) - -else - =image_tag(url, :alt => input.alt.to_s, :style => styleimg ) +=raw '
' if style \ No newline at end of file