From b6a121e7992c414f84d600f98d4c77620a667156 Mon Sep 17 00:00:00 2001 From: qlands Date: Mon, 16 Aug 2021 18:21:41 -0600 Subject: [PATCH] Implements create new ontology --- cropontology/config/routes.py | 11 +++- .../templates/ontology/add_ontology.jinja2 | 39 ++++++++++++++ .../ontology/snippets/breadcrums_add.jinja2 | 13 +++++ cropontology/templates/pages/add_page.jinja2 | 1 + cropontology/templates/pages/edit_page.jinja2 | 1 + .../templates/sections/add_section.jinja2 | 1 + .../templates/sections/edit_section.jinja2 | 1 + .../templates/snippets/navbar_main.jinja2 | 3 ++ cropontology/views/ontology.py | 53 ++++++++++++++++++- cropontology/views/public_views.py | 5 +- cropontology/views/template.py | 6 +++ cropontology/views/term.py | 3 ++ 12 files changed, 133 insertions(+), 4 deletions(-) create mode 100644 cropontology/templates/ontology/add_ontology.jinja2 create mode 100644 cropontology/templates/ontology/snippets/breadcrums_add.jinja2 diff --git a/cropontology/config/routes.py b/cropontology/config/routes.py index 6c51c04..8a12d34 100644 --- a/cropontology/config/routes.py +++ b/cropontology/config/routes.py @@ -47,7 +47,7 @@ SectionRemoveUserView, ) -from ..views.ontology import OntologyView, JSONDataView, OntologyRDFView +from ..views.ontology import OntologyView, JSONDataView, CreateOntology from ..views.api import APIDocView from ..views.brapi import ( BRAPITraitsView, @@ -251,6 +251,15 @@ def load_routes(config): ) ) + routes.append( + add_route( + "create_ontology", + "/ontologies/create", + CreateOntology, + "ontology/add_ontology.jinja2", + ) + ) + routes.append( add_route( "ontology_owl", diff --git a/cropontology/templates/ontology/add_ontology.jinja2 b/cropontology/templates/ontology/add_ontology.jinja2 new file mode 100644 index 0000000..a8bd773 --- /dev/null +++ b/cropontology/templates/ontology/add_ontology.jinja2 @@ -0,0 +1,39 @@ +{% extends 'page.jinja2' %} +{% import 'macros/form.jinja2' as form %} + +{% block breadcrums %} + {% include 'ontology/snippets/breadcrums_add.jinja2' %} +{% endblock breadcrums %} + +{% block main_container %} +
+
+
+
+
{{ _('Information for the new ontology') }}
+
+ {{ form.display_errors(errors) }} +
+ {{ form.secure_form(request) }} +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+{% endblock main_container %} \ No newline at end of file diff --git a/cropontology/templates/ontology/snippets/breadcrums_add.jinja2 b/cropontology/templates/ontology/snippets/breadcrums_add.jinja2 new file mode 100644 index 0000000..2ec00da --- /dev/null +++ b/cropontology/templates/ontology/snippets/breadcrums_add.jinja2 @@ -0,0 +1,13 @@ +
+
+
+

{{ _('Ontologies') }}
{{ _('Add new ontology') }}

+
+
+ +
+
+
\ No newline at end of file diff --git a/cropontology/templates/pages/add_page.jinja2 b/cropontology/templates/pages/add_page.jinja2 index 647c076..f3e4716 100644 --- a/cropontology/templates/pages/add_page.jinja2 +++ b/cropontology/templates/pages/add_page.jinja2 @@ -12,6 +12,7 @@
{{ _('Information for the new page') }}
+ {{ form.display_errors(errors) }}
{{ form.secure_form(request) }}
diff --git a/cropontology/templates/pages/edit_page.jinja2 b/cropontology/templates/pages/edit_page.jinja2 index 0b632cf..2d9d95e 100644 --- a/cropontology/templates/pages/edit_page.jinja2 +++ b/cropontology/templates/pages/edit_page.jinja2 @@ -12,6 +12,7 @@
{{ _('Current content of ') }} {{ form_data.page_desc }}
+ {{ form.display_errors(errors) }} {{ form.secure_form(request) }}
diff --git a/cropontology/templates/sections/add_section.jinja2 b/cropontology/templates/sections/add_section.jinja2 index 1e2228a..6912a69 100644 --- a/cropontology/templates/sections/add_section.jinja2 +++ b/cropontology/templates/sections/add_section.jinja2 @@ -12,6 +12,7 @@
{{ _('Information for the new section') }}
+ {{ form.display_errors(errors) }} {{ form.secure_form(request) }}
diff --git a/cropontology/templates/sections/edit_section.jinja2 b/cropontology/templates/sections/edit_section.jinja2 index fd90841..9d68467 100644 --- a/cropontology/templates/sections/edit_section.jinja2 +++ b/cropontology/templates/sections/edit_section.jinja2 @@ -12,6 +12,7 @@
{{ _('Current content of ') }} {{ form_data.section_desc }}
+ {{ form.display_errors(errors) }} {{ form.secure_form(request) }}
diff --git a/cropontology/templates/snippets/navbar_main.jinja2 b/cropontology/templates/snippets/navbar_main.jinja2 index b3bbc70..ff18f8c 100644 --- a/cropontology/templates/snippets/navbar_main.jinja2 +++ b/cropontology/templates/snippets/navbar_main.jinja2 @@ -28,6 +28,9 @@