-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
393 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* SetupThemeListener.php | ||
* publisher | ||
* Date: 01.05.14 | ||
*/ | ||
|
||
namespace Avanzu\AdminThemeBundle\EventListener; | ||
|
||
|
||
use Avanzu\AdminThemeBundle\Theme\ThemeManager; | ||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent; | ||
|
||
class SetupThemeListener { | ||
|
||
/** | ||
* @var ThemeManager | ||
*/ | ||
protected $manager; | ||
|
||
protected $cssBase; | ||
|
||
protected $lteAdmin; | ||
|
||
function __construct($manager, $cssBase = null, $lteAdmin = null) | ||
{ | ||
$this->cssBase = $cssBase?:'bundles/avanzuadmintheme/'; | ||
$this->lteAdmin = $lteAdmin?:'vendor/AdminLTE/css/'; | ||
$this->manager = $manager; | ||
} | ||
|
||
|
||
public function onKernelController(FilterControllerEvent $event) { | ||
|
||
$css = rtrim($this->cssBase, '/').'/'.trim($this->lteAdmin, '/'); | ||
$mng = $this->manager; | ||
|
||
$mng->registerStyle('jquery-ui', $css.'/jQueryUI/jquery-ui-1.10.3.custom.css'); | ||
$mng->registerStyle('bootstrap', $css.'/bootstrap.css', array('jquery-ui')); | ||
$mng->registerStyle('bootstrap-slider', $css.'/bootstrap-slider/bootstrap-slider.css', array('bootstrap')); | ||
$mng->registerStyle('datatables', $css.'/datatables/dataTables.bootstrap.css', array('bootstrap')); | ||
$mng->registerStyle('fontawesome', $css.'/font-awesome.css'); | ||
$mng->registerStyle('ionicons', $css.'/ionicons.css'); | ||
$mng->registerStyle('admin-lte', $css.'/AdminLTE.css', array('bootstrap-slider', 'fontawesome', 'ionicons','datatables')); | ||
$mng->registerStyle('bs-colorpicker', $css.'/colorpicker/bootstrap-colorpicker.css', array('admin-lte')); | ||
$mng->registerStyle('daterangepicker', $css.'/daterangepicker/daterangepicker-bs3.css', array('admin-lte')); | ||
$mng->registerStyle('timepicker', $css.'/timepicker/bootstrap-timepicker.css', array('admin-lte')); | ||
$mng->registerStyle('wysiwyg', $css.'/bootstrap-wysihtml5/bootstrap3-wysihtml5.css', array('admin-lte')); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"marionette" : "*", | ||
"pickadate" : "*", | ||
"holderjs" : "*", | ||
"bootflat" : "*" | ||
"bootflat" : "*", | ||
"bootbox" : "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
;(function($){ | ||
"use strict"; | ||
|
||
var doConfirm = function(event) { | ||
var $t = $(event.currentTarget) , msg = $t.attr('data-confirm'), href = $t.attr('href'); | ||
event.preventDefault(); | ||
bootbox.confirm(msg, function(result){ | ||
if(result === true) { | ||
window.location = href; | ||
} | ||
}); | ||
}; | ||
|
||
$('[data-confirm]').on('click', doConfirm); | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function namespace(namespaceString) { | ||
var parts = namespaceString.split('.'), | ||
parent = window, | ||
currentPart = ''; | ||
|
||
for(var i = 0, length = parts.length; i < length; i++) { | ||
currentPart = parts[i]; | ||
parent[currentPart] = parent[currentPart] || {}; | ||
parent = parent[currentPart]; | ||
} | ||
|
||
return parent; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{% import "AvanzuAdminThemeBundle:layout:macros.html.twig" as macro %} | ||
<!doctype html> | ||
<!--[if lt IE 7 ]><html lang="en" class="no-js ie6"> <![endif]--> | ||
<!--[if IE 7 ]><html lang="en" class="no-js ie7"> <![endif]--> | ||
<!--[if IE 8 ]><html lang="en" class="no-js ie8"> <![endif]--> | ||
<!--[if IE 9 ]><html lang="en" class="no-js ie9"> <![endif]--> | ||
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"> <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="author" content=""> | ||
<meta name="keywords" content=""> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<title>{% block title %}Avanzu Admin!{% endblock %}</title> | ||
|
||
{# -------------------------------------------------------------------------------------------------- STYLESHEETS #} | ||
{% block stylesheets %} | ||
{% stylesheets '@admin_lte_all_css' filter="cssrewrite" %} | ||
<link rel="stylesheet" href="{{ asset_url }}" /> | ||
{% endstylesheets %} | ||
{% endblock %} | ||
|
||
|
||
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> | ||
|
||
{# --------------------------------------------------------------------------------------------- JAVASCRIPTS_HEAD #} | ||
{% block javascripts_head %} | ||
{% javascripts '@AvanzuAdminThemeBundle/Resources/public/vendor/modernizr/modernizr.js'%} | ||
<script type="text/javascript" src="{{ asset(asset_url) }}"></script> | ||
{% endjavascripts %} | ||
<!--[if lt IE 9]> | ||
<![endif]--> | ||
|
||
{% endblock %} | ||
|
||
</head> | ||
<body class="bg-black"> | ||
|
||
<div class="form-box" id="login-box"> | ||
{% block page_content %}{% endblock %} | ||
</div> | ||
|
||
|
||
|
||
{# ------------------------------------------------------------------------------------------------------ JAVASCRIPTS #} | ||
{% block javascripts %} | ||
|
||
{% javascripts '@admin_lte_all' %} | ||
<script src="{{ asset_url }}"></script> | ||
{% endjavascripts %} | ||
{% endblock %} | ||
|
||
{# ----------------------------------------------------------------------------------------------- JAVASCRIPTS_INLINE #} | ||
{% block javascripts_inline %} | ||
{% endblock %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
/** | ||
* ThemeManager.php | ||
* publisher | ||
* Date: 18.04.14 | ||
*/ | ||
|
||
namespace Avanzu\AdminThemeBundle\Theme; | ||
|
||
|
||
use Assetic\Asset\AssetCollection; | ||
use Assetic\Asset\AssetReference; | ||
use Assetic\Factory\AssetFactory; | ||
use Assetic\Factory\LazyAssetManager; | ||
use Assetic\Factory\Resource\FileResource; | ||
use Avanzu\FoundationBundle\Util\DependencyResolverInterface; | ||
use Symfony\Bundle\AsseticBundle\Config\AsseticResource; | ||
use Symfony\Component\DependencyInjection\Container; | ||
use Avanzu\FoundationBundle\Util\DependencyResolver; | ||
use Symfony\Component\HttpKernel\Config\FileLocator; | ||
|
||
class ThemeManager | ||
{ | ||
|
||
/** @var Container */ | ||
protected $container; | ||
|
||
protected $stylesheets = array(); | ||
|
||
protected $javascripts = array(); | ||
|
||
protected $locations = array(); | ||
|
||
protected $resolverClass; | ||
|
||
function __construct($container, $resolverClass = null) | ||
{ | ||
$this->container = $container; | ||
$this->resolverClass = $resolverClass?: 'Avanzu\AdminThemeBundle\Util\DependencyResolver'; | ||
} | ||
|
||
|
||
|
||
public function registerScript($id, $src, $deps = array(), $location = "bottom") | ||
{ | ||
|
||
if (!isset($this->javascripts[$id])) { | ||
$this->javascripts[$id] = array( | ||
'src' => $src, | ||
'deps' => $deps, | ||
'location' => $location | ||
); | ||
} | ||
|
||
} | ||
|
||
public function registerStyle($id, $src, $deps = array()) { | ||
if(!isset($this->stylesheets[$id])) { | ||
$this->stylesheets[$id] = array( | ||
'src' => $src, | ||
'deps' => $deps, | ||
); | ||
} | ||
} | ||
|
||
public function getScripts($location = 'bottom') { | ||
|
||
$unsorted = array(); $srcList = array(); $assetList = array(); | ||
foreach($this->javascripts as $id => $scriptDefinition) { | ||
if($scriptDefinition['location'] == $location) { | ||
$unsorted[$id] = $scriptDefinition; | ||
} | ||
} | ||
|
||
$queue = $this->getResolver()->register($unsorted)->resolveAll(); | ||
foreach($queue as $def){ | ||
$srcList[] = $def['src']; | ||
} | ||
return $srcList; | ||
} | ||
|
||
public function getStyles() { | ||
$srcList = array(); | ||
$queue = $this->getResolver()->register($this->stylesheets)->resolveAll(); | ||
foreach($queue as $def){ | ||
$srcList[] = $def['src']; | ||
} | ||
return $srcList; | ||
} | ||
|
||
/** | ||
* @return DependencyResolverInterface | ||
*/ | ||
protected function getResolver() { | ||
$class = $this->resolverClass; | ||
return new $class; | ||
} | ||
|
||
/** | ||
* @return FileLocator | ||
*/ | ||
protected function getLocator() { | ||
return $this->container->get('file_locator'); | ||
} | ||
|
||
} |
Oops, something went wrong.