Skip to content

Commit 743dd52

Browse files
committed
fix: templates code style
1 parent 1cef289 commit 743dd52

14 files changed

Lines changed: 35 additions & 42 deletions

templates/components/form/fields_macros.html.twig

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,12 @@
2929
# -------------------------------------------------------------------------
3030
#}
3131

32-
{% import 'components/form/fields_macros.html.twig' as fields %}
33-
3432
{% macro timeField(name, value, label = '', options = {}) %}
3533
{% import 'components/form/fields_macros.html.twig' as fields %}
3634
{% set options = {
3735
'rand': random(),
3836
'disabled': false
39-
}|merge(options)
40-
%}
37+
}|merge(options) %}
4138

4239
{% if options.disabled %}
4340
{% set options = options|merge({specific_tags: {'disabled': 'disabled'}}) %}
@@ -68,9 +65,8 @@
6865
{% set name = "#{name}[]" %}
6966
{% endif %}
7067
{% set options = {
71-
'rand': random(),
72-
'disabled': false}|merge(options)
73-
%}
68+
'rand': random(),
69+
'disabled': false}|merge(options) %}
7470
{% if options.fields_template.isMandatoryField(name)|default(false) %}
7571
{% set options = {'specific_tags': {'required': true}}|merge(options) %}
7672
{% endif %}

templates/computerusageprofile.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
'name',
3939
item.fields['name'],
4040
__('Name'),
41-
{ required: true }
41+
{required: true}
4242
) }}
4343

4444
{{ fields.nullField({
@@ -103,4 +103,4 @@
103103
__('Sunday'),
104104
field_options
105105
) }}
106-
{% endblock %}
106+
{% endblock %}

templates/config.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
current_config['impact_engine'],
6363
impact_engines,
6464
__('Impact engine', 'carbon')
65-
)}}
65+
) }}
6666

6767
{{ fields.largeTitle(
6868
__('Boavizta', 'carbon'),

templates/dashboard/apex_radar.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@
9494
chart.render();
9595
});
9696
</script>
97-
{% endblock %}
97+
{% endblock %}

templates/dashboard/information-block.html.twig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@
6868
<span><img src="{{ icon_url }}" /></span>
6969
</div>
7070
<div class="col">
71-
<p class="m-0 pt-3 pb-3">{{ __('Our data is sourced from reliable sources and is meticulously calculated using industry-standard methodologies. We utilize accurate measurement tools and algorithms to ensure the precision and reliability of our environmental metrics.','carbon') }}</p>
72-
<p class="m-0 pb-4 pt-3">{{ __('As we move towards a greener future, businesses will soon be required to report energy usage and carbon emissions. By 2025, many areas will enforce these regulations. Adopting these practices now ensures compliance and helps combat climate change.','carbon') }}</p>
71+
<p class="m-0 pt-3 pb-3">{{ __('Our data is sourced from reliable sources and is meticulously calculated using industry-standard methodologies. We utilize accurate measurement tools and algorithms to ensure the precision and reliability of our environmental metrics.', 'carbon') }}</p>
72+
<p class="m-0 pb-4 pt-3">{{ __('As we move towards a greener future, businesses will soon be required to report energy usage and carbon emissions. By 2025, many areas will enforce these regulations. Adopting these practices now ensures compliance and helps combat climate change.', 'carbon') }}</p>
7373
</div>
7474
</div>
7575
<div class="row">
76-
<h4 class="pt-3">{{ __('Did you know ?','carbon') }}</h4>
77-
<p class="m-0 pb-2">{{ __('1 gram of CO₂ is equivalent to the CO₂ emitted when you drive a car for about 20 meters.','carbon') }}</p>
76+
<h4 class="pt-3">{{ __('Did you know ?', 'carbon') }}</h4>
77+
<p class="m-0 pb-2">{{ __('1 gram of CO₂ is equivalent to the CO₂ emitted when you drive a car for about 20 meters.', 'carbon') }}</p>
7878
</div>
7979
</div>
8080
</div>
81-
</div>
81+
</div>

templates/dashboard/information-video-card.html.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
</style>
5454
<div class="card" id="{{ id }}">
5555
<div class="card-body">
56-
<h3 class="card-title">{{__('Want to know more ?','carbon')}}</h3>
57-
<p class="text-secondary">{{ __('Here is a video about the impact of numeric on the enviromnent.','carbon')}}</p>
56+
<h3 class="card-title">{{ __('Want to know more ?', 'carbon') }}</h3>
57+
<p class="text-secondary">{{ __('Here is a video about the impact of numeric on the enviromnent.', 'carbon') }}</p>
5858
</div>
5959
<!-- Card footer -->
6060
<div class="d-flex justify-content-center">
6161
<a href="https://www.youtube.com/watch?v=o4_DLOuGToQ" target="_blank" class="btn">Go see the video</a>
6262
</div>
63-
</div>
63+
</div>

templates/dashboard/unhandled-computers-card.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@
6363
</div>
6464
<div class="row">
6565
<div class="col align-items-center">
66-
{% set totalComputers = handled.number + unhandled.number %}
67-
{% if totalComputers == 0 %}
68-
{% set totalComputers = 1 %}
66+
{% set total_computers = handled.number + unhandled.number %}
67+
{% if total_computers == 0 %}
68+
{% set total_computers = 1 %}
6969
{% endif %}
70-
{% set ratio = 100 * unhandled.number / totalComputers %}
70+
{% set ratio = 100 * unhandled.number / total_computers %}
7171
<div class="text-secondary p-3">
7272
{{ __("It represents %s percent of your parc that contains %s computers.", "carbon")|format(ratio|round(2, 'common'), totalComputers) }}
7373
</div>

templates/dashboard/unhandled-monitors-card.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@
6363
</div>
6464
<div class="row">
6565
<div class="col align-items-center">
66-
{% set totalMonitors = handled.number + unhandled.number %}
67-
{% if totalMonitors == 0 %}
68-
{% set totalMonitors = 1 %}
66+
{% set total_monitors = handled.number + unhandled.number %}
67+
{% if total_monitors == 0 %}
68+
{% set total_monitors = 1 %}
6969
{% endif %}
70-
{% set ratio = 100 * unhandled.number / totalMonitors %}
70+
{% set ratio = 100 * unhandled.number / total_monitors %}
7171
<div class="text-secondary p-3">
7272
{{ __("It represents %s percent of your parc that contains %s monitors.", "carbon")|format(ratio|round(2, 'common'), totalMonitors) }}
7373
</div>

templates/dashboard/unhandled-network-equipments-card.html.twig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@
6363
</div>
6464
<div class="row">
6565
<div class="col align-items-center">
66-
{% set totalNetworkEquipments = handled.number + unhandled.number %}
67-
{% if totalNetworkEquipments == 0 %}
68-
{% set totalNetworkEquipments = 1 %}
66+
{% set total_network_equipments = handled.number + unhandled.number %}
67+
{% if total_network_equipments == 0 %}
68+
{% set total_network_equipments = 1 %}
6969
{% endif %}
70-
{% set ratio = 100 * unhandled.number / totalNetworkEquipments %}
70+
{% set ratio = 100 * unhandled.number / total_network_equipments %}
7171
<div class="text-secondary p-3">
7272
{{ __("It represents %s percent of your parc that contains %s network equipments.", "carbon")|format(ratio|round(2, 'common'), totalNetworkEquipments) }}
7373
</div>

templates/environmentalimpact-item.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<div>
6161
{% if not usage_impact.isNewItem() or usage_carbon_emission_count > 0 %}
6262
{% set reset_args = "{_glpi_csrf_token: '" ~ csrf_token() ~ "', reset: '', itemtype: '" ~ asset.getType() ~ "', items_id: '" ~ asset.getID() ~ "'}" %}
63-
<a class="btn btn-primary" onclick="submitGetLink('{{ usage_impact_action_url}}', {{ reset_args }})">{{ __('Reset data', 'carbon') }}</a>
63+
<a class="btn btn-primary" onclick="submitGetLink('{{ usage_impact_action_url }}', {{ reset_args }})">{{ __('Reset data', 'carbon') }}</a>
6464
{% endif %}
6565
{% set calculate_args = "{_glpi_csrf_token: '" ~ csrf_token() ~ "', calculate: '', itemtype: '" ~ asset.getType() ~ "', items_id: '" ~ asset.getID() ~ "'}" %}
6666
<a class="btn btn-primary" onclick="submitGetLink('{{ usage_impact_action_url }}', {{ calculate_args }})">{{ __('Calculate data', 'carbon') }}</a>

0 commit comments

Comments
 (0)