瀏覽代碼

Fix : problème chargement assets Bootstrap

refactoring
keun 6 年之前
父節點
當前提交
dcf2ff0211
共有 3 個檔案被更改,包括 84 行新增2 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

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

Loading…
取消
儲存