Skip to content

Commit

Permalink
Make buttons on home page send user to "new" pages
Browse files Browse the repository at this point in the history
For:
#30
  • Loading branch information
liammulh committed Sep 11, 2024
1 parent e082986 commit 981f517
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 18 deletions.
28 changes: 15 additions & 13 deletions src/hci/templates/hci/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,20 @@
<script src="https://unpkg.com/[email protected]"></script>
</head>
<body hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
<section class="section">
<div class="container">
{% if user.is_authenticated %}
<div class="has-text-right">
<p>{{ email }} | <a hx-post="{% url 'custom_logout' %}" hx-swap="innerHTML" hx-target="body">Log Out</a></p>
<p>{{ affiliation }} | <a href="{% url 'affiliation' %}">Change Affiliation</a></p>
</div>
{% endif %}
<h1 class="title">Clinical Genome HLA Curation</h1>
{% block nav %}{% endblock %}
{% block content %}{% endblock %}
</div>
</section>
<div hx-boost="true">
<section class="section">
<div class="container">
{% if user.is_authenticated %}
<div class="has-text-right">
<p>{{ email }} | <a hx-post="{% url 'custom_logout' %}" hx-swap="innerHTML" hx-target="body">Log Out</a></p>
<p>{{ affiliation }} | <a href="{% url 'affiliation' %}">Change Affiliation</a></p>
</div>
{% endif %}
<h1 class="title">Clinical Genome HLA Curation</h1>
{% block nav %}{% endblock %}
{% block content %}{% endblock %}
</div>
</section>
</div>
</body>
</html>
8 changes: 4 additions & 4 deletions src/hci/templates/hci/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ <h2 class="title">Welcome, {{ username }}.</h2>
</section>
</div>
<div class="block">
<button class="button is-responsive">Add Curation</button>
<button class="button is-responsive">Add Disease</button>
<button class="button is-responsive">Add Allele/Haplotype</button>
<button class="button is-responsive">Add Publication</button>
<a class="button is-responsive" href="{% url 'new_curation' %}">Add Curation</a>
<a class="button is-responsive" href="{% url 'new_disease' %}">Add Disease</a>
<a class="button is-responsive" href="{% url 'new_allele_haplotype' %}">Add Allele/Haplotype</a>
<a class="button is-responsive" href="{% url 'new_publication' %}">Add Publication</a>
</div>

<div class="block">
Expand Down
6 changes: 6 additions & 0 deletions src/hci/templates/hci/new_allele_haplotype.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "hci/nav.html" %}
{% block title %}New Allele/Haplotype{% endblock %}
{% block description %}Add a new allele or haplotype in the HLA curation interface.{% endblock %}
{% block content %}
<p>Coming soon...</p>
{% endblock %}
6 changes: 6 additions & 0 deletions src/hci/templates/hci/new_curation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "hci/nav.html" %}
{% block title %}New Curation{% endblock %}
{% block description %}Start a new curation in the HLA curation interface.{% endblock %}
{% block content %}
<p>Coming soon...</p>
{% endblock %}
6 changes: 6 additions & 0 deletions src/hci/templates/hci/new_disease.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "hci/nav.html" %}
{% block title %}New Disease{% endblock %}
{% block description %}Add a new disease in the HLA curation interface.{% endblock %}
{% block content %}
<p>Coming soon...</p>
{% endblock %}
6 changes: 6 additions & 0 deletions src/hci/templates/hci/new_publication.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "hci/nav.html" %}
{% block title %}New Publication{% endblock %}
{% block description %}Add a new publication in the HLA curation interface.{% endblock %}
{% block content %}
<p>Coming soon...</p>
{% endblock %}
13 changes: 12 additions & 1 deletion src/hci/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
from . import views

urlpatterns = [
# One-off pages:
path("", views.index_view, name="index"),
path("accounts/", include("django.contrib.auth.urls")),
path("affiliation/", views.affiliation_view, name="affiliation"),
# Login/logout:
path("accounts/", include("django.contrib.auth.urls")),
path("logout/", views.logout_view, name="custom_logout"),
# "New" pages:
path(
"allele_haplotype/new/",
views.new_allele_haplotype_view,
name="new_allele_haplotype",
),
path("curation/new/", views.new_curation_view, name="new_curation"),
path("disease/new/", views.new_disease_view, name="new_disease"),
path("publication/new/", views.new_publication_view, name="new_publication"),
]
28 changes: 28 additions & 0 deletions src/hci/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,31 @@ def affiliation_view(request):
"""Show the user the affiliation configuration page."""
context = {"email": request.user.email, "affiliation": "HLA Expert Panel"}
return render(request, "hci/affiliation.html", context)


@login_required
def new_curation_view(request):
"""Show the new curation page."""
context = {"email": request.user.email, "affiliation": "HLA Expert Panel"}
return render(request, "hci/new_curation.html", context)


@login_required
def new_disease_view(request):
"""Show the new curation page."""
context = {"email": request.user.email, "affiliation": "HLA Expert Panel"}
return render(request, "hci/new_disease.html", context)


@login_required
def new_allele_haplotype_view(request):
"""Show the new curation page."""
context = {"email": request.user.email, "affiliation": "HLA Expert Panel"}
return render(request, "hci/new_allele_haplotype.html", context)


@login_required
def new_publication_view(request):
"""Show the new curation page."""
context = {"email": request.user.email, "affiliation": "HLA Expert Panel"}
return render(request, "hci/new_publication.html", context)

0 comments on commit 981f517

Please sign in to comment.