2017 © Pedro Peláez
 

symfony-bundle dashboard-bundle

Configurable Bootstrap dashboard for Kalamu

image

kalamu/dashboard-bundle

Configurable Bootstrap dashboard for Kalamu

  • Thursday, June 14, 2018
  • by nykopol
  • Repository
  • 3 Watchers
  • 3 Stars
  • 1,722 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 8 Versions
  • 4 % Grown

The README.md

Bundle kalamu/dashboard-bundle

Build Status, (*1)

This bundle provide a configurable interface for users to build modulable content. It's can be used to build responsive content, application dashbord and more., (*2)

Installation

Install the bundle:, (*3)

composer require kalamu/dashboard-bundle:~1.0

Register the bundle and the dependency in app/AppKernel.php:, (*4)

``` php public function registerBundles() { $bundles = array( // [...] new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(), new Kalamu\DashboardBundle\KalamuDashboardBundle(), );, (*5)


Register de routing in `app/config/routing.yml`: ``` yaml _bazinga_jstranslation: resource: "@BazingaJsTranslationBundle/Resources/config/routing/routing.yml" kalamu_dashboard_api: resource: "@KalamuDashboardBundle/Resources/config/routing.yml" prefix: /

Publish assets:, (*6)

./bin/console assets:install

How to use it ?

To use this bundle there is 3 key concepts: * The context in witch we work * The elements that compose the content * The dashboard that is the main container, (*7)

The context

The contexts are used to organize and filter the elements that are available. For exemple an application can use the dasboard for two purpuses: a dashboard with personnal activity report and a shared public dashboard with gobal stats., (*8)

This two purpuses will maybe have common elements like todo task list, but somes will have no sense in somes contexts. For exemple, an element for managing personnal activity sould not be added in public shared dashboard., (*9)

For this reason, you can create multiple contexts and define the elements that can be added in each context., (*10)

This defined in the app/config/config.yml :, (*11)

``` yaml kalamu_dashboard: contexts: personal_dashboard: types: cms_content: standard: - service.element.wysiwyg - service.element.bare_text media: - service.element.image - service.element.video global_dashboard: types: stats: default: - service.element.personnal_time - service.element.number_due_tasks project: - service.element.project_calendar - service.element.milestome - ..., (*12)


This configuration create 2 contexts `personal_dashboard` and `global_dashboard`. In `personal_dashboard` there is one type of element `cms_content` that provide 4 element organised in categories `standard` and `media`. Each element of a dashboard is a Symfony service. To enable it, you must report the service name in the appropriate category. ### Create an Element Like it's said, the elements are Symfony services. They must implements either the `Kalamu\DashboardBundle\Model\AbstractElement` for a simple element or `Kalamu\DashboardBundle\Model\AbstractConfigurableElement` if the element require some sort of configuration. Example of an element that show the `n` last tasks of an user. This element will ask the user to define how many task must be reported on his dashboard. ``` php use Kalamu\DashboardBundle\Model\AbstractConfigurableElement; use Symfony\Bundle\TwigBundle\TwigEngine; use Symfony\Component\Form\Form; class UserDueTasks extends AbstractConfigurableElement { public function getTitle() { return 'My lasts tasks'; } public function getDescription() { return 'Display my last assigned tasks with they due time.'; } public function getForm(Form $form) { $form->add("number", 'integer', [ 'label' => 'Number of task to show', 'data' => 10 ]); return $form; } public function render(TwigEngine $templating){ $number = $this->parameters['number']; $tasks = $this->theMagicOne($number); // Here you call your magic method that get the last '$number' tasks of the current user return $templating->render('AcmeAppBundle:Element:user_due_tasks.html.twig', ['tasks' => $tasks, 'number' => $number]); } }

You must register this class as a service in Symfony, then add the service name on your config file (app/config/config.yml) in the appropriate context(s) and category., (*13)

The Form used to configure the element is rendered with default options. If you want a more specific template for this form, you can add the following method renderConfigForm(TwigEngine $templating, Form $form) that will be automaticaly called if present., (*14)

Display the dashboard

``` twig {% stylesheets '@KalamuDashboardBundle/Resources/public/css/dashboard.css' %} {% endstylesheets %}, (*15)

, (*16)

{% javascripts '@KalamuDashboardBundle/Resources/public/js/dashboard/widget.js' '@KalamuDashboardBundle/Resources/public/js/dashboard/col.js' '@KalamuDashboardBundle/Resources/public/js/dashboard/row.js' '@KalamuDashboardBundle/Resources/public/js/dashboard/section.js' '@KalamuDashboardBundle/Resources/public/js/dashboard/explorer.js' '@KalamuDashboardBundle/Resources/public/js/dashboard/generic-row.js' '@KalamuDashboardBundle/Resources/public/js/cms-dashboard.js' %} {% endjavascripts %}, (*17)

, (*18)

```, (*19)

The Versions

14/06 2018

dev-master

9999999-dev

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

14/06 2018

1.2.1

1.2.1.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

09/02 2018

1.2.0

1.2.0.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

05/12 2017

1.1.1

1.1.1.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

08/10 2017

1.1.0

1.1.0.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

06/04 2017

1.0.2

1.0.2.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

22/02 2017

1.0.1

1.0.1.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER

20/08 2016

1.0.0

1.0.0.0

Configurable Bootstrap dashboard for Kalamu

  Sources   Download

MIT

The Requires

 

by Johan DESMYTER