This commit is contained in:
Nicolas Bally 2017-08-31 17:30:59 +02:00
parent eb1a9dd0e1
commit 70e24b2161
5 changed files with 71 additions and 50 deletions

View File

@ -3,5 +3,5 @@ class HtmlContent < ActiveRecord::Base
has_one :portlet, :as => :content, :dependent => :destroy has_one :portlet, :as => :content, :dependent => :destroy
STYLES = []#[["Style 1",1], ["Style 2",2]] STYLES = []#[["Style 1",1], ["Style 2",2]]
CONTENT_TYPES = ["haml","html"] CONTENT_TYPES = ["html"]
end end

View File

@ -2,6 +2,7 @@
= form.input :enabled, :label => "Publié ?" = form.input :enabled, :label => "Publié ?"
= form.input :visible, :label => "Visible ?" = form.input :visible, :label => "Visible ?"
= form.input :sidebar, :label => "Sidebar ?"

View File

@ -33,78 +33,83 @@
#main.row #main.row
.col-md-8 -if (@menu_item and @menu_item.sidebar) or !@menu_item
=yield .col-md-8
=yield
.col-md-4.sidebar .col-md-4.sidebar
=yield :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 .quote
=image_tag("front/left.png", :class => "prev-testimony") =image_tag("front/left.png", :class => "prev-testimony")
=link_to testimony.quote, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug) =link_to testimony.quote, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug)
=image_tag("front/right.png", :class => "next-testimony") =image_tag("front/right.png", :class => "next-testimony")
.author=link_to testimony.author, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug) .author=link_to testimony.author, testimony_path(:slug => testimony.id.to_s+"-"+testimony.author.to_slug)
%br %br
%br %br
%div{:style => "text-align:right;"}=link_to "Tous les témoignages", testimonies_path %div{:style => "text-align:right;"}=link_to "Tous les témoignages", testimonies_path
:coffeescript :coffeescript
stop_dia = false stop_dia = false
next_testimony = -> next_testimony = ->
active = $("#testimony_slideshow .active:first") active = $("#testimony_slideshow .active:first")
if active.next(".testimony").length == 0 if active.next(".testimony").length == 0
$("#testimony_slideshow").append($("#testimony_slideshow").children(".testimony:first")) $("#testimony_slideshow").append($("#testimony_slideshow").children(".testimony:first"))
active.fadeOut(300).removeClass("active") active.fadeOut(300).removeClass("active")
active.next(".testimony").delay(300).fadeIn(300).addClass("active") active.next(".testimony").delay(300).fadeIn(300).addClass("active")
$(".prev-testimony").click -> $(".prev-testimony").click ->
stop_dia = true stop_dia = true
active = $("#testimony_slideshow .active:first") active = $("#testimony_slideshow .active:first")
if active.prev(".testimony").length == 0 if active.prev(".testimony").length == 0
$("#testimony_slideshow").prepend($("#testimony_slideshow").children(".testimony:last")) $("#testimony_slideshow").prepend($("#testimony_slideshow").children(".testimony:last"))
active.fadeOut(300).removeClass("active") active.fadeOut(300).removeClass("active")
active.prev(".testimony").delay(300).fadeIn(300).addClass("active") active.prev(".testimony").delay(300).fadeIn(300).addClass("active")
$(".next-testimony").click -> $(".next-testimony").click ->
stop_dia = true stop_dia = true
next_testimony()
dia_testimony = ->
if stop_dia == false
next_testimony() 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 #bottom

View File

@ -5,8 +5,9 @@
=f.text_area :content, :style => "width:98%;height:400px;", :class => "inputText", :id => "ace_editor_textarea" =f.text_area :content, :style => "width:98%;height:400px;", :class => "inputText", :id => "ace_editor_textarea"
%pre#ace_editor_pre{:style => "margin:0px;"}
=raw "<!---" =raw "<!---"
%pre#ace_editor_pre{:style => "margin:0px;"}
<script> <script>
var editor; var editor;
@ -29,7 +30,8 @@
</script> </script>
%button{:onclick => "$(this).closest('.html_content_form').toggleClass('large');editor.resize() ;return false;"} zoom
=raw "---->" =raw "---->"
%table.form_table %table.form_table
%tr %tr
@ -39,8 +41,7 @@
.action .action
%button{:onclick => "$(this).closest('.html_content_form').toggleClass('large');editor.resize() ;return false;"} zoom
-if HtmlContent::STYLES.size > 0 -if HtmlContent::STYLES.size > 0

View File

@ -1,5 +1,19 @@
-begin -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 -rescue Exception=>e
=raw "<br /><br /><br /><br />" =raw "<br /><br /><br /><br />"