plaquettes & js

This commit is contained in:
Nicolas Bally 2014-04-13 12:26:48 +02:00
parent c33f7583c1
commit 1b51e7287c
9 changed files with 196 additions and 193 deletions

View File

@ -40,12 +40,6 @@ GEM
bcrypt-ruby (3.0.1)
builder (3.1.4)
cancan (1.6.10)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
net-sftp (>= 2.0.0)
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
carrierwave (0.9.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
@ -115,13 +109,6 @@ GEM
minitest (4.7.5)
multi_json (1.9.2)
mysql2 (0.3.15)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.8.0)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
non-stupid-digest-assets (1.0.4)

View File

@ -1,41 +0,0 @@
$('.article_row .show_details').live "click", ->
url = $(this).attr("href")+".html"
$(this).closest(".article_row").addClass('active')
$('#article_detail').load url, ->
$("#article_detail").show().delay(1).css
"-webkit-transition-duration": "0.8s"
"-moz-transition-duration": "0.8s"
"margin-right": "0px"
$("#article_index_slide").show().delay(1).css
"-webkit-transition-duration": "0.8s"
"-moz-transition-duration": "0.8s"
"margin-left": "-110%"
"margin-right": "110%"
false
$('#article_detail .hide').live "click", ->
$("#article_detail #content_types_draggables").hide();
$("#article_index_slide").show().delay(1).css
"-webkit-transition-duration": "0.8s"
"-moz-transition-duration": "0.8s"
"margin-left": "0%"
"margin-right": "0%"
$("#article_detail").css(
"-webkit-transition-duration": "0.8s"
"-moz-transition-duration": "0.8s"
"margin-right": "-110%").delay(800).queue ->
$("#article_detail").html("").clearQueue()
false
false

View File

@ -44,8 +44,8 @@ function init_note_upload_fields(note_id){
$(document).ready(function () {
$(".note .add_files").live("click",function(){
alert('test');
$("body").on("click", ".note .add_files",function(){
$(this).next('input').click();
return false;
});

View File

@ -34,11 +34,29 @@ test_question = (question) ->
return rep
(($) ->
$.fn.nodoubletapzoom = ->
$(this).bind "touchstart", preventZoom = (e) ->
t2 = e.timeStamp
t1 = $(this).data("lastTouch") or t2
dt = t2 - t1
fingers = e.originalEvent.touches.length
$(this).data "lastTouch", t2
return if not dt or dt > 500 or fingers > 1 # not double-tap
e.preventDefault() # double tap - prevent the zoom
# also synthesize click events we just swallowed up
$(this).trigger("click").trigger "click"
return
return
return
) jQuery
$ ->
$(".quizz_img").hide()
$("a.def").click ->
$("body").nodoubletapzoom()
$("body").on "click","a.def", ->
r = "<div class='pane_hover'><h3>"+$(this).html()+"</h3><p>"+$(this).data("def")+"</p></div>"
@ -64,7 +82,7 @@ $ ->
$(this).remove();
$("a.img").click ->
$("body").on "click", "a.img",->
r = "<div class='pane_hover'><img src='"+$(this).data("img")+"' />"
@ -79,19 +97,19 @@ $ ->
$("body").append(r)
$(".pane_hover").click ->
$(".pane_hover").on "click", ->
$(this).remove();
$(".page").hide()
$(".page:first").show()
$(".prev_slide").click ->
$("body").on "click",".prev_slide", ->
$(this).closest(".page").hide()
$(this).closest(".page").prev(".page").show()
$(".next_slide").click ->
$("body").on "click",".next_slide", ->
$(this).closest(".page").hide()
$(this).closest(".page").next(".page").show()
@ -109,32 +127,7 @@ $ ->
$(".quizz").each ->
$(this).find("input").change ->
test_question($(this).closest(".question"))
$(this).find(".fail, .success").hide()
$(this).find(".question").hide()
$(this).find(".question:first").show()
$(this).find(".prev").click ->
test_question($(this).closest(".question"))
$(this).closest(".question").hide()
$(this).closest(".question").prev(".question").show()
$(this).find(".next").click ->
if test_question($(this).closest(".question")) == true
$(this).closest(".question").fadeOut(0)
$(this).closest(".question").next(".question").fadeIn(0)
$(this).find(".check").click ->
test_question($(this).closest(".question"))
@ -261,93 +254,28 @@ initialize_vie_sol = () ->
$(".t_sortable").closest(".animaux_sol").html archive
initialize_vie_sol()
initialize_jeu_1 = ->
$(".sortable_quizz").each ->
element = $(this)
$(document).ready ->
intialize_arbre()
initialize_vie_sol()
intialize_places_jeu2()
intialize_places_jeu()
intialize_puzzle()
#$.backstretch(["/assets/plaquettes/fond.jpg"]);
initialize_jeu_1 = ->
$(".sortable_quizz").each ->
element = $(this)
html = element.find(".sortable").html()
element.find(".sortable").sortable
stop: () ->
win = true
i = 0
element.find("img").each ->
i = i + 1
win = false unless i is $(this).data("order")
if win is true
element.find(".win").show()
element.find(".loose").hide()
element.find(".sortable").disableSelection()
element.find(".reset").click ->
element.find(".sortable").html html
element.find(".sortable").sortable "refresh"
element.find(".win").hide()
element.find(".loose").hide()
initialize_jeu_2 = ->
element = $("#insectes_jeu_2")
html = element.find(".sortable").html()
element.find(".receptable").sortable
connectWith: ".labels,.receptable"
items: ".label"
tolerance: "pointer"
receive: (event, ui) ->
if $(this).children().length > 1
child = $(this).children().not(ui.item)[0]
element.find(".labels").append child
element.find(".sortable").sortable
stop: () ->
win = true
i = 0
element.find("img").each ->
i = i + 1
win = false unless i is $(this).data("order")
element.find(".receptable ul").disableSelection()
element.find(".labels").sortable
connectWith: ".receptable"
tolerance: "pointer"
items: ".label"
receive: (event, ui) ->
ui.item.attr "style", ""
element.find(".labels").disableSelection()
element.find(".verif").bind "click", ->
win = true
i = 0
element.find("img").each ->
i = i + 1
win = false unless i is $(this).data("order")
if win is true
element.find(".win").show()
element.find(".loose").hide()
else
element.find(".win").hide()
element.find(".loose").show()
if win is true
element.find(".win").show()
element.find(".loose").hide()
element.find(".sortable").disableSelection()
element.find(".reset").click ->
element.find(".sortable").html html
@ -355,5 +283,99 @@ $(document).ready ->
element.find(".win").hide()
element.find(".loose").hide()
initialize_jeu_1()
initialize_jeu_2()
initialize_jeu_2 = ->
element = $("#insectes_jeu_2")
html = element.find(".sortable").html()
element.find(".receptable").sortable
connectWith: ".labels,.receptable"
items: ".label"
tolerance: "pointer"
receive: (event, ui) ->
if $(this).children().length > 1
child = $(this).children().not(ui.item)[0]
element.find(".labels").append child
element.find(".receptable ul").disableSelection()
element.find(".labels").sortable
connectWith: ".receptable"
tolerance: "pointer"
items: ".label"
receive: (event, ui) ->
ui.item.attr "style", ""
element.find(".labels").disableSelection()
element.find(".verif").bind "click", ->
win = true
i = 0
element.find("img").each ->
i = i + 1
win = false unless i is $(this).data("order")
if win is true
element.find(".win").show()
element.find(".loose").hide()
else
element.find(".win").hide()
element.find(".loose").show()
element.find(".reset").click ->
element.find(".sortable").html html
element.find(".sortable").sortable "refresh"
element.find(".win").hide()
element.find(".loose").hide()
$(document).ready ->
initialize_plaquette = ->
intialize_arbre()
initialize_vie_sol()
intialize_places_jeu2()
intialize_places_jeu()
intialize_puzzle()
initialize_jeu_1()
initialize_jeu_2()
$(".quizz_img").hide()
$(".quizz").each ->
$(this).find(".prev").click ->
test_question($(this).closest(".question"))
$(this).closest(".question").hide()
$(this).closest(".question").prev(".question").show()
$(this).find(".next").on "click", ->
if test_question($(this).closest(".question")) == true
$(this).closest(".question").fadeOut(0)
$(this).closest(".question").next(".question").fadeIn(0)
$(this).find("input").change ->
test_question($(this).closest(".question"))
$(this).find(".fail, .success").hide()
$(this).find(".question").hide()
$(this).find(".question:first").show()
archive_plaquette = $("body").html()
initialize_plaquette()
$("body").on "click",".restart_plaquette", ->
$("body").html(archive_plaquette)
initialize_plaquette()

View File

@ -60,8 +60,8 @@ text-align:center !important;
color:white;
font-size:30px;
padding:10px 20px;
background:rgba(0,0,0,0.9);
padding:20px 30px;
background:rgba(0,0,0,0.2);
position:absolute;
bottom:10px;
cursor:pointer;
@ -71,15 +71,16 @@ text-align:right;
}
.next_slide{
border-radius:30px 0px 0px 0px;
padding-right:23px;
border-radius:50px 0px 0px 0px;
bottom:0px;
right:0px;
}
.prev_slide{
border-radius:0px 30px 0px 0px;
padding-left:23px;
border-radius:0px 50px 0px 0px;
text-align:left;
bottom:0px;
left:0px;
@ -172,7 +173,8 @@ padding:1em;
.quizz{
.quizz_answer{
margin:1em 0;
margin:1.8em 0;
}
label{
@ -189,8 +191,8 @@ input[type="radio"] {
input[type="radio"] + label {
position:relative;
padding: 0 0 0 25px;
font-size: 20px;
line-height: 20px;
font-size: 25px;
line-height: 25px;
}
input[type="radio"] + label:before {
content:"";
@ -218,9 +220,17 @@ p{
text-align:left;
}
*{
font-size:1.2em !important;
font-size:25px !important;
}
.quizz_img p, .quizz_ill p{
font-size:20px !important;
}
h3{
font-size:1.7em !important;
line-height:1.3em;
@ -564,4 +574,25 @@ height:100% !important;
}
}
ul{
li{
padding:0.3em;
}
}
.page_jardins{
li{
padding:0.1em;
}
}

View File

@ -10,11 +10,11 @@
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="/apple-icon.png" />
<link rel="apple-touch-icon" href="/apple-iconp.png" />
<link rel="icon" type="image/png" href="/apple-icon.png" />
<link rel="icon" href="/favicon.ico" />
<link rel="shortcut icon" href="/favicon.ico">
<link rel="icon" type="image/png" href="/apple-iconp.png" />
<link rel="icon" href="/faviconp.ico" />
<link rel="shortcut icon" href="/faviconp.ico">
%body

View File

@ -1,5 +1,5 @@
.page
.page.page_jardins
.content{:style => "width:500px;box-sizing:border-box;padding:1em;font-size:0.99em;"}
%div{:style => "font-size:1.30em;"}
%h1 Un jardin et son compost

View File

@ -16,7 +16,7 @@
%p Nous remercions également l'entreprise Nicolas Bally pour la confection de toute lapplication.
@ -26,4 +26,8 @@
=image_tag "plaquettes/logos/logo_leader.jpg"
=image_tag "plaquettes/logos/logo_CAPV.jpg"
=image_tag "plaquettes/logos/logo_nb.png"
%center
.restart_plaquette.btn
Remettre à zero

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# version6
#version10
CACHE:
/plaquettes/index.html
@ -113,8 +113,8 @@ CACHE:
/assets/plaquettes/jardin/piege.jpg
/assets/plaquettes/jardin/tas.jpg
/assets/plaquettes/jardin/campagnol.jpg
/apple-icon.png
/favicon.ico
/apple-iconp.png
/faviconp.ico
FALLBACK: