Providing a nice way to interface with date/time widgets
Needs jquery and jquery UI loaded.
Includes field templates for both regular Symfony2 and Sonata Admin Bundles
[MajaxWidgetBundle]
git=http://github.com/jmather/MajaxWidgetBundle.git
target=/bundles/Majax/WidgetBundle
$loader->registerNamespaces(array(
// ...
'Majax' => __DIR__.'/../vendor/bundles',
// ...
));
new Majax\UserBundle\MajaxWidgetBundle(),
php app/console assets:install web
Configuration revolves around two parts:
- Adding the javascript include (and configuring it for your use)
- Using the custom templates to add the javascript needed for each field as well
You will have to add the javascript to your template manually
{% block javascripts %}
{{ parent() }}
<script src="{{ asset('bundles/majaxwidget/js/jquery.majax.datetimeselector.js') }}" type="text/javascript"></script>
<script>$(function() { $.datepicker.setDefaults($.datepicker.regional['']); });</script>
{% endblock %}
There is probably a better way to do this -- let me know!
sonata_admin:
templates:
# default global templates
layout: MajaxWidgetBundle:Admin:standard_layout.html.twig
twig:
form:
resources:
- 'MajaxWidgetBundle:Form:fields.html.twig'
sonata_doctrine_orm_admin:
templates:
form:
- MajaxWidgetBundle:Form:sonata_fields.html.twig