Skip to content

Commit

Permalink
Merge branch 'development' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nfoert authored Oct 20, 2024
2 parents 1343d41 + e37eb13 commit 8b4511a
Show file tree
Hide file tree
Showing 32 changed files with 326 additions and 193 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: tests
on: [pull_request, push]
env:
DATABASE_URL: sqlite:///cardie/db.sqlite3
jobs:
test_project:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install -r requirements.txt
- run: pip install -r requirements-dev.txt
- run: python cardie/manage.py test cardie
5 changes: 5 additions & 0 deletions cardie/cardie/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"django-insecure-a_r$cp+uufzh*bdagc!fra@7n10c*ciuleve_4+-cs_bftbb9",
),
DJANGO_ALLOWED_HOSTS=(list, ["localhost", "127.0.0.1"]),
ADMIN_PATH=(str, "admin/"),
DATABASE_URL=(str, "sqlite:///db.sqlite3")
)
# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand All @@ -40,7 +41,11 @@

ALLOWED_HOSTS = env("DJANGO_ALLOWED_HOSTS")

ADMIN_PATH = env("ADMIN_PATH")

FIXTURE_DIRS = [
os.path.join(BASE_DIR, "fixtures"),
]
# Application definition

INSTALLED_APPS = [
Expand Down
21 changes: 21 additions & 0 deletions cardie/cardie/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from unittest import skip

from django.test import Client, TestCase, override_settings


@override_settings(ADMIN_PATH="foo/")
class AdminTestCase(TestCase):
fixtures = ["server"]

def setUp(self):
self.client = Client()

def test_default_path_should_be_admin(self):
response = self.client.get("/admin/", follow=True)
self.assertEqual(response.status_code, 200)

@skip("This test is failing. Is hard to test this because urls are populated.")
@override_settings(ADMIN_PATH="foo/")
def test_custom_path_should_be_foo(self):
response = self.client.get("/foo/", follow=True)
self.assertEqual(response.status_code, 200)
8 changes: 6 additions & 2 deletions cardie/cardie/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from django.urls import include, path

ADMIN_PATH = settings.ADMIN_PATH

urlpatterns = [
path("", include("main.urls")),
path("auth/", include("authentication.urls")),
path('admin/', admin.site.urls),
path(ADMIN_PATH, admin.site.urls),
]
12 changes: 12 additions & 0 deletions cardie/fixtures/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"model": "main.server",
"pk": 1,
"fields": {
"ip": "127.0.0.1",
"production": true,
"allow_create_accounts": true,
"allow_sign_in": true
}
}
]
28 changes: 19 additions & 9 deletions cardie/main/context_processors.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings

from .models import Server

def server_context(request):
server_context = Server.objects.first()
if server_context is None:
raise ImproperlyConfigured(
"No Server object found in the database. Tip: please add one."
)
if settings.ADMIN_PATH not in request.path:
if server_context is None:
raise ImproperlyConfigured(
"No Server object found in the database. Tip: please add one."
)

return {
"server": {
"ip": server_context.ip,
"production": server_context.production,
return {
"server": {
"ip": server_context.ip,
"production": server_context.production
}
}

else:
return {
"server": {
"ip": "",
"production": ""
}
}
}
3 changes: 2 additions & 1 deletion cardie/main/templates/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
</div>
<div id="editor_header_name">
<button id="editor_header_name_button"
class="ui_button_smallicon"
data-tippy-content="Edit the name of this Card">
<i class="ph-bold ph-pencil-simple"></i>
</button>
Expand Down Expand Up @@ -97,7 +98,7 @@
<input type="color"
class="ui_input_generic"
id="editor_main_settings_colors_background"
data-tippy-content="Change the background color on your card"
data-tippy-content="Change the background color on your card"
value="#ffffff">
<p class="ui_text_description">Accent color</p>
<input type="color"
Expand Down
10 changes: 7 additions & 3 deletions cardie/main/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
<img id="home_card_image" src="{% static '/main/images/home_cards.png' %}">
</img>
<div id="home_card_text">
<p class="ui_text_header_left"><i class="ph-bold ph-cards"></i> Create a Card</p>
<p class="ui_text_header_left">
<i class="ph-bold ph-cards"></i> Create a Card
</p>
<ul>
<li class="ui_text_body">Add your name, title or pronouns to the top section</li>
<li class="ui_text_body">Add text information like your phone number, email, and more</li>
Expand All @@ -65,11 +67,13 @@
src="{% static '/main/images/home_editor.png' %}">
</img>
<div id="home_editor_text">
<p class="ui_text_header_left"><i class="ph-bold ph-pencil-simple"></i> Editor</p>
<p class="ui_text_header_left">
<i class="ph-bold ph-pencil-simple"></i> Editor
</p>
<ul>
<li class="ui_text_body">Add information and link items to your card</li>
<li class="ui_text_body">You can customize those items with a icon selector</li>
<li class="ui_text_body">Then, you can change the colors on your card and choose a font style</li>
<li class="ui_text_body">Then, you can change the colors on your card and choose a font style</li>
<li class="ui_text_body">Once you're finished, copy a link to your card so you can share it with anyone</li>
</ul>
</div>
Expand Down
15 changes: 14 additions & 1 deletion cardie/main/templates/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<p class="ui_text_header_left">
<i class="ph-bold ph-lock"></i> Privacy Policy
</p>
<p id="privacy_lastupdated" class="ui_text_description">Last updated 7/24/24</p>
<p id="privacy_lastupdated" class="ui_text_description">Last updated 10/15/24</p>
<div class="ui_separator_horizontal"></div>
<div id="privacy_content">
<p class="ui_text_subheader_left privacy_header">
Expand All @@ -28,6 +28,8 @@
</p>
<p class="ui_text_body">Email</p>
<p class="ui_text_body">The date and time the Account was created</p>
<p class="ui_text_body">Wallet data</p>
<p class="ui_text_description">This is a field that reflects all of the Cards stored in a User's account</p>
</div>
<div class="privacy_content_section">
<p class="ui_text_subheader_left">
Expand All @@ -38,6 +40,17 @@
<p class="ui_text_body">Card owner</p>
<p class="ui_text_body">Card data</p>
<p class="ui_text_description">This is a piece of JSON data which contains everything the card needs to be rendered.</p>
<p class="ui_text_body">Card date created</p>
<p class="ui_text_body">Card date last edited</p>
</div>
<div class="privacy_content_section">
<p class="ui_text_subheader_left">
<i class="ph-bold ph-cards"></i> Temporary Card
</p>
<p class="ui_text_body">UUID</p>
<p class="ui_text_body">Card data</p>
<p class="ui_text_description">This is a piece of JSON data which contains everything the card needs to be rendered.</p>
<p class="ui_text_body">Card date created</p>
</div>
<div class="privacy_content_section">
<p class="ui_text_body">
Expand Down
2 changes: 0 additions & 2 deletions cardie/main/tests.py

This file was deleted.

2 changes: 1 addition & 1 deletion cardie/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt
from main.icons import icons
from main.models import Card, Server, TempCard
from main.models import Card, TempCard


def index(request):
Expand Down
59 changes: 26 additions & 33 deletions cardie/static/main/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ html {
#editor_header_title_text {
font-family: var(--default-font-family);
font-size: clamp(3vh, 30px, 3vw);
color: white;
color: var(--default-text-color);
margin: 0;
padding: 0;

Expand All @@ -37,23 +37,6 @@ html {
margin-left: clamp(2vh, 20px, 2vw);
}

#editor_header_name_button {
background-color: rgba(99, 99, 99, 0.4);
border: 2px solid rgba(145, 145, 145, 0.6);
border: none;
color: white;

aspect-ratio: 1;
width: clamp(3vh, 30px, 3vw);
height: clamp(3vh, 30px, 3vw);
border-radius: 100px;
padding: 0;

margin-top: auto;
margin-bottom: auto;
transition: var(--default-transition);
}

#editor_header_name_button:hover {
scale: 1.1;
background-color: rgba(99, 99, 99, 0.6);
Expand All @@ -64,17 +47,17 @@ html {
}

#editor_header_name_text_cardname {
color: white;
color: var(--default-text-color);
padding-left: clamp(1vh, 10px, 1vw);
}

#editor_header_name_text_username {
color: white;
color: var(--default-text-color);
margin-left: clamp(0.8vh, 8px, 0.8vw);
}

#editor_status {
color: white;
color: var(--default-text-color);
font-family: var(--default-font-family);
font-size: clamp(1.4vh, 14px, 1.4vw);

Expand Down Expand Up @@ -128,16 +111,6 @@ html {
margin-right: auto;
}

.text_item {
display: flex;
flex-direction: row-reverse;
}

.link_item {
display: flex;
flex-direction: row-reverse;
}

@keyframes show-iconselector {
from {
opacity: 0;
Expand Down Expand Up @@ -285,14 +258,14 @@ html {
}

.editor_iconselector_icon_icon {
color: white;
color: var(--default-text-color);
font-size: clamp(3vh, 30px, 3vw);
text-align: center;
margin-top: clamp(0.3vh, 3px, 0.3vw);
}

.editor_iconselector_icon_text {
color: white;
color: var(--default-text-color);
font-family: "Noto Sans Mono", "Courier New", monospace;
font-size: clamp(1vh, 10px, 1vw);
text-align: center;
Expand Down Expand Up @@ -490,4 +463,24 @@ html {
margin-left: clamp(1.5vh, 15px, 1.5vw);
margin-right: clamp(1vh, 10px, 1vw);

}

@keyframes show-item {
from {
opacity: 0;
scale: 0.8;
}

to {
opacity: 1;
scale: 1;
}
}

.item {
animation: show-item 0.3s ease-in-out forwards;

/* Starting properties for animation */
opacity: 0;
scale: 0.8;
}
Loading

0 comments on commit 8b4511a

Please sign in to comment.