From 09fb3d463494f06cfa43bace947056dbadaced63 Mon Sep 17 00:00:00 2001 From: JC Date: Wed, 23 Nov 2016 17:30:55 +0100 Subject: [PATCH] Pursuie over body animation with carets --- app/assets/javascripts/dossiers.js | 38 +++++++++++++++----- app/views/backoffice/dossiers/show.html.haml | 6 ++-- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/dossiers.js b/app/assets/javascripts/dossiers.js index 554787852..2389e2693 100644 --- a/app/assets/javascripts/dossiers.js +++ b/app/assets/javascripts/dossiers.js @@ -3,15 +3,6 @@ $(document).ready(the_terms); $(document).on('page:load', init_collapse); $(document).ready(init_collapse); -function init_collapse() { - - $('.title').click(function() { - var section = $(this).parents().closest(".show-block").children(".body"); - return section.slideToggle(500, function () {}); - }); - -} - function the_terms() { var the_terms = $("#dossier_autorisation_donnees"); @@ -53,3 +44,32 @@ function toggle_etape_1(){ $('.row.etape.etape_1 .etapes_menu #logos').toggle(100); $('.row.etape.etape_1 .etapes_informations #description_procedure').toggle(100); } + +function openning_block(block) { + var right = $(block).find(".carret-right"); + var down = $(block).find(".carret-down") + right.addClass("hidden"); + down.removeClass("hidden"); +} + +function closing_block(block) { + var right = $(block).find(".carret-right"); + var down = $(block).find(".carret-down") + right.removeClass("hidden"); + down.addClass("hidden"); +} + +function init_collapse() { + + $('.title').click(function() { + var block = $(this).parents().closest(".show-block"); + var section = block.children(".body"); + section.slideToggle(500, function () {}); + if ($(section).is("visible") === true) { + closing_block(block); + } + if ($(section).is("visible") === false) { + openning_block(block); + } + }); +} diff --git a/app/views/backoffice/dossiers/show.html.haml b/app/views/backoffice/dossiers/show.html.haml index d1b3eec95..a1f92a099 100644 --- a/app/views/backoffice/dossiers/show.html.haml +++ b/app/views/backoffice/dossiers/show.html.haml @@ -3,8 +3,8 @@ %div.row.show-block#messages %div.header %div.col-lg-10.col-md-10.title - %div.carret-right.hidden - %div.carret-down + %div.carret-right + %div.carret-down.hidden MESSAGES %div.col-lg-2.col-md-2.count 2 messages @@ -14,6 +14,7 @@ %div.header %div.col-lg-12.col-md-12.title %div.carret-right + %div.carret-down.hidden INFORMATIONS ENTREPRISE / ASSOCIATION / INDIVIDU %div.body @@ -21,6 +22,7 @@ %div.header %div.col-lg-10.col-md-10.title %div.carret-right + %div.carret-down.hidden CONSTRUCTION DU DOSSIER %div.col-lg-2.col-md-2.action EDITER