Skip to content

Commit

Permalink
Moved assets loading from template to module, closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
ausi committed Feb 18, 2014
1 parent 9231e92 commit ebd191c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
7 changes: 7 additions & 0 deletions src/MadeYourDay/Contao/Module/Slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ protected function compile()
$this->Template->images = $images;
$this->Template->slides = $this->parseSlides(SlideModel::findPublishedByPid($this->rsts_id));
$this->Template->options = $this->arrData;

$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rocksolid-slider/assets/js/rocksolid-slider-1.2.0.min.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rocksolid-slider/assets/css/rocksolid-slider.min.css||static';
$skinPath = 'system/modules/rocksolid-slider/assets/css/' . (empty($this->arrData['rsts_skin']) ? 'default' : $this->arrData['rsts_skin']) . '-skin.min.css';
if (file_exists(TL_ROOT . '/' . $skinPath)) {
$GLOBALS['TL_CSS'][] = $skinPath . '||static';
}
}

/**
Expand Down
9 changes: 0 additions & 9 deletions templates/rsts_default.html5
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
<?php
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rocksolid-slider/assets/js/rocksolid-slider-1.2.0.min.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rocksolid-slider/assets/css/rocksolid-slider.min.css||static';
$skinPath = 'system/modules/rocksolid-slider/assets/css/' . (empty($this->options['rsts_skin']) ? 'default' : $this->options['rsts_skin']) . '-skin.min.css';
if (file_exists(TL_ROOT . '/' . $skinPath)) {
$GLOBALS['TL_CSS'][] = $skinPath . '||static';
}
?>

<div class="<?php echo $this->class ?> block"<?php echo $this->cssID ?><?php if ($this->style): ?> style="<?php echo $this->style ?>"<?php endif ?>>

<?php if ($this->headline): ?>
Expand Down
9 changes: 0 additions & 9 deletions templates/rsts_default.xhtml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
<?php
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/rocksolid-slider/assets/js/rocksolid-slider-1.2.0.min.js|static';
$GLOBALS['TL_CSS'][] = 'system/modules/rocksolid-slider/assets/css/rocksolid-slider.min.css||static';
$skinPath = 'system/modules/rocksolid-slider/assets/css/' . (empty($this->options['rsts_skin']) ? 'default' : $this->options['rsts_skin']) . '-skin.min.css';
if (file_exists(TL_ROOT . '/' . $skinPath)) {
$GLOBALS['TL_CSS'][] = $skinPath . '||static';
}
?>

<div class="<?php echo $this->class ?> block"<?php echo $this->cssID ?><?php if ($this->style): ?> style="<?php echo $this->style ?>"<?php endif ?>>

<?php if ($this->headline): ?>
Expand Down

0 comments on commit ebd191c

Please sign in to comment.