valqk / MajaxWidgetBundle

A budle to add nicer widgets to Symfony2

Repository from Github https://github.comvalqk/MajaxWidgetBundleRepository from Github https://github.comvalqk/MajaxWidgetBundle

Majax Widget Bundle

Providing a nice way to interface with date/time widgets

Example

Depends on

Needs jquery and jquery UI loaded.

Includes field templates for both regular Symfony2 and Sonata Admin Bundles

Installation

deps

[MajaxWidgetBundle]
    git=http://github.com/jmather/MajaxWidgetBundle.git
    target=/bundles/Majax/WidgetBundle

Autoloader

$loader->registerNamespaces(array(
    // ...
    'Majax'         => __DIR__.'/../vendor/bundles',
    // ...
));

AppKernel

new Majax\UserBundle\MajaxWidgetBundle(),

Finally

php app/console assets:install web

Configuration

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

General Template Configuration

Global Configuration

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!

SonataAdminBundle Configuration

sonata_admin:
    templates:
        # default global templates
        layout:  MajaxWidgetBundle:Admin:standard_layout.html.twig

Symfony2 Configuration

twig:
    form:
        resources:
            - 'MajaxWidgetBundle:Form:fields.html.twig'

SonataAdminBundle Configuration

sonata_doctrine_orm_admin:
    templates:
        form:
            - MajaxWidgetBundle:Form:sonata_fields.html.twig

About

A budle to add nicer widgets to Symfony2


Languages

Language:JavaScript 95.1%Language:PHP 4.9%