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

17 using wysiwyg editor to enter messages #31

Merged
merged 10 commits into from
Jan 5, 2025
Merged
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
venv
.vscode
12 changes: 8 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ name: Python package

on:
push:
branches: master
branches:
- dev
- master
pull_request:
branches: master
branches:
- dev
- master

jobs:
build:
Expand All @@ -16,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]

env:
DEBUG: true
Expand All @@ -41,7 +45,7 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
cd dry
cd src
mkdir logs
pytest --cov-report xml
- name: Upload Coverage to Codecov
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ coverage.xml
local_settings.py
db.sqlite3
db.sqlite3-journal
media/

# Flask stuff:
instance/
Expand Down Expand Up @@ -127,3 +128,5 @@ dmypy.json

# Pyre type checker
.pyre/

*.csv
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"autoDocstring.docstringFormat": "sphinx",
"editor.tabSize": 4
"editor.tabSize": 4,
"cSpell.words": [
"sents",
"Zepto"
]
}
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.11

ENV PYTHONUNBUFFERED 1

WORKDIR /app

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

RUN chmod +x ./src/entrypoint.sh

EXPOSE 8000
16 changes: 16 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.5'
services:
thunder:
build: .
ports:
- "7000:8000"
container_name: thunder
volumes:
- db-data:/app/src
env_file:
- ./src/.env
working_dir: /app/src
entrypoint: ./entrypoint.sh

volumes:
db-data:
74 changes: 42 additions & 32 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
asgiref==3.5.2
atomicwrites==1.4.0
attrs==21.4.0
certifi==2022.6.15
charset-normalizer==2.1.0
colorama==0.4.5
coverage==6.4.1
Django==4.0.5
execnet==1.9.0
idna==3.3
iniconfig==1.1.1
numpy==1.23.0
packaging==21.3
pandas==1.4.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.0.9
pytest==7.1.2
pytest-cov==3.0.0
pytest-django==4.5.2
pytest-forked==1.4.0
pytest-lazy-fixture==0.6.3
pytest-xdist==2.5.0
python-dateutil==2.8.2
python-decouple==3.6
pytz==2022.1
requests==2.28.1
six==1.16.0
sqlparse==0.4.2
tomli==2.0.1
tzdata==2022.1
urllib3==1.26.9
aiohappyeyeballs==2.3.5
aiohttp==3.10.3
aiohttp-retry==2.8.3
aiosignal==1.3.1
asgiref==3.5.2
atomicwrites==1.4.0
attrs==21.4.0
certifi==2022.6.15
charset-normalizer==2.1.0
colorama==0.4.5
coverage==6.4.1
Django==4.0.5
django-quill-editor==0.1.40
execnet==1.9.0
frozenlist==1.4.1
idna==3.3
iniconfig==1.1.1
multidict==6.0.5
numpy==1.23.0
packaging==21.3
pandas==1.4.3
pluggy==1.0.0
py==1.11.0
PyJWT==2.9.0
pyparsing==3.0.9
pytest==7.1.2
pytest-cov==3.0.0
pytest-django==4.5.2
pytest-forked==1.4.0
pytest-lazy-fixture==0.6.3
pytest-xdist==2.5.0
python-dateutil==2.8.2
python-decouple==3.6
pytz==2022.1
requests==2.28.1
six==1.16.0
sqlparse==0.4.2
tomli==2.0.1
twilio==9.2.3
tzdata==2022.1
urllib3==1.26.9
yarl==1.9.4
5 changes: 5 additions & 0 deletions src/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SECRET_KEY='test'
DEBUG=True
BLOCK_EMAIL=False
DEBUG_EMAIL=False
DJANGO_SETTINGS_MODULE='config.settings.dev'
47 changes: 40 additions & 7 deletions src/assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ body {
background-color: var(--bs-dark);
}

.navbar{
.navbar {
padding-top: 1.5rem;
padding-bottom: 1.5rem;
background-color: #131518 !important;
Expand All @@ -13,30 +13,30 @@ body {
gap: 1rem;
}

.container-fluid{
.container-fluid {
max-width: 900px;
margin: 0 auto;
}

label{
label {
margin-bottom: 6px;
font-weight: 500;
}

form{
max-width: 500px;
.box-container {
max-width: 900px;
margin: auto;
background: white;
padding: 2rem;
border-radius: 10px;
}

legend{
legend {
margin: 1rem 0 2rem 0;
font-weight: bold;
}

form button.btn {
#sender button.btn {
margin-top: 3rem !important;
display: block;
padding: 1.1rem 2rem;
Expand All @@ -45,3 +45,36 @@ form button.btn {
font-size: 1.1rem;
}


.manager-form {
display: flex;
gap: 12px;
flex-wrap: wrap;
background: #212529;
color: white;
padding: 1rem;
border-radius: 12px;
}

.manager-form p {
flex: 1;
min-width: 200px;
}


#manager-details {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
#manager-details .manager-detail-item {
flex: 1;
min-width: 200px;
display: flex;
gap: 12px;
flex-wrap: wrap;
}
#manager-details .manager-detail-item strong {
font-weight: 500;
text-transform: capitalize;
}
49 changes: 49 additions & 0 deletions src/assets/js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const fileInput = document.getElementById("csv");

const previewCSVData = async (dataurl) => {
const d = await d3.csv(dataurl);
console.log({
d,
});
console.log(d.columns);

const email_key = document.getElementById("email_key");
// delete previous options
email_key.options.length = 0;

d.columns.map((col) => {
email_key.options[email_key.options.length] = new Option(col, col);
});

$(function () {
$("#slider-range").slider({
range: true,
min: 0,
max: d.length,
values: [0, d.length],
slide: function (event, ui) {
$("#start").val(ui.values[0]);
$("#stop").val(ui.values[1]);
},
});
$("#start").val($("#slider-range").slider("values", 0));
$("#stop").val($("#slider-range").slider("values", 1));
});
};

const readFile = (e) => {
const file = fileInput.files[0];
if (!file) {
return;
}
const reader = new FileReader();
reader.onload = () => {
const dataUrl = reader.result;
previewCSVData(dataUrl);
};
reader.readAsDataURL(file);
};

if (fileInput) {
fileInput.onchange = readFile;
}
37 changes: 31 additions & 6 deletions src/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BASE_DIR = Path(__file__).resolve().parent.parent.parent


SECRET_KEY = config('SECRET_KEY', default='test')
SECRET_KEY = config('SECRET_KEY', default='django-insecure-ddd1')

DEBUG = config('DEBUG', default=True, cast=bool)

Expand All @@ -19,7 +19,8 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'mailer'
'mailer',
'django_quill',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -124,14 +125,14 @@
'handlers': {
'basic_h': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
# 'filename': BASE_DIR / 'logs/debug.log',
'class': 'logging.FileHandler',
'filename': BASE_DIR / 'logs/debug.log',
'formatter': 'simple',
},
'basic_e': {
'level': 'WARNING',
'class': 'logging.StreamHandler',
# 'filename': BASE_DIR / 'logs/error.log',
'class': 'logging.FileHandler',
'filename': BASE_DIR / 'logs/error.log',
'formatter': 'simple',
},
},
Expand All @@ -149,3 +150,27 @@

TWILIO_SID = config('TWILIO_SID', default='test')
TWILIO_TOKEN = config('TWILIO_TOKEN', default='test')


QUILL_CONFIGS = {
'default':{
'theme': 'snow',
'modules': {
'syntax': True,
'toolbar': [
[
{'font': []},
{'header': [1, 2, 3, 4, 5, 6, False]},
{'align': []},
'bold', 'italic', 'underline', 'strike', 'blockquote',
{'color': []},
{'background': []},
],
[{ 'list': 'ordered'}, { 'list': 'bullet' }, { 'list': 'check' }],
['code-block', 'link'],
['clean'],
]
}
}
}

7 changes: 2 additions & 5 deletions src/config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@

ALLOWED_HOSTS = ["*"]

SEND_GRID = config('SEND_GRID', default='test')
ZEPTOTOKEN = config('ZEPTOTOKEN', default='test')
EMAIL_DOMAIN = config('EMAIL_DOMAIN', default='test')
BLOCK_EMAIL = config('BLOCK_EMAIL', default=True, cast=bool)
DEBUG_EMAIL = config('DEBUG_EMAIL', default=True, cast=bool)
BLOCK_EMAIL = config('BLOCK_EMAIL', default=False, cast=bool)
DEBUG_EMAIL = config('DEBUG_EMAIL', default=False, cast=bool)
5 changes: 5 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

python manage.py migrate
python manage.py collectstatic --no-input
python manage.py runserver 0.0.0.0:8000
Loading
Loading