2017 © Pedro Peláez
 

symfony-bundle shortcuts-bundle

Symfony ShortcutsBundle

image

appventus/shortcuts-bundle

Symfony ShortcutsBundle

  • Sunday, July 16, 2017
  • by lenybernard
  • Repository
  • 10 Watchers
  • 4 Stars
  • 13,883 Installations
  • JavaScript
  • 3 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

AppVentus, (*1)

Gitter License, (*2)

Version

Awesome Shortcuts Bundle

What is the point ?

This bundle allows you to easily add and use shortcuts for your dev apps., (*3)

Install

This procedure describes the installation of the project for use in a virtual machine vagrant., (*4)

Recovery Bundle

Composer

Add the following lines in your composer.json :, (*5)

    {
        "require": {
            "appventus/shortcuts-bundle": "dev-master"
        }
    }

Then execute the following command:, (*6)

    php composer.phar update

Bundle activation

In your AppKernel.php add the following lines :, (*7)

<?php

public function registerBundles()
{
    $bundles = array(
        // ...
        new AppVentus\Awesome\ShortcutsBundle\AvAwesomeShortcutsBundle(),
    );
}

Configuration

Twig

Add the following lines in Config.yml :, (*8)

    # Sf=2.*
    twig:
        form:
            resources:
                - 'AvAwesomeShortcutsBundle::fields.html.twig'# Twig Configuration
    # Sf>=3.*
    twig:
        form_themes:
            - 'AvAwesomeShortcutsBundle::fields.html.twig'

In your layout file, load the following files :, (*9)

    '@AvAwesomeShortcutsBundle/Resources/public/css/datepicker.css'
    '@AvAwesomeShortcutsBundle/Resources/public/js/bootstrap-datepicker.js'

Using shortcuts

A service allows the use of functions used in many applications., (*10)

Eg. in a controller:, (*11)

$shorcutService = $this->get('av.shorcuts');
$shorcutService->getSession(...
$shorcutService->setSession(...
$shorcutService->createAndQueueMail(...
$shorcutService->createAndSendMail(...

View ShortcutService file for a complete list of shortcuts and their parametres., (*12)

FormErrorService

As it is common to submit forms by ajax, it is desired to return the error forms of a string, (*13)

The FormErrorService transforms errors on a form (and its sub-forms) into a string., (*14)

Eg. in a controller:, (*15)

    $form = ...  //some form

    if ($form->isValid()) {
        ...
    } else {
        $formErrorService = $this->get('av.form_error_service');
        $errorsAsString = $formErrorService->getRecursiveReadableErrors($form);
    }

Integration with AvAlertifyBundle

This bundle brings a lot of shortcuts for AvAlertify bundle to standardize all alerts for your application., (*16)

Instead of using:, (*17)

$this->get('session')->getFlashBag()->add('noty', array(
        'type'              => $type,
        'layout'            => $layout,
        'body'              => $content,
        'translationDomain' => $translationDomain
    )
);

or worse, (*18)

$this->session->getFlashBag()->add('success', 'Congratulations !');

We can now use the following shortcuts from the av.shortcuts Service :, (*19)

$this->container->get('av.shortcuts')->congrat($content, $layout, $translationDomain);

or any of our controller inheriting AwesomeController :, (*20)

$this->congrat('Congratulations !');         // Success
$this->warn('Careful, this is important !'); // Warning
$this->inform('Did you know ?');             // Information
$this->scold('Oups something went wrong !'); // Error

RedactorType

Add the assetic injector redactor tag, (*21)

$redactorOptions = [
    'lang' => $this->request->getLocale(),
    'plugins' => ['video'],
    'buttons' => ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'video', 'link', 'alignment', 'horizontalrule'],
    'imageUpload' => '/bundles/avawesomeshortcuts/libs/redactor/scripts/image_upload.php',
];

$builder->add('description', RedactorType::class, [
    'options' => $redactorOptions
]);

The Versions

16/07 2017

dev-master

9999999-dev http://appventus.com/bundles/shortcuts

Symfony ShortcutsBundle

  Sources   Download

MIT

The Development Requires

controller

16/07 2017

1.1

1.1.0.0 http://appventus.com/bundles/shortcuts

Symfony ShortcutsBundle

  Sources   Download

MIT

The Development Requires

controller

08/09 2016

1.0

1.0.0.0 http://appventus.com/bundles/shortcuts

Symfony ShortcutsBundle

  Sources   Download

MIT

The Development Requires

controller

26/06 2014

dev-feature/generate-url

dev-feature/generate-url http://appventus.com/bundles/shortcuts

Symfony ShortcutsBundle

  Sources   Download

MIT

The Development Requires

controller

19/06 2013

2.3.x-dev

2.3.9999999.9999999-dev http://appventus.com/bundles/shortcuts

Symfony ShortcutsBundle

  Sources   Download

MIT

The Development Requires

controller

31/05 2013

2.2.x-dev

2.2.9999999.9999999-dev http://appventus.com/bundles/shortcuts

Symfony ShortcutsBundle

  Sources   Download

MIT

The Development Requires

controller