Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pages and navigation #8

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion estimation/app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h4 style="font-weight: bold">GitHub Async Estimation Tool</h4>
</div>
<div class="w3-main">
<!-- Body -->
<div class="w3-container w3-responsive w3-text-theme">
<div class="w3-container w3-responsive w3-text-theme" style="margin-top: 55px;">
{% block content %}
{% endblock content %}
</div>
Expand Down
40 changes: 40 additions & 0 deletions estimation/app/templates/confirm_issue.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{% extends "base.html" %}

{% block title %} Select Isuse {% endblock %}


{% block content %}
<div class="w3-row w3-padding-32">
<div class="w3-col">
<div class="w3-card-4">
<div class="w3-container w3-theme">
<h2>Confirm issue to estimate</h2>
</div>
<form action="confirm_issue" method="post" class="w3-container">
{% csrf_token %}
<div class="w3-row w3-margin">
<div class="w3-col">
<label for="issue_url">Issue URL</label>
<input id="issue_url" name="issue_url" class="w3-input" type="text" placeholder="The github issue URL, i.e. https://github.com/bcgov/cas-estimation-tool/issues/4" value="{{ issue_url }}" disabled/>
</div>
</div>
<div class="w3-row w3-margin">
<div class="w3-col" style="width: 120px;">
<p>Issue details</p>
</div>
<div class="w3-rest">
<p>ID: {{ issue.issue_id }}</p>
<p>Title: The title of the issue goes here</p>
</div>
</div>
<div class="w3-row w3-margin">
<div class="w3-col">
<input type="submit" value="Start Estimation Session" class="w3-button w3-theme w3-right w3-margin"/>
<a class="w3-button w3-right w3-margin">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
8 changes: 4 additions & 4 deletions estimation/app/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


{% block content %}
<div class="w3-display-container" style="min-height: 400px; margin-top: 55px;">
<div class="w3-display-container" style="min-height: 400px;">
<div class="w3-row">
<div class="w3-col">
<img
Expand All @@ -20,12 +20,12 @@ <h3>Issues awaiting votes for {{ user.handle }}@github:</h3>
</div>
<div class="w3-row">
<div class="w3-col">
<button class="w3-button w3-display-left">
<a class="w3-button w3-display-left w3-theme" href={% url "select_issue" %}>
+ Add Issue For Estimation
</button>
</a>
</div>
</div>
<div class="w3-row-padding">
<div class="w3-row w3-row-padding">
{% for estimation_session in estimation_sessions %}
<div class="w3-col s6 m4 l3">
<div
Expand Down
17 changes: 17 additions & 0 deletions estimation/app/templates/estimation_session.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends "base.html" %}

{% block title %} Select Isuse {% endblock %}


{% block content %}
<div class="w3-row w3-padding-32">
<div class="w3-col">
<div class="w3-card-4">
<div class="w3-container w3-theme">
<h2>Estimation Session For Card #12345</h2>
</div>
<div>blargh</div>
</div>
</div>
</div>
{% endblock %}
30 changes: 30 additions & 0 deletions estimation/app/templates/select_issue.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends "base.html" %}

{% block title %} Select Isuse {% endblock %}


{% block content %}
<div class="w3-row w3-padding-32">
<div class="w3-col">
<div class="w3-card-4">
<div class="w3-container w3-theme">
<h2>Select issue to estimate</h2>
</div>
<form action="select_issue" method="post" class="w3-container">
{% csrf_token %}
<div class="w3-row w3-margin">
<div class="w3-col">
<label for="issue_url">Issue URL:</label>
<input id="issue_url" name="issue_url" class="w3-input" type="text" placeholder="The github issue URL, i.e. https://github.com/bcgov/cas-estimation-tool/issues/4" value="{{ issue_url }}"/>
</div>
</div>
<div class="w3-row w3-margin">
<div class="w3-col">
<input type="submit" value="Find Issue" class="w3-button w3-theme w3-right"/>
</div>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
3 changes: 3 additions & 0 deletions estimation/app/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
path("github/callback/", views.github_callback, name="github_callback"),
path("dashboard/", views.dashboard, name="dashboard"),
path("logout", views.logout, name="logout"),
path("select_issue", views.select_issue, name="select_issue"),
path("confirm_issue", views.confirm_issue, name="confirm_issue"),
path("estimation_session", views.estimation_session, name="estimation_session"),
]
2 changes: 2 additions & 0 deletions estimation/app/view_models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .base_view_model import *
from .dashboard_view_model import *
from .index_view_model import *
from .select_issue_view_model import *
from .confirm_issue_view_model import *
7 changes: 7 additions & 0 deletions estimation/app/view_models/confirm_issue_view_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from ..models import GithubIssue
from ..view_models.base_view_model import BaseViewModel


class ConfirmIssueViewModel(BaseViewModel):
issue: GithubIssue
issue_url: str
5 changes: 5 additions & 0 deletions estimation/app/view_models/select_issue_view_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ..view_models.base_view_model import BaseViewModel


class SelectIssueViewModel(BaseViewModel):
issue_url: str
3 changes: 3 additions & 0 deletions estimation/app/views/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from .base import *
from .logout import *
from .select_issue import *
from .confirm_issue import *
from .estimation_session import *
19 changes: 19 additions & 0 deletions estimation/app/views/confirm_issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.http import HttpRequest, HttpResponseRedirect
from django.shortcuts import render

from ..models import GithubIssue
from ..view_models.confirm_issue_view_model import ConfirmIssueViewModel


def confirm_issue(request: HttpRequest):

if request.method == "POST":
# Here we'll create the database stuff
return HttpResponseRedirect("estimation_session")

issue = GithubIssue(org="bcgov", repo="repo", issue_id=12345)
return render(
request,
"confirm_issue.html",
ConfirmIssueViewModel(issue=issue, issue_url=issue.url()),
)
6 changes: 6 additions & 0 deletions estimation/app/views/estimation_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.http import HttpRequest
from django.shortcuts import render


def estimation_session(request: HttpRequest):
return render(request, "estimation_session.html", {})
24 changes: 24 additions & 0 deletions estimation/app/views/select_issue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from django.http import HttpRequest
from django.shortcuts import render

from ..models import GithubIssue
from ..view_models.confirm_issue_view_model import ConfirmIssueViewModel

from ..view_models.select_issue_view_model import SelectIssueViewModel


def select_issue(request: HttpRequest):

if request.method == "POST":
issue_url = request.POST.get("issue_url")
# Here goes the Github API request

gh_issue = GithubIssue(org="bcgov", repo="cas-estimation-tool", issue_id="1234")

return render(
request,
"confirm_issue.html",
ConfirmIssueViewModel(issue=gh_issue, issue_url=issue_url),
)
else:
return render(request, "select_issue.html", SelectIssueViewModel())