Skip to content

Commit

Permalink
refactor: For each app align name in apps.py, urls.py and template di…
Browse files Browse the repository at this point in the history
…rectory, and use more specific identifier by appending 'ddm_' to every app and template dir.
  • Loading branch information
Nico-AP committed Dec 3, 2024
1 parent 70628e3 commit a6c9bbf
Show file tree
Hide file tree
Showing 127 changed files with 273 additions and 273 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/base.html' %}
{% extends 'ddm_core/base.html' %}

{% load static %}

Expand All @@ -11,7 +11,7 @@
<div class="container row justify-content-center">
<div class="col-4 text-center mt-5">
<div class="row">
<img alt="Data Donation Module" height="100" alt="" src="{% static 'core/img/logos/DDM_Logo_Schwarz.svg' %}">
<img alt="Data Donation Module" height="100" alt="" src="{% static 'ddm_core/img/logos/DDM_Logo_Schwarz.svg' %}">
</div>

<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/base.html' %}
{% extends 'ddm_core/base.html' %}

{% load static %}

Expand All @@ -11,7 +11,7 @@
<div class="container row justify-content-center">
<div class="col-4 text-center mt-5">
<div class="row">
<img alt="Data Donation Module" height="100" alt="" src="{% static 'core/img/logos/DDM_Logo_Schwarz.svg' %}">
<img alt="Data Donation Module" height="100" alt="" src="{% static 'ddm_core/img/logos/DDM_Logo_Schwarz.svg' %}">
</div>

<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/base.html' %}
{% extends 'ddm_core/base.html' %}

{% block page_title %}Permission Denied{% endblock %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% block page_title %}Project Access Token{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion ddm/auth/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_redirect_if_anonymous(self):


class TestView(DDMAuthMixin, TemplateView):
template_name = 'auth/no_permission.html'
template_name = 'ddm_auth/no_permission.html'


@override_settings(DDM_SETTINGS={'EMAIL_PERMISSION_CHECK': r'.*(\.|@)mail\.com$', })
Expand Down
4 changes: 2 additions & 2 deletions ddm/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class DdmNoPermissionView(TemplateView):
* Unauthenticated users are redirected to the login page.
* Logged-in users with permission and a research profile are redirected to the project list.
"""
template_name = 'auth/no_permission.html'
template_name = 'ddm_auth/no_permission.html'

def dispatch(self, request, *args, **kwargs):
if request.method == 'GET':
Expand All @@ -73,7 +73,7 @@ def dispatch(self, request, *args, **kwargs):

class ProjectTokenView(SuccessMessageMixin, DDMAuthMixin, FormView):
""" View to see existing access token or generate a new one. """
template_name = 'auth/token.html'
template_name = 'ddm_auth/token.html'
form_class = TokenCreationForm

def get_project(self):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<meta charset="UTF-8">
<title>DDM: {% block page_title %}Title{% endblock %}</title>

<link rel="stylesheet" href="{% static 'core/css/bootstrap/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'core/css/ddm-base.css' %}">
<link rel="stylesheet" href="{% static 'projects/css/research-interface-base.css' %}">
<link rel="stylesheet" href="{% static 'core/css/bootstrap/bootstrap-icons.css' %}">
<link rel="stylesheet" href="{% static 'ddm_core/css/bootstrap/bootstrap.min.css' %}">
<link rel="stylesheet" href="{% static 'ddm_core/css/ddm-base.css' %}">
<link rel="stylesheet" href="{% static 'ddm_projects/css/research-interface-base.css' %}">
<link rel="stylesheet" href="{% static 'ddm_core/css/bootstrap/bootstrap-icons.css' %}">
{% block extrahead %}{% endblock %}
</head>

Expand All @@ -17,7 +17,7 @@
{% block header %}
<div class="ddm-header">
<div class="container fs-6 fw-light">
{% include "core/components/header.html" %}
{% include "ddm_core/components/header.html" %}
</div>
</div>
{% endblock %}
Expand Down Expand Up @@ -56,9 +56,9 @@ <h1>{% block main_heading %}{% endblock %}</h1>


{% block scripts %}
<script src="{% static 'core/js/jquery/jquery-3.6.2.min.js' %}"></script>
<script src="{% static 'core/js/bootstrap/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'projects/js/project-admin-base.js' %}"></script>
<script src="{% static 'ddm_core/js/jquery/jquery-3.6.2.min.js' %}"></script>
<script src="{% static 'ddm_core/js/bootstrap/bootstrap.bundle.min.js' %}"></script>
<script src="{% static 'ddm_projects/js/project-admin-base.js' %}"></script>
{% endblock %}

</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<nav class="navbar navbar-expand-lg navbar-light">
<a class="ddm-nav-icon" href="{% url 'ddm_projects:list' %}">
<img alt="Data Donation Module" height="40" alt=""
src="{% static 'core/img/logos/DDM_Logo_Schwarz.svg' %}">
src="{% static 'ddm_core/img/logos/DDM_Logo_Schwarz.svg' %}">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/base.html' %}
{% extends 'ddm_core/base.html' %}

{% block page_title %}Create {{ object_type }}{% endblock %}

Expand Down
8 changes: 4 additions & 4 deletions ddm/core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@

urlpatterns = [
path(r'', RedirectView.as_view(pattern_name='ddm_projects:list'), name='ddm_landing'),
path(r'studies/<slug:slug>/', include('ddm.participation.urls', namespace='participation')),
path(r'studies/<slug:slug>/', include('ddm.participation.urls', namespace='ddm_participation')),
path(r'projects/', include('ddm.projects.urls', namespace='ddm_projects')),
path(r'projects/<int:project_pk>/questionnaire/', include('ddm.questionnaire.urls', namespace='questionnaire')),
path(r'projects/<int:project_pk>/data-donation/', include('ddm.datadonation.urls', namespace='datadonation')),
path(r'', include('ddm.logging.urls', namespace='ddm_logs')),
path(r'projects/<int:project_pk>/questionnaire/', include('ddm.questionnaire.urls', namespace='ddm_questionnaire')),
path(r'projects/<int:project_pk>/data-donation/', include('ddm.datadonation.urls', namespace='ddm_datadonation')),
path(r'', include('ddm.logging.urls', namespace='ddm_logging')),
path(r'', include('ddm.auth.urls', namespace='ddm_auth')),
path(r'api/', include(api_patterns))
]
2 changes: 1 addition & 1 deletion ddm/datadonation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __str__(self):
return self.name

def get_absolute_url(self):
return reverse('datadonation:blueprints:edit', args=[str(self.project_id), str(self.id)])
return reverse('ddm_datadonation:blueprints:edit', args=[str(self.project_id), str(self.id)])

def get_slug(self):
return 'blueprint'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% load static %}

Expand All @@ -8,12 +8,12 @@

{% block submit_label %}Create File Blueprint{% endblock %}

{% block cancel_target %}{% url 'datadonation:overview' project.pk %}{% endblock %}
{% block cancel_target %}{% url 'ddm_datadonation:overview' project.pk %}{% endblock %}

{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project.pk %}">"{{ project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project.pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:overview' project.pk %}">Data Donation</a> /
Create File Blueprint
{% endblock %}

Expand Down Expand Up @@ -43,7 +43,7 @@ <h5>General Settings</h5>
<div class="ddm-admin-form">
<h5>File Validation Settings</h5>

{% include "core/components/info_collapsible.html" with element_id="filevalidation" title="How the file validation works" include_path="datadonation/blueprint/block_file_validation.html" body="" %}
{% include "ddm_core/components/info_collapsible.html" with element_id="filevalidation" title="How the file validation works" include_path="ddm_datadonation/blueprint/block_file_validation.html" body="" %}

{% for field in form %}
{% if field.name in "expected_fields,expected_fields_regex_matching,regex_path,exp_file_format,csv_delimiter,json_extraction_root" %}
Expand All @@ -63,13 +63,13 @@ <h5>File Validation Settings</h5>

<input class="ddm-btn" type="submit" value="Create Blueprint">
<p class="mt-3">
<a href="{% url 'datadonation:overview' project.pk %}">&#129040; Back</a>
<a href="{% url 'ddm_datadonation:overview' project.pk %}">&#129040; Back</a>
</p>
</form>
{% endblock %}

{% block scripts %}
{{ block.super }}
{{ file_uploader_meta|json_script:'file_uploader_meta' }}
<script src="{% static 'datadonation/js/blueprint-general-ui-helpers.js' %}"></script>
<script src="{% static 'ddm_datadonation/js/blueprint-general-ui-helpers.js' %}"></script>
{% endblock scripts %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% block page_title %}Delete File Blueprint{% endblock %}

Expand Down Expand Up @@ -48,7 +48,7 @@
<p><b>Are you sure you want to delete this blueprint along with all associated data donations, and questions? This action cannot be reversed.</b></p>
<input class="ddm-btn ddm-btn-red" type="submit" value="Delete Donation Blueprint">
<p class="mt-3">
<a href="{% url 'datadonation:overview' project.pk %}">&#129040; Cancel</a>
<a href="{% url 'ddm_datadonation:overview' project.pk %}">&#129040; Cancel</a>
</p>
</form>
{% endblock %}
Expand All @@ -59,6 +59,6 @@
{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project.pk %}">"{{ project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project.pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:overview' project.pk %}">Data Donation</a> /
Delete Blueprint
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% load static %}

Expand Down Expand Up @@ -32,7 +32,7 @@ <h5>General Settings</h5>
<div class="ddm-admin-form">
<h5>File Validation Settings</h5>

{% include "core/components/info_collapsible.html" with element_id="filevalidation" title="How the file validation works" include_path="datadonation/blueprint/block_file_validation.html" body="" %}
{% include "ddm_core/components/info_collapsible.html" with element_id="filevalidation" title="How the file validation works" include_path="ddm_datadonation/blueprint/block_file_validation.html" body="" %}

{% for field in form %}
{% if field.name in "expected_fields,expected_fields_regex_matching,regex_path,exp_file_format,csv_delimiter,json_extraction_root" %}
Expand All @@ -50,7 +50,7 @@ <h5>File Validation Settings</h5>

<div class="ddm-admin-form">
<h5>Data Extraction Settings</h5>
{% include "core/components/info_collapsible.html" with element_id="dataextraction" title="How the data extraction works" include_path="datadonation/blueprint/block_data_extraction.html" body="" %}
{% include "ddm_core/components/info_collapsible.html" with element_id="dataextraction" title="How the data extraction works" include_path="ddm_datadonation/blueprint/block_data_extraction.html" body="" %}

{{ formset.management_form }}

Expand Down Expand Up @@ -107,10 +107,10 @@ <h5>Data Extraction Settings</h5>

{% for form in formset%}
{% with modal_id_postfix=forloop.counter0|stringformat:"i" button_id_postfix=forloop.counter0|stringformat:"i" %}
{% include "datadonation/processing_rule_modal.html" with modal_id="configuration-"|add:modal_id_postfix form=form button_id=""|add:button_id_postfix %}
{% include "ddm_datadonation/processing_rule_modal.html" with modal_id="configuration-"|add:modal_id_postfix form=form button_id=""|add:button_id_postfix %}
{% endwith %}
{% empty %}
{% include "datadonation/processing_rule_modal.html" with modal_id="configuration-template" form=formset.empty_form button_id="__prefix__" %}
{% include "ddm_datadonation/processing_rule_modal.html" with modal_id="configuration-template" form=formset.empty_form button_id="__prefix__" %}
{% endfor %}

<table id="empty-form-placeholder" style="display:none">
Expand Down Expand Up @@ -163,7 +163,7 @@ <h5>Data Extraction Settings</h5>

<input class="ddm-btn mt-3" type="submit" value="Save Blueprint">
<p class="mt-3">
<a href="{% url 'datadonation:overview' project.pk %}">&#129040; Back</a>
<a href="{% url 'ddm_datadonation:overview' project.pk %}">&#129040; Back</a>
</p>
</form>
{{ file_uploader_meta|json_script:'file_uploader_meta' }}
Expand All @@ -173,13 +173,13 @@ <h5>Data Extraction Settings</h5>
{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project.pk %}">"{{ project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project.pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:overview' project.pk %}">Data Donation</a> /
Edit Blueprint
{% endblock %}

{% block scripts %}
{{ block.super }}
<script src="{% static 'datadonation/js/blueprint-edit-ui-helpers.js' %}"></script>
<script src="{% static 'datadonation/js/processing-rule-modal.js' %}"></script>
<script src="{% static 'datadonation/js/blueprint-general-ui-helpers.js' %}"></script>
<script src="{% static 'ddm_datadonation/js/blueprint-edit-ui-helpers.js' %}"></script>
<script src="{% static 'ddm_datadonation/js/processing-rule-modal.js' %}"></script>
<script src="{% static 'ddm_datadonation/js/blueprint-general-ui-helpers.js' %}"></script>
{% endblock scripts %}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% block page_title %}Create Instruction Page for File Uploader "{{ file_uploader.name }}"{% endblock %}

{% block main_heading %}Create Instruction Page{% endblock %}

{% block submit_label %}Create Instruction Page{% endblock %}

{% block cancel_target %}{% url 'datadonation:instructions:overview' project_pk file_uploader.pk %}{% endblock %}
{% block cancel_target %}{% url 'ddm_datadonation:instructions:overview' project_pk file_uploader.pk %}{% endblock %}

{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project_pk %}">"{{ file_uploader.project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
<a href="{% url 'ddm_datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
Create Instruction Page
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% block page_title %}Delete Instruction Page{% endblock %}

Expand Down Expand Up @@ -31,7 +31,7 @@
<p>Are you sure you want to delete this instruction page? <b>This action cannot be reversed.</b></p>
<input class="ddm-btn ddm-btn-red" type="submit" value="Delete Instruction Page">
<p class="mt-3">
<a href="{% url 'datadonation:instructions:overview' project_pk file_uploader.pk %}">&#129040; Cancel</a>
<a href="{% url 'ddm_datadonation:instructions:overview' project_pk file_uploader.pk %}">&#129040; Cancel</a>
</p>
</form>
{% endblock %}
Expand All @@ -40,8 +40,8 @@
{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project_pk %}">"{{ project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
<a href="{% url 'datadonation:instructions:overview' project_pk file_uploader.pk %}">Instructions</a> /
<a href="{% url 'ddm_datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
<a href="{% url 'ddm_datadonation:instructions:overview' project_pk file_uploader.pk %}">Instructions</a> /
Delete Instruction Page
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/page_with_form.html' %}
{% extends 'ddm_core/page_with_form.html' %}

{% block page_title %}Edit Instruction Page{% endblock %}

Expand All @@ -8,15 +8,15 @@

{% block cancel %}
<p>
<a href="{% url 'datadonation:instructions:overview' project_pk file_uploader.pk %}">&#129040; Back</a>
<a href="{% url 'ddm_datadonation:instructions:overview' project_pk file_uploader.pk %}">&#129040; Back</a>
</p>
{% endblock %}

{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project_pk %}">"{{ file_uploader.project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
<a href="{% url 'datadonation:instructions:overview' project_pk file_uploader.pk %}">Instructions</a> /
<a href="{% url 'ddm_datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
<a href="{% url 'ddm_datadonation:instructions:overview' project_pk file_uploader.pk %}">Instructions</a> /
Edit Instruction Page
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'core/base.html' %}
{% extends 'ddm_core/base.html' %}

{% block page_title %}Donation Instructions{% endblock %}

Expand All @@ -15,8 +15,8 @@
<div class="row border-top py-2">
<div class="col-2 border-end">
<h4>Page {{ page.index }}</h4>
<a href="{% url 'datadonation:instructions:edit' project_pk file_uploader.pk page.pk %}">Edit</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="{% url 'datadonation:instructions:delete' project_pk file_uploader.pk page.pk %}">Delete</a>
<a href="{% url 'ddm_datadonation:instructions:edit' project_pk file_uploader.pk page.pk %}">Edit</a>&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="{% url 'ddm_datadonation:instructions:delete' project_pk file_uploader.pk page.pk %}">Delete</a>
</div>
<div class="col bg-white">
{{ page.text | safe }}
Expand All @@ -26,19 +26,19 @@ <h4>Page {{ page.index }}</h4>
<tr><td>No Instructions defined.</td></tr>
{% endfor %}
</div>
<a class="ddm-btn" href="{% url 'datadonation:instructions:create' project_pk file_uploader.pk %}"><b>+</b>&nbsp;&nbsp;Add Instruction Page</a>
<a class="ddm-btn" href="{% url 'ddm_datadonation:instructions:create' project_pk file_uploader.pk %}"><b>+</b>&nbsp;&nbsp;Add Instruction Page</a>
</div>
</div>

<div class="mt-3">
<a href="{% url 'datadonation:overview' project_pk %}">&#129040; Back</a>
<a href="{% url 'ddm_datadonation:overview' project_pk %}">&#129040; Back</a>
</div>
{% endblock %}

{% block breadcrumbs %}
<a href="{% url 'ddm_projects:list' %}">Projects</a> /
<a href="{% url 'ddm_projects:detail' project_pk %}">"{{ file_uploader.project.name|truncatechars:15 }}" Project</a> /
<a href="{% url 'datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
<a href="{% url 'ddm_datadonation:overview' project_pk %}">Data Donation</a> /
<a href="{% url 'ddm_datadonation:uploaders:edit' project_pk file_uploader.pk %}">File Uploader "{{ file_uploader.name|truncatechars:15 }}"</a> /
Instructions
{% endblock %}
Loading

0 comments on commit a6c9bbf

Please sign in to comment.