Skip to content

Commit 9be0e5c

Browse files
committed
Cleaning up UI, plus various bug fixes
1 parent 43b520d commit 9be0e5c

File tree

5 files changed

+35
-34
lines changed

5 files changed

+35
-34
lines changed

api/API/projects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def getProjectsByUsername(username):
5858
#TODO: factor the project lists out to their own functions
5959
projects = (Projects.select()
6060
.join(URCPPFaculty, on = (URCPPFaculty.pID == Projects.pID))
61-
.where(URCPPFaculty.username == username))
62-
61+
.where(URCPPFaculty.username == username)
62+
.order_by(-Projects.year))
6363
if projects.exists():
6464
project_list = []
6565
for project in projects:

api/pages/done.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from budget import getBudget
44
from ..API.parameters import getCurrentParameters
55
from ..API.collaborators import getCollaborators, getCollaboratorsByProjectId
6-
6+
from ..API.faculty import getFacultyForProject
77
from upload import checkForFile
88

99

@@ -54,7 +54,8 @@ def review_GET ():
5454
parameters = getCurrentParameters()
5555
collaborators = getCollaborators(g.user.username)
5656
uploadedFiles = [];
57-
57+
primary_faculty = getFacultyForProject(proj.pID)
58+
5859
# TODO: I don't think this is being used, keeping it for now, but need to check
5960
# if it is removed
6061
if request.referrer:
@@ -74,7 +75,9 @@ def review_GET ():
7475
collabs = collaborators,
7576
previous_url = previous_url,
7677
ldap = g.user,
77-
username = g.user.username
78+
username = g.user.username,
79+
currentUser = g.user.username, # Need both because of next route, which has to have it as well (and it won't be the same as username)
80+
primary_faculty = primary_faculty
7881
)
7982

8083
@app.route("/urcpp/v1/project/<pID>/<username>/<year>", methods = ["GET"])
@@ -87,6 +90,7 @@ def project_GET (pID, username, year):
8790
parameters = getCurrentParameters()
8891
collaborators = getCollaboratorsByProjectId(pID)
8992
uploadedFiles = [];
93+
primary_faculty = getFacultyForProject(pID)
9094

9195
if request.referrer:
9296
previous_url = request.referrer
@@ -104,5 +108,7 @@ def project_GET (pID, username, year):
104108
params = parameters,
105109
collabs = collaborators,
106110
previous_url = previous_url,
107-
username=username
111+
username = username,
112+
primary_faculty = primary_faculty,
113+
currentUser = g.user.username
108114
)

api/static/js/pages/awardLetters.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ $(document).ready(function(){
8888

8989
function getProjects (username) {
9090
$.getJSON("/urcpp/v1/history/"+username, function( data ){
91-
//remove any table that might have been left behinf
91+
//remove any table that might have been left behind
9292
$("#pastProjects").remove();
9393
$("#collaboratedProjects").remove();
94-
var tableheading = '<tr><th>Year</th><th>Project Name</th></tr>'
94+
var tableheading = '<tr><th style = "padding-right: 25px;">Year</th><th>Project Name</th></tr>'
9595
var projectCaption = "Projects";
96-
var collaboratedCaption = "collaborated Projects"
96+
var collaboratedCaption = "Collaborative Projects"
9797
if (data["primaryFaculty"].length){
98-
$('#projectModalBody').append('<table id="pastProjects" class="table"></table>');
98+
$('#projectModalBody').append('<table id="pastProjects" class="table table-striped"></table>');
9999
$("#pastProjects").prepend("<caption>"+projectCaption+"</caption>");
100100
$('#pastProjects').append(tableheading);
101101
$.each(data['primaryFaculty'], function(index, project) {
102-
$('#pastProjects').append("<tr><td>"+project.year.year+"</td><td><a href='/urcpp/v1/project/"+project.pID+"/"+username+"/"+project.year.year+"'>"+project.title+"</a></td></tr>")
102+
$('#pastProjects').append("<tr><td style='padding-bottom: 10px;' >"+project.year.year+"</td><td style='padding-bottom: 10px;' ><a href='/urcpp/v1/project/"+project.pID+"/"+username+"/"+project.year.year+"'>"+project.title+"</a></td></tr>")
103103
});
104104
}
105105
if (data["collaborated"].length){

api/templates/snips/projectInfo.html

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,21 @@
66
<br/>
77
<dt>Project Info</dt>
88
<dd>Title: {{proj.title}}</dd>
9-
<dd>Start Date: {{proj.startDate}}</dd>
9+
<dd>Start Date: {{proj.startDate.strftime('%m-%d-%Y')}}</dd>
1010
<dd>Duration: {{proj.duration}} weeks</dd>
1111
<dd>Number of Students: {{proj.numberStudents}}</dd>
12-
<dd>Community Partners:
13-
{% if proj.hasCommunityPartner %}
14-
Yes
15-
{% else %}
16-
No
17-
{% endif %}
18-
</dd>
19-
<dd>Community Service:
20-
{% if proj.isServiceToCommunity %}
21-
Yes
22-
{% else %}
23-
No
24-
{% endif %}
25-
</dd>
26-
<dd>Date Submitted: {{proj.createdDate.strftime('%Y-%m-%d @ %I:%m %p')}}</dd>
12+
{% if proj.hasCommunityPartner %}
13+
<dd>Community Partners: Yes</dd>
14+
{% endif %}
15+
{% if proj.isServiceToCommunity %}
16+
<dd>Community Service: Yes</dd>
17+
{% endif %}
18+
<dd>Date Submitted: {{proj.createdDate.strftime('%m-%d-%Y')}}</dd>
2719
<dd>Status: {{proj.status}}</dd>
2820
<br />
2921
{% if collabs is not none %}
30-
<dt>Collaborators</dt>
22+
<dt>Faculty</dt>
23+
<dd>{{primary_faculty.username.firstname}} {{primary_faculty.username.lastname}}</dd>
3124
{% for collaborator in collabs %}
3225
<dd>{{collaborator.username.firstname}} {{collaborator.username.lastname}}</dd>
3326
{% endfor %}
@@ -44,7 +37,7 @@
4437
<dd><strong>Travel:</strong> ${{proj.budgetID.otherTravel}}</dd>
4538
<dd>Description: {{proj.budgetID.otherTravelDesc}}</dd>
4639
{% set mileageCost = '%.2f' | format(proj.budgetID.miles*params.mileageRate) %}
47-
<dd><strong>Mileage:</strong> {{proj.budgetID.miles}} miles (${{ mileageCost }} @ {{params.mileageRate}} / mile)</dd>
40+
<dd><strong>Mileage:</strong> ${{ mileageCost }} ({{proj.budgetID.miles}} miles @ ${{params.mileageRate}}/mile)</dd>
4841
<dd>Description: {{proj.budgetID.milesDesc}}</dd>
4942
<dd><strong>Other:</strong> ${{proj.budgetID.other}}</dd>
5043
<dd>Description: {{proj.budgetID.otherDesc}}</dd>
@@ -62,10 +55,12 @@
6255

6356
</br>
6457
<p style="margin-top:1em">
65-
<button class="btn btn-danger pull-left" onclick="withdraw({{proj.pID}})" style="padding-top:10">Withdraw</button>
58+
{% if username == currentUser %}
59+
<button class="btn btn-danger pull-left" onclick="withdraw({{proj.pID}})" style="padding-top:10">Withdraw</button>
60+
{% endif %}
6661

6762
<a href="{{previous_url}}">
68-
<button class="btn btn-primary pull-right" class = "form-control" >Done</button>
63+
<button class="btn btn-primary pull-right" class = "form-control" >Done</button>
6964
</a>
7065
</p>
7166
</div>
@@ -75,4 +70,4 @@
7570

7671
<br/>
7772
</div>
78-
</div>
73+
</div>

api/templates/snips/projectsModal.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ <h4 class="modal-title" id="myModalLabel">Past Projects</h4>
1111
<div class="modal-body" id="projectModalBody">
1212
</div>
1313
<div class="modal-footer">
14-
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
14+
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
1515
</div>
1616
</div>
1717
</div>
18-
</div>
18+
</div>

0 commit comments

Comments
 (0)