Skip to content

Commit

Permalink
Merge pull request sonata-project#2038 from Bladrak/adminLTE
Browse files Browse the repository at this point in the history
Replaced SB-Admin theme with AdminLTE
  • Loading branch information
rande committed Apr 4, 2014
2 parents 42f7882 + 45b2ad3 commit bc32135
Show file tree
Hide file tree
Showing 16 changed files with 1,150 additions and 302 deletions.
5 changes: 5 additions & 0 deletions Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2078,6 +2078,11 @@ public function buildBreadcrumbs($action, MenuItemInterface $menu = null)

if (!$menu) {
$menu = $this->menuFactory->createItem('root');

$menu = $menu->addChild(
$this->trans($this->getLabelTranslatorStrategy()->getLabel('dashboard', 'breadcrumb', 'link'), array(), 'SonataAdminBundle'),
array('uri' => $this->routeGenerator->generate('sonata_admin_dashboard'))
);
}

$menu = $menu->addChild(
Expand Down
40 changes: 39 additions & 1 deletion Admin/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class Pool

protected $templates = array();

protected $assets = array();

protected $title;

protected $titleLogo;
Expand All @@ -36,13 +38,15 @@ class Pool
* @param string $title
* @param string $logoTitle
* @param array $options
* @param array $assets
*/
public function __construct(ContainerInterface $container, $title, $logoTitle, $options = array())
public function __construct(ContainerInterface $container, $title, $logoTitle, $options = array(), $assets = array())
{
$this->container = $container;
$this->title = $title;
$this->titleLogo = $logoTitle;
$this->options = $options;
$this->assets = $assets;
}

/**
Expand Down Expand Up @@ -289,6 +293,40 @@ public function getTemplate($name)
return null;
}

/**
* @param array $assets
*
* @return void
*/
public function setAssets(array $assets)
{
$this->assets = $assets;
}

/**
* @return array
*/
public function getAssets()
{
return $this->assets;
}

/**
* @return array
*/
public function getCss()
{
return $this->assets['css'];
}

/**
* @return array
*/
public function getJavascripts()
{
return $this->assets['javascripts'];
}

/**
* @return string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public function process(ContainerBuilder $container)
$groups[$resolvedGroupName]['label_catalogue'] = 'SonataAdminBundle';
}

if (empty($group['icon'])) {
$groups[$resolvedGroupName]['icon'] = $groupDefaults[$resolvedGroupName]['icon'];
}

if (!empty($group['item_adds'])) {
$groups[$resolvedGroupName]['items'] = array_merge($groups[$resolvedGroupName]['items'], $group['item_adds']);
}
Expand Down
46 changes: 46 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public function getConfigTreeBuilder()
->children()
->scalarNode('label')->end()
->scalarNode('label_catalogue')->end()
->scalarNode('icon')->defaultValue('<i class="fa fa-folder"></i>')->end()
->arrayNode('items')
->prototype('scalar')->end()
->end()
Expand Down Expand Up @@ -173,6 +174,51 @@ public function getConfigTreeBuilder()
->end()
->end()

->arrayNode('assets')
->addDefaultsIfNotSet()
->children()
->arrayNode('css')
->defaultValue(array(
'bundles/sonataadmin/admin-lte/css/bootstrap.min.css',
'bundles/sonataadmin/admin-lte/css/font-awesome.min.css',
'bundles/sonataadmin/admin-lte/css/ionicons.min.css',
'bundles/sonataadmin/admin-lte/css/AdminLTE.css',

'bundles/sonatajquery/themes/flick/jquery-ui-1.10.4.custom.css',

'bundles/sonataadmin/select2/select2.css',
'bundles/sonataadmin/select2/select2-bootstrap.css',

'bundles/sonataadmin/bootstrap3-editable/bootstrap3-editable/css/bootstrap-editable.css',

'bundles/sonataadmin/css/styles.css',
'bundles/sonataadmin/css/layout.css'
))
->prototype('scalar')->end()
->end()
->arrayNode('javascripts')
->defaultValue(array(
'bundles/sonatajquery/jquery-1.10.2.js',
'bundles/sonatajquery/jquery-ui-1.10.4.js',
'bundles/sonatajquery/jquery-ui-i18n.js',

'bundles/sonataadmin/jquery/jquery.form.js',
'bundles/sonataadmin/jquery/jquery.confirmExit.js',

'bundles/sonataadmin/admin-lte/js/bootstrap.min.js',

'bundles/sonataadmin/bootstrap3-editable/bootstrap3-editable/js/bootstrap-editable.min.js',

'bundles/sonataadmin/select2/select2.min.js',

'bundles/sonataadmin/App.js',
'bundles/sonataadmin/Admin.js',
))
->prototype('scalar')->end()
->end()
->end()
->end()

->arrayNode('extensions')
->useAttributeAsKey('id')
->defaultValue(array('admins' => array(), 'excludes' => array(), 'implements' => array(), 'extends' => array(), 'instanceof' => array()))
Expand Down
3 changes: 3 additions & 0 deletions DependencyInjection/SonataAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class SonataAdminExtension extends Extension
*
* @param array $configs An array of configuration settings
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws \RuntimeException
*/
public function load(array $configs, ContainerBuilder $container)
{
Expand Down Expand Up @@ -79,6 +81,7 @@ public function load(array $configs, ContainerBuilder $container)
$pool->replaceArgument(1, $config['title']);
$pool->replaceArgument(2, $config['title_logo']);
$pool->replaceArgument(3, $config['options']);
$pool->replaceArgument(4, $config['assets']);

$container->setParameter('sonata.admin.configuration.templates', $config['templates']);
$container->setParameter('sonata.admin.configuration.admin_services', $config['admin_services']);
Expand Down
1 change: 1 addition & 0 deletions Resources/config/core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<argument />
<argument />
<argument type="collection" />
<argument type="collection" />

<call method="setTemplates">
<argument>%sonata.admin.configuration.templates%</argument>
Expand Down
29 changes: 29 additions & 0 deletions Resources/doc/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ Full Configuration Options
base_list_field: SonataAdminBundle:CRUD:base_list_field.html.twig
pager_links: SonataAdminBundle:Pager:links.html.twig
pager_results: SonataAdminBundle:Pager:results.html.twig
assets:
css:
# Defaults:
- bundles/sonataadmin/admin-lte/css/bootstrap.min.css
- bundles/sonataadmin/admin-lte/css/font-awesome.min.css
- bundles/sonataadmin/admin-lte/css/ionicons.min.css
- bundles/sonataadmin/admin-lte/css/AdminLTE.css
- bundles/sonatajquery/themes/flick/jquery-ui-1.10.4.custom.css
- bundles/sonataadmin/select2/select2.css
- bundles/sonataadmin/select2/select2-bootstrap.css
- bundles/sonataadmin/bootstrap3-editable/bootstrap3-editable/css/bootstrap-editable.css
- bundles/sonataadmin/css/styles.css
- bundles/sonataadmin/css/layout.css
javascripts:
# Defaults:
- bundles/sonatajquery/jquery-1.10.2.js
- bundles/sonatajquery/jquery-ui-1.10.4.js
- bundles/sonatajquery/jquery-ui-i18n.js
- bundles/sonataadmin/jquery/jquery.form.js
- bundles/sonataadmin/jquery/jquery.confirmExit.js
- bundles/sonataadmin/admin-lte/js/bootstrap.min.js
- bundles/sonataadmin/bootstrap3-editable/bootstrap3-editable/js/bootstrap-editable.min.js
- bundles/sonataadmin/select2/select2.min.js
- bundles/sonataadmin/App.js
- bundles/sonataadmin/Admin.js
extensions:
# Prototype
Expand Down
11 changes: 11 additions & 0 deletions Resources/public/Admin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
This file is part of the Sonata package.
(c) Thomas Rabaix <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
*/

jQuery(document).ready(function() {
jQuery('html').removeClass('no-js');
if (window.SONATA_CONFIG && window.SONATA_CONFIG.CONFIRM_EXIT) {
Expand Down
731 changes: 731 additions & 0 deletions Resources/public/App.js

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Resources/public/css/layout.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
body{
padding-top: 50px;
}

@media (max-width: 978px) {
body{
padding-top: 0;
}
}
/*body{*/
/*padding-top: 50px;*/
/*}*/

/*@media (max-width: 978px) {*/
/*body{*/
/*padding-top: 0;*/
/*}*/
/*}*/

div.border {
border: 1px solid #DDDDDD;
Expand Down
79 changes: 42 additions & 37 deletions Resources/public/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
/**
* SonataAdminBundle Theme based on SB Admin v2.0
* http://startbootstrap.com/templates/sb-admin-v2/
*/
*/

body {
background-color: #f8f8f8;
padding-top: 50px;
html {
position: relative;
min-height: 100%;
}

body {
margin-bottom: 20px;
}

/* wrappers */

#wrapper {
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 20px;
background-color: #333;
}

.sonata-bc #page-wrapper {
padding-top: 10px;
footer p {
margin: 0;
}

/*#page-wrapper {*/
/*padding: 15px 15px 0;*/
/*min-height: 568px;*/
/*background-color: #fff;*/
/*}*/
footer a {
color: #f6f6f6;
}

/*@media(min-width:768px) {*/
/*#page-wrapper {*/
/*position: inherit;*/
/*margin: 0 0 0 250px;*/
/*padding: 30px 30px 0;*/
/*min-height: 1300px;*/
/*border-left: 1px solid #e7e7e7;*/
/*}*/
/*}*/
/* navigation */

.navbar-static-side ul li {
border-bottom: 1px solid #e7e7e7;
}

/* navigation */

.navbar-brand {
padding-right: 20px;
}
Expand All @@ -56,6 +49,14 @@ body {
padding: 0 10px;
}

.content-header .navbar {
margin-bottom: 0;
}

.content-header .navbar-nav.navbar-right:last-child {
margin-right: 0;
}

/* breadcrumb */

.sonata-bc .breadcrumb {
Expand All @@ -67,13 +68,6 @@ body {

.sonata-bc .breadcrumb li a {
display: inline-block;
padding-left: 3px;
padding-right: 3px;
}

.sonata-bc .breadcrumb>li+li:before {
padding-right: 0;
padding-left: 4px;
}

/* MEGA MENU STYLE
Expand Down Expand Up @@ -102,19 +96,25 @@ body {
display: inline-block;
}

.navbar-top-links li:last-child {
margin-right: 15px;
}

.navbar-top-links li a,
.navbar-top-links li span {
padding: 15px;
min-height: 50px;
}

.navbar-top-links li a:hover {
text-decoration: none;
}

.skin-black .navbar .breadcrumb > li > a:hover {
color: #444;
background: #f5f5f5;
}

.skin-black .navbar .dropdown-menu > li > a:hover {
background-color: #f5f5f5;
}

.navbar-top-links .dropdown-menu li {
display: block;
}
Expand Down Expand Up @@ -156,6 +156,12 @@ body {
left: auto;
}

/* Content navbar */

body.fixed .content-header .navbar {
position: relative;
}

/* sidebar menu styles */

.sidebar-search {
Expand Down Expand Up @@ -247,7 +253,6 @@ form.sonata-filter-form.form-stacked {
padding-left: 0;
}


/* Overrides */

/* x-editable */
Expand Down
Loading

0 comments on commit bc32135

Please sign in to comment.