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

Beta v3 #32

Merged
merged 72 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
2e360fc
adminview to see other schools home pages
verndrade May 25, 2020
6d67838
about view
verndrade May 25, 2020
f3b0958
Takedown page + admin control (school)
verndrade May 25, 2020
d7cd16b
remove default admin site so css stops getting hosted
verndrade May 25, 2020
ca54a85
fix image, restrict uploads to 1MB (most are <200KB)
verndrade May 25, 2020
fb5ba91
Add Robbie to Team
HamstersR2good May 25, 2020
0a5103a
Merge pull request #34 from verndrade/robbie-team
verndrade May 25, 2020
c99d0c1
Background Change
HamstersR2good May 25, 2020
d75d6eb
Merge pull request #35 from SyllabiShare/Background
verndrade May 25, 2020
9dc41b6
Background
HamstersR2good May 25, 2020
cebf5b9
add peter to about
verndrade May 25, 2020
eadc483
bug fix
verndrade May 25, 2020
b3754dd
Merge pull request #36 from SyllabiShare/Background
verndrade May 25, 2020
b3ff4d2
Update README.md
politicalhamster May 25, 2020
e798979
edit readme
verndrade May 25, 2020
0bb1c93
technical details
verndrade May 25, 2020
10dc195
flip peters hamster
verndrade May 25, 2020
c2a4e39
Merge pull request #38 from SyllabiShare/readmechange
politicalhamster May 25, 2020
c72a5f6
Better Name Validiation
HamstersR2good May 25, 2020
1e0ff5e
close feedback as admin
verndrade May 25, 2020
1c907a2
Merge branch 'development' of https://github.com/verndrade/syllabi-sh…
verndrade May 25, 2020
286ba7b
Merge pull request #39 from SyllabiShare/Validation-Names
verndrade May 25, 2020
3f7f166
Generalize template pluralization branches
winstliu May 26, 2020
8177a1d
gitignore venv
winstliu May 26, 2020
37d5f93
Update my about information
winstliu May 26, 2020
b7fe176
Merge pull request #40 from SyllabiShare/wl-template-pluralization
verndrade May 26, 2020
8be2df0
Merge pull request #41 from SyllabiShare/wl-gitignore-venv
verndrade May 26, 2020
4c58d6c
Merge pull request #42 from SyllabiShare/wl-about
verndrade May 26, 2020
d672bcb
oopsies
winstliu May 26, 2020
d730690
Wrap the navbar content in a collapsible
winstliu May 26, 2020
fc6ed39
Make the whole darn thing responsive
winstliu May 26, 2020
bc7ec68
Change the navbar breakpoint to -md
winstliu May 26, 2020
c927300
fix pastel on pastel alerts
verndrade May 26, 2020
822cc61
Merge branch 'development' of https://github.com/verndrade/syllabi-sh…
verndrade May 26, 2020
677c813
allow 5MB uploads for syllabi with pictures
verndrade May 26, 2020
83362a7
Merge pull request #44 from SyllabiShare/winston-is-a-dumb-dumb
verndrade May 26, 2020
39d6307
Merge pull request #45 from SyllabiShare/wl-responsive-navbar
verndrade May 26, 2020
6a995d0
Uh, more "about me" stuff?
winstliu May 26, 2020
b06fbce
Restyle the search input
winstliu May 26, 2020
c14f530
Make the main div a container
winstliu May 26, 2020
6ff1bf9
Make the paypal footer play nicely
winstliu May 26, 2020
02d46e5
Flex the entire body
winstliu May 26, 2020
fd885ff
...make the footer clickable
winstliu May 26, 2020
e5d2bb9
Update README.md
verndrade May 26, 2020
d495dd1
Merge pull request #47 from SyllabiShare/about-winston-again
verndrade May 26, 2020
8c60336
Merge pull request #49 from SyllabiShare/wl-container-styling
verndrade May 26, 2020
a76e168
fix buttons for alerts and make ux change for admins
verndrade May 27, 2020
1d4387b
remove paypal
verndrade May 27, 2020
4f6efe4
Merge pull request #48 from SyllabiShare/wl-style-search
verndrade May 27, 2020
b0f0ec2
store semester, and school, and customize names for pdfs
verndrade May 27, 2020
b0d288e
Bootstrapify upload.html
winstliu May 27, 2020
87a745b
Bootstrapify suggest.html
winstliu May 27, 2020
14619fc
Go less crazy with the heading tags in about.html
winstliu May 27, 2020
21c77a4
Use dynamic rows for the team members
winstliu May 27, 2020
7f8a5cd
Bootstrapify settings.html
winstliu May 27, 2020
9eb0618
Move Settings above Logout
winstliu May 27, 2020
1514b71
added course title to upload.html, display.html, views, and models
madi0899 May 28, 2020
61eebd7
Merge branch 'development' of https://github.com/SyllabiShare/syllabi…
madi0899 May 28, 2020
5323f20
added course title to upload.html, display.html, views, and models
madi0899 May 28, 2020
0a3f56a
Open syllabi in new tab
winstliu May 28, 2020
089ab86
Merge pull request #56 from SyllabiShare/wl-open-in-new-tab
verndrade May 29, 2020
d866ef1
Merge branch 'development' into addCourseTitle
verndrade May 29, 2020
43adabe
Merge pull request #55 from SyllabiShare/addCourseTitle
verndrade May 29, 2020
f91330f
Merge branch 'development' into wl-misc-styling
verndrade May 29, 2020
1887244
Merge pull request #52 from SyllabiShare/wl-misc-styling
verndrade May 29, 2020
ab5de05
Update title to match the new styling
winstliu May 29, 2020
a2786f7
Restyle the "what's your school" page
winstliu May 29, 2020
9fa937a
Merge pull request #58 from SyllabiShare/wl-style-school
verndrade May 29, 2020
a6d45b4
Merge pull request #57 from SyllabiShare/wl-upload-form-again
verndrade May 29, 2020
2f0e290
Update views.py
verndrade May 29, 2020
9ab9292
Merge pull request #60 from SyllabiShare/verndrade-force-upload
verndrade May 30, 2020
92cd123
add .pdf
verndrade May 30, 2020
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,6 @@ db.sqlite3
staticfiles/
.vscode/
.idea/
project/uploads
project/uploads

venv/
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,35 @@ These instructions will detail how to use SyllabiShare.

### Logging In and Logging Out

We use Google OAuth to handle logging into our application, so as long as you have a university related .edu Google Account you can use it. Simply click the button that says "Please Login with a .edu Email" and it will take you to the Google login screen. To logout click the "Logout" button. Login is to help identify which school you come from so that we can direct you to the correct syllabi.
We use Google OAuth to handle logging into our application, so as long as you have a university-related .edu Google Account you can use it. Simply click the button that says "Please Login with a .edu Email" and it will take you to the Google login screen. To logout click your username at the top right corner. It opens a dropdown menu, then click the "Logout" button to logout. Login is to help identify which school you come from so that we can direct you to the correct syllabi.

### Uploading a Syllabus

To upload a syllabus click the bottom left corner of the home page or by clicking the upload button on the found on the upper right of the webpage. Please fill in the professor's name and course of the syllabus you intend to upload. Then select the syllabus from your computer and upload it. The syllabus must be smaller than 1 MB and must be a PDF for security reasons, otherwise it will not allow you to upload. Once you have done this, click submit to finish the upload process. You should see a green 'Addition Successful' confirmation pop up. It is important to note that until SyllabiShare has a professor consent system developed it is up to the uploader to ensure that they are not violating any policies of their university by uploading a syllabus.

### Finding a Syllabus

SyllabiShare sorts syllabi by department so you can find a specific syllabus at the page that corresponds to its department. We also allow you to search for syllabi by the course identifiers (CS 2150) or the professor. We intend to add course names to our uploads soon&trade; and those will be searchable as well. SyllabiShare is reliant on students uploading syllabi so it is possible that you do not find a syllabus that you are looking for due to it not being uploaded yet. We will add a feature to request syllabi directly from professors soon&trade;.

### Leaderboard

The Leaderboard shows the top uploaders of SyllabiShare for each school. We are currently working on an opt-out feature soon&trade; so those who do not want to see their username displayed will not have to refrain from uploading.

### Feedback

The developers of SyllabiShare do not pretend to be perfect and recognize that feedback is an important part of the development process. Therefore if you have found a bug or have a suggestion for us to implement in the app we highly recommend you leave feedback by clicking the feedback link on the upper right tab. We ask that you open a Github issue as well and connect it to your feedback in order for us to keep track of it at one easy location.

### Delete your Account

To delete your account click your email at the top right corner of any page. It will open a drop-down menu where you can click Settings. There it will ask you if you want to delete your account and to confirm the deletion of your account by typing your username. Once you have deleted your account you will be redirected to the login screen, which confirms your account was deleted. However, we must keep record of what you have uploaded and when you uploaded it.

### Technical Details

This app was written in Python using the Django Framework and is hosted on Heroku, with files being served through an Amazon Web Services S3 Bucket in Northern Virginia. This will eventually cost money, which is why I will once again ask for your financial support and ask that you click the Donate link at the bottom of the screen and donate if you are able to. We understand if you can't though, we're all college students here.

## Authors

* **Vernon Andrade** - *Development*
* **Vernon Andrade** - *Development, Lead*
* **Robbie B** - *Development*
* **Peter B** - *Documentation*
* **Winston Liu** - *Development, UI/UX*
1 change: 0 additions & 1 deletion project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand Down
Binary file added project/static/back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/static/hamster.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 11 additions & 12 deletions project/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
margin: 2%;
}

.profile {
margin: 0 auto;
padding: 1%;
}

body {
margin: 0;
height: 100%;
Expand Down Expand Up @@ -30,29 +35,23 @@ body {
padding: 2px;
}

.paypal {
position:fixed;
bottom:0px;
width:100%;
z-index:-99;
/* Ugh, get rid of this as soon as we move those upload/back/GH buttons somewhere else */
footer {
z-index: 1 !important;
}

.leaderboard {
position: fixed;
right: 0px;
top: 20%;
margin-right: 1%;
border-style: solid;
border-style: solid;
text-align: center;
}

table, th, td {
border: 1px solid black;
}

.arrow {
height:2%;
width:2%;
margin-bottom: 2%;
margin-bottom: 2%;
border: 1px solid black;
}
}
Binary file added project/static/unknown.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/static/unknown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/static/vernon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/static/winston.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions syllabiShare/migrations/0012_auto_20200525_0717.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.0.6 on 2020-05-25 12:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('syllabiShare', '0011_suggestion_github_issue'),
]

operations = [
migrations.AddField(
model_name='school',
name='reason',
field=models.TextField(default=''),
),
migrations.AddField(
model_name='school',
name='takedown',
field=models.BooleanField(default=False),
),
]
23 changes: 23 additions & 0 deletions syllabiShare/migrations/0013_auto_20200526_2337.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.0.6 on 2020-05-27 04:37

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('syllabiShare', '0012_auto_20200525_0717'),
]

operations = [
migrations.AddField(
model_name='submission',
name='semester',
field=models.TextField(blank=True),
),
migrations.AddField(
model_name='submission',
name='year',
field=models.TextField(blank=True),
),
]
18 changes: 18 additions & 0 deletions syllabiShare/migrations/0013_submission_title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.5 on 2020-05-28 13:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('syllabiShare', '0012_auto_20200525_0717'),
]

operations = [
migrations.AddField(
model_name='submission',
name='title',
field=models.TextField(blank=True),
),
]
14 changes: 14 additions & 0 deletions syllabiShare/migrations/0014_merge_20200528_0941.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 2.2.5 on 2020-05-28 13:41

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('syllabiShare', '0013_auto_20200526_2337'),
('syllabiShare', '0013_submission_title'),
]

operations = [
]
6 changes: 6 additions & 0 deletions syllabiShare/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ class Submission(models.Model):
prof = models.TextField(blank=True)
dept = models.TextField(blank=True)
course = models.TextField(blank=True)
title = models.TextField(blank=True)
school = models.TextField(blank=True)
semester = models.TextField(blank=True)
year = models.TextField(blank=True)
syllabus = models.FileField(blank=True, upload_to=settings.UPLOAD_TO)
upvotes = models.IntegerField(default = 1)

class School(models.Model):
school = models.TextField(blank=True)
domain = models.TextField(unique=True)
poster = models.TextField(blank=True)
takedown = models.BooleanField(default=False)
reason = models.TextField(default='')
poster = models.TextField(blank=True)
reviewed = models.BooleanField(default=False)
uploads = JSONField(default={})
def add_school(self,name,id):
Expand Down
1 change: 1 addition & 0 deletions syllabiShare/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
path('suggest/', views.suggest, name="suggest"),
path('upload/', views.upload, name="upload"),
path('<slug:dept>/', views.display, name="display"),
path('view/<slug:school>/', views.schooladmin, name="schooladmin"),
]
45 changes: 39 additions & 6 deletions syllabiShare/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def admin(request):
User.objects.exclude(email__contains=".edu").delete()
elif 'delete' in request.POST:
Submission.objects.get(pk=request.POST['pk']).delete()
elif 'close' in request.POST:
Suggestion.objects.get(pk=request.POST['pk']).delete()
elif 'takedown' in request.POST and 'reason' in request.POST:
school = School.objects.get(pk=request.POST['pk'])
school.takedown = True
school.reason = request.POST['reason']
school.save()
elif 'edit' in request.POST:
edit = Suggestion.objects.get(pk=request.POST['pk'])
edit.github_issue = request.POST['githubIssue']
Expand Down Expand Up @@ -62,6 +69,10 @@ def authenticate(user):
return ('error.html', {'loggedIn': False})
if user.email[-4:] != '.edu':
return ('error.html', {'loggedIn': True})
domain = get_domain(user.email)
school = School.objects.get(domain=domain)
if school.takedown:
return ('sorry.html', {'loggedIn': True, 'reason': school.reason, 'domain':domain})
return (False, False)

def display(request, dept=None):
Expand Down Expand Up @@ -101,12 +112,15 @@ def index(request):
else:
entry.review()
entry.save()

school = entry.school
if not school:
return render(request, 'school.html', {'first': True})
elif not entry.reviewed and not user_string == entry.poster:
return render(request, 'school.html', {'poster': entry.poster,'name': school})
return render(request, 'school.html', {'name': school})

if len(Submission.objects.filter(school=get_domain(request.user.email))) == 0:
return render(request, 'upload.html', {'message':'Misuse of uploads will be met by a ban!'})

posts = Submission.objects.filter(school=domain)
dep = set()
Expand All @@ -119,6 +133,20 @@ def privacy(request):
return render(request, 'privacy.html')


def schooladmin(request,school=None):
if request.user.is_superuser:
try:
entry = School.objects.get(domain=school)
except:
return redirect('/')
posts = Submission.objects.filter(school=school)
dep = set()
for i in posts:
dep.add(i.dept)
return render(request, 'index.html', {'leaderboard':entry.topFive(),'posts':sorted(list(dep)),'school':school,'num':len(posts)})
return redirect('/')


def search(request):
(template, context) = authenticate(request.user)
if template:
Expand All @@ -128,7 +156,7 @@ def search(request):
domain = get_domain(request.user.email)
found = Submission.objects.filter(school=domain)
if request.method == 'POST':
found = found.filter(prof__icontains=request.POST['search']) | found.filter(course__icontains=request.POST['search'])
found = found.filter(prof__icontains=request.POST['search']) | found.filter(course__icontains=request.POST['search']) | found.filter(title__icontains=request.POST['search'])
dep = set()
for i in found:
dep.add(i.dept)
Expand Down Expand Up @@ -173,19 +201,23 @@ def upload(request):
success = False
message = 'Misuse of uploads will be met by a ban!'
if request.method == 'POST':
course = request.POST['prof'].split()
goodProf = len(request.POST['prof'].split()) == 2 and course[0].isalpha() and course[1].isalpha()
prof = request.POST['prof'].strip().split()
goodProf = len(prof) == 2 and all(char.isalpha() or char == '-' or char == '\'' for char in prof[0]) and all(char.isalpha() or char == '-' or char == '\'' for char in prof[1])
verndrade marked this conversation as resolved.
Show resolved Hide resolved
course = request.POST['course'].split()
goodCourse = len(course) == 2 and course[0].isalpha() and course[1].isnumeric()
if goodProf and goodCourse:
entry = Submission()
entry.user = request.user.username
entry.school = get_domain(request.user.email)
entry.prof = request.POST['prof']
entry.prof = prof[0] + ' ' + prof[1]
entry.course = request.POST['course'].upper()
entry.title = request.POST['title']
entry.dept = course[0].upper()
entry.semester = request.POST['semester']
entry.year = request.POST['year']
entry.upvotes = 1
entry.syllabus = request.FILES['file']
entry.syllabus.name = '_'.join([prof[0].lower(), prof[1].lower(), course[0], course[1], entry.semester, entry.year]) + '.pdf'
entry.save()
school = School.objects.filter(domain=entry.school)[0]
school.upload(request.user.username)
Expand All @@ -202,3 +234,4 @@ def upload(request):

def view404(request, exception=None):
return redirect('/')

70 changes: 59 additions & 11 deletions templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,65 @@
{% block content %}
{% load static %}

Coming Soon!
<div class="text-center paypal" id='paypal'>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations" />
<input type="hidden" name="business" value="[email protected]" />
<input type="hidden" name="item_name" value="Help pay for AWS hosting costs" />
<input type="hidden" name="currency_code" value="USD" />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
</form>
<b>I am once again asking for your finanical support. All money goes towards hosting costs.</b>
<h1 class="mb-3">About</h1>
<h2>What is SyllabiShare for?</h2>
<p>
SyllabiShare was developed as an open-source project to empower students to crowdsource a public repository of course syllabi that are essential to make informed course selections and to understand course policies.
To find out information about a course, you would usually go to a friend or RateMyProfessor, but if you didn't know anyone who took the class before and there are no online reviews for the class you would need to email the professor for a syllabus and hope they respond... yeah right good luck with that.
With this tool users will be able to upload, search, and download syllabi for all viewers at their university to enjoy.
It is ludicrous that students can pay tens of thousands of dollars to their university and not have access to such materials already.
Fortunately, some schools have a Syllabus repository like this already, but not nearly enough schools do it.
All of these are reasons why we made this tool and made it open-source for students of any university to adopt and improve.
If you can get your university to sponsor your fork of the app please do let us know and we'll redirect to yours.
Please feel free to add to the codebase or join the team if you feel inclined to help the effort.
</p>

<h2>The Team</h2>
<div class="row row-cols-md-2 row-cols-lg-3">
<div class="col my-2 text-center profile">
<img src="{% static 'vernon.jpg' %}" class="rounded-circle mb-2">
<h3><a class="text-body" href='https://www.linkedin.com/in/verndrade'>Vernon Andrade</a></h3>
<h4>UVA CS '21</h4>
<h4>Lead Developer / Admin</h4>
</div>
<div class="col my-2 text-center profile">
<img src="{% static 'winston.jpg' %}" class="rounded-circle mb-2">
<h3><a class="text-body" href='https://www.linkedin.com/in/winston-liu'>Winston Liu</a></h3>
<h4>UVA CS '20</h4>
<h4>Developer</h4>
</div>
<div class="col my-2 text-center profile">
<img src="{% static 'unknown.png' %}" class="rounded-circle mb-2">
<h3><a class="text-body" href=''>Madison Flynn</a></h3>
<h4>UVA CS '21</h4>
<h4>Developer</h4>
</div>
<div class="col my-2 text-center profile">
<img src="{% static 'hamster.jpg' %}" class="rounded-circle mb-2">
<h3>Robbie B</h3>
<h4>UVA CS '26</h4>
<h4>Head Hamster</h4>
</div>
<div class="col my-2 text-center profile">
<img src="{% static 'hamster.jpg' %}" class="rounded-circle mb-2" style="transform: scaleX(-1);">
<h3><a class="text-body" href=''>Peter B</a></h3>
<h4>CNU '23</h4>
<h4>Hamster Sounding Board</h4>
</div>
<div class="col my-2 text-center profile">
<img src="{% static 'unknown.png' %}" class="rounded-circle mb-2">
<h3><a class="text-body" href=''>You!</a></h3>
<h4>UVA '2?</h4>
<h4>Bug Creator</h4>
</div>
</div>

<h2>Technical Details</h2>
<p>This app was written in Python using the Django Framework and is hosted on Heroku, with files being served through an Amazon Web Services S3 Bucket in Northern Virginia. This will eventually cost money, so I will once again ask for your financial support and ask that you click the Donate link at the bottom of the screen if you are in the financial position to. We understand if you can't thought, we're all college students here. The code is on Github <a style="color: purple" href="https://github.com/verndrade/syllabi-share">here</a> or in the bottom right corner of your screen.</p>

<h2>Suggestions</h2>
<p>If you have suggestions for how to make this app better or any feedback, please click <a href="/suggest">here</a>.</p>

<a href="/"><img class="left" src="{% static 'left.png' %}"></a>

{% endblock %}
{% endblock %}
Loading