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
STYLES = []#[["Style 1",1], ["Style 2",2]]
CONTENT_TYPES = ["haml","html"]
CONTENT_TYPES = ["html"]
end

View File

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

View File

@ -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

View File

@ -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 "<!---"
%pre#ace_editor_pre{:style => "margin:0px;"}
<script>
var editor;
@ -29,7 +30,8 @@
</script>
%button{:onclick => "$(this).closest('.html_content_form').toggleClass('large');editor.resize() ;return false;"} zoom
=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

View File

@ -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 "<br /><br /><br /><br />"
=raw "<br /><br /><br /><br />"