Skip to content

Commit 2e216ca

Browse files
author
Максим Пешехонов
committed
stwe#814 small fixes
1 parent 6dc43d4 commit 2e216ca

File tree

3 files changed

+86
-81
lines changed

3 files changed

+86
-81
lines changed

Maker/MakeDatatable.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
9898
sort($this->columnTypes);
9999
$generator->generateClass(
100100
$datatableClassDetails->getFullName(),
101-
$this->baseSleleton . '/Datatable.tpl.php',
101+
$this->baseSleleton . '/datatable.tpl.php',
102102
[
103103
'bounded_full_class_name' => $entityClassDetails->getFullName(),
104104
'bounded_class_name' => $entityClassDetails->getShortName(),

Resources/help/MakeDatatable.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The <info>%command.name%</info> command generates datatable class for selected entity.
2+
3+
<info>php %command.full_name% BlogPost</info>
4+
5+
If the argument is missing, the command will ask for the entity class name interactively.

Resources/views/skeleton/datatable.tpl.php

+80-80
Original file line numberDiff line numberDiff line change
@@ -5,98 +5,98 @@
55
use Sg\DatatablesBundle\Datatable\AbstractDatatable;
66

77
<?php foreach ($column_types as $type): ?>
8-
use Sg\DatatablesBundle\Datatable\Column\<?= $type ?>;
8+
use Sg\DatatablesBundle\Datatable\Column\<?= $type ?>;
99
<?php endforeach; ?>
1010

1111
/**
12-
* Class <?= $class_name.PHP_EOL ?>
13-
*
14-
* @package <?= $namespace ?>\Datatables
15-
*/
12+
* Class <?= $class_name.PHP_EOL ?>
13+
*
14+
* @package <?= $namespace ?>\Datatables
15+
*/
1616
class <?= $class_name ?> extends AbstractDatatable
1717
{
1818

19-
/**
20-
* {@inheritdoc}
21-
*
22-
* @throws \Exception
23-
*/
24-
public function buildDatatable(array $options = array())
25-
{
26-
$this->language->set(array(
27-
'cdn_language_by_locale' => true
28-
//'language' => 'de'
29-
));
19+
/**
20+
* {@inheritdoc}
21+
*
22+
* @throws \Exception
23+
*/
24+
public function buildDatatable(array $options = array())
25+
{
26+
$this->language->set(array(
27+
'cdn_language_by_locale' => true
28+
//'language' => 'de'
29+
));
3030

31-
$this->ajax->set(array(
32-
));
31+
$this->ajax->set(array(
32+
));
3333

34-
$this->options->set(array(
35-
'individual_filtering' => true,
36-
'individual_filtering_position' => 'head',
37-
'order_cells_top' => true,
38-
));
34+
$this->options->set(array(
35+
'individual_filtering' => true,
36+
'individual_filtering_position' => 'head',
37+
'order_cells_top' => true,
38+
));
3939

40-
$this->features->set(array(
41-
));
40+
$this->features->set(array(
41+
));
4242

43-
$this->columnBuilder
44-
<?php foreach ($fields as $field): ?>
45-
->add('<?= $field['property'] ?>', <?= $field['column_type'] ?>, array(
46-
'title' => '<?= $field['title'] ?>',
43+
$this->columnBuilder
44+
<?php foreach ($fields as $field): ?>
45+
->add('<?= $field['property'] ?>', <?= $field['column_type'] ?>, array(
46+
'title' => '<?= $field['title'] ?>',
4747
<?php if (isset($field['data']) && $field['data']!== null ): ?>
48-
'data' => '<?= $field['data'] ?>'
48+
'data' => '<?= $field['data'] ?>'
4949
<?php endif ?>
50-
))
51-
<?php endforeach; ?>
52-
->add(null, ActionColumn::class, array(
53-
'title' => $this->translator->trans('sg.datatables.actions.title'),
54-
'actions' => array(
55-
array(
56-
'route' => '<?= $route_pref ?>_show',
57-
'route_parameters' => array(
58-
'id' => 'id'
59-
),
60-
'label' => $this->translator->trans('sg.datatables.actions.show'),
61-
'icon' => 'glyphicon glyphicon-eye-open',
62-
'attributes' => array(
63-
'rel' => 'tooltip',
64-
'title' => $this->translator->trans('sg.datatables.actions.show'),
65-
'class' => 'btn btn-primary btn-xs',
66-
'role' => 'button'
67-
),
68-
),
69-
array(
70-
'route' => '<?= $route_pref ?>_edit',
71-
'route_parameters' => array(
72-
'id' => 'id'
73-
),
74-
'label' => $this->translator->trans('sg.datatables.actions.edit'),
75-
'icon' => 'glyphicon glyphicon-edit',
76-
'attributes' => array(
77-
'rel' => 'tooltip',
78-
'title' => $this->translator->trans('sg.datatables.actions.edit'),
79-
'class' => 'btn btn-primary btn-xs',
80-
'role' => 'button'
81-
),
82-
)
83-
)
84-
));
85-
}
50+
))
51+
<?php endforeach; ?>
52+
->add(null, ActionColumn::class, array(
53+
'title' => $this->translator->trans('sg.datatables.actions.title'),
54+
'actions' => array(
55+
array(
56+
'route' => '<?= $route_pref ?>_show',
57+
'route_parameters' => array(
58+
'id' => 'id'
59+
),
60+
'label' => $this->translator->trans('sg.datatables.actions.show'),
61+
'icon' => 'glyphicon glyphicon-eye-open',
62+
'attributes' => array(
63+
'rel' => 'tooltip',
64+
'title' => $this->translator->trans('sg.datatables.actions.show'),
65+
'class' => 'btn btn-primary btn-xs',
66+
'role' => 'button'
67+
),
68+
),
69+
array(
70+
'route' => '<?= $route_pref ?>_edit',
71+
'route_parameters' => array(
72+
'id' => 'id'
73+
),
74+
'label' => $this->translator->trans('sg.datatables.actions.edit'),
75+
'icon' => 'glyphicon glyphicon-edit',
76+
'attributes' => array(
77+
'rel' => 'tooltip',
78+
'title' => $this->translator->trans('sg.datatables.actions.edit'),
79+
'class' => 'btn btn-primary btn-xs',
80+
'role' => 'button'
81+
),
82+
)
83+
)
84+
));
85+
}
8686

87-
/**
88-
* {@inheritdoc}
89-
*/
90-
public function getEntity()
91-
{
92-
return '<?= $bounded_full_class_name ?>';
93-
}
87+
/**
88+
* {@inheritdoc}
89+
*/
90+
public function getEntity()
91+
{
92+
return '<?= $bounded_full_class_name ?>';
93+
}
9494

95-
/**
96-
* {@inheritdoc}
97-
*/
98-
public function getName()
99-
{
100-
return '<?= $datatable_name ?>';
101-
}
95+
/**
96+
* {@inheritdoc}
97+
*/
98+
public function getName()
99+
{
100+
return '<?= $datatable_name ?>';
101+
}
102102
}

0 commit comments

Comments
 (0)