瀏覽代碼

Merge pull request #2099 from Bladrak/titleMode

Added title_mode to display image, text or both in title
Thomas 11 年之前
父節點
當前提交
98da9fdef1

+ 5 - 0
DependencyInjection/Configuration.php

@@ -80,6 +80,11 @@ class Configuration implements ConfigurationInterface
                         ->integerNode('pager_links')->defaultValue(null)->end()
                         ->scalarNode('form_type')->defaultValue('standard')->end()
                         ->integerNode('dropdown_number_groups_per_colums')->defaultValue(2)->end()
+                        ->enumNode('title_mode')
+                            ->values(array('single_text', 'single_image', 'both'))
+                            ->defaultValue('both')
+                            ->cannotBeEmpty()
+                        ->end()
                     ->end()
                 ->end()
                 ->arrayNode('dashboard')

+ 1 - 0
Resources/doc/reference/configuration.rst

@@ -61,6 +61,7 @@ Full Configuration Options
                 use_select2:                            true      # enable select2
                 pager_links:                            ~         # pager max links to display
                 dropdown_number_groups_per_colums:      2         # max items per column in dropdown menu (add button in top nav)
+                title_mode:           'both'                      # 'both', 'single_text' or 'single_image'
             dashboard:
                 groups:
 

+ 4 - 0
Resources/public/css/styles.css

@@ -32,6 +32,10 @@ body > .header .logo {
     font-family: 'Source Sans Pro', sans-serif;
 }
 
+.logo img {
+    padding-bottom: 4px;
+}
+
 .open > .dropdown-menu {
     animation-duration: .3s;
     -webkit-animation-duration: .3s;

+ 6 - 2
Resources/views/standard_layout.html.twig

@@ -77,8 +77,12 @@ file that was distributed with this source code.
         <header class="header">
             {% block logo %}
                 <a class="logo" href="{{ url('sonata_admin_dashboard') }}">
-                    {#<img src="{{ asset(admin_pool.titlelogo) }}" alt="">#}
-                    {{ admin_pool.title }}
+                    {% if 'single_image' == admin_pool.getOption('title_mode') or 'both' == admin_pool.getOption('title_mode') %}
+                        <img src="{{ asset(admin_pool.titlelogo) }}" alt="{{ admin_pool.title }}">{% if 'both' == admin_pool.getOption('title_mode') %}&nbsp;{% endif %}
+                    {% endif %}
+                    {% if 'single_text' == admin_pool.getOption('title_mode') or 'both' == admin_pool.getOption('title_mode') %}
+                        {{ admin_pool.title }}
+                    {% endif %}
                 </a>
             {% endblock %}
             {% block sonata_nav %}