Skip to content

Commit

Permalink
Merge pull request #1 from sheepman4267/0.2.0
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
sheepman4267 authored Jan 18, 2023
2 parents 15835a9 + e1098cd commit 302e749
Show file tree
Hide file tree
Showing 16 changed files with 166 additions and 56 deletions.
1 change: 1 addition & 0 deletions Effort/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

urlpatterns = [
path('admin/', admin.site.urls),
path('', include('core.urls')),
path('lists/', include('lists.urls')),
path('notes/', include('notes.urls')),
path('accounts/', include('allauth.urls')),
Expand Down
67 changes: 67 additions & 0 deletions core/static/core/core.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
* {
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: "sans-serif";
}

.navbar {
height: 75px;
background: #b37bff;
display: flex;
flex-direction: row;
box-shadow: 0 0 5px 0 #000000;
z-index: 5;
}

.nav-container.left {
margin: 0 auto 0 10px;
align-self: center;
}

.nav-container.right {
margin: 0 10px 0 auto;
}

.nav-container.center {
align-self: center;
text-align: center;
margin-left: auto;
margin-right: auto;
}

.center-content {
max-width: 11in;
margin-right: auto;
margin-left: auto;
background: #87b9d3;
height: calc(100vh - 75px);
}

.app-button-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 200px));
padding: 10px;
grid-gap: 10px;
align-items: start;
width: 100%;
}

#core-body > .content-container {
background: #417698;
}

.app-button {
width: 100%;
min-width: fit-content;
text-align: center;
border: 2px solid #5c6b79;
background: #bed1de;
border-radius: 10px;
height: 30px;
padding-left: 10px;
padding-right: 10px;
white-space: nowrap;
text-decoration: 0;
color: black;
}
10 changes: 7 additions & 3 deletions core/templates/core/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
{% load static %}

<link rel="stylesheet" type="text/css" href="{% static 'lists/style.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'core/core.css' %}">
<script src="https://unpkg.com/[email protected]"></script><!--integrity="sha384-tvG/2mnCFmGQzYC1Oh3qxQ7CkQ9kMzYjWZSNtrRZygHPDDqottzEJsqS4oUVodhW" crossorigin="anonymous"></script>-->

{% block head %}
Expand All @@ -12,8 +12,12 @@
</head>
{% endblock %}

<body id="body" class="main-body" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
{% block body %}
<body id="core-body" class="main-body" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'>
{% block navbar %}
{% endblock %}
<div class="content-container">
{% block body %}
{% endblock %}
</div>
</body>
</html>
13 changes: 13 additions & 0 deletions core/templates/core/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'core/base.html' %}

{% block navbar %}
{% include 'core/navbar.html' %}
{% endblock %}

{% block body %}
<div class="center-content">
<div class="app-button-container">
<a class="app-button" href="{% url 'lists-index' %}">Lists!</a>
</div>
</div>
{% endblock %}
11 changes: 11 additions & 0 deletions core/templates/core/navbar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{% load icon %}
<div class="navbar" id="navbar">
<div class="nav-container left">
</div>
<div class="nav-container center">
<h1>Effort</h1>
<h4>v0.2.0</h4>
</div>
<div class="nav-container right">
</div>
</div>
6 changes: 6 additions & 0 deletions core/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.urls import path
from core import views

urlpatterns = [
path('', views.index, name='core-index')
]
6 changes: 5 additions & 1 deletion core/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
from django.shortcuts import render
from django.contrib.auth.decorators import login_required

@login_required
def index(request):
return render(request, 'core/index.html')

# Create your views here.
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
app:
image: docker.io/sheepman4267/effort:latest

volumes:
static-root:

5 changes: 3 additions & 2 deletions lists/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ class Meta:
model = ListItem
details = MarkdownxFormField
fields = (
'details',
'due_date',
# 'uncheck_every', #Disabled due to JS bugs in django-recurrence widget
)
widgets = {
'due_date': forms.DateInput()
'due_date': forms.DateInput(attrs = {
'type': 'date',
}),
}

class ListForm(forms.ModelForm):
Expand Down
Empty file.
46 changes: 15 additions & 31 deletions lists/static/lists/style.css → lists/static/lists/lists.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
* {
box-sizing: border-box;
padding: 0;
margin: 0;
font-family: "sans-serif";
}

h2 {
margin-bottom: 5px;
}
Expand Down Expand Up @@ -178,6 +171,12 @@ h2:hover .edit-button {
}
}

.field-container > input {
margin-left: auto;
margin-right: 0;
}

.field-container > input,
button {
width: fit-content;
min-width: fit-content;
Expand All @@ -188,6 +187,7 @@ button {
border: 2px solid gray;
display: block;
white-space: nowrap;
background: #e3e3e3;
}

.li-buttons-right > button {
Expand Down Expand Up @@ -264,38 +264,22 @@ button {
width: 100%;
}

/*.details-container > div {*/

/*}*/
.details-container > div {
height: 100%;
max-width: fit-content;
}

.details-container .field-container {
margin-bottom: 5px;
margin-top: 5px;
}

.field-container > h4 {
color: gray;
}

.navbar {
height: 75px;
background: #b37bff;
width: 100%;
gap: 5px;
display: flex;
flex-direction: row;
}

.nav-container.left {
margin: 0 auto 0 10px;
align-self: center;
.field-container > h4 {
color: gray;
}

.nav-container.right {
margin: 0 10px 0 auto;
}

.nav-container.center {
align-self: center;
text-align: center;
margin-left: auto;
margin-right: auto;
}
9 changes: 5 additions & 4 deletions lists/templates/lists/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" type="text/css" href="{% static 'lists/style.css' %}">
<script src="https://unpkg.com/[email protected]"></script>
<link rel="stylesheet" type="text/css" href="{% static 'core/core.css' %}">
<link rel="stylesheet" type="text/css" href="{% static 'lists/lists.css' %}">
<script src="https://unpkg.com/[email protected]"></script>
<script src="https://unpkg.com/[email protected]"></script>
<script src="{% url 'jsi18n' %}"></script>

Expand All @@ -16,12 +17,12 @@
</head>
{% endblock %}

<body id="body" class="main-body show-list" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' hx-boost="false" >
<body id="body" class="main-body show-list" hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}' hx-boost="true" >
{% block navbar %}
{% endblock %}
<div class="content-container">
{% block body %}
{% endblock %}
</>
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion lists/templates/lists/list-edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<form method="post" action="{% url "new-list" parent_list_pk %}">{% csrf_token %}
title:{{ form.title }}<br>
{{ form.errors }}
<input type="submit">
<input type="submit" class="submit-button">
</form>
</div>

Expand Down
22 changes: 14 additions & 8 deletions lists/templates/lists/list-item-details.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{% load lists_extras %}
{% load icon %}
<div id="item-details-{{ item.pk }}" class="details-container">

<form id="item-details-{{ item.pk }}" class="details-container" method="post" action="{% url 'item-details' item_pk=item.pk %}">
{% csrf_token %}
{{ form.media }}
<div>
<div class="field-container">
<h4>Details:</h4>
{{ form.details }}
</div>
</div>
{# <div>#}
{# <div class="field-container">#}
{# <h4>Details:</h4>#}
{# {{ form.details }}#}
{# </div>#}
{# </div>#}
{# Removed Details; it was causing styling headaches and isn't very useful. TODO: Allow linking to a note instead.#}
<div>
<div class="field-container">
<h4>Due Date:</h4>
Expand All @@ -16,5 +19,8 @@ <h4>Due Date:</h4>
<div class="field-container">
<h4>Configure repetition in admin due to bugs</h4>
</div>
<div class="field-container">
<input type="submit" class="submit-button" value="Submit Item Edits">
</div>
</div>
</div>
</form>
2 changes: 1 addition & 1 deletion lists/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from . import views

urlpatterns = [
path('', views.index, name='index'),
path('', views.index, name='lists-index'),
path('list/<int:list>', views.display_list, name='list'),
path('list/new', views.new_list, name='new-list'),
path('list/new/<int:parent>', views.new_list, name='new-sublist'),
Expand Down
15 changes: 10 additions & 5 deletions lists/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,13 @@ def new_list(request, parent=None):
@login_required
def item_details(request, item_pk):
item = ListItem.objects.get(pk=item_pk)
form = DetailedListItemForm(instance=item)
return render(request, 'lists/list-item-details.html', {
'item': item,
'form': form,
})
if request.method == 'POST':
form = DetailedListItemForm(request.POST, instance=item)
form.save()
return HttpResponseRedirect(reverse('list', args=[1]))
else: # as in, if request.method != 'POST':
form = DetailedListItemForm(instance=item)
return render(request, 'lists/list-item-details.html', {
'item': item,
'form': form,
})

0 comments on commit 302e749

Please sign in to comment.