2017 © Pedro Peláez
 

package bootstrap3-modal-bundle

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

image

tiitoo/bootstrap3-modal-bundle

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  • Friday, January 26, 2018
  • by TiiToo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

BootstrapModalBundle

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window. If a page loaded into a modal window contains a form, the form will submit via ajax., (*1)

Installation

Step 1: Add the following to the "require" section of composer.json

"sideclick/bootstrap-modal-bundle": "dev-master"

OR just require the bundle from the commandline, (*2)

composer require sideclick/bootstrap-modal-bundle

Step 2: Enable the bundle

Enable the bundle in the kernel:, (*3)

``` php <?php // app/AppKernel.php, (*4)

public function registerBundles() { $bundles = array( // ... new Sideclick\BootstrapModalBundle\SideclickBootstrapModalBundle(), ); }, (*5)


### Step 3: Include the JS file and the empty modal div just before your closing </body> tag on any page that you want to be able to open a modal window.

Check if sideclick-bootstrap-modal.js is added to your Bundles Assets folder. If not run please - php bin/console assets:install, (*6)


### Step 4: This bundle relies on Bootstrap 3.x & jQuery 1.x You must include those two libraries on any page using this bundle. ## Usage ### Old way of usage (Deprecated) To open a page in a modal you now simply prefix the href value of a URL with '#modal='. For example:

Login, (*7)


This way is deprecated because it does not accommodate URL that already use hash values ### New way of usage To open a page in a modal you now simply add a data attribute - data-sideclick-modal-trigger and set href with the necessary URL . For example:

Login, (*8)

This will cause the /login page to be loaded into the modal window instead of in the current tab.

## Optional: Suggested Structure of modal pages
The pages that you load into the modal window should follow the standard Bootstrap structure as described here http://getbootstrap.com/javascript/#modals

For quick reference here is the structure:

, (*9)


## Optional: Redirecting & Reloading The JavaScript controlling the modal windows will respond to specific reload & redirect requests. You may trigger a complete page reload or a redirect by loading a page into the modal window that is generated with a custom response from your controller. An example of both is described below.

use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request;, (*11)

class DefaultController extends Controller { // implement the BootstrapModalBundle Controller Trait which will // bring three methods: redirectWithAjaxSupport(), reloadWithAjaxSupport() & redirectToRouteWithAjaxSupport() use \Sideclick\BootstrapModalBundle\Controller\ControllerTrait;, (*12)

public function thisActionWillRedirect(Request $request)
{
    return $this->redirectWithAjaxSupport($request, '/new/url')
}

public function thisActionWillReload(Request $request)
{
    return $this->reloadWithAjaxSupport($request)
}

public function thisActionWillReload(Request $request)
{
    return $this->redirectToRouteWithAjaxSupport($request,'route_name',['parameters'=>$parameters])
}

} ```, (*13)

If you are planning to use modals all over the place it is advisable to create a single 'base controller' from which all your other controllers extend., (*14)

And that's it!, (*15)

The Versions

26/01 2018

dev-master

9999999-dev

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

21/12 2017

0.4.3

0.4.3.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

17/10 2017

0.4.2

0.4.2.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

02/07 2017

0.4.1

0.4.1.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

03/01 2017

0.4

0.4.0.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

07/12 2016

0.3.3

0.3.3.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

28/09 2016

0.3.2

0.3.2.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

28/09 2016

0.3.1

0.3.1.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

28/09 2016

0.3

0.3.0.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

28/09 2016

0.2

0.2.0.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid

28/09 2016

0.1

0.1.0.0

Bundle for Symfony 2.6+ that makes it easy to load pages into a Bootstrap modal window.

  Sources   Download

MIT

The Requires

 

by Rowan Reid