Commit 76d358c7 authored by David Haynes's avatar David Haynes 🙆

Merge branch '120-masonstrap-4' into 2.3-dev

parents fd262ff6 d6f2bc64
Pipeline #2110 passed with stages
in 3 minutes and 21 seconds
......@@ -5,7 +5,7 @@ about the current issue. Maybe a picture? Some details that could best help some
especially someone new, understand the goal of the issue and how they should best
approach the problem.
# Helpful Links
## Helpful Links
Here you should include a bullet point list of links to documentation, stack overflow,
whatever, that could help guide someone on what it is they are trying to do.
......
......@@ -18,13 +18,15 @@ the issues page.
If you decide to take on an issue for Go you will need to work in a branch off
of the current development branch (ie. `2.3-dev` with 2.3 being the version in
development).
development).
This can be done with the following chain of `git` commands within `go/`:
git pull
git checkout 2.3-dev
git checkout -B ##-shortdescription
```sh
git pull
git checkout 2.3-dev
git checkout -B ##-shortdescription
```
**Note:**
......@@ -34,9 +36,11 @@ does.
**Example:**
git pull
git checkout 2.3-dev
git checkout -B 102-readmeUpdates
```sh
git pull
git checkout 2.3-dev
git checkout -B 102-readmeUpdates
```
If you are working on something that does not have an issue please open a new
issue before creating your branch.
......
......@@ -221,6 +221,18 @@ repository and is named go-cleanlinks.cron. Drop this in cron.hourly and
change the paths so that they point to the virtualenv activate script and
manage.py.
## Production cron job
```sh
#!/bin/bash
# Cron job to automatically expire outdated links, put this in cron.hourly
ACTIVATE_PATH=/path/to/virtualenv/activate
MANAGE_PATH=/path/to/go/manage.py
source ${ACTIVATE_PATH}
python ${MANAGE_PATH} expirelinks
```
---
**Note:**
......
......@@ -7,7 +7,7 @@ services:
restart_policy:
condition: on-failure
networks:
- gonet
- go
ports:
- "3306:3306"
environment:
......@@ -23,10 +23,10 @@ services:
restart_policy:
condition: on-failure
networks:
- gonet
- go
ports:
- '8000:8000'
command: /bin/bash ./startup.sh
command: ./startup.sh
volumes:
- .:/go
depends_on:
......@@ -46,7 +46,7 @@ services:
- GO_EMAIL_HOST_PASSWORD=
- GO_EMAIL_FROM=
- GO_EMAIL_TO=
- superuser=dhaynes3
- SUPERUSER=dhaynes3
networks:
gonet:
go:
#!/bin/bash
# Cron job to automatically expire outdated links, put this in cron.hourly
ACTIVATE_PATH=/path/to/virtualenv/activate
MANAGE_PATH=/path/to/go/manage.py
source ${ACTIVATE_PATH}
python ${MANAGE_PATH} expirelinks
"""
go/commands/expirelinks.py
"""
Remove expired links from the database.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
......@@ -16,20 +17,15 @@ from go.models import URL
class Command(BaseCommand):
"""
Define a new custom django-admin command to remove expired links from the
database
database.
"""
# Define help text for this command
help = 'Removes expired links from the database'
def handle(self, *args, **options):
"""
The handle function handles the main component of the django-admin
command.
Handle the main component of the django-admin command. Loop
through a list of all URL objects that have expired (expires field is
less than or equal [lte] to today's date)
"""
# Loop through a list of all URL objects that have expired
# (expires field is less than or equal to today's date)
for toexpire in URL.objects.filter(expires__lte=timezone.now()):
# Delete the current URL
toexpire.delete()
for expired_url in URL.objects.filter(expires__lte=timezone.now()):
expired_url.delete()
"""
go/commands/test_expirelinks.py
"""
Test that the function to expire Go links actually works.
"""
# Future Imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
......@@ -19,16 +20,11 @@ from django.utils import timezone
from go.models import URL, RegisteredUser
class ExpireLinksTest(TestCase):
"""
Test cases for the functions in expirelinks
"""
def setUp(self):
"""
Set up any variables such as dummy objects that will be utilised in
Set up any variables such as dummy objects that will be utilized in
testing methods
"""
# Setup a blank URL object with an owner
User.objects.create(username='dhaynes', password='password')
get_user = User.objects.get(username='dhaynes')
......@@ -52,9 +48,8 @@ class ExpireLinksTest(TestCase):
def test_expirelinks(self):
"""
Test that the expirelinks django admin command functions as intentioned.
Make a call to expire Go links and assert that the number of links has
been reduced.
"""
call_command('expirelinks')
self.assertTrue(len(URL.objects.all()) == 1)
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; About
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<!-- page header -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
......@@ -26,41 +23,32 @@ SRCT Go &bull; About
</div>
</div>
<!-- define the terms of use div -->
<!-- terms of use -->
<div class="row" id="terms">
<div class="col-md-12">
<h4>Terms of Use</h4>
<legend></legend>
<h2>Terms of Use</h2>
<p>
By using Go you acknowledge that you are a current George Mason Student or faculty
member.
<br></br>
Additionally, any link that you create is subject to removal by Go admins if it is
deemed to associate the univeristy with any
<br /> derogatory or controversial matters.
<br></br>
deemed to associate the univeristy with any derogatory or controversial matters.
Go admins also reserve the right to remove and ban any users who attempt to abuse
the link creation system in any manner.
<br></br>
Since Go falls under the gmu.edu domain, users who use this service will act in compliance
with the GMU <a href="https://universitypolicy.gmu.edu/policies/responsible-use-of-computing/">
Responsible Use of Computing</a> policies.
with the GMU <a href="https://universitypolicy.gmu.edu/policies/responsible-use-of-computing/">Responsible Use of Computing</a> policies.
</p>
<br />
</div>
</div>
<!-- define the who made go? div -->
<!-- who made go? -->
<div class="row">
<div class="col-md-12">
<h4>Who made Go?</h4>
<legend></legend>
<h2>Who made Go?</h2>
<p>
Members of the
<a href="//srct.gmu.edu">Student-Run Computing and Technology</a> registered
student organization at <a href="//gmu.edu">George Mason University</a> are
the clever,
<br /> talented student developers behind Go.
the clever, talented student developers behind Go.
</p>
<p>
We are a group of creative people that like making software and want to give back
......@@ -68,22 +56,18 @@ SRCT Go &bull; About
</p>
<p>
<a href="//srct.gmu.edu/contact/">Contact us</a> to get involved!
<p>
<br />
</p>
</div>
</div>
<!-- define the thanks! div -->
<div class="row">
<div class="col-md-12">
<h4>Thanks!</h4>
<legend></legend>
<h2>Thanks!</h2>
<p>
This project was made possible through the collective contributions of multiple Mason
SRCT members.
<br></br>
This project was made possible through the collective contributions of
multiple Mason SRCT members.
<a href="https://git.gmu.edu/srct/go/milestones/3">Go 2.2</a>:
<br />
<a href="https://github.com/dhaynespls">David Haynes</a>,
<a href="https://github.com/ocelotsloth">Mark Stenglein</a>,
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">Andres Villogas</a>,
......@@ -97,9 +81,7 @@ SRCT Go &bull; About
<a href="https://github.com/nanderson94">Nicholas Anderson</a>,
<a href="">Kevin Mckigney</a>,
and <a href="https://github.com/dwbond">Daniel Bond</a>.
<br></br>
<a href="https://git.gmu.edu/srct/go/milestones/2">Go 2.1</a>:
<br />
<a href="https://github.com/dhaynespls">David Haynes</a>,
<a href="https://github.com/zosman1">Zach Osman</a>,
<a href="https://github.com/roberthitt">Robert Hitt</a>,
......@@ -109,85 +91,23 @@ SRCT Go &bull; About
<a href="https://github.com/mdsecurity">Mattias Duffy</a>,
<a href="https://github.com/IAmEyad">Eyad Hasan</a>,
and <a href="https://github.com/danielkim1">Danny Kim</a>.
<br></br>
<a href="https://git.gmu.edu/srct/go/milestones/1">Go 2.0</a>:
<br />
<a href="https://github.com/dhaynespls">David Haynes</a>,
<a href="">Matthew Rodgers</a>,
<a href="https://github.com/nanderson94">Nicholas Anderson</a>,
and <a href="https://github.com/dwbond">Daniel Bond</a>.
<br></br>
Go 1.0:
<br />
<a href="https://github.com/jrouly">Michel Rouly</a>,
<a href="https://github.com/creffett">Chris Reffett</a>,
<a href="https://github.com/nanderson94">Nicholas Anderson</a>, and <a href="https://github.com/akshaykarthik">Akshay Karthik</a>.
<br></br>
</p>
<p>
Additional thanks are due to the <a href="https://wiki.srct.gmu.edu/Executive_Board">
Student-Run Computing and Technology executive
board from 2014-present</a>, and our academic advisor,
board from 2014-present</a>,and our academic advisor,
<a href="https://cs.gmu.edu/~kdobolyi/">Professor Kinga Dobolyi</a>.
</p>
</div>
</div>
<!-- define the LibreJS License Table -->
<div class="row">
<div class="col-md-12">
<h4>JavaScript License Information</h4>
<legend></legend>
<table class="table" id="jslicense-labels1">
<thead>
<tr>
<th>Source File</th>
<th>License</th>
<th>Uncompressed Source</th>
</tr>
</thead>
<tr>
<td><a href="{% static "js/jquery.min.js" %}">jquery.min.js</a></td>
<td><a href="http://jquery.org/license">Expat</a></td>
<td><a href="http://code.jquery.com/jquery-2.1.1.js">jquery-2.1.1.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/bootstrap.min.js" %}">bootstrap.js</a></td>
<td><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></td>
<td><a href="{% static "js/bootstrap.js" %}">bootstrap.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/clipboard.min.js" %}">clipboard.min.js</a></td>
<td><a href="https://zenorocha.mit-license.org/">Expat</a></td>
<td><a href="{% static "js/clipboard.js" %}">clipboard.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/copy.js" %}">copy.js</a></td>
<td><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></td>
<td><a href="{% static "js/copy.js" %}">copy.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/new_link.js" %}">new_link.js</a></td>
<td><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></td>
<td><a href="{% static "js/new_link.js" %}">new_link.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/tab.js" %}">tab.js</a></td>
<td><a href="https://github.com/twbs/bootstrap/blob/master/LICENSE">Expat</a></td>
<td><a href="{% static "js/tab.js" %}">tab.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/tooltip.js" %}">tooltip.js</a></td>
<td><a href="https://github.com/twbs/bootstrap/blob/master/LICENSE">Expat</a></td>
<td><a href="{% static "js/tooltip.js" %}">tooltip.js</a></td>
</tr>
<tr>
<td><a href="{% static "js/useradmin.js" %}">useradmin.js</a></td>
<td><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache-2.0</a></td>
<td><a href="{% static "js/useradmin.js" %}">useradmin.js</a></td>
</tr>
</table>
</div>
</div>
{% endblock %}
{% extends 'layouts/base.html' %}
{% block title %}
SRCT Go &bull; Welcome
{% endblock %}
{% block content %}
<div class="page-header mb-5">
<div class="row">
<div class="col">
<h1><i class="fas fa-link"></i> Go</h1>
<p class="lead">University-branded URL shortening</p>
</div>
</div>
</div>
<div class="row mb-5 ">
<div class="col-md-4 d-flex align-items-stretch">
<div class="card landing-card shadow-hover mb-3">
<div class="card-header">
<h5>What is Go?</h5>
</div>
<div class="card-body">
<p class="card-text">
Go provides University-branded URL shortening for student organizations, administration,
and ULife groups. Any approved user can generate a
<a href="https://go.gmu.edu">go.gmu.edu</a> address that can redirect to a longer URL.
</p>
<p class="card-text">
Go is a product of the George Mason University
<a href="https://srct.gmu.edu">Student-Run Computing and Technology</a>
student organization.
</p>
</div>
</div>
</div>
<div class="col-md-4 d-flex align-items-stretch">
<div class="card landing-card shadow-hover mb-3">
<div class="card-header">
<h5>Why should I use Go?</h5>
</div>
<div class="card-body">
<p class="card-text">
Go features:
<ul class="fa-ul">
<li>
<span class="fa-li mt-1">
<i class="fas fa-check-square"></i>
</span>Data tracking on the number of clicks a Go link gets.</li>
<li>
<span class="fa-li mt-1">
<i class="fas fa-check-square"></i>
</span>Options to share Go links across various social media platforms.
</li>
<li>
<span class="fa-li mt-1">
<i class="fas fa-check-square"></i>
</span>QR Code generation at various resolutions, ready to be shared.
</li>
<li>
<span class="fa-li mt-1">
<i class="fas fa-check-square"></i>
</span>Optional expiration for links after particular times.</li>
</ul>
</p>
</div>
</div>
</div>
<div class="col-md-4 d-flex align-items-stretch">
<div class="card landing-card shadow-hover mb-3">
<div class="card-header">
<h5>How do I access Go?</h5>
</div>
<div class="card-body">
<p class="card-text">
In order to prevent abuse of the URL shortener, access to Go is moderated by SRCT
administrators. New users will need to fill out a registration form in
order to become an approved user.
</p>
<p class="card-text">
Additionally, only users with a current, valid Mason username and password may request
to be approved.
</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<a href="{% url 'go_login' %}" class="btn btn-outline-primary btn-block shadow-hover mb-3">
<i class="fas fa-sign-in-alt"></i> Log In</a>
</div>
<div class="col-md-6">
<a href="{% url 'signup' %}" class="btn btn-outline-primary btn-block shadow-hover mb-3">
<i class="fas fa-user-plus"></i> Sign Up</a>
</div>
</div>
{% endblock %}
\ No newline at end of file
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- HTML 5 definition -->
<!DOCTYPE html>
<!-- Start the HTML page for Go -->
<html>
<!-- load in our header content for every page -->
<head>
<!-- load in the title block defined on each html page -->
<!-- title block defined on each html page -->
<title>
{% block title %}
{% endblock %}
</title>
<!-- Metatags -->
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Chrome on Android navbar color -->
<meta name="theme-color" content="#006633">
<!-- FB/Opengraph tags -->
<meta property="og:url" content="https://go.gmu.edu/">
<meta property="og:type" content="website">
<meta property="og:title" content="SRCT Go">
<!--<meta property="og:image" content="https://git.gmu.edu/uploads/project/avatar/10/noun_534670_cc.png">-->
<meta property="og:description" content="University-branded URL shortening.">
<meta property="og:site_name" content="SRCT Go">
<meta property="og:locale" content="en_US">
......@@ -34,38 +27,31 @@
<meta name="twitter:site" content="@MasonSRCT">
<meta name="twitter:creator" content="@MasonSRCT">
<meta name="twitter:url" content="https://go.gmu.edu/">
<meta name="twitter:title" content="SRCT Gp">
<meta name="twitter:title" content="SRCT Go">
<meta name="twitter:description" content="University-branded URL shortening.">
<!--<meta name="twitter:image" content="https://git.gmu.edu/uploads/project/avatar/10/noun_534670_cc.png">-->
<!-- Load in our icon -->
<!-- Global favicon -->
<link rel="icon" type="image/ico" href="{% static "img/favicon.ico" %}" />
<!-- Load in global CSS -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{% static "css/bootswatch.min.css" %}" />
<link rel="stylesheet" href="{% static "css/styles.css" %}" />
<!-- Load in global JS -->
<script src="{% static "js/jquery.min.js" %}"></script>
<script src="{% static "js/bootstrap.min.js" %}"></script>
<script src="{% static "js/clipboard.min.js" %}"></script>
<!-- Global CSS -->
<link href="https://srct.gmu.io/masonstrap/css/masonstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="{% static "css/global.css" %}" />
</head>
<!-- Load in the body of a Go page -->
<body>
<!-- Load in the navbar template -->
{% include 'layouts/navigation.html' %}
<!-- Load in the navbar -->
{% include 'layouts/navbar.html' %}
<!-- Wrap the page content in a bootstrap container -->
<div class="container">
<div class="container begin">
<!-- Load in the main page content -->
{% block content %}
{% endblock %}
</div>
<!-- Load in the footer template -->
{% include 'layouts/footer.html' %}
</body>
<!-- Load in the footer template -->
{% include 'layouts/footer.html' %}
<!-- Global JS -->
<script src="https://srct.gmu.io/masonstrap/js/masonstrap.min.js"></script>
</html>
\ No newline at end of file
<!-- load in go templatetags -->
{% load go_extras %}
<header class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary" role="navigation">
<div class="container">
<!-- Brand -->
<a class="navbar-brand" href="/">
<i class="fas fa-link"></i> Go
</a>
<!-- Collapse button -->
<button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#collapse" aria-controls="collapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- -->
<div class="collapse navbar-collapse" id="collapse">
<!-- -->
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="{% url 'about' %}">About</a>
</li>
<!-- -->
{% if user.is_authenticated %}
{% if user.registereduser.approved %}
<li class="nav-item">
<a class="nav-link" href="{% url 'new_link' %}">New Link</a>
</li>
{% endif %}
{% if not user.registereduser.registered %}
<li class="nav-item">
<a href="{% url 'signup' %}">Register</a>
</li>
{% endif %}
{% endif %}
</ul>
<!-- -->
<ul class="navbar-nav ml-auto">
<!-- -->
{% if user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{% url 'go_logout' %}">
Log Out <i class="fa fa-sign-out fa-fw"></i>
</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'go_login' %}">
<i class="fas fa-sign-in-alt"></i> Log In
</a>
</li>
{% endif %}
<!-- -->
{% if user.is_staff %}
<li class="nav-item">
<a class="nav-link" href="{% url 'useradmin' %}">
User Moderation <i class="fa fa-users fa-fw"></i>
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</header>
\ No newline at end of file
<!-- load in go templatetags -->
{% load go_extras %}
<!-- define our navbar -->
<div class="navbar navbar-default">
<!-- define the main "header" of the navbar -->
<div class="navbar-header" style="margin-left:5%;">
<!-- responsive hamburger menu -->
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-responsive-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Go brand logo -->
<a class="navbar-brand" href="{% url 'index' %}">
<i class="fa fa-link"></i> Go
</a>
</div>
<!-- define the parts of the navbar that collapse b/c responsiveness -->
<div class="navbar-collapse collapse navbar-responsive-collapse">
<!-- The left side -->
<ul class="nav navbar-nav navbar-left">
<li><a href="{% url 'about' %}" data-jslicense="1">About</a></li>
<!-- only show if the current user is authenticated -->
{% if user.is_authenticated %}
<!-- only if they are an approved user -->
{% if user.registereduser.approved %}
<li><a href="{% url 'new_link' %}">New Link</a></li>
{% endif %}
<!-- only if the current user has not registered to use go -->
{% if not user.registereduser.registered %}
<li><a href="{% url 'signup' %}">Register</a></li>
{% endif %}
{% endif %}
</ul>
<!-- The right side -->
<ul class="nav navbar-nav navbar-right" style="margin-right:5%;">
<!-- only show if the user is authenticated -->
{% if user.is_authenticated %}
<!-- logout -->
<li>
<a href="{% url 'go_logout' %}">
Log Out <i class="fa fa-sign-out fa-fw"></i>
</a>
</li>
{% else %}
<!-- login -->
<li>
<a href="{% url 'go_login' %}">
Log In <i class="fa fa-sign-in fa-fw"></i>
</a>
</li>
{% endif %}
<!-- if the user is a staff member -->
{% if user.is_staff %}
<li class="dropdown">
<a href="#" class="dropdown-toggle"
data-toggle="dropdown">
Administration <i class="fa fa-caret-down fa-fw"></i></a>
<ul class="dropdown-menu dropdown-menu-left">
<li><a href="{% url 'useradmin' %}">User Moderation <i class="fa fa-users fa-fw"></i></a></li>
</ul>
</li>
{% endif %}
</ul>
</div>
</div>
<!-- inline css for just this page -->
<style>
.navbar-brand {
padding: 12px 15px !important;
}
banner,.page-header,#banner {
border-bottom: none;
margin-bottom: 0;
}
.fix a:link{
color: #FFFFFF;
}
</style>
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- define the page title block -->
{% block title %}