From 70e24b2161a4ad79c69a5614ba109ebc794e4239 Mon Sep 17 00:00:00 2001 From: Nicolas Bally Date: Thu, 31 Aug 2017 17:30:59 +0200 Subject: [PATCH] suite --- app/models/html_content.rb | 2 +- app/views/admin/menu_items/_form.html.haml | 1 + app/views/layouts/public.html.haml | 91 ++++++++++--------- .../portlet/html_contents/_form.html.haml | 9 +- .../render_public/_htmlcontent.html.haml | 18 +++- 5 files changed, 71 insertions(+), 50 deletions(-) diff --git a/app/models/html_content.rb b/app/models/html_content.rb index a8e958e..95e6409 100644 --- a/app/models/html_content.rb +++ b/app/models/html_content.rb @@ -3,5 +3,5 @@ class HtmlContent < ActiveRecord::Base has_one :portlet, :as => :content, :dependent => :destroy STYLES = []#[["Style 1",1], ["Style 2",2]] - CONTENT_TYPES = ["haml","html"] + CONTENT_TYPES = ["html"] end diff --git a/app/views/admin/menu_items/_form.html.haml b/app/views/admin/menu_items/_form.html.haml index b36f6a2..ed187ed 100644 --- a/app/views/admin/menu_items/_form.html.haml +++ b/app/views/admin/menu_items/_form.html.haml @@ -2,6 +2,7 @@ = form.input :enabled, :label => "Publié ?" = form.input :visible, :label => "Visible ?" + = form.input :sidebar, :label => "Sidebar ?" diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml index 1960a51..3daa04b 100644 --- a/app/views/layouts/public.html.haml +++ b/app/views/layouts/public.html.haml @@ -33,78 +33,83 @@ #main.row - .col-md-8 - =yield + -if (@menu_item and @menu_item.sidebar) or !@menu_item + .col-md-8 + =yield - .col-md-4.sidebar - =yield :sidebar + .col-md-4.sidebar + =yield :sidebar - #testimony_slideshow + #testimony_slideshow - -Testimony.find(:all).sort_by { rand }.each do |testimony| + -Testimony.find(:all).sort_by { rand }.each do |testimony| - .testimony + .testimony - .quote - =image_tag("front/left.png", :class => "prev-testimony") - =link_to testimony.quote, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug) - =image_tag("front/right.png", :class => "next-testimony") + .quote + =image_tag("front/left.png", :class => "prev-testimony") + =link_to testimony.quote, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug) + =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 + .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 + :coffeescript - stop_dia = false + stop_dia = false - next_testimony = -> - active = $("#testimony_slideshow .active:first") + next_testimony = -> + active = $("#testimony_slideshow .active:first") - if active.next(".testimony").length == 0 - $("#testimony_slideshow").append($("#testimony_slideshow").children(".testimony:first")) + if active.next(".testimony").length == 0 + $("#testimony_slideshow").append($("#testimony_slideshow").children(".testimony:first")) - active.fadeOut(300).removeClass("active") - active.next(".testimony").delay(300).fadeIn(300).addClass("active") + active.fadeOut(300).removeClass("active") + active.next(".testimony").delay(300).fadeIn(300).addClass("active") - $(".prev-testimony").click -> - stop_dia = true - active = $("#testimony_slideshow .active:first") + $(".prev-testimony").click -> + stop_dia = true + active = $("#testimony_slideshow .active:first") - if active.prev(".testimony").length == 0 - $("#testimony_slideshow").prepend($("#testimony_slideshow").children(".testimony:last")) + if active.prev(".testimony").length == 0 + $("#testimony_slideshow").prepend($("#testimony_slideshow").children(".testimony:last")) - active.fadeOut(300).removeClass("active") - active.prev(".testimony").delay(300).fadeIn(300).addClass("active") + active.fadeOut(300).removeClass("active") + active.prev(".testimony").delay(300).fadeIn(300).addClass("active") - $(".next-testimony").click -> - stop_dia = true - next_testimony() - - dia_testimony = -> - if stop_dia == false + $(".next-testimony").click -> + stop_dia = true next_testimony() - window.setTimeout (-> - dia_testimony() - ), 7000 - - dia_testimony() - $("#testimony_slideshow").children(".testimony:first").show().addClass("active") - + dia_testimony = -> + if stop_dia == false + next_testimony() + window.setTimeout (-> + dia_testimony() + ), 7000 + + dia_testimony() + + $("#testimony_slideshow").children(".testimony:first").show().addClass("active") + + -else + .col-md-12 + =yield + #bottom diff --git a/app/views/portlet/html_contents/_form.html.haml b/app/views/portlet/html_contents/_form.html.haml index 5b68841..d485943 100644 --- a/app/views/portlet/html_contents/_form.html.haml +++ b/app/views/portlet/html_contents/_form.html.haml @@ -5,8 +5,9 @@ =f.text_area :content, :style => "width:98%;height:400px;", :class => "inputText", :id => "ace_editor_textarea" - %pre#ace_editor_pre{:style => "margin:0px;"} =raw "" %table.form_table %tr @@ -39,8 +41,7 @@ .action - %button{:onclick => "$(this).closest('.html_content_form').toggleClass('large');editor.resize() ;return false;"} zoom - + -if HtmlContent::STYLES.size > 0 diff --git a/app/views/portlets/render_public/_htmlcontent.html.haml b/app/views/portlets/render_public/_htmlcontent.html.haml index edf5dc6..3aba899 100644 --- a/app/views/portlets/render_public/_htmlcontent.html.haml +++ b/app/views/portlets/render_public/_htmlcontent.html.haml @@ -1,5 +1,19 @@ -begin - =render :inline => input.content, :type => input.content_type + -if admin + .html_content_label + Contenu HTML + + :scss + .html_content_label{ + padding:15px; + background:#f5f5f5; + text-align:center; + border:1px solid #d7d7d7; + color:#616161; + margin:10px 0; + } + -else + =render :inline => input.content, :type => input.content_type -rescue Exception=>e - =raw "



" \ No newline at end of file + =raw "



" \ No newline at end of file