Skip to content

Commit

Permalink
Apply stashed changes
Browse files Browse the repository at this point in the history
 - Alter submitted requests pages with better UI
 - User ratings now display as stars
 - Other various tweaks to frontend elements
  • Loading branch information
Asterisk007 committed May 8, 2020
1 parent 4eea9cd commit 7ec51da
Show file tree
Hide file tree
Showing 10 changed files with 237 additions and 143 deletions.
20 changes: 11 additions & 9 deletions myapp/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ class IssueForm(forms.Form):
)

issue_type = forms.CharField(
label='Issue Type',
widget=forms.Select(
choices=ISSUE_CHOICES,
attrs={'class': 'form-control'}
widget = forms.Select(
attrs = {'class': 'form-control'},
choices=ISSUE_CHOICES
),
label='Issue Type',
required=True
)

Expand Down Expand Up @@ -89,7 +89,7 @@ class IssueFilter(forms.Form):
'id': 'issue_type'
}
),
label='Filter by Issue Type',
label='Filter by Request Type',
required=False
)

Expand Down Expand Up @@ -281,8 +281,10 @@ def save(self, writer, subject):
class EditReviewForm(forms.Form):
rating = forms.CharField(
widget = forms.Select(
choices=STARS,
attrs={'class': 'form-control'}
attrs={
"class":"form-control"
},
choices=STARS
),
label='Rating',
required=True
Expand Down Expand Up @@ -349,8 +351,8 @@ class EditIssueForm(forms.Form):
issue_type = forms.CharField(
label='Issue Type',
widget=forms.Select(
choices=ISSUE_CHOICES,
attrs={'class': 'form-control'}
attrs={'class': 'form-control'},
choices=ISSUE_CHOICES
),
required=True
)
Expand Down
4 changes: 4 additions & 0 deletions myapp/static/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 13 additions & 5 deletions myapp/templates/editreview.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@
{% load static %}
<div class="container">
<div class="row justify-content-center align-items-center">
<div class="col-sm-1 mx-auto d-flex flex-column align-items-center"></div>
<div class="col-md-6 mx-auto d-flex flex-column align-items-center">

<form method="post" enctype="multipart/form-data">
<div class="form-group ml-2 mr-2">
<div class="form-group">
{% csrf_token %}
<table>{{ form.as_table }}</table><br>
{% comment %} Daniel speaking:
Credit goes to this CodePen (https://codepen.io/neilpomerleau/pen/wzxzQr?editors=1111)
for this neat little rating system.

TODO: Implement at some point.
{% endcomment %}
{% for field in form %}
<p class="mb-1">{{ field.label_tag }}</p>
<p class="mb-2">{{ field }}</p>
{% endfor %}
<br>
<input type="submit" class="btn btn-primary" value="Confirm Changes">
<a href="/viewprofile/{{ id }}" class="btn-btn-secondary">Cancel</a>
<a href="/viewprofile/{{ id }}" class="btn btn-secondary ml-2">Cancel</a>
</div>
</form>
</div>
Expand Down
8 changes: 5 additions & 3 deletions myapp/templates/editticket.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
{% load static %}
<div class="container">
<div class="row justify-content-center align-items-center">
<div class="col-sm-1 mx-auto d-flex flex-column align-items-center"></div>
<div class="col-md-6 mx-auto d-flex flex-column align-items-center">
<form method="post" enctype="multipart/form-data">
<div class="form-group ml-2 mr-2">
{% csrf_token %}
<table>{{ form.as_table }}</table><br>
<table>
{{ form.as_table }}
</table>
<br>
<input type="submit" class="btn btn-primary" value="Confirm Edits">
<a href="/viewmysubmittedissues.html" class="btn-btn-secondary">Cancel</a>
<a href="/viewmysubmittedissues.html" class="btn btn-secondary">Cancel</a>
</div>
</form>
</div>
Expand Down
16 changes: 4 additions & 12 deletions myapp/templates/registration/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@ <h3>Sign Up Today!</h3>
<div class="card py-2 px-4 bg-light text-left collapse" id="requirements">
Your password must satisfy the following requirements:
<ul>
<li>
Requirement
</li>
<li>
Requirement
</li>
<li>
Requirement
</li>
<li>
Requirement
</li>
<li>Your password can’t be too similar to your other personal information.</li>
<li>Your password must contain at least 8 characters.</li>
<li>Your password can’t be a commonly used password.</li>
<li>Your password can’t be entirely numeric.</li>
</ul>
</div>
</div>
Expand Down
144 changes: 101 additions & 43 deletions myapp/templates/viewissues.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,115 @@
{% extends "base.html" %}
{% block content %}

<div class="container mb-2 card bg-secondary py-2">
<h3 class="card bg-light px-2">Search for Requests:</h3>
<form method="post" enctype="multipart/form-data">
<div class="row">
<div class="col col-md-4">
<div class="form-group">
{% csrf_token %}
<table>{{ form.as_table }}</table>
</div>
</div>
<div class="col col-sm justify-content-center">
<input type="submit" class="btn btn-primary mb-2" value="Filter"><br>
{% comment %} <button class="btn btn-secondary btn-outline-light" onclick="clear()">Clear</button> {% endcomment %}
<button class="btn btn-secondary btn-outline-light">Clear</button>
{% comment %} <script>
function clear(){
$("#keyword").val("");
$("#issue_type").val("");
}
</script> {% endcomment %}
<div class="container">
<div class="card bg-secondary mb-2 mx-auto">
<div class="card-header" style="font-weight: bold;">Search for Requests:</div>
<div class="card-body">
<form method="post" enctype="multipart/form-data">
<div class="row">
<div class="col">
<div class="form-group">
{% csrf_token %}
<table>
<tr>
<td>
<p class="text-right mr-2">{{ form.keyword.label_tag }}</p>
</td>
<td>
<p>{{ form.keyword }}</p>
</td>
<td>
<p><input type="submit" class="btn btn-primary" value="Filter"></p>
</td>
</tr>
<tr>
<td>
<p class="text-right mr-2">{{ form.issue_type.label_tag }}</p>
</td>
<td>
<p>{{ form.issue_type }}</p>
</td>
<td>
<p><a href="viewissues.html" class="btn btn-secondary btn-outline-light">Clear</a></p>
</td>
</tr>
</table>
</div>
</div>
</div>
</form>
</div>
</div>
</form>
</div>
</div>

<div class="container">
<div class="row">
<div class="col ml-2 mr-2">
{% if issues_list %}
{% for i in issues_list %}
<div class="card bg-light my-2">
<div class="card-header">
Ticket #{{ i.id }}: <span class="bg-primary text-white px-1 py-1 rounded">{{ i.title|title }}</span>
</div>
<div class="row">
<div class="col ml-2 mr-2">
{% if issues_list %}
<div class="accordion" id="accordionExample">
{% for i in issues_list %}
<div class="card bg-light">
<div class="card-header" id="heading{{ forloop.counter }}">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapse{{ forloop.counter }}" aria-expanded="false" aria-controls="collapse{{ forloop.counter }}">
Ticket #{{ i.id }}: <span class="bg-primary text-white px-1 py-1 rounded">{{ i.title|title }}</span>
</button>
</div>
<div id="collapse{{ forloop.counter }}" class="collapse" aria-labelledby="heading{{ forloop.counter }}" data-parent="#accordionExample">
<div class="card-body">
<p>Description: {{ i.description }}</p>
<p>Date created: {{ i.date_created }}</p>
<p>Issue type: {{ i.issue_type }}</p>
<p>Assigned user: {{ i.assigned_user }} {% if i.assigned_user %}<a class="btn btn-secondary" href="viewprofile/{{ i.assigned_user.id }}">View Profile</a>{% endif %}</p>
<p>Affected user: {{ i.affected_user }} {% if i.affected_user %}<a class="btn btn-secondary" href="viewprofile/{{ i.affected_user.id }}">View Profile</a>{% endif %}</p>
<p>Issue solved?: {% if i.is_solved == True %} Yes {% else %} No {% endif %}</p>
{% if is_technician and user != i.assigned_user and user != i.affected_user and i.is_solved == False %}
<a class="btn btn-success" href="/viewissues/assign/{{i.id}}">Assign Issue</a>
{% endif %}
<h5>Request type: {{ i.issue_type }}</h5>
<div class="border border-secondary px-2 mb-2">
<p>{{ i.description|linebreaks }}</p>
</div>
<p>Request solved? {% if i.is_solved == True %} Yes {% else %} No {% endif %}</p>
<hr>
<h4>Request details:</h4>
<div style="font-size: 14px;">
<table class="table table-bordered">
<tr>
<th>
Date Created:
</th>
<th>
Assigned Technician:
{% if is_technician and user != i.assigned_user and user != i.affected_user and i.is_solved == False %}
<a class="btn btn-success" href="/viewissues/assign/{{i.id}}">Assign yourself to this request</a>
{% endif %}
</th>
</tr>
<tr>
<td>
<p>{{ i.date_created }}</p>
</td>
<td>
<p>
{% if i.assigned_user %}
<a class="btn btn-secondary" href="viewprofile/{{ i.assigned_user.id }}">
{{ i.assigned_user }}
</a>
{% else %}
None at the moment

{% endif %}
</p>
</td>
</tr>
</table>


{% comment %} <p class="">{{ i.description|linebreaks }}</p>
<p>Date created: {{ i.date_created }}</p>
<p>Issue type: {{ i.issue_type }}</p>
<p>Assigned user: {{ i.assigned_user }} {% if i.assigned_user %}<a class="btn btn-secondary" href="viewprofile/{{ i.assigned_user.id }}">View Profile</a>{% endif %}</p>
<p>Affected user: {{ i.affected_user }} {% if i.affected_user %}<a class="btn btn-secondary" href="viewprofile/{{ i.affected_user.id }}">View Profile</a>{% endif %}</p>
<p>Issue solved?: {% if i.is_solved == True %} Yes {% else %} No {% endif %}</p> {% endcomment %}
</div>
</div>
{% endfor %}
{% else %}
<p>There are no entries with those parameters.</p>
{% endif %}
</div>
{% endfor %}
</div>
{% else %}
<p>There are no requests that contain what you searched.</p>
{% endif %}
</div>
</div>

Expand Down
77 changes: 53 additions & 24 deletions myapp/templates/viewmysubmittedissues.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,64 @@
</div>
</div>

<div class="container">
<div class="row">
<div class="col ml-2 mr-2">
<div class="card bg-secondary mb-2">
<div class="card-header">Issues you have submitted:</div>
<div class="card-body">
{% if issues_list.count > 0 %}
{% comment %} TODO: Add a filter form to this list, too {% endcomment %}
{% for issue in issues_list %}
<div class="card bg-light mb-1">
<div class="card-header">{{ issue.title|title }}</div>
<div class="card-body px-1 py-1">
<div class="border border-secondary rounded px-2 py-2">
<p>{{ issue.description }}</p>
</div>
<p>Date Created: {{ issue.date_created }}</p>
<p>Issue Type: {{ issue.issue_type }}</p>
<p>Assigned Technician: {{ issue.assigned_user }} {% if issue.assigned_user %}<a class="btn btn-secondary" href="viewprofile/{{ issue.assigned_user.id }}">View Profile</a>{% endif %}</p>
<p>Issue solved?: {% if issue.is_solved == True %} Yes {% else %} No {% endif %}</p>
<a class="btn btn-secondary" href="editticket/{{ issue.id }}">Edit Issue</a>
<div class="row mx-4">
<div class="col">
<h3>Requests you have submitted:</h3>
{% if issues_list.count > 0 %}
<div class="accordion" id="accordionExample">
{% for issue in issues_list %}
<div class="card bg-light">
<div class="card-header" id="heading{{ forloop.counter }}">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapse{{ forloop.counter }}" aria-expanded="false" aria-controls="collapse{{ forloop.counter }}">
{{ issue.title|title }}
</button>
</div>
<div id="collapse{{ forloop.counter }}" class="collapse" aria-labelledby="heading{{ forloop.counter }}" data-parent="#accordionExample">
<div class="card-body px-1 py-1">
<h5>Request type: {{ issue.issue_type }}</h5>
<div class="border border-secondary px-2 mb-2">
<p>{{ issue.description|linebreaks }}</p>
</div>
<p>Request solved?: {% if issue.is_solved == True %} Yes {% else %} No {% endif %}</p>
<a class="btn btn-secondary" href="editticket/{{ issue.id }}">Edit Issue</a>
<hr>
<h4>Request details:</h4>
<div style="font-size: 14px;">
<table class="table table-bordered">
<tr>
<th>
Date Created:
</th>
<th>
Assigned Technician:
</th>
</tr>
<tr>
<td>
<p>{{ issue.date_created }}</p>
</td>
<td>
<p>
{% if issue.assigned_user %}
<a class="btn btn-secondary" href="viewprofile/{{ issue.assigned_user.id }}">
{{ issue.assigned_user }}
</a>
{% else %}
None at the moment
{% endif %}
</p>
</td>
</tr>
</table>
</div>
</div>
{% endfor %}
{% else %}
<p>Nothing found! {% comment %} We hope you continue to have zero problems with your technology. Feel free to <a href="/submit.html">submit a request</a> when a problem does pop up.{% endcomment %}</p>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<p>Nothing found!</p>
{% endif %}
</div>
</div>

Expand Down
Loading

0 comments on commit 7ec51da

Please sign in to comment.