Skip to content

Commit

Permalink
EditCounter: add CSV to download formats for the timecard
Browse files Browse the repository at this point in the history
Fix wikitext output

Bug: T346608
  • Loading branch information
MusikAnimal committed Jan 15, 2024
1 parent 8345d09 commit e4cf514
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions templates/editCounter/timecard.csv.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% set days = {
1: msg('sunday'),
2: msg('monday'),
3: msg('tuesday'),
4: msg('wednesday'),
5: msg('thursday'),
6: msg('friday'),
7: msg('saturday')
}%},{% for period in 0..23 %}{{ period }}:00{% if not(loop.last) %},{% endif %}{% endfor %}
{% for day in 1..7 %}

{{ days[day] }},{% for item in ec.timeCard|filter(item => item.day_of_week == day and item.hour != 24) %}{{ item.value }}{% if not(loop.last) %},{% endif %}{% endfor %}{% endfor %}
2 changes: 1 addition & 1 deletion templates/editCounter/timecard.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% import 'macros/layout.html.twig' as layout %}

{% block downloadLink %}
{{ layout.downloadLink('EditCounterTimecard', {project:project.domain, username:user.usernameIdent}, ['wikitext'], 'UserApiTimeCard') }}
{{ layout.downloadLink('EditCounterTimecard', {project:project.domain, username:user.usernameIdent}, ['wikitext', 'csv'], 'UserApiTimeCard') }}
{% endblock %}

{% block ecBody %}
Expand Down
4 changes: 2 additions & 2 deletions templates/editCounter/timecard.wikitext.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

{| class="wikitable"
!
{% for period in 0..11 %}
! {{ period * 2 }}:00
{% for period in 0..23 %}
! {{ period }}:00
{% endfor %}
|-
{% for day in 1..7 %}
Expand Down

0 comments on commit e4cf514

Please sign in to comment.