Skip to content

Commit

Permalink
Add indents for selects in note edit
Browse files Browse the repository at this point in the history
  • Loading branch information
Volmarg committed Apr 4, 2020
1 parent 1fdbe49 commit 663ee77
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ public function getCategories(bool $only_categories_with_notes = false): array
AND mnc.deleted = 0
GROUP BY mnc.name
ORDER BY -childrens_id DESC
";

$statement = $connection->prepare($sql);
Expand Down
25 changes: 19 additions & 6 deletions src/Twig/GlobalVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Twig;

use App\Controller\Modules\Notes\MyNotesCategoriesController;
use App\Controller\Modules\Notes\MyNotesController;
use App\Controller\Utils\Application;
use App\DTO\Settings\Finances\SettingsFinancesDTO;
Expand Down Expand Up @@ -30,17 +31,21 @@ class GlobalVariables extends AbstractExtension {
*/
private $my_notes_controller;

public function __construct(Application $app, MyNotesController $my_notes_controller) {
$this->app = $app;
$this->my_notes_controller = $my_notes_controller;
private $my_notes_categories_controller;

public function __construct(Application $app, MyNotesController $my_notes_controller, MyNotesCategoriesController $my_notes_categories_controller) {
$this->app = $app;
$this->my_notes_controller = $my_notes_controller;
$this->my_notes_categories_controller = $my_notes_categories_controller;
}

public function getFunctions() {
return [
new TwigFunction('getMyNotesCategories', [$this, 'getMyNotesCategories']),
new TwigFunction('getSchedulesTypes', [$this, 'getSchedulesTypes']),
new TwigFunction('getMyNotesCategories', [$this, 'getMyNotesCategories']),
new TwigFunction('getSchedulesTypes', [$this, 'getSchedulesTypes']),
new TwigFunction('getSchedulesForNotifications', [$this, 'getSchedulesForNotifications']),
new TwigFunction('getFinancesCurrenciesDtos', [$this, 'getFinancesCurrenciesDtos']),
new TwigFunction('getFinancesCurrenciesDtos', [$this, 'getFinancesCurrenciesDtos']),
new TwigFunction('buildCategoriesDepths', [$this, 'buildCategoriesDepths']),
];
}

Expand Down Expand Up @@ -77,6 +82,14 @@ public function getMyNotesCategories($filter = false) {
return $new_results;
}

/**
* @return array
*/
public function buildCategoriesDepths(): array {
$depths = $this->my_notes_categories_controller->buildCategoriesDepths();
return $depths;
}

/**
* @return MyScheduleType[]
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,21 @@

<select class="form-control d-none note-modal-categories-list note-category"
style="max-width:100px; float:left;">
{% set categories = getMyNotesCategories() %}
{% set categories = getMyNotesCategories() %}
{% set categories_depths = buildCategoriesDepths() %}

{% for category_on_list in categories %}
{% set depth = categories_depths[category_on_list.category_id] %}

<option value="{{ category_on_list.category_id }}"
{% if category_id == category_on_list.category_id %}selected{% endif %}>
{% if category_id == category_on_list.category_id %}selected{% endif %}>

{% for i in range(0, depth) %}
{% if depth > 0 %}
&nbsp;
{% endif %}
{% endfor %}

{{ category_on_list.category | capitalize }}
</option>
{% endfor %}
Expand Down

0 comments on commit 663ee77

Please sign in to comment.