Commit 7933bb5f authored by Eyad Hasan's avatar Eyad Hasan
Browse files

39 commits behind

parents fda41933 0f5f9af4
Pipeline #1302 passed with stage
in 1 minute and 39 seconds
...@@ -56,5 +56,6 @@ Go-py3.6: ...@@ -56,5 +56,6 @@ Go-py3.6:
image: library/python:3.6 image: library/python:3.6
type: test type: test
script: script:
- if pip list --outdated | grep "Latest" | wc -l > 0; then pip list --outdated && exit 1; else exit 0; fi
- coverage run --source=go --omit=*migrations/*,*admin.py,*manage.py,*wsgi.py,*settings.py,*secret.py,*__init__.py,*.pyc,*templates/*,*static/* manage.py test - coverage run --source=go --omit=*migrations/*,*admin.py,*manage.py,*wsgi.py,*settings.py,*secret.py,*__init__.py,*.pyc,*templates/*,*static/* manage.py test
- coverage html -i && grep pc_cov htmlcov/index.html | egrep -o "[0-9]+\%" | awk '{ print "covered " $1;}' - coverage html -i && grep pc_cov htmlcov/index.html | egrep -o "[0-9]+\%" | awk '{ print "covered " $1;}'
# On Contributing # On Contributing
## git ## git
First take a look at [github flow](https://guides.github.com/introduction/flow/) First take a look at [github flow](https://guides.github.com/introduction/flow/)
as this page gives a good starting point on understanding how to work with `git` as this page gives a good starting point on understanding how to work with `git`
in an open source repo. in an open source repo.
...@@ -77,7 +78,13 @@ Example commit description: ...@@ -77,7 +78,13 @@ Example commit description:
### Merging to the current development branch ### Merging to the current development branch
Once you've finished work in a branch open a [pull request](https://git.gmu.edu/srct/go/merge_requests/new) Once you've finished work in a branch you will need to push your commits to gitlab.
git push origin ##-branchname
`Origin` is gitlab.
Open a [merge request](https://git.gmu.edu/srct/go/merge_requests/new)
to start the process of getting your code into the repo. Your code wil be reviewed to start the process of getting your code into the repo. Your code wil be reviewed
by another member before being merged. Your code must pass our tests and include by another member before being merged. Your code must pass our tests and include
in the description: in the description:
......
...@@ -12,7 +12,7 @@ from django.contrib.auth.admin import UserAdmin ...@@ -12,7 +12,7 @@ from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User from django.contrib.auth.models import User
# App Imports # App Imports
from go.models import URL, RegisteredUser from .models import URL, RegisteredUser
class URLAdmin(admin.ModelAdmin): class URLAdmin(admin.ModelAdmin):
""" """
......
...@@ -19,7 +19,7 @@ from django.utils import timezone ...@@ -19,7 +19,7 @@ from django.utils import timezone
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
# App Imports # App Imports
from go.models import URL, RegisteredUser from .models import URL, RegisteredUser
# Other Imports # Other Imports
from bootstrap3_datetime.widgets import DateTimePicker from bootstrap3_datetime.widgets import DateTimePicker
......
...@@ -134,14 +134,13 @@ class URL(models.Model): ...@@ -134,14 +134,13 @@ class URL(models.Model):
""" """
if cache.get("hashids_counter") is None: if cache.get("hashids_counter") is None:
cache.set("hashids_counter", URL.objects.count()) cache.set("hashids_counter", URL.objects.count())
cache.incr("hashids_counter")
short = HASHIDS.encrypt(cache.get("hashids_counter"))
tries = 1 tries = 1
while tries < 100: while tries < 100:
try: try:
URL.objects.get(short__iexact=short) short = HASHIDS.encrypt(cache.get("hashids_counter"))
tries += 1 tries += 1
cache.incr("hashids_counter") cache.incr("hashids_counter")
URL.objects.get(short__iexact=short)
except URL.DoesNotExist as ex: except URL.DoesNotExist as ex:
print(ex) print(ex)
return short return short
......
...@@ -7,17 +7,20 @@ ...@@ -7,17 +7,20 @@
<!-- define the content block for the page --> <!-- define the content block for the page -->
{% block content %} {% block content %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- define the page header div --> <!-- define the page header div -->
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-balance-scale fa-stack-1x fa-inverse"></i> <i class="fa fa-balance-scale fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">Moderation Panel</i> Moderation Panel
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
...@@ -309,8 +312,7 @@ ...@@ -309,8 +312,7 @@
</form> </form>
</div> </div>
</div> </div>
<script src="../../static/js/useradmin.js">
</script> <script src="{% static "js/useradmin.js" %}"></script>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -10,13 +10,13 @@ SRCT Go &bull; Account Blocked ...@@ -10,13 +10,13 @@ SRCT Go &bull; Account Blocked
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-ban fa-stack-1x fa-inverse"></i> <i class="fa fa-ban fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">Account Is Blocked</i> Account Is Blocked
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
...@@ -32,10 +32,11 @@ SRCT Go &bull; Account Blocked ...@@ -32,10 +32,11 @@ SRCT Go &bull; Account Blocked
<p> <p>
If you believe this is an error, please contact the <a href="mailto:srct@gmu.edu">Go Admins</a> If you believe this is an error, please contact the <a href="mailto:srct@gmu.edu">Go Admins</a>
<br /> <br />
<br/> <br />
Thank you, and have a nice day! Thank you, and have a nice day!
</p> </p>
<br/><br/> <br />
<br />
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
...@@ -13,13 +13,13 @@ SRCT Go &bull; About ...@@ -13,13 +13,13 @@ SRCT Go &bull; About
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-question fa-stack-1x fa-inverse"></i> <i class="fa fa-question fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">About</i> About
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
...@@ -27,12 +27,12 @@ SRCT Go &bull; About ...@@ -27,12 +27,12 @@ SRCT Go &bull; About
<!-- define the terms of use div --> <!-- define the terms of use div -->
<div class="row" id="terms"> <div class="row" id="terms">
<div class="col-md-12"> <div class="col-md-12">
<h4><i class="fa">Terms of Use</i></h4> <h4>Terms of Use</h4>
<legend></legend> <legend></legend>
<p> <p>
By using Go you acknowledge that you are a current George Mason Student or faculty member. By using Go you acknowledge that you are a current George Mason Student or faculty member.
<br></br> <br></br>
Additionally any link that you create is subject to removal by Go admins if it is deemed Additionally, any link that you create is subject to removal by Go admins if it is deemed
to associate the univeristy with any to associate the univeristy with any
<br /> <br />
derogatory or controversial matters. derogatory or controversial matters.
...@@ -53,7 +53,7 @@ SRCT Go &bull; About ...@@ -53,7 +53,7 @@ SRCT Go &bull; About
<!-- define the who made go? div --> <!-- define the who made go? div -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h4><i class="fa">Who made Go?</i></h4> <h4>Who made Go?</h4>
<legend></legend> <legend></legend>
<p> <p>
Members of the Members of the
...@@ -77,7 +77,7 @@ SRCT Go &bull; About ...@@ -77,7 +77,7 @@ SRCT Go &bull; About
<!-- define the thanks! div --> <!-- define the thanks! div -->
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h4><i class="fa">Thanks</i></h4> <h4>Thanks</h4>
<legend></legend> <legend></legend>
<p> <p>
This project was made possible through the collective contributions of multiple Mason SRCT members. This project was made possible through the collective contributions of multiple Mason SRCT members.
...@@ -103,7 +103,7 @@ SRCT Go &bull; About ...@@ -103,7 +103,7 @@ SRCT Go &bull; About
<br></br> <br></br>
Go 1.0: Go 1.0:
<br /> <br />
<a href="https://github.com/jrouly">Michel Rouley</a>, <a href="https://github.com/jrouly">Michel Rouly</a>,
<a href="https://github.com/creffett">Chris Reffett</a>, <a href="https://github.com/creffett">Chris Reffett</a>,
<a href="https://github.com/nanderson94">Nicholas Anderson</a>, <a href="https://github.com/nanderson94">Nicholas Anderson</a>,
and <a href="https://github.com/akshaykarthik">Akshay Karthik</a>. and <a href="https://github.com/akshaykarthik">Akshay Karthik</a>.
......
...@@ -19,13 +19,13 @@ SRCT Go &bull; Edit Link ...@@ -19,13 +19,13 @@ SRCT Go &bull; Edit Link
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-wrench fa-stack-1x fa-inverse"></i> <i class="fa fa-wrench fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">Edit Link</i> Edit Link
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -13,13 +13,13 @@ SRCT Go &bull; My Links ...@@ -13,13 +13,13 @@ SRCT Go &bull; My Links
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-link fa-stack-1x fa-inverse"></i> <i class="fa fa-link fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">My Links</i> My Links
</strong></h1> </h1>
</div> </div>
</div> </div>
<div class="newlink" style="text-align: right;"> <div class="newlink" style="text-align: right;">
......
...@@ -19,13 +19,13 @@ SRCT Go &bull; New Link ...@@ -19,13 +19,13 @@ SRCT Go &bull; New Link
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-link fa-stack-1x fa-inverse"></i> <i class="fa fa-link fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">Shorten URL</i> Shorten URL
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -16,13 +16,13 @@ SRCT Go &bull; Apply ...@@ -16,13 +16,13 @@ SRCT Go &bull; Apply
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-user-plus fa-stack-1x fa-inverse"></i> <i class="fa fa-user-plus fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">Apply to Go</i> Apply to Go
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -6,55 +6,66 @@ ...@@ -6,55 +6,66 @@
<!-- Start the HTML page for Go --> <!-- Start the HTML page for Go -->
<html> <html>
<!-- load in our header content for every page -->
<head>
<!-- load in the title block defined on each html page -->
<title>
{% block title %}
{% endblock %}
</title>
<!-- load in our header content for every page --> <!-- Metatags -->
<head> <meta charset="utf-8">
<!-- load in the title block defined on each html page --> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
{% block title %} <!-- Chrome on Android navbar color -->
{% endblock %} <meta name="theme-color" content="#006633">
</title> <!-- FB/Opengraph tags -->
<meta property="og:url" content="https://go.gmu.edu/">
<!-- Some metadata --> <meta property="og:type" content="website">
<meta charset="UTF-8"> <meta property="og:title" content="SRCT Go">
<meta name="keywords" content="George Mason, URL shortener, URL"> <!--<meta property="og:image" content="https://git.gmu.edu/uploads/project/avatar/10/noun_534670_cc.png">-->
<meta name="description" content="University branded URL shortener."> <meta property="og:description" content="University-branded URL shortening.">
<meta name="author" content="Mason SRCT"> <meta property="og:site_name" content="SRCT Go">
<meta name="robots" content="all"> <meta property="og:locale" content="en_US">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta property="article:author" content="SRCT">
<meta name="theme-color" content="#006633"> <!-- Twitter card tags -->
<meta name="twitter:card" content="summary">
<!-- Load in our icon --> <meta name="twitter:site" content="@MasonSRCT">
<link rel="icon" type="image/ico" href="{% static "img/favicon.ico"%}" /> <meta name="twitter:creator" content="@MasonSRCT">
<meta name="twitter:url" content="https://go.gmu.edu/">
<!-- Load in global CSS --> <meta name="twitter:title" content="SRCT Gp">
<link href="https://fonts.googleapis.com/css?family=Carrois+Gothic" <meta name="twitter:description" content="University-branded URL shortening.">
rel="stylesheet" type="text/css"> <!--<meta name="twitter:image" content="https://git.gmu.edu/uploads/project/avatar/10/noun_534670_cc.png">-->
<link
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" <!-- Load in our icon -->
rel="stylesheet"> <link rel="icon" type="image/ico" href="{% static "img/favicon.ico" %}" />
<link rel="stylesheet" href="{% static "css/bootswatch.min.css" %}" />
<link rel="stylesheet" href="{% static "css/styles.css" %}" /> <!-- Load in global CSS -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
<!-- Load in global js --> rel="stylesheet" type="text/css">
<script src="{% static "js/jquery.min.js" %}"></script> <link rel="stylesheet" href="{% static "css/bootswatch.min.css" %}" />
<script src="{% static "js/bootstrap.min.js" %}"></script> <link rel="stylesheet" href="{% static "css/styles.css" %}" />
<script src="{% static "js/clipboard.min.js" %}"></script>
</head> <!-- Load in global JS -->
<script src="{% static "js/jquery.min.js" %}"></script>
<!-- Load in the body of a Go page --> <script src="{% static "js/bootstrap.min.js" %}"></script>
<body> <script src="{% static "js/clipboard.min.js" %}"></script>
<!-- Load in the navbar template --> </head>
{% include 'layouts/navigation.html' %}
<!-- Load in the body of a Go page -->
<!-- Wrap the page content in a container --> <body>
<div class="container"> <!-- Load in the navbar template -->
<!-- Load in the main page content --> {% include 'layouts/navigation.html' %}
{% block content %}
{% endblock %} <!-- Wrap the page content in a bootstrap container -->
</div> <div class="container">
<!-- Load in the main page content -->
<!-- Load in the footer template --> {% block content %}
{% include 'layouts/footer.html' %} {% endblock %}
</body> </div>
</html>
<!-- Load in the footer template -->
{% include 'layouts/footer.html' %}
</body>
</html>
\ No newline at end of file
<!-- define the footer template --> <!-- define the footer template -->
<footer class="footer"> <footer class="footer">
<!-- note: this is a special css class (see styles.css) --> <!-- note: this is a special css class (see styles.css) -->
<div class="text-center valign-center"> <div class="hidden-xs text-center valign-center">
<span class="text-muted">A project of <span class="text-muted">A project of
<a href="http://srct.gmu.edu/">GMU<strong> SRCT</strong></a>. | <a href="http://srct.gmu.edu/">GMU<strong> SRCT</strong></a>. |
Read and contribute to our <a href="https://git.gmu.edu/srct/go/">source code</a>. | Read and contribute to our <a href="https://git.gmu.edu/srct/go/">source code</a>. |
...@@ -9,4 +9,19 @@ ...@@ -9,4 +9,19 @@
Go Version 2.1.1 Go Version 2.1.1
</span> </span>
</div> </div>
<div class="container text-center hidden-sm hidden-md hidden-lg">
<div class="col-sm-4 text-muted">
A project of <a href="http://srct.gmu.edu/">GMU<strong> SRCT</strong></a>.
</div>
<div class="col-sm-4 text-muted">
Read and contribute to our <a href="https://git.gmu.edu/srct/go/">source code</a>.
</div>
<div class="col-sm-4 text-muted">
Freely-licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
</div>
<div class="col-sm-4 text-muted">
Go Version 2.1.1
</div>
</div>
</footer> </footer>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</button> </button>
<!-- Go brand logo --> <!-- Go brand logo -->
<a class="navbar-brand" href="{% url 'index' %}"> <a class="navbar-brand" href="{% url 'index' %}">
<i class="fa fa-link"> Go</i> <i class="fa fa-link"></i> Go
</a> </a>
</div> </div>
......
...@@ -97,12 +97,12 @@ ...@@ -97,12 +97,12 @@
<br></br> <br></br>
<!-- Delete Button --> <!-- Delete Button -->
<a class="button btn btn-danger btn-sm fa" data-target="#deletionModal-{{url.short}}" data-toggle="modal"> <a class="button btn btn-danger btn-sm" data-target="#deletionModal-{{url.short}}" data-toggle="modal">
<i class="fa fa-trash-o fa-lg"></i> Delete <i class="fa fa-trash-o fa-lg"></i> Delete
</a> </a>
<!-- Edit Button --> <!-- Edit Button -->
<a href="{{domain}}edit/{{url.short}}" class="button btn btn-info btn-sm fa"> <a href="{{domain}}edit/{{url.short}}" class="button btn btn-info btn-sm">
<i class="fa fa-cog fa-lg"></i> Edit <i class="fa fa-cog fa-lg"></i> Edit
</a> </a>
......
...@@ -13,13 +13,13 @@ SRCT Go &bull; Account Not Approved ...@@ -13,13 +13,13 @@ SRCT Go &bull; Account Not Approved
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><strong> <h1>
<span class="fa-stack fa-lg"> <span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-ban fa-stack-1x fa-inverse"></i> <i class="fa fa-ban fa-stack-1x fa-inverse"></i>
</span> </span>
<i class="fa">Account Not Approved</i> Account Not Approved
</strong></h1> </h1>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -27,7 +27,7 @@ SRCT Go &bull; Welcome ...@@ -27,7 +27,7 @@ SRCT Go &bull; Welcome
<div class="page-header" id="banner"> <div class="page-header" id="banner">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1><i class="fa"><i class="fa fa-link"></i> Go</i></h1> <h1><i class="fa fa-link"></i> Go</h1>
<p class="lead">University-branded URL shortening</p> <p class="lead">University-branded URL shortening</p>
</div> </div>
</div> </div>
...@@ -37,7 +37,7 @@ SRCT Go &bull; Welcome ...@@ -37,7 +37,7 @@ SRCT Go &bull; Welcome
<div class="row"> <div class="row">
<!-- what is go? --> <!-- what is go? -->
<div class="col-md-4">