Skip to content

Commit

Permalink
Dev: fixxed rendering error with css and script files
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Aug 16, 2017
1 parent b386d65 commit 40503dd
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 51 deletions.
4 changes: 2 additions & 2 deletions application/core/LS_Twig_Extension.php
Expand Up @@ -103,8 +103,8 @@ public static function registerGeneralScript($sGeneralScriptFileName, $position=
*/
public static function registerTemplateScript($sTemplateScriptFileName, $position=null, array $htmlOptions=array())
{
$oTemplate = self::getTemplateForRessource($sTemplateCssFileName);
Yii::app()->getClientScript()->packages[$oTemplate->sPackageName]['js'][]=$sTemplateCssFileName;
$oTemplate = self::getTemplateForRessource($sTemplateScriptFileName);

This comment has been minimized.

Copy link
@tammoterhark

tammoterhark Aug 16, 2017

Contributor

Correct English is "resource", not "ressource"

Yii::app()->getClientScript()->packages[$oTemplate->sPackageName]['js'][]=$sTemplateScriptFileName;
}

/**
Expand Down
86 changes: 48 additions & 38 deletions application/models/TemplateConfiguration.php
Expand Up @@ -486,29 +486,32 @@ public function getOptionPage()
protected function getFilesToLoad($oTemplate, $sType)
{
if (empty($this->aFilesToLoad)){
$sField = 'files_'.$sType;
$jFiles = $oTemplate->$sField;

$this->aFilesToLoad = array();
}

$sField = 'files_'.$sType;
$jFiles = $oTemplate->$sField;
$this->aFilesToLoad[$sType] = array();

if(!empty($jFiles)){
$oFiles = json_decode($jFiles);
foreach($oFiles as $action => $aFileList){
if ($action == "add" || $action == "replace"){

// Specific inheritance of one of the value of the json array
if ($aFileList[0] == 'inherit'){
$aParentjFiles = (array) json_decode($oTemplate->getParentConfiguration->$sField);
$aFileList = $aParentjFiles[$action];
}
if(!empty($jFiles)){
$oFiles = json_decode($jFiles);
foreach($oFiles as $action => $aFileList){
if ($action == "add" || $action == "replace"){

$this->aFilesToLoad = array_merge($this->aFilesToLoad, $aFileList);
// Specific inheritance of one of the value of the json array
if ($aFileList[0] == 'inherit'){
$aParentjFiles = (array) json_decode($oTemplate->getParentConfiguration->$sField);
$aFileList = $aParentjFiles[$action];
}

$this->aFilesToLoad[$sType] = array_merge($this->aFilesToLoad[$sType], $aFileList);
}
}
}


return $this->aFilesToLoad;
return $this->aFilesToLoad[$sType];
}

/**
Expand Down Expand Up @@ -642,30 +645,34 @@ protected function addMotherTemplatePackage($packages)
protected function getFrameworkAssetsToReplace( $sType, $bInlcudeRemove = false)
{
if (empty($this->aFrameworkAssetsToReplace)){
$sFieldName = 'cssframework_'.$sType;
$aFieldValue = (array) json_decode($this->$sFieldName);

$this->aFrameworkAssetsToReplace = array();
if (!empty( $aFieldValue )){
$this->aFrameworkAssetsToReplace = (array) $aFieldValue['replace'] ;

// Inner field inheritance
foreach ($this->aFrameworkAssetsToReplace as $key => $aFiles){
foreach($aFiles as $sReplacement){
if ( $sReplacement == "inherit"){
$aParentReplacement = $this->getParentConfiguration()->getFrameworkAssetsToReplace($sType);
$this->aFrameworkAssetsToReplace[$key][1] = $aParentReplacement[$key][1];
}
}

$this->aFrameworkAssetsToReplace[$sType] = array();

$sFieldName = 'cssframework_'.$sType;
$aFieldValue = (array) json_decode($this->$sFieldName);

if (!empty( $aFieldValue )){
$this->aFrameworkAssetsToReplace[$sType] = (array) $aFieldValue['replace'] ;

// Inner field inheritance
foreach ($this->aFrameworkAssetsToReplace[$sType] as $key => $aFiles){
foreach($aFiles as $sReplacement){
if ( $sReplacement == "inherit"){
$aParentReplacement = $this->getParentConfiguration()->getFrameworkAssetsToReplace($sType);
$this->aFrameworkAssetsToReplace[$sType][$key][1] = $aParentReplacement[$key][1];
}
}
}

if($bInlcudeRemove && isset($aFieldValue['remove'])){
$this->aFrameworkAssetsToReplace = array_merge($this->aFrameworkAssetsToReplace, (array) $aFieldValue['remove'] );
}
if($bInlcudeRemove && isset($aFieldValue['remove'])){
$this->aFrameworkAssetsToReplace[$sType] = array_merge($this->aFrameworkAssetsToReplace, (array) $aFieldValue['remove'] );
}
}


return $this->aFrameworkAssetsToReplace;
return $this->aFrameworkAssetsToReplace[$sType];
}

/**
Expand All @@ -677,16 +684,19 @@ protected function getFrameworkAssetsToReplace( $sType, $bInlcudeRemove = false)
protected function getFrameworkAssetsReplacement( $sType )
{
if (empty($this->aReplacements)){
$aFrameworkAssetsToReplace = $this->getFrameworkAssetsToReplace($sType);

$this->aReplacements = array();
foreach($aFrameworkAssetsToReplace as $key => $aAsset ){
$aReplace = $aAsset[1];
$this->aReplacements[] = $aReplace;
}
}
$this->aReplacements[$sType] = array();

$aFrameworkAssetsToReplace = $this->getFrameworkAssetsToReplace($sType);

foreach($aFrameworkAssetsToReplace as $key => $aAsset ){
$aReplace = $aAsset[1];
$this->aReplacements[$sType][] = $aReplace;
}


return $this->aReplacements;
return $this->aReplacements[$sType];
}


Expand Down
2 changes: 1 addition & 1 deletion templates/default/css/animate.css
@@ -1,4 +1,4 @@
@charset "UTF-8";
/* @charset "UTF-8"; */

/*!
* animate.css -http://daneden.me/animate
Expand Down
13 changes: 9 additions & 4 deletions templates/default/css/flatly.css
Expand Up @@ -11,7 +11,9 @@
*/
/* Replace google font by included font (see mantis) */
/* @see : http://www.latofonts.com/lato-free-fonts/ */
/* Webfont: Lato-Regular */@font-face {

/* Webfont: Lato-Regular */
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 400;
Expand All @@ -23,7 +25,8 @@
url('../fonts/Lato-Regular.ttf') format('truetype');
}

/* Webfont: Lato-Italic */@font-face {
/* Webfont: Lato-Italic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-weight: 400;
Expand All @@ -35,7 +38,8 @@
url('../fonts/Lato-Italic.ttf') format('truetype');
}

/* Webfont: Lato-Bold */@font-face {
/* Webfont: Lato-Bold */
@font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 700;
Expand All @@ -48,7 +52,8 @@

}

/* Webfont: Lato-BoldItalic */@font-face {
/* Webfont: Lato-BoldItalic */
@font-face {
font-family: 'Lato';
font-style: italic;
font-weight: 700;
Expand Down
8 changes: 2 additions & 6 deletions templates/default/css/template.css
@@ -1,13 +1,9 @@
body
{
body {
padding-bottom: 10px;
background-color: #f6f6f6;
}
/* The header */
body
{
padding-top: 60px;/* now is redefine in JS to fit any title length */
}

.navbar-action-link{
padding-right:1em; /* really close to window without */
}
Expand Down

0 comments on commit 40503dd

Please sign in to comment.