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

Major overhaul #197

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ jobs:
- uses: actions/cache@v2
with:
path: ~/.cache/pip
# Match requirements.txt and dev-requirements.txt
key: ${{ runner.os }}-pip-${{ hashFiles('*requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/common.txt', 'requirements/dev.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt -r dev-requirements.txt
pip install -r requirements/common.txt -r requirements/dev.txt
- name: Lint
run: |
flake8
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ ENV PYTHONUNBUFFERED=1
WORKDIR /app/src

# Install dependencies
RUN pip install --no-cache-dir gunicorn psycopg2
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY requirements requirements
RUN pip install --no-cache-dir -r requirements/common.txt -r requirements/prod.txt

COPY . .

Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ Cooking website.

### Local Python

- Create and activate virtual environment
- Copy `.env.example` to `.env` and adjust as wanted
- `pip install -r requirements.txt -r dev-requirements.txt`
- `python manage.py runserver`
- (`python manage.py migrate`)
* Create and activate virtual environment
* Copy `.env.example` to `.env` and adjust as wanted
* `pip install -r requirements/common.txt -r requirements/dev.txt`

### Docker

Expand All @@ -21,14 +19,19 @@ Cooking website.

## Development commands

- Lint code: `flake8`
- Run unit tests: `python manage.py test`
- Create superuser: `python manage.py createsuperuser`
* Lint code: `flake8`
* Run unit tests: `python manage.py test`
* Create superuser: `python manage.py createsuperuser`
* Development server: `python manage.py runserver`
* Apply migrations: `python manage.py migrate`

## On dependencies

To add a new dependency, append it to `requirements.in`, install `pip-tools`
To add a new dependency, append it to `requirements/common.in`, install `pip-tools`
inside the virtual environment
and run `pip-compile requirements.in`.
and run `pip-compile requirements/common.in`.
See [pip-tools documentation](https://github.com/jazzband/pip-tools)
for details.

Requirements only for development (e.g. linting) go in `requirements/dev.in`,
only for production (gunicorn) go in `requirements/prod.in`.
12 changes: 8 additions & 4 deletions assets/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
}
}

/* Fix for strange background behavior in Chrome */
body {
background-color: #212121;
}

/* CSS corrections for Select2 */
.select2-container {
Expand All @@ -30,3 +26,11 @@ body {
.select2-selection {
background-color: #fff;
}


/**
* Bootstrap table row vertical centering
*/
.table td {
vertical-align: middle;
}
54 changes: 0 additions & 54 deletions assets/static/css/dining_v2.css
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
.slot_image{
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

.slot-back{
position: absolute;
background-color: transparent;

display: block;
width: 100%;
height:100%;
left: 0;
top: 0;
}

hr {
border-top: 1px solid #ccc;
}

.slot-signup, .slot-signed, .slot-unlist{
background-position: center;
-webkit-background-size: contain;
background-size: auto 75%;
background-repeat: no-repeat;
}

.slot-signup{
background-image: url("/static/images/sign_up_in.png");
}

.slot-signed{
background-image: url("/static/images/signed_in.png");
}

.slot-unlist{
background-image: url("/static/images/sign_up_out.png");
}

.diningentry:hover{
background-color: #254a9999;
}

.dining-nav {
border-radius: 10px 10px 0 0 ;
}
Expand All @@ -56,13 +12,3 @@ hr {
filter: grayscale(100%);
padding: 0 0.1em;
}

.collapser{
height:0;
overflow: hidden;
transition: all 0.3s ease;
}

input:checked + .collapser{
height:auto;
}
Binary file removed assets/static/images/cooking.png
Binary file not shown.
Binary file removed assets/static/images/dishes.png
Binary file not shown.
35 changes: 0 additions & 35 deletions assets/static/images/github_mark.svg

This file was deleted.

Binary file removed assets/static/images/shopping_cart.png
Binary file not shown.
Binary file removed assets/static/images/sign_up_in.png
Binary file not shown.
Binary file removed assets/static/images/sign_up_out.png
Binary file not shown.
Binary file removed assets/static/images/signed_in.png
Binary file not shown.
14 changes: 9 additions & 5 deletions assets/templates/account/settings/settings_account.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
{% block details %}
{# Username #}
<form method="post" action="{% url 'settings_account' %}">
<h3>Account</h3>
{% csrf_token %}
{% include "snippets/bootstrap_form.html" with form=user_form horizontal=True %}
{% include "snippets/bootstrap_form.html" with horizontal=True fields=form.visible_fields|slice:":3" %}
<h3>Contact info</h3>
<p>
Contact info is visible to everyone who joins the same dining lists as you.
Leave empty if for privacy reasons you don't want to share your contact info.
</p>
{% include "snippets/bootstrap_form.html" with fields=form.visible_fields|slice:"4:6" horizontal=True %}
<h3>Dining</h3>
{% include "snippets/bootstrap_form.html" with form=dining_form horizontal=True %}
{% include "snippets/bootstrap_form.html" with fields=form.visible_fields|slice:"3:4" horizontal=True %}
<h3>Memberships</h3>
{% include "account/snippet_associations_form.html" with form=association_links_form %}
<p><button type="submit" name="user_submit" class="btn btn-primary btn-block">Save</button></p>
<button type="submit" class="btn btn-primary btn-block">Save</button>
</form>

{% endblock %}
80 changes: 28 additions & 52 deletions assets/templates/account/signup.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,32 @@
{% load static %}

{% block content %}
<div class="row width-max-lg text-size-md-5">
<div class="col-12">
<form method="post">
{% csrf_token %}

<div class="">
<h3>Account specifications</h3>
{% include "snippets/bootstrap_form.html" with form=account_form horizontal=True %}

<h3>Personal information</h3>
{% include "snippets/bootstrap_form.html" with form=account_detail_form horizontal=True %}

<h3>Memberships</h3>
{% include "account/snippet_associations_form.html" with form=associationlink_form horizontal=True %}

<p>
<span class="text-danger">*</span> required
</p>

<h3>Terms of service</h3>
<p class="offset-sm-2 col-sm-10">
We care for your privacy, though due to the nature of the service we will openly display
your name on the dining lists you subscribe on. For full details check our
<a target="_blank" rel="noopener noreferrer" href="{% static "files/Scala Dining App - Privacy Policy 8-4-17.pdf" %}">Privacy policy</a>.<br>
By using the site, you are automatically agreeing to the
<a target="_blank" rel="noopener noreferrer" href="{% static "files/Scala Dining App - User Agreement 8-4-17.pdf" %}">User Agreement</a>.<br>
</p>
<br>

<label for="accept_rules" class="row m-0">

<div class="col-1 col-sm-2 p-2">
<input type="checkbox" id="accept_rules" required="required" class=""/>
<div class="checkbox"></div>
</div>
<div class="col-11 col-sm-10">
I understand and accept both the privacy and the user agreement.
</div>

</label>


<br>
<br>
</div>
<input type="submit" value="Register" class="btn btn-block btn-primary">
<br>
<br>
<br>
</form>
<form method="post" action="{% url 'account_signup' %}">
{% csrf_token %}
<h3>Account specifications</h3>
{% include "snippets/bootstrap_form.html" with fields=form.visible_fields|slice:":3" horizontal=True %}
<h3>Personal details</h3>
{% include "snippets/bootstrap_form.html" with fields=form.visible_fields|slice:"3:7" horizontal=True %}
<h3>Memberships</h3>
{% include "snippets/bootstrap_form.html" with fields=form.visible_fields|slice:"7:8" horizontal=True %}
<p><span class="text-danger">*</span> required</p>
<h3>Terms of service</h3>
<p>
We care for your privacy, though due to the nature of the service we will openly display
your name on the dining lists you subscribe on. For full details check our
<a target="_blank" rel="noopener noreferrer"
href="{% static "files/Scala Dining App - Privacy Policy 8-4-17.pdf" %}">privacy policy</a>.
By using the site, you automatically agree to the
<a target="_blank" rel="noopener noreferrer"
href="{% static "files/Scala Dining App - User Agreement 8-4-17.pdf" %}">user agreement</a>.
</p>
{# This is not checked server-side (but that's probably fine) #}
<div class="custom-control custom-checkbox mb-3">
<input type="checkbox" class="custom-control-input" id="tosCheck" required="required">
<label class="custom-control-label" for="tosCheck">
I understand and accept both the privacy and the user agreement.
</label>
</div>
</div>
{% endblock %}
<button type="submit" class="btn btn-block btn-primary">Register</button>
</form>
{% endblock %}
6 changes: 3 additions & 3 deletions assets/templates/account/snippet_associations_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
{% if field.field.disabled %}disabled{% endif %}>
<label class="custom-control-label w-100 mb-3" for="{{ field.id_for_label }}">
{{ field.label }}
{% if field.field.verified %}
{% if field.field.membership.is_verified %}
<span class="badge badge-success">Verified</span>
{% elif field.field.verified == False %}
{% elif field.field.membership.is_rejected %}
<span class="badge badge-danger">Rejected</span>
{% elif field.field.pending %}
{% elif field.field.membership.is_pending %}
<span class="badge badge-info">Pending</span>
{% endif %}
</label>
Expand Down
39 changes: 0 additions & 39 deletions assets/templates/accounts/association_correct_negatives.html

This file was deleted.

8 changes: 1 addition & 7 deletions assets/templates/accounts/association_credits.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,12 @@

{% block details %}
<p>
Association balance: <strong>{{ association.account.get_balance|euro }}</strong>
Association balance: <strong>{{ association.account.balance|euro }}</strong>
</p>
<p>
<a class="btn btn-primary" href="{% url 'association_transaction_add' association_name=association.slug %}">
<i class="fas fa-plus"></i> Money transfer
</a>
{% if association.has_min_exception %}
<a href="{% url 'association_process_negatives' association_name=association.slug %}"
class="btn btn-secondary">
Autocorrect negative credits
</a>
{% endif %}
<a href="{% url 'association_transactions_csv' association_name=association.slug %}"
class="btn btn-secondary">
<i class="fa fa-file-export"></i> Download CSV
Expand Down
2 changes: 1 addition & 1 deletion assets/templates/accounts/association_members.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<td>{{ user.get_username }}</td>
<td>{{ user.get_full_name }}</td>
<td>{{ user.email }}</td>
<td>{{ user.account.get_balance|euro }}</td>
<td>{{ user.account.balance|euro }}</td>
<td>{{ user.account.negative_since|default:"-" }}</td>
</tr>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion assets/templates/accounts/association_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h3>Association balance</h3>
</p>
<div class="card">
<div class="card-body">
Association balance: <strong>{{ association.account.get_balance|euro }}</strong>
Association balance: <strong>{{ association.account.balance|euro }}</strong>
</div>
</div>
<p class="mt-3">
Expand Down
Loading