mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-01 20:43:49 +00:00
Merge branch 'master' into export
This commit is contained in:
@@ -16,13 +16,14 @@ Chill\ActivityBundle\Entity\Activity:
|
||||
type: text
|
||||
attendee:
|
||||
type: boolean
|
||||
manyToMany:
|
||||
reasons:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityReason
|
||||
manyToOne:
|
||||
user:
|
||||
targetEntity: Chill\MainBundle\Entity\User
|
||||
scope:
|
||||
targetEntity: Chill\MainBundle\Entity\Scope
|
||||
reason:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityReason
|
||||
type:
|
||||
targetEntity: Chill\ActivityBundle\Entity\ActivityType
|
||||
person:
|
||||
|
@@ -16,7 +16,8 @@ services:
|
||||
chill.activity.form.type.translatableactivitytype:
|
||||
class: Chill\ActivityBundle\Form\Type\TranslatableActivityType
|
||||
arguments:
|
||||
- "@request_stack"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
- "@chill_activity.repository.activity_type"
|
||||
tags:
|
||||
- { name: form.type, alias: translatable_activity_type }
|
||||
|
||||
@@ -27,6 +28,7 @@ services:
|
||||
- "@chill.main.security.authorization.helper"
|
||||
- "@doctrine.orm.entity_manager"
|
||||
- "@chill.main.helper.translatable_string"
|
||||
- "%chill_activity.form.time_duration%"
|
||||
tags:
|
||||
- { name: form.type, alias: chill_activitybundle_activity }
|
||||
|
||||
|
6
Resources/config/services/repositories.yml
Normal file
6
Resources/config/services/repositories.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
services:
|
||||
chill_activity.repository.activity_type:
|
||||
class: Doctrine\ORM\EntityRepository
|
||||
factory: ['@doctrine.orm.entity_manager', getRepository]
|
||||
arguments:
|
||||
- 'Chill\ActivityBundle\Entity\ActivityType'
|
79
Resources/migrations/Version20160222103457.php
Normal file
79
Resources/migrations/Version20160222103457.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace Application\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Migrate schema to allow multiple or empty reasons on an activity.
|
||||
*
|
||||
* The relation between the activity and reason **was** oneToMany. After this
|
||||
* migration, the relation will be manyToMany.
|
||||
*/
|
||||
class Version20160222103457 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema)
|
||||
{
|
||||
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
// create the new table activity reason
|
||||
$this->addSql('CREATE TABLE activity_activityreason ('
|
||||
. 'activity_id INT NOT NULL, '
|
||||
. 'activityreason_id INT NOT NULL, '
|
||||
. 'PRIMARY KEY(activity_id, activityreason_id))'
|
||||
);
|
||||
$this->addSql('CREATE INDEX IDX_338A864381C06096 ON activity_activityreason (activity_id)');
|
||||
$this->addSql('CREATE INDEX IDX_338A8643D771E0FC ON activity_activityreason (activityreason_id)');
|
||||
$this->addSql('ALTER TABLE activity_activityreason '
|
||||
. 'ADD CONSTRAINT FK_338A864381C06096 FOREIGN KEY (activity_id) '
|
||||
. 'REFERENCES Activity (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('ALTER TABLE activity_activityreason '
|
||||
. 'ADD CONSTRAINT FK_338A8643D771E0FC FOREIGN KEY (activityreason_id) '
|
||||
. 'REFERENCES ActivityReason (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
|
||||
// migrate old data to new table
|
||||
$this->addSql('INSERT INTO activity_activityreason (activity_id, activityreason_id) '
|
||||
. 'SELECT id, reason_id FROM activity WHERE reason_id IS NOT NULL');
|
||||
|
||||
|
||||
// remove old column
|
||||
$this->addSql('ALTER TABLE activity DROP CONSTRAINT fk_55026b0c59bb1592');
|
||||
$this->addSql('DROP INDEX idx_55026b0c59bb1592');
|
||||
$this->addSql('ALTER TABLE activity DROP reason_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema)
|
||||
{
|
||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'postgresql',
|
||||
'Migration can only be executed safely on \'postgresql\'.');
|
||||
|
||||
$this->addSql('ALTER TABLE Activity ADD reason_id INT DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE Activity ADD CONSTRAINT '
|
||||
. 'fk_55026b0c59bb1592 FOREIGN KEY (reason_id) '
|
||||
. 'REFERENCES activityreason (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||
$this->addSql('CREATE INDEX idx_55026b0c59bb1592 ON Activity (reason_id)');
|
||||
|
||||
// try to keep at least on activity reason...
|
||||
$this->addSql('UPDATE activity
|
||||
SET reason_id=rid
|
||||
FROM (
|
||||
SELECT activity_id AS aid, MIN(activityreason_id) AS rid
|
||||
FROM activity_activityreason
|
||||
GROUP BY activity_id ) AS sb
|
||||
WHERE sb.aid = activity.id'
|
||||
);
|
||||
|
||||
|
||||
$this->addSql('DROP TABLE activity_activityreason');
|
||||
|
||||
}
|
||||
}
|
@@ -4,7 +4,7 @@ Edit the activity: Modifier l'activité
|
||||
Activity: Activité
|
||||
Duration time: Durée
|
||||
Duration Time: Durée
|
||||
Reason: Sujet
|
||||
Reasons: Sujets
|
||||
Attendee: Présence de la personne
|
||||
Remark: Notes
|
||||
Add a new activity: Ajouter une nouvelle activité
|
||||
@@ -15,6 +15,8 @@ Delete: Supprimer
|
||||
Update: Mettre à jour
|
||||
Update activity: Édition de l'activité
|
||||
Scope: Cercle
|
||||
Activity data: Données de l'activité
|
||||
No reason associated: Aucun sujet
|
||||
|
||||
#forms
|
||||
Activity creation: Nouvelle activité
|
||||
@@ -22,6 +24,21 @@ Create: Créer
|
||||
Back to the list: Retour à la liste
|
||||
Save activity: Sauver l'activité
|
||||
Reset form: Remise à zéro du formulaire
|
||||
Choose the duration: Choisir la durée
|
||||
Choose a type: Choisir un type
|
||||
5 minutes: 5 minutes
|
||||
10 minutes: 10 minutes
|
||||
15 minutes: 15 minutes
|
||||
20 minutes: 20 minutes
|
||||
25 minutes: 25 minutes
|
||||
30 minutes: 30 minutes
|
||||
45 minutes: 45 minutes
|
||||
1 hour: 1 heure
|
||||
1 hour 15: 1 heure 15
|
||||
1 hour 30: 1 heure 30
|
||||
1 hour 45: 1 heure 45
|
||||
2 hours: 2 heures
|
||||
|
||||
|
||||
#timeline
|
||||
'%user% has done an %activity_type% on %date%': %user% a effectué une activité de type "%activity_type%" le %date%
|
||||
|
@@ -18,12 +18,24 @@
|
||||
|
||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||
|
||||
{% block title %}{{ 'Activity edit' |trans }}{% endblock title %}
|
||||
{% block title 'Update activity'|trans %}
|
||||
|
||||
{% block personcontent %}
|
||||
<h1>{{ "Update activity"|trans }}</h1>
|
||||
|
||||
{{ form_start(edit_form) }}
|
||||
|
||||
{{ form_row(edit_form.user) }}
|
||||
{{ form_row(edit_form.scope) }}
|
||||
|
||||
<h2>{{ 'Activity data'|trans }}</h2>
|
||||
{{ form_row(edit_form.date) }}
|
||||
{{ form_row(edit_form.durationTime) }}
|
||||
{{ form_row(edit_form.type) }}
|
||||
{{ form_row(edit_form.remark) }}
|
||||
{{ form_row(edit_form.attendee) }}
|
||||
{{ form_row(edit_form.reasons) }}
|
||||
|
||||
|
||||
{{ form_widget(edit_form) }}
|
||||
<div class="grid-12 centered sticky-form-buttons">
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#}
|
||||
{% extends "ChillPersonBundle::layout.html.twig" %}
|
||||
|
||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||
|
||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||
|
||||
{% block title %}{{ 'Activity list' |trans }}{% endblock title %}
|
||||
@@ -26,10 +28,9 @@
|
||||
<tr>
|
||||
<th class="chill-red">{{'Date' | trans }}</th>
|
||||
<th class="chill-green">{{'Duration Time' | trans }}</th>
|
||||
<th class="chill-orange">{{'Reason' | trans}}</th>
|
||||
<th class="chill-orange">{{'Reasons' | trans}}</th>
|
||||
<th>{{'Type' | trans}}</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -37,13 +38,22 @@
|
||||
<tr>
|
||||
<td>{% if activity.date %}{{ activity.date|localizeddate('long', 'none') }}{% endif %}</td>
|
||||
<td>{{ activity.durationTime|date('H:i') }}</td>
|
||||
<td>{{ activity.reason.name | localize_translatable_string }}</td>
|
||||
<td>
|
||||
{%- if activity.reasons is empty -%}
|
||||
{{ 'No reason associated'|trans }}
|
||||
{%- else -%}
|
||||
{% for r in activity.reasons %}{{ m.reason(r) }} {% endfor %}
|
||||
{%- endif -%}
|
||||
</td>
|
||||
<td>{{ activity.type.name | localize_translatable_string }}</td>
|
||||
<td>
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button black">{{ 'Show' | trans }}</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-update">{{ 'Edit' | trans }}</a>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_show', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button">{{ 'show'|trans|capitalize }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_activity_activity_edit', { 'id': activity.id, 'person_id': person.id }) }}" class="sc-button bt-update">{{ 'Edit' | trans }}</a>
|
||||
</li>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@@ -18,14 +18,25 @@
|
||||
|
||||
{% set activeRouteKey = 'chill_activity_activity_new' %}
|
||||
|
||||
{% block title %}{{ 'Activity create' |trans }}{% endblock title %}
|
||||
{% block title 'Activity creation' |trans %}
|
||||
|
||||
{% block personcontent %}
|
||||
<h2 class="chill-red">{{ "Activity creation"|trans }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_widget(form) }}
|
||||
|
||||
{{ form_row(form.user) }}
|
||||
{{ form_row(form.scope) }}
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
|
||||
{{ form_row(form.date) }}
|
||||
{{ form_row(form.durationTime) }}
|
||||
{{ form_row(form.type) }}
|
||||
{{ form_row(form.remark) }}
|
||||
{{ form_row(form.attendee) }}
|
||||
{{ form_row(form.reasons) }}
|
||||
|
||||
<div class="grid-12 centered sticky-form-buttons">
|
||||
<button class="sc-button green margin-10" type="submit"><i class="fa fa-save"></i> {{ 'Add a new activity'|trans }}</button>
|
||||
</div>
|
||||
|
@@ -2,32 +2,42 @@
|
||||
|
||||
{% set activeRouteKey = 'chill_activity_activity_list' %}
|
||||
|
||||
{% block title 'Activity'|trans %}
|
||||
|
||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||
|
||||
{% block personcontent -%}
|
||||
<h2 class="chill-red">{{ "Activity"|trans }}</h1>
|
||||
<h1 >{{ "Activity"|trans }}</h1>
|
||||
|
||||
<dl>
|
||||
<dt class="inline">{{ 'Person'|trans }}</dt>
|
||||
<dd>{{ entity.person }}</dd>
|
||||
<dl class="chill_view_data">
|
||||
<dt class="inline">{{ 'User'|trans }}</dt>
|
||||
<dd>{{ entity.user }}</dd>
|
||||
<dt class="inline">{{ 'Scope'|trans }}</dt>
|
||||
<dd><span class="scope">{{ entity.scope.name|localize_translatable_string }}</span></dd>
|
||||
|
||||
<h2 class="chill-red">{{ 'Activity data'|trans }}</h2>
|
||||
<dt class="inline">{{ 'Person'|trans }}</dt>
|
||||
<dd>{{ entity.person }}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Date'|trans }}</dt>
|
||||
<dd>{{ entity.date|localizeddate('long', 'none') }}</dd>
|
||||
<dt class="inline">{{ 'Duration Time'|trans }}</dt>
|
||||
<dd>{{ entity.durationTime|date('H:i') }}</dd>
|
||||
<dt class="inline">{{ 'User'|trans }}</dt>
|
||||
<dd>{{ entity.user }}</dd>
|
||||
<dt class="inline">{{ 'Reason'|trans }}</dt>
|
||||
<dd>{{ entity.reason.name | localize_translatable_string }}</dd>
|
||||
<dt class="inline">{{ 'Type'|trans }}</dt>
|
||||
<dd>{{ entity.type.name | localize_translatable_string }}</dd>
|
||||
<dt class="inline">{{ 'Remark'|trans }}</dt>
|
||||
<dd>{% if entity.remark is empty %}{{ 'No remarks'|trans }}{% else %}<blockquote class="chill-user-quote">{{ entity.remark|nl2br }}</blockquote>{% endif %}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Attendee'|trans }}</dt>
|
||||
<dd>{% if entity.attendee is not null %}{% if entity.attendee %}{{ 'present'|trans|capitalize }} {% else %} {{ 'not present'|trans|capitalize }}{% endif %}{% else %}{{ 'None'|trans|capitalize }}{% endif %}</dd>
|
||||
<dt class="inline">{{ 'Remark'|trans }}</dt>
|
||||
<dd>{% if entity.remark is empty %}{{ 'No remarks'|trans }}{% else %}<pre>{{ entity.remark }}</pre>{% endif %}</dd>
|
||||
<dt class="inline">{{ ''|trans }}</dt>
|
||||
<dd></dd>
|
||||
<dt class="inline">{{ ''|trans }}</dt>
|
||||
<dd></dd>
|
||||
|
||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||
{%- if entity.reasons is empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{% for r in entity.reasons %}{{ m.reason(r) }} {% endfor %}</dd>
|
||||
{%- endif -%}
|
||||
|
||||
</dl>
|
||||
|
||||
<a class="sc-button bt-update" href="{{ path('chill_activity_activity_edit', { 'id': entity.id, 'person_id': person.id }) }}">
|
||||
|
3
Resources/views/ActivityReason/macro.html.twig
Normal file
3
Resources/views/ActivityReason/macro.html.twig
Normal file
@@ -0,0 +1,3 @@
|
||||
{%- macro reason(r) -%}
|
||||
<span class="entity entity-activity activity-reason"><i class="fa fa-question-circle"></i> {{ r.name | localize_translatable_string }}</span>
|
||||
{%- endmacro -%}
|
Reference in New Issue
Block a user