Skip to content

Commit 24af964

Browse files
Merge pull request #2144 from betagouv/refactor/reco-push-next-field#2027
✅ refactor(actions): Suppression du champs `next` du pousse reco
2 parents 1313c0b + 0b4b78b commit 24af964

6 files changed

Lines changed: 7 additions & 25 deletions

File tree

recoco/apps/projects/templates/projects/project/conversations_new.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ <h3 class="fr-mt-2w conversation-new__topics-list-member-subtitle">Equipe de sui
129129
is_staff : staff on current site
130130
{% endcomment %}
131131
{% if advising_position.is_advisor or is_switchtender or is_staff %}
132-
{% include "tools/editor.html" with model="message" input_name=posting_form.content.name initial_content=posting_form.content.value|default:'' errors=posting_form.content.errors input_required=True can_add_reco=True next_url_add_reco="projects-project-detail-conversations" can_attach_files=True can_attach_contact=True show_send_button=True form_id="conversation-form" placeholder="Écrivez votre message ici. Ajoutez des fichiers, contacts ou une recommandation…" can_compress_editor=True on_leave_alert=True is_notification_alert=True %}
132+
{% include "tools/editor.html" with model="message" input_name=posting_form.content.name initial_content=posting_form.content.value|default:'' errors=posting_form.content.errors input_required=True can_add_reco=True can_attach_files=True can_attach_contact=True show_send_button=True form_id="conversation-form" placeholder="Écrivez votre message ici. Ajoutez des fichiers, contacts ou une recommandation…" can_compress_editor=True on_leave_alert=True is_notification_alert=True %}
133133
{% else %}
134-
{% include "tools/editor.html" with model="message" input_name=posting_form.content.name initial_content=posting_form.content.value|default:'' errors=posting_form.content.errors input_required=True can_add_reco=False next_url_add_reco="projects-project-detail-conversations" can_attach_files=True can_attach_contact=False show_send_button=True form_id="conversation-form" placeholder="Écrivez votre message ici. Vous pouvez ajouter des fichiers." can_compress_editor=True on_leave_alert=True is_notification_alert=True %}
134+
{% include "tools/editor.html" with model="message" input_name=posting_form.content.name initial_content=posting_form.content.value|default:'' errors=posting_form.content.errors input_required=True can_add_reco=False can_attach_files=True can_attach_contact=False show_send_button=True form_id="conversation-form" placeholder="Écrivez votre message ici. Vous pouvez ajouter des fichiers." can_compress_editor=True on_leave_alert=True is_notification_alert=True %}
135135
{% endif %}
136136
<input type="hidden" name="contact" :value="message?.contact?.id">
137137
</div>

recoco/apps/tasks/forms.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def __init__(self, user, *args, **kwargs):
9696
)
9797

9898
push_type = forms.ChoiceField(choices=PUSH_TYPES)
99-
next = forms.CharField(required=False)
10099
project = forms.ModelChoiceField(
101100
queryset=projects_models.Project.objects.none(),
102101
empty_label="(Veuillez sélectionner un dossier)",
@@ -181,7 +180,6 @@ class UpdateTaskForm(forms.ModelForm):
181180

182181
content = MarkdownxFormField(required=False)
183182
topic_name = forms.CharField(required=False)
184-
next = forms.CharField(required=False)
185183

186184
class Meta:
187185
model = models.Task

recoco/apps/tasks/templates/tasks/tasks/task_create.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ <h2 class="push-reco__main-title">Créer une recommandation</h2>
2929
{% include "projects/project/fragments/action_pusher/type.html" %}
3030
{% include "projects/project/fragments/action_pusher/resource_search.html" %}
3131
{% include "projects/project/fragments/action_pusher/details_form.html" with form=type_form %}
32-
{% comment %} TODO remove this next field when recommendation tab will be removed {% endcomment %}
33-
<input type="hidden" name="next" value="{{ type_form.next.value }}">
3432
<input type="hidden" name="public" x-model="public">
3533
</form>
3634
</div>

recoco/apps/tasks/templates/tasks/tasks/task_update.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ <h1 class=" align-items-center">
3333
{% include "projects/project/fragments/action_pusher/type.html" with disable_multi=True %}
3434
{% include "projects/project/fragments/action_pusher/resource_search.html" %}
3535
{% include "projects/project/fragments/action_pusher/details_form.html" with disable_draft=task.public form=form %}
36-
{% comment %} TODO remove this next field when recommendation tab will be removed {% endcomment %}
37-
<input type="hidden" name="next" value="{{ form.next.value }}">
3836
<input type="hidden" name="public" x-model="public">
3937
{{ form.media }}
4038
</form>

recoco/apps/tasks/views/tasks.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,12 @@ def create_task(request):
124124
user=request.user,
125125
)
126126

127-
# Redirect to `action-inline` if we're coming
128-
# from `action-inline` after create
129-
# TODO remove the logic about 'next' field in the form when the recommendation tab is removed
130-
next_url = type_form.cleaned_data["next"]
131127
conversation_url = reverse(
132128
"projects-project-detail-conversations", args=[project.id]
133129
)
134-
if not next_url or next_url == "None":
135-
next_url = conversation_url
136-
137-
if not action.public and next_url == conversation_url:
138-
next_url += "#drafts"
139-
return redirect(next_url)
130+
if not action.public:
131+
conversation_url += "#drafts"
132+
return redirect(conversation_url)
140133

141134
else:
142135
type_form = PushTypeActionForm(request.user, request.GET)
@@ -300,16 +293,12 @@ def update_task(request, task_id=None):
300293
user=request.user,
301294
)
302295

303-
if form.cleaned_data["next"] and form.cleaned_data["next"] != "None":
304-
return redirect(form.cleaned_data["next"])
305-
306296
return redirect(
307297
reverse("projects-project-detail-conversations", args=[task.project_id])
308298
)
309299
else:
310300
initial = {
311301
"topic_name": task.topic.name if task.topic else None,
312-
"next": request.GET.get("next"),
313302
}
314303
form = UpdateTaskForm(instance=task, initial=initial)
315304
# Initialize preserved_content for template compatibility

recoco/templates/default_site/tools/editor.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
- initial_content: string
88
- can_attach_contact (boolean)
99
- can_add_reco (boolean)
10-
- next_url_add_reco (string)
1110
- input_name (string)
1211
- input_required (boolean)
1312
- input_file_name (string)
@@ -176,8 +175,8 @@
176175
class="common-dropdown common-dropdown__top-menu list-unstyled flex-column item-no-space">
177176
<li>
178177
<button class="fr-btn fr-btn--sm fr-btn--secondary w-100 justify-content-center"
179-
@click.prevent="goToCreateRecommendation(`{% url 'projects-create-task' %}?project_id={{ project.pk }}{% if next_url_add_reco %}&next={% url next_url_add_reco project.pk %}{% endif %}&content=${encodeURIComponent(markdownContent || '')}`)">
180-
Nouvelle recommandation
178+
@click.prevent="goToCreateRecommendation(`{% url 'projects-create-task' %}?project_id={{ project.pk }}&content=${encodeURIComponent(markdownContent || '')}`)">
179+
Recommandation vierge
181180
</button>
182181
</li>
183182
{% flag "suggest_reco_btn" %}

0 commit comments

Comments
 (0)