Revize cdaf3e0a
Přidáno uživatelem Filip Jani před téměř 6 roky(ů)
app/AdminModule/component/Transliteration/TransliterationDataEditForm.latte | ||
---|---|---|
1 |
{ifset $containers} |
|
2 |
{form form class => 'form'} |
|
3 |
{foreach $containers as $containerName => $container} |
|
4 |
|
|
5 |
<div class="card mb-1"> |
|
6 |
|
|
7 |
<h5 class="mb-0"> |
|
8 |
<a class="btn btn-link" data-toggle="collapse" data-target="#{$containerName}" |
|
9 |
aria-expanded="false"> |
|
10 |
<small> |
|
11 |
<span class="fa fa-fw fa-plus"></span> |
|
12 |
<span class="fa fa-fw fa-minus"></span> |
|
13 |
</small> {$container['title']} |
|
14 |
</a> |
|
15 |
</h5> |
|
16 |
|
|
17 |
<div id="{$containerName}" class="collapse"> |
|
18 |
<div class="card-body"> |
|
19 |
|
|
20 |
{foreach $container as $multiplierName => $multiplier} |
|
21 |
|
|
22 |
{if $multiplierName !== 'title'} |
|
23 |
{var name = $containerName . '-' . $multiplierName} |
|
24 |
|
|
25 |
<div class="card mb-1"> |
|
26 |
<h5 class="mb-0"> |
|
27 |
<a class="btn btn-link" data-toggle="collapse" data-target="#{$name}" |
|
28 |
aria-expanded="false" onclick="return false;"> |
|
29 |
<small> |
|
30 |
<span class="fa fa-fw fa-plus"></span> |
|
31 |
<span class="fa fa-fw fa-minus"></span> |
|
32 |
</small> {$multiplier} |
|
33 |
</a> |
|
34 |
</h5> |
|
35 |
|
|
36 |
<div id="{$name}" class="collapse"> |
|
37 |
<div class="card-body"> |
|
38 |
<div n:multiplier="$name" n:class="row, mb-2"> |
|
39 |
<div class="col-5"> |
|
40 |
<input n:name="\App\Model\Repository\LineRepository::COLUMN_LINE_NUMBER" n:class="form-control, form-control-sm"> |
|
41 |
</div> |
|
42 |
<div class="col-5"> |
|
43 |
<input n:name="\App\Model\Repository\LineRepository::COLUMN_TRANSLITERATION" n:class="form-control, form-control-sm"> |
|
44 |
</div> |
|
45 |
<div class="col-2"> |
|
46 |
{btnRemove 'class' => 'btn btn-danger btn-sm float-right'} |
|
47 |
</div> |
|
48 |
</div> |
|
49 |
|
|
50 |
{btnCreate $name 'class' => 'btn btn-info btn-sm'} |
|
51 |
</div> |
|
52 |
</div> |
|
53 |
|
|
54 |
</div> |
|
55 |
{/if} |
|
56 |
|
|
57 |
{/foreach} |
|
58 |
|
|
59 |
</div> |
|
60 |
</div> |
|
61 |
</div> |
|
62 |
{/foreach} |
|
63 |
|
|
64 |
<div class="row mt-5"> |
|
65 |
<div class="col-4 offset-8 float-right"> |
|
66 |
{input submit} |
|
67 |
</div> |
|
68 |
</div> |
|
69 |
{/form} |
|
70 |
{/ifset} |
app/AdminModule/component/Transliteration/TransliterationDataEditForm.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\AdminModule\Components; |
|
5 |
|
|
6 |
|
|
7 |
use App\Model\Facade\TransliterationFacade; |
|
8 |
use App\Model\Repository\LineRepository; |
|
9 |
use App\Model\Repository\ObjectTypeRepository; |
|
10 |
use App\Model\Repository\SurfaceTypeRepository; |
|
11 |
use App\Utils\Form; |
|
12 |
use Nette\Application\UI\Control; |
|
13 |
use Nette\Forms\Container; |
|
14 |
use WebChemistry\Forms\Controls\Multiplier; |
|
15 |
|
|
16 |
class TransliterationDataEditForm extends Control |
|
17 |
{ |
|
18 |
/** @var int ID transliterace */ |
|
19 |
private $id; |
|
20 |
|
|
21 |
/** @var array Pole objektů a typu povrch pro strom dat transliterace */ |
|
22 |
private $containers; |
|
23 |
|
|
24 |
/** |
|
25 |
* @var ObjectTypeRepository |
|
26 |
*/ |
|
27 |
private $objectTypeRepository; |
|
28 |
/** |
|
29 |
* @var SurfaceTypeRepository |
|
30 |
*/ |
|
31 |
private $surfaceTypeRepository; |
|
32 |
/** |
|
33 |
* @var TransliterationFacade |
|
34 |
*/ |
|
35 |
private $transliterationFacade; |
|
36 |
|
|
37 |
public function __construct(ObjectTypeRepository $objectTypeRepository, |
|
38 |
SurfaceTypeRepository $surfaceTypeRepository, |
|
39 |
TransliterationFacade $transliterationFacade |
|
40 |
) |
|
41 |
{ |
|
42 |
parent::__construct(); |
|
43 |
|
|
44 |
$this->objectTypeRepository = $objectTypeRepository; |
|
45 |
$this->surfaceTypeRepository = $surfaceTypeRepository; |
|
46 |
$this->transliterationFacade = $transliterationFacade; |
|
47 |
|
|
48 |
$objectTypes = $this->objectTypeRepository->fetchObjectTypes(); |
|
49 |
$surfaceTypes = $this->surfaceTypeRepository->fetchSurfaceTypes(); |
|
50 |
$containers = []; |
|
51 |
|
|
52 |
// Načtení typů objektů a typu povrchů do pole pro vykreslení v šabloně |
|
53 |
foreach ($objectTypes as $objectType) |
|
54 |
{ |
|
55 |
$containers[$this->transliterationFacade->getInputName($objectType)]['title'] = $objectType; |
|
56 |
|
|
57 |
foreach ($surfaceTypes as $surfaceType) |
|
58 |
{ |
|
59 |
$containers[$this->transliterationFacade->getInputName($objectType)][$this->transliterationFacade->getInputName($objectType, $surfaceType)] = $surfaceType; |
|
60 |
} |
|
61 |
} |
|
62 |
|
|
63 |
$this->containers = $containers; |
|
64 |
} |
|
65 |
|
|
66 |
public function render() |
|
67 |
{ |
|
68 |
$this->template->setFile(__DIR__ . '/TransliterationDataEditForm.latte'); |
|
69 |
|
|
70 |
$this->template->containers = $this->containers; |
|
71 |
|
|
72 |
$this->template->render(); |
|
73 |
} |
|
74 |
|
|
75 |
public function createComponentForm() |
|
76 |
{ |
|
77 |
$form = new Form; |
|
78 |
|
|
79 |
foreach ($this->containers as $name => $container) |
|
80 |
{ |
|
81 |
$cont = $form->addContainer($name); |
|
82 |
|
|
83 |
foreach ($container as $nameMultiplier => $multiplier) |
|
84 |
{ |
|
85 |
if ($nameMultiplier === 'title') |
|
86 |
{ |
|
87 |
continue; |
|
88 |
} |
|
89 |
|
|
90 |
/** @var Multiplier $multiplier */ |
|
91 |
$multiplier = $cont->addMultiplier($nameMultiplier, function (Container $container) |
|
92 |
{ |
|
93 |
$container->addInteger(LineRepository::COLUMN_LINE_NUMBER); |
|
94 |
$container->addText(LineRepository::COLUMN_TRANSLITERATION); |
|
95 |
}, 0); |
|
96 |
|
|
97 |
$multiplier->addCreateButton('Add line')->setValidationScope([])->addClass('btn btn-primary'); |
|
98 |
$multiplier->addRemoveButton('Delete')->addClass('btn btn-danger'); |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
$form->setDefaults($this->getDefaults()); |
|
103 |
|
|
104 |
$form->onSuccess[] = [$this, 'formSuccess']; |
|
105 |
$form->addSubmit('submit', 'Save'); |
|
106 |
|
|
107 |
return $form; |
|
108 |
} |
|
109 |
|
|
110 |
public function formSuccess(Form $form) |
|
111 |
{ |
|
112 |
|
|
113 |
} |
|
114 |
|
|
115 |
/** |
|
116 |
* Nastavení ID právě upravované transliterace |
|
117 |
* |
|
118 |
* @param int $id |
|
119 |
*/ |
|
120 |
public function setTransliteration(int $id) |
|
121 |
{ |
|
122 |
$this->id = $id; |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* Vrací hodnoty formuláře při editaci |
|
127 |
* |
|
128 |
* @return array |
|
129 |
*/ |
|
130 |
private function getDefaults() |
|
131 |
{ |
|
132 |
if (isset($this->id)) |
|
133 |
{ |
|
134 |
return $this->transliterationFacade->getTransliterationData($this->id); |
|
135 |
} |
|
136 |
} |
|
137 |
} |
|
138 |
|
|
139 |
interface ITransliterationDataEditFormFactory |
|
140 |
{ |
|
141 |
/** |
|
142 |
* @return TransliterationDataEditForm |
|
143 |
*/ |
|
144 |
public function create(); |
|
145 |
} |
app/AdminModule/component/Transliteration/TransliterationEditForm.latte | ||
---|---|---|
1 | 1 |
{form form} |
2 | 2 |
<div class="row"> |
3 |
<div class="col-4">
|
|
3 |
<div class="col-12">
|
|
4 | 4 |
<div class="row mb-2"> |
5 | 5 |
<div class="col-4"> |
6 | 6 |
{label \App\Model\Repository\TransliterationRepository::COLUMN_BOOK_ID} |
... | ... | |
91 | 91 |
<div n:multiplier="references"> |
92 | 92 |
<div class="row mb-2"> |
93 | 93 |
|
94 |
<div class="col-2">
|
|
94 |
<div class="col-3">
|
|
95 | 95 |
<input n:name="\App\Model\Repository\LitReferenceRepository::COLUMN_SERIES" n:class="form-control" |
96 | 96 |
required></div> |
97 | 97 |
|
98 |
<div class="col-2">
|
|
98 |
<div class="col-3">
|
|
99 | 99 |
<input n:name="\App\Model\Repository\LitReferenceRepository::COLUMN_NUMBER" n:class="form-control"> |
100 | 100 |
</div> |
101 | 101 |
|
102 |
<div class="col-2">
|
|
102 |
<div class="col-3">
|
|
103 | 103 |
<input n:name="\App\Model\Repository\LitReferenceRepository::COLUMN_PLATE" n:class="form-control"> |
104 | 104 |
</div> |
105 |
<div class="col-2">{btnRemove 'class' => 'btn btn-danger'}</div> |
|
105 |
<div class="col-2">{btnRemove 'class' => 'btn btn-danger float-right'}</div>
|
|
106 | 106 |
</div> |
107 | 107 |
</div> |
108 | 108 |
|
... | ... | |
111 | 111 |
</div> |
112 | 112 |
|
113 | 113 |
<div class="row mt-5"> |
114 |
<div class="col-4"> |
|
114 |
<div class="col-4 offset-8 float-right">
|
|
115 | 115 |
{input submit} |
116 | 116 |
</div> |
117 | 117 |
</div> |
app/AdminModule/presenters/TransliterationPresenter.php | ||
---|---|---|
4 | 4 |
namespace App\AdminModule\Presenters; |
5 | 5 |
|
6 | 6 |
|
7 |
use App\AdminModule\Components\ITransliterationDataEditFormFactory; |
|
7 | 8 |
use App\AdminModule\Components\ITransliterationGridFactory; |
8 | 9 |
use App\AdminModule\Components\ITransliterationEditFormFactory; |
9 | 10 |
use App\Model\Repository\TransliterationRepository; |
... | ... | |
25 | 26 |
*/ |
26 | 27 |
private $transliterationRepository; |
27 | 28 |
|
29 |
/** |
|
30 |
* @var ITransliterationDataEditFormFactory |
|
31 |
*/ |
|
32 |
private $transliterationDataEditFormFactory; |
|
33 |
|
|
28 | 34 |
public function __construct(ITransliterationGridFactory $transliterationGridFactory, |
29 | 35 |
ITransliterationEditFormFactory $transliterationEditFormFactory, |
30 |
TransliterationRepository $transliterationRepository) |
|
36 |
TransliterationRepository $transliterationRepository, |
|
37 |
ITransliterationDataEditFormFactory $transliterationDataEditFormFactory |
|
38 |
) |
|
31 | 39 |
{ |
32 | 40 |
parent::__construct(); |
33 | 41 |
$this->transliterationEditFormFactory = $transliterationEditFormFactory; |
34 | 42 |
$this->transliterationGridFactory = $transliterationGridFactory; |
35 | 43 |
$this->transliterationRepository = $transliterationRepository; |
44 |
$this->transliterationDataEditFormFactory = $transliterationDataEditFormFactory; |
|
36 | 45 |
} |
37 | 46 |
|
38 | 47 |
/** |
... | ... | |
57 | 66 |
public function actionEdit(int $id) |
58 | 67 |
{ |
59 | 68 |
$this['transliterationEditForm']->setTransliteration($id); |
69 |
$this['transliterationDataEditForm']->setTransliteration($id); |
|
60 | 70 |
} |
61 | 71 |
|
62 | 72 |
public function createComponentTransliterationGrid() |
... | ... | |
69 | 79 |
return $this->transliterationEditFormFactory->create(); |
70 | 80 |
} |
71 | 81 |
|
82 |
public function createComponentTransliterationDataEditForm() |
|
83 |
{ |
|
84 |
return $this->transliterationDataEditFormFactory->create(); |
|
85 |
} |
|
86 |
|
|
72 | 87 |
} |
app/AdminModule/templates/@layout.latte | ||
---|---|---|
39 | 39 |
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous"> |
40 | 40 |
|
41 | 41 |
<link rel="stylesheet" href="{$basePath}/css/admin/style.css"> |
42 |
<link rel="stylesheet" href="{$basePath}/css/common.css"> |
|
42 | 43 |
|
43 | 44 |
<script src="https://nette.github.io/resources/js/netteForms.min.js"></script> |
44 | 45 |
<script src="{$basePath}/js/nette.ajax.js"></script> |
app/AdminModule/templates/Transliteration/edit.latte | ||
---|---|---|
1 | 1 |
{block content} |
2 | 2 |
<div class="row"> |
3 |
<div class="col-12">
|
|
3 |
<div class="col-5">
|
|
4 | 4 |
<div class="display-5">Edit Transliteration</div> |
5 |
|
|
6 |
<fieldset> |
|
7 |
<legend>Transliteration information</legend> |
|
8 |
|
|
9 |
{control transliterationEditForm} |
|
10 |
</fieldset> |
|
5 | 11 |
</div> |
6 | 12 |
</div> |
7 |
{control transliterationEditForm} |
|
8 |
{/block} |
|
13 |
|
|
14 |
<div class="row mt-5"> |
|
15 |
<div class="col-5"> |
|
16 |
<fieldset> |
|
17 |
<legend>Transliteration data</legend> |
|
18 |
|
|
19 |
{control transliterationDataEditForm} |
|
20 |
</fieldset> |
|
21 |
</div> |
|
22 |
</div> |
|
23 |
{/block} |
|
24 |
|
|
25 |
{block scripts} |
|
26 |
<script> |
|
27 |
$(function () { |
|
28 |
$.nette.init(); |
|
29 |
}); |
|
30 |
</script> |
app/FrontModule/templates/@layout.latte | ||
---|---|---|
39 | 39 |
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous"> |
40 | 40 |
|
41 | 41 |
<link rel="stylesheet" href="{$basePath}/css/front/style.css"> |
42 |
<link rel="stylesheet" href="{$basePath}/css/common.css"> |
|
42 | 43 |
|
43 | 44 |
<script src="https://nette.github.io/resources/js/netteForms.min.js"></script> |
44 | 45 |
<script src="{$basePath}/js/nette.ajax.js"></script> |
app/config/components.neon | ||
---|---|---|
21 | 21 |
- App\AdminModule\Components\IBookTypeEditFormFactory |
22 | 22 |
- App\AdminModule\Components\IBookEditFormFactory |
23 | 23 |
- App\AdminModule\Components\ITransliterationEditFormFactory |
24 |
- App\AdminModule\Components\ITransliterationDataEditFormFactory |
|
24 | 25 |
|
25 | 26 |
- App\FrontModule\Components\IKeyboard |
26 | 27 |
- App\FrontModule\Components\ITransliterationSearchResultListFactory |
app/config/model.neon | ||
---|---|---|
19 | 19 |
|
20 | 20 |
#Facade |
21 | 21 |
- App\Model\Facade\UserFacade |
22 |
- App\Model\Facade\TransliterationFacade |
|
22 | 23 |
|
23 | 24 |
#Sessions |
24 | 25 |
- App\Model\TransliterationSearchModel |
app/model/facade/TransliterationFacade.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
|
|
4 |
namespace App\Model\Facade; |
|
5 |
|
|
6 |
|
|
7 |
use App\Model\Repository\LineRepository; |
|
8 |
use App\Model\Repository\ObjectTypeRepository; |
|
9 |
use App\Model\Repository\SurfaceRepository; |
|
10 |
use App\Model\Repository\SurfaceTypeRepository; |
|
11 |
use Nette\Database\Table\ActiveRow; |
|
12 |
|
|
13 |
class TransliterationFacade |
|
14 |
{ |
|
15 |
/** |
|
16 |
* @var SurfaceRepository |
|
17 |
*/ |
|
18 |
private $surfaceRepository; |
|
19 |
/** |
|
20 |
* @var LineRepository |
|
21 |
*/ |
|
22 |
private $lineRepository; |
|
23 |
/** |
|
24 |
* @var ObjectTypeRepository |
|
25 |
*/ |
|
26 |
private $objectTypeRepository; |
|
27 |
/** |
|
28 |
* @var SurfaceTypeRepository |
|
29 |
*/ |
|
30 |
private $surfaceTypeRepository; |
|
31 |
|
|
32 |
public function __construct(SurfaceRepository $surfaceRepository, |
|
33 |
LineRepository $lineRepository, |
|
34 |
ObjectTypeRepository $objectTypeRepository, |
|
35 |
SurfaceTypeRepository $surfaceTypeRepository |
|
36 |
) |
|
37 |
{ |
|
38 |
$this->surfaceRepository = $surfaceRepository; |
|
39 |
$this->lineRepository = $lineRepository; |
|
40 |
$this->objectTypeRepository = $objectTypeRepository; |
|
41 |
$this->surfaceTypeRepository = $surfaceTypeRepository; |
|
42 |
} |
|
43 |
|
|
44 |
/** |
|
45 |
* Uloží data transliterace |
|
46 |
* |
|
47 |
* @param int $id |
|
48 |
* @param array $values |
|
49 |
*/ |
|
50 |
public function saveTransliterationData(int $id, array $values) |
|
51 |
{ |
|
52 |
|
|
53 |
} |
|
54 |
|
|
55 |
/** |
|
56 |
* Vrací data transliterace pro formulář |
|
57 |
* |
|
58 |
* @param int $id : ID transliterace |
|
59 |
* @return array |
|
60 |
*/ |
|
61 |
public function getTransliterationData(int $id) |
|
62 |
{ |
|
63 |
$surfaces = $this->surfaceRepository->findByTransliterationId($id)->fetchAll(); |
|
64 |
|
|
65 |
$surfaceTypes = $this->surfaceTypeRepository->fetchSurfaceTypes(); |
|
66 |
$objectTypes = $this->objectTypeRepository->fetchObjectTypes(); |
|
67 |
|
|
68 |
$defaults = array(); |
|
69 |
|
|
70 |
/** @var ActiveRow $surface */ |
|
71 |
foreach ($surfaces as $surface) |
|
72 |
{ |
|
73 |
// Načtení všech řádek |
|
74 |
$lineRows = $surface->related(LineRepository::TABLE_NAME, SurfaceRepository::COLUMN_ID)->fetchAll(); |
|
75 |
if ($lineRows === FALSE) |
|
76 |
{ |
|
77 |
continue; |
|
78 |
} |
|
79 |
|
|
80 |
// Získání názvu typu povrchu a typu objektu |
|
81 |
$surfaceType = $surfaceTypes[$surface->{SurfaceRepository::COLUMN_SURFACE_TYPE_ID}]; |
|
82 |
$objectType = $objectTypes[$surface->{SurfaceRepository::COLUMN_OBJECT_TYPE_ID}]; |
|
83 |
|
|
84 |
$objectName = $this->getInputName($objectType); |
|
85 |
$surfaceName = $this->getInputName($objectType, $surfaceType); |
|
86 |
|
|
87 |
$defaults[$objectName][$surfaceName] = $lineRows; |
|
88 |
} |
|
89 |
|
|
90 |
return $defaults; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* Vrací název inputu pro formulář |
|
95 |
* |
|
96 |
* @param string $container |
|
97 |
* @param string|NULL $name |
|
98 |
* @return string |
|
99 |
*/ |
|
100 |
public function getInputName(string $container, string $name = NULL) |
|
101 |
{ |
|
102 |
return str_replace(' ', '', $container) . str_replace(' ', '', $name); |
|
103 |
} |
|
104 |
} |
app/model/repository/ObjectTypeRepository.php | ||
---|---|---|
16 | 16 |
/** Sloupečky tabulky */ |
17 | 17 |
const COLUMN_ID = 'id_object_type'; |
18 | 18 |
const COLUMN_OBJECT_TYPE = 'object_type'; |
19 |
|
|
20 |
/** |
|
21 |
* Vrací typy objektů pro formulář pro přidávání transliterací |
|
22 |
* |
|
23 |
* @return array |
|
24 |
*/ |
|
25 |
public function fetchObjectTypes() |
|
26 |
{ |
|
27 |
return $this->findAll()->fetchPairs(self::COLUMN_ID, self::COLUMN_OBJECT_TYPE); |
|
28 |
} |
|
19 | 29 |
} |
app/model/repository/SurfaceRepository.php | ||
---|---|---|
19 | 19 |
const COLUMN_TRANSLITERATION_ID = 'id_transliteration'; |
20 | 20 |
const COLUMN_OBJECT_TYPE_ID = 'id_object_type'; |
21 | 21 |
const COLUMN_SURFACE_TYPE_ID = 'id_surface_type'; |
22 |
|
|
23 |
/** |
|
24 |
* Vrací povrchy podle ID transliterace |
|
25 |
* |
|
26 |
* @param int $id : ID transliterace |
|
27 |
* @return \Nette\Database\Table\Selection |
|
28 |
*/ |
|
29 |
public function findByTransliterationId(int $id) |
|
30 |
{ |
|
31 |
return $this->findBy([self::COLUMN_TRANSLITERATION_ID => $id]); |
|
32 |
} |
|
22 | 33 |
} |
app/model/repository/SurfaceTypeRepository.php | ||
---|---|---|
17 | 17 |
const COLUMN_ID = 'id_surface_type'; |
18 | 18 |
const COLUMN_SURFACE_TYPE = 'surface_type'; |
19 | 19 |
const COLUMN_SORTER = 'sorter'; |
20 |
|
|
21 |
/** |
|
22 |
* Vrací typy povrchů pro formulář pro přidávání transliterací |
|
23 |
* |
|
24 |
* @return array |
|
25 |
*/ |
|
26 |
public function fetchSurfaceTypes() |
|
27 |
{ |
|
28 |
return $this->findAll()->order(self::COLUMN_SORTER)->fetchPairs(self::COLUMN_ID, self::COLUMN_SURFACE_TYPE); |
|
29 |
} |
|
20 | 30 |
} |
app/utils/Form.php | ||
---|---|---|
29 | 29 |
|
30 | 30 |
public function addText($name, $label = null, $cols = null, $maxLength = null) |
31 | 31 |
{ |
32 |
return parent::addText($name, $label, $cols, $maxLength)->setHtmlAttribute('class', 'form-control'); |
|
32 |
return parent::addText($name, $label, $cols, $maxLength)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
33 | 33 |
} |
34 | 34 |
|
35 | 35 |
public function addSelect($name, $label = null, array $items = null, $size = null) |
36 | 36 |
{ |
37 |
return parent::addSelect($name, $label, $items, $size)->setHtmlAttribute('class', 'form-control'); |
|
37 |
return parent::addSelect($name, $label, $items, $size)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
38 | 38 |
} |
39 | 39 |
|
40 | 40 |
public function addPassword($name, $label = null, $cols = null, $maxLength = null) |
41 | 41 |
{ |
42 |
return parent::addPassword($name, $label, $cols, $maxLength)->setHtmlAttribute('class', 'form-control'); |
|
42 |
return parent::addPassword($name, $label, $cols, $maxLength)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
43 | 43 |
} |
44 | 44 |
|
45 | 45 |
public function addEmail($name, $label = null) |
46 | 46 |
{ |
47 |
return parent::addEmail($name, $label)->setHtmlAttribute('class', 'form-control'); |
|
47 |
return parent::addEmail($name, $label)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
48 | 48 |
} |
49 | 49 |
|
50 | 50 |
public function addTextArea($name, $label = null, $cols = null, $rows = null) |
51 | 51 |
{ |
52 |
return parent::addTextArea($name, $label, $cols, $rows)->setHtmlAttribute('class', 'form-control'); |
|
52 |
return parent::addTextArea($name, $label, $cols, $rows)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
53 | 53 |
} |
54 | 54 |
|
55 | 55 |
public function addUpload($name, $label = null, $multiple = false) |
56 | 56 |
{ |
57 |
return parent::addUpload($name, $label, $multiple)->setHtmlAttribute('class', 'form-control'); |
|
57 |
return parent::addUpload($name, $label, $multiple)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
58 | 58 |
} |
59 | 59 |
|
60 | 60 |
public function addInteger($name, $label = null) |
61 | 61 |
{ |
62 |
return parent::addInteger($name, $label)->setHtmlAttribute('class', 'form-control'); |
|
62 |
return parent::addInteger($name, $label)->setHtmlAttribute('class', 'form-control form-control-sm');
|
|
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
protected function beforeRender() |
... | ... | |
71 | 71 |
$type = $control->getOption('type'); |
72 | 72 |
if ($type === 'button') |
73 | 73 |
{ |
74 |
$control->getControlPrototype()->addClass('btn btn-success form-control'); |
|
74 |
$control->getControlPrototype()->addClass('btn btn-success btn-sm form-control');
|
|
75 | 75 |
} |
76 | 76 |
} |
77 | 77 |
} |
www/css/common.css | ||
---|---|---|
1 |
fieldset |
|
2 |
{ |
|
3 |
border: 1px solid #ddd !important; |
|
4 |
margin: 0; |
|
5 |
xmin-width: 0; |
|
6 |
padding: 10px; |
|
7 |
position: relative; |
|
8 |
border-radius:4px; |
|
9 |
background-color:#f5f5f5; |
|
10 |
padding-left:10px!important; |
|
11 |
} |
|
12 |
|
|
13 |
legend |
|
14 |
{ |
|
15 |
font-size:14px; |
|
16 |
font-weight:bold; |
|
17 |
margin-bottom: 0px; |
|
18 |
width: 35%; |
|
19 |
border: 1px solid #ddd; |
|
20 |
border-radius: 4px; |
|
21 |
padding: 5px 5px 5px 10px; |
|
22 |
background-color: #ffffff; |
|
23 |
} |
|
24 |
|
|
25 |
a[aria-expanded=true] .fa-plus { |
|
26 |
display: none; |
|
27 |
} |
|
28 |
a[aria-expanded=false] .fa-minus { |
|
29 |
display: none; |
|
30 |
} |
Také k dispozici: Unified diff
Re #7505 formulář pro editaci dat transliterace
- vytvořen formulář
- načítání výchozích hodnot formuláře
- úprava vzhledu formulářů