mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fixed: [calendar] Fix picking calendar document templating, when adding document in person context
This commit is contained in:
parent
57e1786b99
commit
788b1e9eeb
@ -72,11 +72,21 @@ class CalendarDocController
|
||||
);
|
||||
}
|
||||
|
||||
return new Response(
|
||||
$this->engine->render('@ChillCalendar/CalendarDoc/pick_template.html.twig', [
|
||||
'calendar' => $calendar,
|
||||
'accompanyingCourse' => $calendar->getAccompanyingPeriod(),
|
||||
])
|
||||
);
|
||||
switch ($calendar->getContext()) {
|
||||
case 'person':
|
||||
return new Response(
|
||||
$this->engine->render('@ChillCalendar/CalendarDoc/pick_template_person.html.twig', [
|
||||
'calendar' => $calendar,
|
||||
])
|
||||
);
|
||||
case 'accompanying_period':
|
||||
return new Response(
|
||||
$this->engine->render('@ChillCalendar/CalendarDoc/pick_template_accompanying_period.html.twig', [
|
||||
'calendar' => $calendar,
|
||||
])
|
||||
);
|
||||
default:
|
||||
throw new \UnexpectedValueException("calendar context not expected : " . $calendar->getContext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
{% block title %}{{ 'chill_calendar.Add a document' |trans }}{% endblock title %}
|
||||
|
||||
{% set user_id = null %}
|
||||
{% set accompanyingCourse = calendar.accompanyingPeriod %}
|
||||
{% set accompanying_course_id = accompanyingCourse.id %}
|
||||
|
||||
{% block js %}
|
||||
@ -19,6 +20,18 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ 'chill_calendar.Add a document'|trans }}</h1>
|
||||
|
||||
<p>
|
||||
{% if calendar.endDate.diff(calendar.startDate).days >= 1 %}
|
||||
{{ calendar.startDate|format_datetime('short', 'short') }}
|
||||
- {{ calendar.endDate|format_datetime('short', 'short') }}
|
||||
{% else %}
|
||||
{{ calendar.startDate|format_datetime('short', 'short') }}
|
||||
- {{ calendar.endDate|format_datetime('none', 'short') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-id="{{ calendar.id }}" data-entity-class="{{ 'Chill\\CalendarBundle\\Entity\\Calendar'|e('html_attr') }}"></div>
|
||||
|
||||
{% endblock %}
|
@ -0,0 +1,35 @@
|
||||
{% extends "@ChillPerson/Person/layout.html.twig" %}
|
||||
|
||||
{% set activeRouteKey = 'chill_calendar_calendar_list' %}
|
||||
|
||||
{% block title %}{{ 'chill_calendar.Add a document' |trans }}{% endblock title %}
|
||||
|
||||
{% set person = calendar.person %}
|
||||
|
||||
{% block js %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_script_tags('mod_docgen_picktemplate') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block css %}
|
||||
{{ parent() }}
|
||||
{{ encore_entry_link_tags('mod_docgen_picktemplate') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ 'chill_calendar.Add a document'|trans }}</h1>
|
||||
|
||||
<p>
|
||||
{% if calendar.endDate.diff(calendar.startDate).days >= 1 %}
|
||||
{{ calendar.startDate|format_datetime('short', 'short') }}
|
||||
- {{ calendar.endDate|format_datetime('short', 'short') }}
|
||||
{% else %}
|
||||
{{ calendar.startDate|format_datetime('short', 'short') }}
|
||||
- {{ calendar.endDate|format_datetime('none', 'short') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<div data-docgen-template-picker="data-docgen-template-picker" data-entity-id="{{ calendar.id }}" data-entity-class="{{ 'Chill\\CalendarBundle\\Entity\\Calendar'|e('html_attr') }}"></div>
|
||||
|
||||
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user