Browse Source

Fix : problème chargement assets Bootstrap

refactoring
keun 6 years ago
parent
commit
dcf2ff0211
3 changed files with 84 additions and 2 deletions
  1. +4
    -1
      frontend/assets/AppAsset.php
  2. +79
    -0
      frontend/web/js/boulange.js
  3. +1
    -1
      frontend/web/js/frontend.js

+ 4
- 1
frontend/assets/AppAsset.php View File

@@ -21,7 +21,9 @@ class AppAsset extends \common\components\MyAssetBundle
public $baseUrl = '@web';
public $css = [];
public $js = [];
public $depends = [];
public $depends = [
'yii\bootstrap\BootstrapPluginAsset',
];
public function __construct() {
parent::__construct() ;
@@ -31,5 +33,6 @@ class AppAsset extends \common\components\MyAssetBundle

// js
$this->addAsset('js','js/frontend.js');
$this->addAsset('js','js/boulange.js');
}
}

+ 79
- 0
frontend/web/js/boulange.js View File

@@ -0,0 +1,79 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

$(document).ready(function()
{
boulange_signup() ;
boulange_add_boulangerie() ;
});

function boulange_scroll(id) {
if($("#"+id).size())
$('html,body').animate({
scrollTop: $("#"+id).offset().top},
1000);
}

function boulange_add_boulangerie()
{
$('#bloc-add-etablissement .panel-heading').click(function() {
var panel_body = $(this).parent().find('.panel-body') ;
if(panel_body.css('display') == 'none')
panel_body.fadeIn() ;
else
panel_body.hide() ;
}) ;
$('#addetablissementform-id_etablissement,#signupform-id_etablissement').change(function() {
if($(this).find('option:selected').hasClass('lock')) {
$('#bloc-code-acces').fadeIn() ;
}
else {
$('#bloc-code-acces').hide() ;
}
}) ;
if($('#addetablissementform-id_etablissement option:selected,#signupform-id_etablissement option:selected').hasClass('lock')) {
$('#bloc-code-acces').show() ;
}
else {
$('#bloc-code-acces').hide() ;
}
if($('#bloc-add-etablissement').size()) {
if($('#bloc-add-etablissement .has-error').size()) {
$('#bloc-add-etablissement .panel-body').show() ;
}
}
}

function boulange_signup()
{
if($('#form-signup').size())
{
boulange_signup_champs_boulanger() ;
$('#option-client, #option-boulanger').change(function() {
boulange_signup_champs_boulanger() ;
}) ;
}
}

function boulange_signup_champs_boulanger()
{
if($('#option-boulanger').prop('checked'))
{
$('#champs-boulanger').fadeIn() ;
$('#champs-client').hide() ;
}
else {
$('#champs-boulanger').hide() ;
$('#champs-client').fadeIn() ;
}
}



+ 1
- 1
frontend/web/js/frontend.js View File

@@ -1,4 +1,4 @@

$(document).ready(function() {
$('.dropdown-toggle').dropdown() ;
}) ;

Loading…
Cancel
Save