From c068bd21448c2e202720a9daf2923a375c96370d Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Fri, 1 Jul 2022 10:36:20 +0200 Subject: Create "Add Repository" form and view Creates "Add repository" form with the required inputs: name and IP. --- ogcp/forms/action_forms.py | 7 +++++++ ogcp/templates/actions/add_repository.html | 17 ++++++++++++++++ ogcp/templates/repositories.html | 2 ++ ogcp/views.py | 31 +++++++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 ogcp/templates/actions/add_repository.html (limited to 'ogcp') diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index 1ee7b72..b1da58b 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -185,3 +185,10 @@ class ImageDetailsForm(FlaskForm): modified = StringField(label=_l('Modified')) permissions = StringField(label=_l('Permissions')) software_id = StringField(label=_l('Software id')) + +class RepositoryForm(FlaskForm): + name = StringField(label=_l('Name'), + validators=[InputRequired()]) + ip = StringField(label=_l('IP'), + validators=[InputRequired()]) + submit = SubmitField(label=_l('Submit')) diff --git a/ogcp/templates/actions/add_repository.html b/ogcp/templates/actions/add_repository.html new file mode 100644 index 0000000..e7c50fa --- /dev/null +++ b/ogcp/templates/actions/add_repository.html @@ -0,0 +1,17 @@ +{% extends 'repositories.html' %} +{% import "bootstrap/wtf.html" as wtf %} + +{% set sidebar_state = 'disabled' %} +{% set btn_back = true %} + +{% block nav_repository_add %}active{% endblock %} +{% block content %} + +

{{_('Add a repository')}}

+ +{{ wtf.quick_form(form, + action=url_for('repository_add_post'), + method='post', + button_map={'submit_btn':'primary'}) }} + +{% endblock %} diff --git a/ogcp/templates/repositories.html b/ogcp/templates/repositories.html index 3bed073..2333a88 100644 --- a/ogcp/templates/repositories.html +++ b/ogcp/templates/repositories.html @@ -24,6 +24,8 @@ {% endblock %} {% block commands %} + {% if btn_back %}