1
0
Fork 0
mirror of https://github.com/Findus23/acronomy.git synced 2024-09-19 15:33:45 +02:00

asset management

This commit is contained in:
Lukas Winkler 2020-06-02 20:10:37 +02:00
parent f4f17be679
commit 23d1234f83
Signed by: lukas
GPG key ID: 54DE4D798D244853
21 changed files with 229 additions and 170 deletions

1
.gitignore vendored
View file

@ -113,3 +113,4 @@ node_modules/
acronyms.txt
media/
acronomy/secrets.py
static/css

View file

@ -36,7 +36,6 @@ INSTALLED_APPS = [
'debug_toolbar',
'rest_framework',
'bootstrap4',
"cachalot"
]
MIDDLEWARE = [
@ -115,26 +114,14 @@ MEDIA_URL = '/media/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
os.path.join(BASE_DIR, 'node_modules', 'bootstrap', 'dist'),
os.path.join(BASE_DIR, 'node_modules', 'jquery', 'dist'),
os.path.join(BASE_DIR, 'node_modules', 'popper.js', 'dist'),
os.path.join(BASE_DIR, 'node_modules', '@trevoreyre'),
os.path.join(BASE_DIR, 'node_modules', '@yaireo', 'tagify', 'dist'),
os.path.join(BASE_DIR, 'node_modules', 'codemirror')
]
# STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage"
INTERNAL_IPS = [
'127.0.0.1',
]
if Production:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
TAGGIT_CASE_INSENSITIVE = True
SECURE_BROWSER_XSS_FILTER = True
@ -148,22 +135,3 @@ if Production:
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
if DEBUG:
DEBUG_TOOLBAR_PANELS = [
'debug_toolbar.panels.versions.VersionsPanel',
'debug_toolbar.panels.timer.TimerPanel',
'debug_toolbar.panels.settings.SettingsPanel',
'debug_toolbar.panels.headers.HeadersPanel',
'debug_toolbar.panels.request.RequestPanel',
'debug_toolbar.panels.sql.SQLPanel',
'debug_toolbar.panels.staticfiles.StaticFilesPanel',
'debug_toolbar.panels.templates.TemplatesPanel',
'debug_toolbar.panels.cache.CachePanel',
'debug_toolbar.panels.signals.SignalsPanel',
'debug_toolbar.panels.logging.LoggingPanel',
'debug_toolbar.panels.redirects.RedirectsPanel',
'debug_toolbar.panels.profiling.ProfilingPanel',
] # default
DEBUG_TOOLBAR_PANELS.append("cachalot.panels.CachalotPanel")

View file

@ -1,7 +1,7 @@
from django.core.management.base import BaseCommand
from acros.models import Acronym
from acros.utils import md_to_html
from acros.utils.conversion import md_to_html
class Command(BaseCommand):

View file

@ -0,0 +1,30 @@
from pathlib import Path
import sass
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'compile scss'
def handle(self, *args, **kwargs):
basedir = Path(__file__).resolve().parent.parent.parent.parent
inputdir = basedir / "static/scss/"
inputfile = inputdir / "main.scss"
outputfile = basedir / "static/css/main.css"
sourcemap = outputfile.with_suffix(".css.map")
with inputfile.open() as f:
sass_text = f.read()
css,sourcemap_text = sass.compile(
filename=str(inputfile),
output_style="compressed",
include_paths=[str(inputdir), str(basedir)],
source_map_filename=str(sourcemap)
)
with outputfile.open("w") as f:
f.write(css)
with sourcemap.open("w") as f:
f.write(sourcemap_text)

View file

@ -61,11 +61,11 @@
<p>{{ paper.authors }}</p>
<div class="linkbar">
<a href="{{ paper.ads_url }}" data-toggle="tooltip" title="view on ADS">
<img src="{% static "ads.ico" %}">
<img src="{% static "images/ads.png" %}" width="32" height="32">
</a>
{% if paper.arxiv_id %}
<a href="{{ paper.arxiv_url }}" data-toggle="tooltip" title="view on arXiv.org">
<img src="{% static "arxiv.ico" %}">
<img src="{% static "images/arxiv.png" %}" width="32" height="32">
</a>
{% endif %}
{% if paper.doi %}
@ -104,5 +104,5 @@
{% endfor %}
</div>
<a href="{% url 'admin:acros_acronym_change' acro.id %}">Admin-Edit</a>
{# <a href="{% url 'edit' acro.slug %}">Edit</a>#}
{# <a href="{% url 'edit' acro.slug %}">Edit</a>#}
{% endblock %}

43
poetry.lock generated
View file

@ -163,18 +163,6 @@ django = ">=2.2,<4.0"
python = "<3.8"
version = ">=1.5.0,<2.0.0"
[[package]]
category = "main"
description = "Caches your Django ORM queries and automatically invalidates them."
name = "django-cachalot"
optional = false
python-versions = "*"
version = "2.2.0"
[package.dependencies]
Django = ">=1.11"
six = ">=1.13"
[[package]]
category = "main"
description = "A configurable set of panels that display various debug information about the current request/response."
@ -266,6 +254,17 @@ zipp = ">=0.5"
docs = ["sphinx", "rst.linker"]
testing = ["packaging", "importlib-resources"]
[[package]]
category = "main"
description = "Sass for Python: A straightforward binding of libsass for Python."
name = "libsass"
optional = false
python-versions = "*"
version = "0.20.0"
[package.dependencies]
six = "*"
[[package]]
category = "main"
description = "Python implementation of Markdown."
@ -424,7 +423,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"]
testing = ["jaraco.itertools", "func-timeout"]
[metadata]
content-hash = "bdfe2e7b4c2741554f3480b96ef5e05b9940b06c5520832e2dd7e98351c15be6"
content-hash = "cdcdcb111c5b517e781302c281d1bc1af54fb423475aa09b2632b407692d155c"
python-versions = ">=3.7,<4.0"
[metadata.files]
@ -517,9 +516,6 @@ django-bootstrap4 = [
{file = "django-bootstrap4-2.0.0.tar.gz", hash = "sha256:2618205322306b1cf3e4e67ec9d42cdf30b2656bf06d2b65d17498b0b2667271"},
{file = "django_bootstrap4-2.0.0-py3-none-any.whl", hash = "sha256:ca51246ea4a0bc06f7fa4305cefe7f7700cc09e7da1280f7bea5213470bb673d"},
]
django-cachalot = [
{file = "django-cachalot-2.2.0.tar.gz", hash = "sha256:c6fa5d0b8c0f8e812e4d9d512d0f923937413f6a892276fe0b094da57cd0d321"},
]
django-debug-toolbar = [
{file = "django-debug-toolbar-2.2.tar.gz", hash = "sha256:eabbefe89881bbe4ca7c980ff102e3c35c8e8ad6eb725041f538988f2f39a943"},
{file = "django_debug_toolbar-2.2-py3-none-any.whl", hash = "sha256:ff94725e7aae74b133d0599b9bf89bd4eb8f5d2c964106e61d11750228c8774c"},
@ -572,6 +568,21 @@ importlib-metadata = [
{file = "importlib_metadata-1.6.0-py2.py3-none-any.whl", hash = "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f"},
{file = "importlib_metadata-1.6.0.tar.gz", hash = "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e"},
]
libsass = [
{file = "libsass-0.20.0-cp27-cp27m-macosx_10_14_intel.whl", hash = "sha256:107c409524c6a4ed14410fa9dafa9ee59c6bd3ecae75d73af749ab2b75685726"},
{file = "libsass-0.20.0-cp27-cp27m-win32.whl", hash = "sha256:98f6dee9850b29e62977a963e3beb3cfeb98b128a267d59d2c3d675e298c8d57"},
{file = "libsass-0.20.0-cp27-cp27m-win_amd64.whl", hash = "sha256:b077261a04ba1c213e932943208471972c5230222acb7fa97373e55a40872cbb"},
{file = "libsass-0.20.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:e6a547c0aa731dcb4ed71f198e814bee0400ce04d553f3f12a53bc3a17f2a481"},
{file = "libsass-0.20.0-cp36-abi3-manylinux1_x86_64.whl", hash = "sha256:74f6fb8da58179b5d86586bc045c16d93d55074bc7bb48b6354a4da7ac9f9dfd"},
{file = "libsass-0.20.0-cp36-cp36m-win32.whl", hash = "sha256:a43f3830d83ad9a7f5013c05ce239ca71744d0780dad906587302ac5257bce60"},
{file = "libsass-0.20.0-cp36-cp36m-win_amd64.whl", hash = "sha256:fd19c8f73f70ffc6cbcca8139da08ea9a71fc48e7dfc4bb236ad88ab2d6558f1"},
{file = "libsass-0.20.0-cp37-abi3-macosx_10_14_x86_64.whl", hash = "sha256:8cf72552b39e78a1852132e16b706406bc76029fe3001583284ece8d8752a60a"},
{file = "libsass-0.20.0-cp37-cp37m-win32.whl", hash = "sha256:7555d9b24e79943cfafac44dbb4ca7e62105c038de7c6b999838c9ff7b88645d"},
{file = "libsass-0.20.0-cp37-cp37m-win_amd64.whl", hash = "sha256:794f4f4661667263e7feafe5cc866e3746c7c8a9192b2aa9afffdadcbc91c687"},
{file = "libsass-0.20.0-cp38-cp38-win32.whl", hash = "sha256:3bc0d68778b30b5fa83199e18795314f64b26ca5871e026343e63934f616f7f7"},
{file = "libsass-0.20.0-cp38-cp38-win_amd64.whl", hash = "sha256:5c8ff562b233734fbc72b23bb862cc6a6f70b1e9bf85a58422aa75108b94783b"},
{file = "libsass-0.20.0.tar.gz", hash = "sha256:b7452f1df274b166dc22ee2e9154c4adca619bcbbdf8041a7aa05f372a1dacbc"},
]
markdown = [
{file = "Markdown-3.2.2-py3-none-any.whl", hash = "sha256:c467cd6233885534bf0fe96e62e3cf46cfc1605112356c4f9981512b8174de59"},
{file = "Markdown-3.2.2.tar.gz", hash = "sha256:1fafe3f1ecabfb514a5285fca634a53c1b32a81cb0feb154264d55bf2ff22c17"},

View file

@ -18,7 +18,7 @@ Pillow = "^7.1.2"
gunicorn = "^20.0.4"
beautifulsoup4 = "^4.9.1"
django-bootstrap4 = "^2.0.0"
django-cachalot = "^2.2.0"
libsass = "^0.20.0"
[tool.poetry.dev-dependencies]
bpython = "^0.19"

View file

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
static/images/ads.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
static/images/arxiv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

1
static/libs/autocomplete.min.js vendored Symbolic link
View file

@ -0,0 +1 @@
../../node_modules/@trevoreyre/autocomplete-js/dist/autocomplete.min.js

1
static/libs/bootstrap.min.js vendored Symbolic link
View file

@ -0,0 +1 @@
../../node_modules/bootstrap/dist/js/bootstrap.min.js

1
static/libs/jquery.slim.min.js vendored Symbolic link
View file

@ -0,0 +1 @@
../../node_modules/jquery/dist/jquery.slim.min.js

1
static/libs/popper.min.js vendored Symbolic link
View file

@ -0,0 +1 @@
../../node_modules/popper.js/dist/umd/popper.min.js

1
static/libs/tagify.min.js vendored Symbolic link
View file

@ -0,0 +1 @@
../../node_modules/@yaireo/tagify/dist/tagify.min.js

View file

@ -0,0 +1 @@
$primary: #28a745;

152
static/scss/main.scss Normal file
View file

@ -0,0 +1,152 @@
//@import "login";
@import "variables";
@import "node_modules/@trevoreyre/autocomplete-js/dist/style";
@import "node_modules/@yaireo/tagify/dist/tagify";
@import "node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/variables";
@import "node_modules/bootstrap/scss/mixins";
@import "node_modules/bootstrap/scss/root";
@import "node_modules/bootstrap/scss/reboot";
@import "node_modules/bootstrap/scss/type";
@import "node_modules/bootstrap/scss/images";
@import "node_modules/bootstrap/scss/code";
@import "node_modules/bootstrap/scss/grid";
@import "node_modules/bootstrap/scss/tables";
@import "node_modules/bootstrap/scss/forms";
@import "node_modules/bootstrap/scss/buttons";
@import "node_modules/bootstrap/scss/transitions";
//@import "node_modules/bootstrap/scss/dropdown";
@import "node_modules/bootstrap/scss/button-group";
@import "node_modules/bootstrap/scss/input-group";
@import "node_modules/bootstrap/scss/custom-forms";
//@import "node_modules/bootstrap/scss/nav";
//@import "node_modules/bootstrap/scss/navbar";
@import "node_modules/bootstrap/scss/card";
//@import "node_modules/bootstrap/scss/breadcrumb";
//@import "node_modules/bootstrap/scss/pagination";
@import "node_modules/bootstrap/scss/badge";
//@import "node_modules/bootstrap/scss/jumbotron";
@import "node_modules/bootstrap/scss/alert";
//@import "node_modules/bootstrap/scss/progress";
//@import "node_modules/bootstrap/scss/media";
//@import "node_modules/bootstrap/scss/list-group";
//@import "node_modules/bootstrap/scss/close";
//@import "node_modules/bootstrap/scss/toasts";
//@import "node_modules/bootstrap/scss/modal";
//@import "node_modules/bootstrap/scss/tooltip";
//@import "node_modules/bootstrap/scss/popover";
//@import "node_modules/bootstrap/scss/carousel";
//@import "node_modules/bootstrap/scss/spinners";
//@import "node_modules/bootstrap/scss/utilities";
@import "node_modules/bootstrap/scss/print";
.accountStatus {
position: absolute;
top: 20px;
right: 20px;
}
h1 {
text-align: center;
}
h1.acronym {
font-size: 4rem;
}
.fullName {
text-align: center;
font-size: 2rem;
}
/*.linkwrapper {*/
/* display: flex;*/
/* flex-direction: column;*/
/*}*/
/*.linkwrapper div {*/
/* display: flex;*/
/* align-items: center;*/
/*}*/
.card-title {
text-align: center;
}
.card-title img {
max-width: 32px;
height: auto;
}
.card-img-top {
height: auto;
}
.card-body a {
display: block;
text-align: center;
}
.linkbar {
display: flex;
justify-content: space-between;
}
.linkbar a {
display: block;
}
.linkbar img, .linkbar svg {
width: 26px;
height: 26px;
padding: 5px;
}
.tags {
margin-bottom: 2rem;
}
.taglist {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.taglist .badge {
font-size: 150%;
margin: 5px;
}
/* https://stackoverflow.com/a/27727359/4398037 */
.CodeMirror {
/* Bootstrap Settings */
box-sizing: border-box;
margin: 0;
font: inherit;
display: block;
width: 100%;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
/* Code Mirror Settings */
font-family: monospace, monospace;
position: relative;
overflow: hidden;
}
.CodeMirror-focused {
/* Bootstrap Settings */
border-color: #66afe9;
outline: 0;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

View file

@ -1,106 +0,0 @@
.accountStatus {
position: absolute;
top: 20px;
right: 20px;
}
h1 {
text-align: center;
}
h1.acronym {
font-size: 4rem;
}
.fullName {
text-align: center;
font-size: 2rem;
}
/*.linkwrapper {*/
/* display: flex;*/
/* flex-direction: column;*/
/*}*/
/*.linkwrapper div {*/
/* display: flex;*/
/* align-items: center;*/
/*}*/
.card-title {
text-align: center;
}
.card-title img {
max-width: 32px;
height: auto;
}
.card-img-top {
height: auto;
}
.card-body a {
display: block;
text-align: center;
}
.linkbar {
display: flex;
justify-content: space-between;
}
.linkbar a {
display: block;
}
.linkbar img, .linkbar svg {
width: 26px;
height: 26px;
padding: 5px;
}
.tags {
margin-bottom: 2rem;
}
.taglist {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.taglist .badge {
font-size: 150%;
margin: 5px;
}
/* https://stackoverflow.com/a/27727359/4398037 */
.CodeMirror {
/* Bootstrap Settings */
box-sizing: border-box;
margin: 0;
font: inherit;
display: block;
width: 100%;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
/* Code Mirror Settings */
font-family: monospace, monospace;
position: relative;
overflow: hidden;
}
.CodeMirror-focused {
/* Bootstrap Settings */
border-color: #66afe9;
outline: 0;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

View file

@ -9,10 +9,7 @@
<title>{% block title %}Acronomy{% endblock %}</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="{% static "css/bootstrap.min.css" %}">
<link rel="stylesheet" href="{% static "autocomplete-js/dist/style.css" %}">
<link rel="stylesheet" href="{% static "tagify.css" %}">
<link rel="stylesheet" href="{% static "style.css" %}">
<link rel="stylesheet" href="{% static "css/main.css" %}">
{% block extra_head %}
{% endblock %}
</head>
@ -33,11 +30,11 @@
{% block content %}
{% endblock %}
</div>
<script src="{% static "jquery.min.js" %}"></script>
<script src="{% static "umd/popper.min.js" %}"></script>
<script src="{% static "js/bootstrap.min.js" %}"></script>
<script src="{% static "tagify.min.js" %}"></script>
<script src="{% static "autocomplete-js/dist/autocomplete.min.js" %}"></script>
<script src="{% static "libs/jquery.slim.min.js" %}"></script>
<script src="{% static "libs/popper.min.js" %}"></script>
<script src="{% static "libs/bootstrap.min.js" %}"></script>
<script src="{% static "libs/tagify.min.js" %}"></script>
<script src="{% static "libs/autocomplete.min.js" %}"></script>
<script src="{% static "app.js" %}"></script>
</body>