2017 © Pedro PelĆ”ez
 

cakephp-plugin bootscake

Bootstrap 4 helpers for CakePHP 3.4

image

kacospro/bootscake

Bootstrap 4 helpers for CakePHP 3.4

  • Saturday, April 28, 2018
  • by kacospro
  • Repository
  • 3 Watchers
  • 3 Stars
  • 83 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 10 Versions
  • 28 % Grown

The README.md

BootsCake

Build Status License: MIT, (*1)

Bootstrap 4 plugin for CakePHP ^3.4., (*2)

Requirements

  • CakePHP ^3.4.0
  • Bootstrap ^4.0.0
  • jQuery 1.9.1 - 3,
  • Popper.js ^1.14.0

Description

Adapter of current CakePHP's helpers. While I feel it is getting pretty close to a stable version :smile: it is possible that breaking changes ocurre, (*3)

Includes

  • FormHelper
  • PaginatorHelper
  • ModalHelper
  • FlashHelper

Installing Using Composer

composer require kacospro/bootscake

Load the plugin by adding the following to your app's config/boostrap.php:, (*4)

Plugin::load('BootsCake');

or using CakePHP's console:, (*5)

bin/cake plugin load BootsCake

Setup

First of all you should load Bootstrap by your favorite method., (*6)

Then in your src/View/AppView.php load the helpers you need:, (*7)

public function initialize()
{
    $this->loadHelper('BootsCake.BootsCakeFlash');
    $this->loadHelper('BootsCake.BootsCakeForm');
    $this->loadHelper('BootsCake.BootsCakeModal');
    $this->loadHelper('BootsCake.BootsCakePaginator');
}

Helper Usage

Form Helper. You only need to call BootsCakeForm on the View, (*8)

<?php
echo $this->BootsCakeForm->create($article);
echo $this->BootsCakeForm->control('title');
echo $this->BootsCakeForm->control('body');
echo $this->BootsCakeForm->control(__('Submit'), ['type' => 'submit']);
echo $this->BootsCakeForm->end();
?>

Wait! What if I need different form sizes?
I got your back! You can pass size as an option it could be sm or lg:, (*9)

<?= $this->BootsCakeForm->control(
    'email',
    [
        'placeholder' => 'carlos@example.com',
        'size' => 'sm',
    ]
) ?>

Also if you pass the option 'type' => 'submit' it supports a color to render the submit button, (*10)

= $this->BootsCakeForm->control('Submit', ['type' => 'submit', 'color' => 'primary']) ?>

Flash Helper., (*11)

= $this->BootsCakeFlash->render() ?>

Paginator Helper., (*12)

<nav>
    <ul class="pagination">
        <?php
        echo $this->BootsCakePaginator->first();
        echo $this->BootsCakePaginator->prev();
        echo $this->BootsCakePaginator->numbers();
        echo $this->BootsCakePaginator->next();
        echo $this->BootsCakePaginator->last();
        ?>
    </ul>
</nav>

Modal. It only renders the skeleton of the Modal Component, I use it primary for rendering a delete modal This is the delete button code:, (*13)

=
$this->BootsCakeForm->postLink(__('Delete'),
[
  'action' => 'delete',
  $article->id
], [
  'data-name' => $article->id,
  'escape' => false,
  'title' => 'Eliminar usuario'
])
?>

Then call the Modal skeleton:, (*14)

= $this->element('BootsCake.modal/default') ?>

or, (*15)

= $this->BootsCakeModal->render() ?>

Alongside this javascript code:, (*16)

$('#modal').on('show.bs.modal', function (event) {
    var button = $(event.relatedTarget);
    var recipient = button.data('name');
    var formName = button.data('form-name');
    $('#confirm').attr('onClick', 'document.' + formName + '.submit();');
    var modal = $(this);
    modal.find('.modal-title').html(
        '

Eliminar , (*17)

' ) modal.find('.modal-body').html( '

ĀæDesea eliminar a ' + recipient + '?, (*18)

' + '<br>' + 'La informaciĆ³n no se podrĆ” recuperar' ); });

TODO

  • [ ] Improve Docs.
  • [ ] Handle configurations.
  • [x] Add options for size (sm, md, lg).
  • [ ] Add options for modal rendering.
  • [ ] Create Html Helpers.
  • [ ] Create a way to automatize Bootstrap instalation.

License

Copyright (c) 2018, Carlos ProaƱo and licensed under The MIT License., (*19)

The Versions

28/04 2018

dev-master

9999999-dev

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

03/10 2017

v0.0.4

0.0.4.0

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

12/09 2017

v0.0.3

0.0.3.0

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

13/08 2017

v0.0.1

0.0.1.0

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

08/08 2017

v1.0.5-alpha

1.0.5.0-alpha

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

14/06 2017

v1.0.4-alpha

1.0.4.0-alpha

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

19/05 2017

v1.0.3-alpha

1.0.3.0-alpha

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

17/04 2017

v1.0.2-alpha

1.0.2.0-alpha

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

16/04 2017

v1.0.1-alpha

1.0.1.0-alpha

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo

16/04 2017

v1.0.0-alpha

1.0.0.0-alpha

Bootstrap 4 helpers for CakePHP 3.4

  Sources   Download

MIT

The Requires

 

The Development Requires

by Carlos ProaƱo