diff --git a/.gitignore b/.gitignore index 9ffeffe..c92b4e1 100644 --- a/.gitignore +++ b/.gitignore @@ -113,3 +113,4 @@ node_modules/ acronyms.txt media/ acronomy/secrets.py +static/css diff --git a/acronomy/settings.py b/acronomy/settings.py index 31f4b45..b1918fb 100644 --- a/acronomy/settings.py +++ b/acronomy/settings.py @@ -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") diff --git a/acros/management/commands/markdown.py b/acros/management/commands/markdown.py index 0130d82..58a7e89 100644 --- a/acros/management/commands/markdown.py +++ b/acros/management/commands/markdown.py @@ -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): diff --git a/acros/management/commands/scss.py b/acros/management/commands/scss.py new file mode 100644 index 0000000..5d30363 --- /dev/null +++ b/acros/management/commands/scss.py @@ -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) diff --git a/acros/templates/acros/detail.html b/acros/templates/acros/detail.html index 5628663..258b804 100644 --- a/acros/templates/acros/detail.html +++ b/acros/templates/acros/detail.html @@ -61,11 +61,11 @@

{{ paper.authors }}

Admin-Edit -{# Edit#} + {# Edit#} {% endblock %} diff --git a/poetry.lock b/poetry.lock index e2ec220..bfdc1c9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -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"}, diff --git a/pyproject.toml b/pyproject.toml index 7441c5e..4cb5e65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/static/ads.ico b/static/images/ads.ico similarity index 100% rename from static/ads.ico rename to static/images/ads.ico diff --git a/static/images/ads.png b/static/images/ads.png new file mode 100644 index 0000000..2957713 Binary files /dev/null and b/static/images/ads.png differ diff --git a/static/arxiv.ico b/static/images/arxiv.ico similarity index 100% rename from static/arxiv.ico rename to static/images/arxiv.ico diff --git a/static/images/arxiv.png b/static/images/arxiv.png new file mode 100644 index 0000000..d1d7ebe Binary files /dev/null and b/static/images/arxiv.png differ diff --git a/static/libs/autocomplete.min.js b/static/libs/autocomplete.min.js new file mode 120000 index 0000000..c0ca5c7 --- /dev/null +++ b/static/libs/autocomplete.min.js @@ -0,0 +1 @@ +../../node_modules/@trevoreyre/autocomplete-js/dist/autocomplete.min.js \ No newline at end of file diff --git a/static/libs/bootstrap.min.js b/static/libs/bootstrap.min.js new file mode 120000 index 0000000..e734ff9 --- /dev/null +++ b/static/libs/bootstrap.min.js @@ -0,0 +1 @@ +../../node_modules/bootstrap/dist/js/bootstrap.min.js \ No newline at end of file diff --git a/static/libs/jquery.slim.min.js b/static/libs/jquery.slim.min.js new file mode 120000 index 0000000..aa7a1aa --- /dev/null +++ b/static/libs/jquery.slim.min.js @@ -0,0 +1 @@ +../../node_modules/jquery/dist/jquery.slim.min.js \ No newline at end of file diff --git a/static/libs/popper.min.js b/static/libs/popper.min.js new file mode 120000 index 0000000..fef2072 --- /dev/null +++ b/static/libs/popper.min.js @@ -0,0 +1 @@ +../../node_modules/popper.js/dist/umd/popper.min.js \ No newline at end of file diff --git a/static/libs/tagify.min.js b/static/libs/tagify.min.js new file mode 120000 index 0000000..d1eabca --- /dev/null +++ b/static/libs/tagify.min.js @@ -0,0 +1 @@ +../../node_modules/@yaireo/tagify/dist/tagify.min.js \ No newline at end of file diff --git a/static/login.css b/static/scss/_login.scss similarity index 100% rename from static/login.css rename to static/scss/_login.scss diff --git a/static/scss/_variables.scss b/static/scss/_variables.scss new file mode 100644 index 0000000..481d82f --- /dev/null +++ b/static/scss/_variables.scss @@ -0,0 +1 @@ +$primary: #28a745; diff --git a/static/scss/main.scss b/static/scss/main.scss new file mode 100644 index 0000000..de6851c --- /dev/null +++ b/static/scss/main.scss @@ -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; +} diff --git a/static/style.css b/static/style.css deleted file mode 100644 index 7804419..0000000 --- a/static/style.css +++ /dev/null @@ -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; -} diff --git a/templates/base.html b/templates/base.html index 5f138cd..2d70fa2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,10 +9,7 @@ {% block title %}Acronomy{% endblock %} - - - - + {% block extra_head %} {% endblock %} @@ -33,11 +30,11 @@ {% block content %} {% endblock %} - - - - - + + + + +