Skip to content

Commit 421da19

Browse files
Merge pull request #31 from stephanediondev/theme
Use variables to define theme (Bootstrap)
2 parents ebec977 + 6cbe456 commit 421da19

File tree

109 files changed

+294
-281
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+294
-281
lines changed

.env.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ SECRET_REGISTER=
3333
VAPID_PUBLIC_KEY=
3434
VAPID_PRIVATE_KEY=
3535
SENDER_ADDRESS=
36+
#THEME_COLOR_1='light'
37+
#THEME_COLOR_2='dark'
38+
#THEME_COLOR_3='primary'
3639
###< app ###

assets/js/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ if('serviceWorker' in navigator && 'https:' == window.location.protocol) {
9696
}
9797

9898
$(document).ready(function () {
99-
$('label.required').append(' <small class="badge bg-light text-dark ml-1">' + trans_required + '</small>');
99+
$('label.required').append(' <small class="badge bg-' + themeColor2 + ' text-' + themeColor1 + ' ml-1">' + trans_required + '</small>');
100100

101101
$(document).on('click', '.dashboard-table-expand', function(event) {
102102
event.preventDefault();

config/packages/twig.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
twig:
22
default_path: '%kernel.project_dir%/templates'
33
form_themes: ['bootstrap_5_layout.html.twig']
4+
globals:
5+
themeColor1: '%env(THEME_COLOR_1)%'
6+
themeColor2: '%env(THEME_COLOR_2)%'
7+
themeColor3: '%env(THEME_COLOR_3)%'

config/services.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# Put parameters here that don't need to change on each machine where the app is deployed
55
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
66
parameters:
7+
env(THEME_COLOR_1): 'dark'
8+
env(THEME_COLOR_2): 'light'
9+
env(THEME_COLOR_3): 'info'
710

811
services:
912
# default configuration for services in *this* file
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="shadow p-3 mb-4 bg-dark rounded">
1+
<div class="shadow p-3 mb-4 bg-{{ themeColor1 }} rounded">
22
{% block content %}
33
{% endblock %}
44
</div>

templates/Embed/shard_reroute_cluster_embed.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<div class="modal fade" id="modal{{ modalReference }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ modalReference }}" aria-hidden="true">
88
<div class="modal-dialog" role="document">
9-
<div class="modal-content bg-dark">
9+
<div class="modal-content bg-{{ themeColor1 }}">
1010
<form action="{{ form_action }}">
1111
<div class="modal-header">
1212
<h5 class="modal-title" id="modalLabel{{ modalReference }}">{{ title }}</h5>

templates/Embed/stats_table_embed.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{% set limit = 15 %}
22

33
<div class="col">
4-
<div class="card bg-dark border border-secondary mb-4">
4+
<div class="card bg-{{ themeColor1 }} border border-secondary mb-4">
55
<div class="card-body card-dashboard" id="{{ key }}">
66
<h4 class="card-title text-center">{% block title %}{% endblock %}</h4>
77

8-
<table class="table table-dark table-hover table-sm">
8+
<table class="table table-{{ themeColor1 }} table-hover table-sm">
99
{% block content %}
1010
{% endblock %}
1111
</table>
1212

1313
{% block all %}
1414
{% if limit < results|length %}
15-
<a href="#{{ key }}" class="btn btn-light btn-sm text-center d-block dashboard-table-expand">{{ 'all'|trans }} ({{ results|length }})</a>
15+
<a href="#{{ key }}" class="btn btn-{{ themeColor2 }} btn-sm text-center d-block dashboard-table-expand">{{ 'all'|trans }} ({{ results|length }})</a>
1616
{% endif %}
1717
{% endblock %}
1818
</div>

templates/Embed/table_embed.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class="table-responsive">
2-
<table class="{% block table_class %}table table-dark table-hover table-sm{% endblock %}">
2+
<table class="{% block table_class %}table table-{{ themeColor1 }} table-hover table-sm{% endblock %}">
33

44
<thead>
55
{% block thead %}

templates/Import/app_import.html.twig

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<input
55
id="searchInput"
66
name="{{ app.request.attributes.get('_route') }}-searchInput"
7-
class="form-control bg-dark text-light form-control-sm"
7+
class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }} form-control-sm"
88
type="text"
99
autocomplete="off"
1010
>
@@ -83,7 +83,7 @@
8383

8484
{% macro link(params) %}
8585
{% if params.class is not defined %}
86-
{% set params = params|merge({'class': 'text-light'}) %}
86+
{% set params = params|merge({'class': 'text-' ~ themeColor2}) %}
8787
{% endif %}
8888

8989
<a class="{{ params.class }}" href="{{ params.url }}">{{ params.title }}</a>
@@ -92,7 +92,7 @@
9292
{% macro sort(params) %}
9393
{% if true == params.cat_sort %}
9494
{% if params.class is not defined %}
95-
{% set params = params|merge({'class': 'text-light'}) %}
95+
{% set params = params|merge({'class': 'text-' ~ themeColor2}) %}
9696
{% endif %}
9797

9898
{% if '?' in params.url %}
@@ -176,7 +176,7 @@
176176
</button>
177177
<div class="modal fade" id="modal{{ params.id }}" tabindex="-1" role="dialog" aria-labelledby="modalLabel{{ params.id }}" aria-hidden="true">
178178
<div class="modal-dialog" role="document">
179-
<div class="modal-content bg-dark">
179+
<div class="modal-content bg-{{ themeColor1 }}">
180180
<div class="modal-header">
181181
<h5 class="modal-title" id="modalLabel{{ params.id }}">{{ params.title }}{% if params.badge is defined %}{{ _self.badge(params.badge) }}{% endif %}</h5>
182182
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="{{ 'cancel'|trans }}"></button>
@@ -236,55 +236,55 @@
236236
<ul class="pagination">
237237
{% if params.previous %}
238238
<li class="page-item">
239-
<a class="page-link bg-dark text-light" rel="prev" href="{{ path(params.route, parameters|merge({'page': params.previous})) }}">&laquo;&nbsp;{{ 'previous'|trans }}</a>
239+
<a class="page-link bg-{{ themeColor1 }} text-{{ themeColor2 }}" rel="prev" href="{{ path(params.route, parameters|merge({'page': params.previous})) }}">&laquo;&nbsp;{{ 'previous'|trans }}</a>
240240
</li>
241241
{% else %}
242242
<li class="page-item disabled">
243-
<span class="page-link bg-dark text-secondary">&laquo;&nbsp;{{ 'previous'|trans }}</span>
243+
<span class="page-link bg-{{ themeColor1 }} text-secondary">&laquo;&nbsp;{{ 'previous'|trans }}</span>
244244
</li>
245245
{% endif %}
246246

247247
{% if params.first %}
248248
<li class="page-item">
249-
<a class="page-link bg-dark text-light" rel="next" href="{{ path(params.route, parameters|merge({'page': params.first})) }}">{{ params.first }}</a>
249+
<a class="page-link bg-{{ themeColor1 }} text-{{ themeColor2 }}" rel="next" href="{{ path(params.route, parameters|merge({'page': params.first})) }}">{{ params.first }}</a>
250250
</li>
251251
{% if params.first != params.start_page - 1 %}
252252
<li class="page-item disabled">
253-
<span class="page-link bg-dark text-secondary">&hellip;</span>
253+
<span class="page-link bg-{{ themeColor1 }} text-secondary">&hellip;</span>
254254
</li>
255255
{% endif %}
256256
{% endif %}
257257

258258
{% for page in params.pages_slice %}
259259
{% if page != params.page %}
260260
<li class="page-item">
261-
<a class="page-link bg-dark text-light" href="{{ path(params.route, parameters|merge({'page': page})) }}">{{ page }}</a>
261+
<a class="page-link bg-{{ themeColor1 }} text-{{ themeColor2 }}" href="{{ path(params.route, parameters|merge({'page': page})) }}">{{ page }}</a>
262262
</li>
263263
{% else %}
264264
<li class="page-item active">
265-
<span class="page-link bg-light text-dark border border-light">{{ page }}</span>
265+
<span class="page-link bg-{{ themeColor2 }} text-{{ themeColor1 }} border border-{{ themeColor2 }}">{{ page }}</span>
266266
</li>
267267
{% endif %}
268268
{% endfor %}
269269

270270
{% if params.last %}
271271
{% if params.last != params.end_page + 1 %}
272272
<li class="page-item disabled">
273-
<span class="page-link bg-dark text-secondary">&hellip;</span>
273+
<span class="page-link bg-{{ themeColor1 }} text-secondary">&hellip;</span>
274274
</li>
275275
{% endif %}
276276
<li class="page-item">
277-
<a class="page-link bg-dark text-light" rel="next" href="{{ path(params.route, parameters|merge({'page': params.last})) }}">{{ params.last }}</a>
277+
<a class="page-link bg-{{ themeColor1 }} text-{{ themeColor2 }}" rel="next" href="{{ path(params.route, parameters|merge({'page': params.last})) }}">{{ params.last }}</a>
278278
</li>
279279
{% endif %}
280280

281281
{% if params.next %}
282282
<li class="page-item">
283-
<a class="page-link bg-dark text-light" rel="next" href="{{ path(params.route, parameters|merge({'page': params.next})) }}">{{ 'next'|trans }}&nbsp;&raquo;</a>
283+
<a class="page-link bg-{{ themeColor1 }} text-{{ themeColor2 }}" rel="next" href="{{ path(params.route, parameters|merge({'page': params.next})) }}">{{ 'next'|trans }}&nbsp;&raquo;</a>
284284
</li>
285285
{% else %}
286286
<li class="page-item disabled">
287-
<span class="page-link bg-dark text-secondary">{{ 'next'|trans }}&nbsp;&raquo;</span>
287+
<span class="page-link bg-{{ themeColor1 }} text-secondary">{{ 'next'|trans }}&nbsp;&raquo;</span>
288288
</li>
289289
{% endif %}
290290
</ul>

templates/Modules/app_index_database_import/app_index_database_import_index.html.twig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<form name="data" method="post" action="{{ path('index_database_import_connect', {'index': index.name}) }}" id="form-connect">
3434
<div class="form-group mb-3">
3535
<label class="required form-label" for="driver">{{ 'database.driver'|trans }}</label>
36-
<select id="driver" name="driver" required="required" class="form-control bg-dark text-light">
36+
<select id="driver" name="driver" required="required" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }}">
3737
<option value="">-</option>
3838
{% for driver in drivers %}
3939
<option value="{{ driver }}">{{ driver }}</option>
@@ -43,29 +43,29 @@
4343

4444
<div class="form-group mb-3">
4545
<label for="host" class="required form-label">{{ 'database.host'|trans }}</label>
46-
<input type="text" id="host" name="host" required="required" class="form-control bg-dark text-light">
46+
<input type="text" id="host" name="host" required="required" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }}">
4747
</div>
4848

4949
<div class="form-group mb-3">
5050
<label for="user" class="required form-label">{{ 'database.user'|trans }}</label>
51-
<input type="text" id="user" name="user" required="required" autocomplete="nope" class="form-control bg-dark text-light">
51+
<input type="text" id="user" name="user" required="required" autocomplete="nope" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }}">
5252
</div>
5353

5454
<div class="form-group mb-3">
5555
<label for="password" class="required form-label">{{ 'database.password'|trans }}</label>
56-
<input type="password" id="password" name="password" required="required" autocomplete="new-password" class="form-control bg-dark text-light">
56+
<input type="password" id="password" name="password" required="required" autocomplete="new-password" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }}">
5757
</div>
5858

5959
<div class="form-group mb-3">
6060
<label for="dbname" class="required form-label">{{ 'database.dbname'|trans }}</label>
61-
<input type="text" id="dbname" name="dbname" required="required" class="form-control bg-dark text-light">
61+
<input type="text" id="dbname" name="dbname" required="required" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }}">
6262
</div>
6363
</div>
6464

6565
<div class="col-12 col-md-5 col-lg-4">
6666
<div class="form-group mb-3">
6767
<label for="query" class="required form-label">{{ 'database.query'|trans }}</label>
68-
<textarea id="query" name="query" required="required" class="form-control bg-dark text-light"></textarea>
68+
<textarea id="query" name="query" required="required" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }}"></textarea>
6969
</div>
7070

7171
<div class="form-group mb-3">
@@ -102,7 +102,7 @@
102102
<td>_id</td>
103103
<td>meta</td>
104104
<td>
105-
<select id="_id" name="_id" class="form-control bg-dark text-light select-column" data-field="_id">
105+
<select id="_id" name="_id" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }} select-column" data-field="_id">
106106
</select>
107107
</td>
108108
</tr>
@@ -111,7 +111,7 @@
111111
<td><label for="{{ field }}">{{ field }}</label></td>
112112
<td>{{ mapping['type'] }}</td>
113113
<td>
114-
<select id="{{ field }}" name="{{ field|replace({'.': '_DOT_'}) }}" class="form-control bg-dark text-light select-column" data-field="{{ field }}">
114+
<select id="{{ field }}" name="{{ field|replace({'.': '_DOT_'}) }}" class="form-control bg-{{ themeColor1 }} text-{{ themeColor2 }} select-column" data-field="{{ field }}">
115115
</select>
116116
</td>
117117
</tr>
@@ -153,14 +153,14 @@
153153
<div class="row">
154154
<div class="text-center mb-4 col-12 col-md-4 col-lg-3">
155155
<h4>{{ 'documents'|trans }}</h4>
156-
<h3><span class="badge bg-info text-light"></span></h3>
156+
<h3><span class="badge bg-info text-{{ themeColor2 }}"></span></h3>
157157
</div>
158158
</div>
159159

160160
<div class="table-responsive d-none" id="errors">
161161
<h4>{{ 'errors'|trans }}</h4>
162162

163-
<table class="table table-dark table-hover table-sm">
163+
<table class="table table-{{ themeColor1 }} table-hover table-sm">
164164

165165
<thead>
166166
<tr>

0 commit comments

Comments
 (0)