Skip to content

Commit

Permalink
UI: Updated GalleryAdmin context picker
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Feb 17, 2016
1 parent dfd8fb7 commit d619777
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
4 changes: 3 additions & 1 deletion Admin/GalleryAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ protected function configureDatagridFilters(DatagridMapper $datagridMapper)
$datagridMapper
->add('name')
->add('enabled')
->add('context')
->add('context', null, array(
'show_filter' => false,
))
;
}

Expand Down
38 changes: 26 additions & 12 deletions Resources/views/GalleryAdmin/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,30 @@ file that was distributed with this source code.
{% extends 'SonataAdminBundle:CRUD:base_list.html.twig' %}

{% block preview %}

<ul class="nav nav-pills">
<li><a><strong>{{ "label.select_context"|trans({}, 'SonataMediaBundle') }}</strong></a></li>
{% for name, context in media_pool.contexts %}
{% if name == persistent_parameters.context %}
<li class="active"><a href="{{ admin.generateUrl('list', {'context' : name }) }}">{{ name|trans({}, 'SonataMediaBundle') }}</a></li>
{% else %}
<li><a href="{{ admin.generateUrl('list', {'context' : name }) }}">{{ name|trans({}, 'SonataMediaBundle') }}</a></li>
{% endif %}
{% endfor %}
</ul>

<div class="box box-primary">
<div class="box-header">
<h1 class="box-title">
{{ "label.select_context"|trans({}, 'SonataMediaBundle') }}
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<strong class="text-info">{{ persistent_parameters.context }}</strong> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
{% for name, context in media_pool.contexts %}
<li>
<a href="{{ admin.generateUrl('list', {'context' : name }) }}">
{% if name == persistent_parameters.context %}
<span class="pull-right">
<i class="fa fa-check"></i>
</span>
{% endif %}
{{ name|trans({}, 'SonataMediaBundle') }}
</a>
</li>
{% endfor %}
</ul>
</div>
</h1>
</div>
</div>
{% endblock %}

0 comments on commit d619777

Please sign in to comment.