From 9e386e5454ca6108e5c45664ca24aab79f41af48 Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Mon, 4 Jul 2022 15:29:49 +0200 Subject: Add "Delete Repository" In "Repositories" view, users select a repository from the list on the left and press "Delete repository". --- ogcp/forms/action_forms.py | 5 ++++ ogcp/templates/actions/delete_repository.html | 23 ++++++++++++++++++ ogcp/templates/repositories.html | 2 ++ ogcp/views.py | 35 ++++++++++++++++++++++++++- 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 ogcp/templates/actions/delete_repository.html (limited to 'ogcp') diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index b1da58b..951ea06 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -192,3 +192,8 @@ class RepositoryForm(FlaskForm): ip = StringField(label=_l('IP'), validators=[InputRequired()]) submit = SubmitField(label=_l('Submit')) + +class DeleteRepositoryForm(FlaskForm): + repository = SelectField(label=_l('Repository'), + validators=[InputRequired()]) + submit = SubmitField(label=_l('Submit')) diff --git a/ogcp/templates/actions/delete_repository.html b/ogcp/templates/actions/delete_repository.html new file mode 100644 index 0000000..82177a3 --- /dev/null +++ b/ogcp/templates/actions/delete_repository.html @@ -0,0 +1,23 @@ +{% extends 'repositories.html' %} +{% import "bootstrap/wtf.html" as wtf %} + +{% set sidebar_state = 'disabled' %} +{% set btn_back = true %} + +{% block content %} + +{{ args }} + +

+ {{ _('Delete repository %(repo_name)s', repo_name=repo_name) }} +

+ +{{ wtf.quick_form(form, + action=url_for('repository_delete_post'), + method='post', + button_map={'submit': 'primary'}, + extra_classes="mx-5") }} + +{% endblock %} + + diff --git a/ogcp/templates/repositories.html b/ogcp/templates/repositories.html index 2333a88..7aa2d06 100644 --- a/ogcp/templates/repositories.html +++ b/ogcp/templates/repositories.html @@ -26,6 +26,8 @@ {% block commands %} + {% if btn_back %}