Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/nfoert/cardie into d…
Browse files Browse the repository at this point in the history
…evelopment
  • Loading branch information
nfoert committed Oct 5, 2024
2 parents c0f1676 + 31c4c31 commit 1c3c63d
Show file tree
Hide file tree
Showing 29 changed files with 570 additions and 383 deletions.
6 changes: 6 additions & 0 deletions .djlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"max_line_length": "180",
"max_blank_lines": 1,
"profile": "django"
}

10 changes: 10 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Ruff
on: [ push, pull_request ]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
with:
path: './cardie'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
cardie/db.sqlite3
__pycache__
django.log
.env
.env
.ruff_cache
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"charliermarsh.ruff"
]
}
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@
"panel": "new"
},
"problemMatcher": []
},
{
"label": "Format Django templats with djlint",
"type": "shell",
"command": "source .venv/bin/activate && djlint cardie --reformat",
"presentation": {
"reveal": "always",
"panel": "new"
},
"problemMatcher": []
}
]
}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Activate the virtual environment using the command for your system (Linux is use
```bash
source ./.venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
```

Copy the `.env.example` file to a new file called `.env`.
Expand Down Expand Up @@ -98,6 +99,19 @@ Set the following global environment variables:
- `DEBUG` -> `False`
- `DATABASE_URL` -> `${db.DATABASE_URL}` (This works on DigitalOcean, this may not work on every hosting provider)

## Development
### djlint
This project uses `djlint` to lint the templates. You can run this using the following command
```bash
djlint cardie --reformat
```
### ruff
This project uses [`ruff`](https://docs.astral.sh/ruff/) to lint and format the code.
You can run the following command to lint and format the code.
```bash
ruff check cardie --fix
```
For VS Code users, you can install the `ruff` extension to get linting and formatting on save.

## Contributing
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how you can contribute to Cardie
1 change: 0 additions & 1 deletion cardie/authentication/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from django.contrib import admin

# Register your models here.
1 change: 0 additions & 1 deletion cardie/authentication/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from django.test import TestCase

# Create your tests here.
2 changes: 1 addition & 1 deletion cardie/authentication/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.shortcuts import render, HttpResponse
from django.shortcuts import HttpResponse
from django.contrib.auth.hashers import make_password, check_password

from authentication.models import User
Expand Down
2 changes: 1 addition & 1 deletion cardie/main/management/commands/cleartempcards.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.core.management.base import BaseCommand, CommandError
from django.core.management.base import BaseCommand
from main.models import TempCard
from django.utils import timezone
import datetime
Expand Down
1 change: 0 additions & 1 deletion cardie/main/migrations/0010_migrate_card_v0_to_v1.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 5.0.3 on 2024-09-09 23:31

from django.db import migrations
import json

def migrate_json_data(apps, schema_editor):
Card = apps.get_model('main', 'Card')
Expand Down
1 change: 0 additions & 1 deletion cardie/main/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from colorfield.fields import ColorField
from django.db import models
from authentication.models import User
import uuid
Expand Down
94 changes: 61 additions & 33 deletions cardie/main/templates/authentication.html
Original file line number Diff line number Diff line change
@@ -1,56 +1,85 @@
{% extends "base.html" %}

{% load static %}

{% block head_title %}Authentication{% endblock %}

{% block stylesheets %}
<link rel="stylesheet" type="text/css" href="{% static '/main/ui.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/main/notifications.css' %}">

<link rel="stylesheet" type="text/css" href="{% static '/main/authentication.css' %}">
<link rel="stylesheet"
type="text/css"
href="{% static '/main/notifications.css' %}">
<link rel="stylesheet"
type="text/css"
href="{% static '/main/authentication.css' %}">
{% endblock %}


{% block body %}
<div id="authentication-box" x-data="box_param_check()">
{% csrf_token %}

<img id="authentication-box-image" @click="window.location.href = server_ip" src="{% static '/main/images/logo_light.png' %}">

<div class="ui_status_critical" id="authentication-error" style="display: none;">
<img id="authentication-box-image"
@click="window.location.href = server_ip"
src="{% static '/main/images/logo_light.png' %}">
<div class="ui_status_critical"
id="authentication-error"
style="display: none">
<i class="ph-bold ph-warning-octagon ui_status_icon"></i>
<p class="ui_status_text">Critical status box</p>
</div>

<div id="signin-box" x-show="sign_in" x-transition:enter.delay.200ms>
<p class="ui_text_header"><i class="ph-bold ph-keyhole"></i> Sign In</p>
<p class="ui_text_header">
<i class="ph-bold ph-keyhole"></i> Sign In
</p>
<div class="ui_separator_horizontal"></div>

<input id="signin-username" type="text" class="ui_input_generic" placeholder="Username"></input>
<input id="signin-password" type="password" class="ui_input_generic" placeholder="Password"></input>

<button id="signin-signin" class="ui_button_large"><strong>Sign In</strong> <i class="ph-bold ph-sign-in"></i></button>
<button id="signin-createaccount" class="ui_button_small" @click="sign_in = !sign_in">Create an Account <i class="ph-bold ph-arrow-right"></i></button>
<input id="signin-username"
type="text"
class="ui_input_generic"
placeholder="Username">
<input id="signin-password"
type="password"
class="ui_input_generic"
placeholder="Password">
<button id="signin-signin" class="ui_button_large">
<strong>Sign In</strong> <i class="ph-bold ph-sign-in"></i>
</button>
<button id="signin-createaccount"
class="ui_button_small"
@click="sign_in = !sign_in">
Create an Account <i class="ph-bold ph-arrow-right"></i>
</button>
</div>

<div id="createaccount-box" x-show="!sign_in" x-transition:enter.delay.200ms>
<p class="ui_text_header"><i class="ph-bold ph-key"></i> Create Account</p>
<div id="createaccount-box"
x-show="!sign_in"
x-transition:enter.delay.200ms>
<p class="ui_text_header">
<i class="ph-bold ph-key"></i> Create Account
</p>
<div class="ui_separator_horizontal"></div>

<input id="createaccount-username" type="text" class="ui_input_generic" placeholder="Username"></input>
<input id="createaccount-password" type="password" class="ui_input_generic" placeholder="Password"></input>
<input id="createaccount-email" type="text" class="ui_input_generic" placeholder="Email"></input>

<button id="createaccount-createaccount" class="ui_button_large"><strong>Create Account</strong> <i class="ph-bold ph-user-plus"></i></button>
<button id="createaccount-signin" class="ui_button_small" @click="sign_in = !sign_in">Sign In <i class="ph-bold ph-arrow-right"></i></button>
<input id="createaccount-username"
type="text"
class="ui_input_generic"
placeholder="Username">
<input id="createaccount-password"
type="password"
class="ui_input_generic"
placeholder="Password">
<input id="createaccount-email"
type="text"
class="ui_input_generic"
placeholder="Email">
<button id="createaccount-createaccount" class="ui_button_large">
<strong>Create Account</strong> <i class="ph-bold ph-user-plus"></i>
</button>
<button id="createaccount-signin"
class="ui_button_small"
@click="sign_in = !sign_in">
Sign In <i class="ph-bold ph-arrow-right"></i>
</button>
</div>
<div id="authentication_privacypolicy"
@click="window.location.href = server_ip + '/privacy'">
<i class="ph-bold ph-lock"></i> Privacy Policy
</div>

<div id="authentication_privacypolicy" @click="window.location.href = server_ip + '/privacy'"><i class="ph-bold ph-lock"></i> Privacy Policy</div>
</div>

<div id="blob"></div>

{% endblock %}

{% block scripts %}
Expand All @@ -71,7 +100,6 @@
};
}
</script>

<script src="{% static '/main/scripts/authentication/authentication.js' %}"></script>
<script src="{% static '/main/scripts/global/notifications.js' %}"></script>
{% endblock %}
29 changes: 16 additions & 13 deletions cardie/main/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@
<!DOCTYPE html>
<html>
<head>
{% block head_scripts %}{% endblock head_scripts %}

{% block head_scripts %}
{% endblock head_scripts %}
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>

<link rel="stylesheet" type="text/css" href="{% static '/main/variables.css' %}">
<script defer
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
<link rel="stylesheet"
type="text/css"
href="{% static '/main/variables.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/main/ui.css' %}">
<link rel="stylesheet" type="text/css" href="{% static '/main/footer.css' %}">
<link rel="stylesheet"
type="text/css"
href="{% static '/main/footer.css' %}">
{% block stylesheets %}{% endblock %}

<link rel="shortcut icon" type="image/png" href="{% static '/main/images/favicon_light.ico' %}"/>

<link rel="shortcut icon"
type="image/png"
href="{% static '/main/images/favicon_light.ico' %}" />
<meta name="darkreader-lock">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="{% url "config_js" %}"></script>
<title>Cardie | {% block head_title %}{% endblock %}</title>
<title>Cardie |
{% block head_title %}{% endblock %}
</title>
</head>

<body>
{% block body %}{% endblock %}
{% include "footer.html" %}

<script>
var server_ip = "{{ server.ip }}";
var production = "{{ server.production }}";
var username = "{{ username }}"
</script>

<script src="{% static '/main/scripts/global/favicon.js' %}"></script>
<script src="{% static '/main/scripts/global/logging.js' %}"></script>
{% block scripts %}{% endblock %}
Expand Down
25 changes: 9 additions & 16 deletions cardie/main/templates/card.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,32 @@
<div class="card_wrap">
<div class="card_card" card-align="left">

<div class="card_card_front">
<div class="card_content">
<div class="card_top">
<img class="card_top_profilepicture">

<div class="card_top_text">
<p class="card_top_text_username">username</p>
<p class="card_top_text_pronouns">pronouns</p>
</div>

</div>

<div class="card_items">

</div>
<div class="card_items"></div>
</div>
</div>

<div class="card_card_back">
<div class="card_content">
<p>Back of card</p>
</div>
</div>
</div>
</div>

<dialog id="dialog_card_menu" class="ui_dialog_generic" x-data="{ single: false }">
<dialog id="dialog_card_menu"
class="ui_dialog_generic"
x-data="{ single: false }">
<div class="ui_dialog_generic_top">
<p class="ui_text_subheader_left ui_dialog_generic_top_text">All Items</p>
<button class="ui_button_icon ui_dialog_generic_top_close"><i class="ph-bold ph-x-circle"></i></button>
</div>

<div id="dialog_card_menu_items">

<button class="ui_button_icon ui_dialog_generic_top_close">
<i class="ph-bold ph-x-circle"></i>
</button>
</div>
</dialog>
<div id="dialog_card_menu_items"></div>
</dialog>
Loading

0 comments on commit 1c3c63d

Please sign in to comment.