From dac4460c6862ce98fb9e9572ac018b312aa1fcc3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 19 Sep 2020 20:59:52 +0200 Subject: [PATCH] Better static files --- requirements.txt | 1 + .../css/datepicker-widget.css | 121 ------------------ .../js/datepicker-widget.js | 55 -------- tfjm/settings.py | 5 +- tfjm/settings_prod.py | 2 +- .../Autorisation_droit_image_majeur.tex | 0 .../Autorisation_droit_image_mineur.tex | 0 .../static}/Autorisation_parentale.tex | 0 {static => tfjm/static}/Fiche synthèse.pdf | Bin {static => tfjm/static}/Fiche synthèse.tex | 0 {static => tfjm/static}/Fiche_sanitaire.pdf | Bin {static => tfjm/static}/Instructions.tex | 0 {static => tfjm/static}/favicon.ico | Bin {static => tfjm/static}/logo.svg | 0 {static => tfjm/static}/logo_animath.png | Bin {static => tfjm/static}/style.css | 0 tfjm/urls.py | 2 - 17 files changed, 6 insertions(+), 180 deletions(-) delete mode 100644 static/bootstrap_datepicker_plus/css/datepicker-widget.css delete mode 100644 static/bootstrap_datepicker_plus/js/datepicker-widget.js rename {static => tfjm/static}/Autorisation_droit_image_majeur.tex (100%) rename {static => tfjm/static}/Autorisation_droit_image_mineur.tex (100%) rename {static => tfjm/static}/Autorisation_parentale.tex (100%) rename {static => tfjm/static}/Fiche synthèse.pdf (100%) rename {static => tfjm/static}/Fiche synthèse.tex (100%) rename {static => tfjm/static}/Fiche_sanitaire.pdf (100%) rename {static => tfjm/static}/Instructions.tex (100%) rename {static => tfjm/static}/favicon.ico (100%) rename {static => tfjm/static}/logo.svg (100%) rename {static => tfjm/static}/logo_animath.png (100%) rename {static => tfjm/static}/style.css (100%) diff --git a/requirements.txt b/requirements.txt index 4338302..717d53b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ bcrypt Django~=3.0 django-allauth +django-bootstrap-datepicker-plus django-crispy-forms django-extensions django-filter diff --git a/static/bootstrap_datepicker_plus/css/datepicker-widget.css b/static/bootstrap_datepicker_plus/css/datepicker-widget.css deleted file mode 100644 index baeec50..0000000 --- a/static/bootstrap_datepicker_plus/css/datepicker-widget.css +++ /dev/null @@ -1,121 +0,0 @@ -@font-face { - font-family: 'Glyphicons Halflings'; - src: url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot'); - src: url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), - url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff2') format('woff2'), - url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff') format('woff'), - url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.ttf') format('truetype'), - url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); -} - -.glyphicon { - position: relative; - top: 1px; - display: inline-block; - font-family: 'Glyphicons Halflings'; - font-style: normal; - font-weight: normal; - line-height: 1; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.glyphicon-time:before { - content: "\e023"; -} - -.glyphicon-chevron-left:before { - content: "\e079"; -} - -.glyphicon-chevron-right:before { - content: "\e080"; -} - -.glyphicon-chevron-up:before { - content: "\e113"; -} - -.glyphicon-chevron-down:before { - content: "\e114"; -} - -.glyphicon-calendar:before { - content: "\e109"; -} - -.glyphicon-screenshot:before { - content: "\e087"; -} - -.glyphicon-trash:before { - content: "\e020"; -} - -.glyphicon-remove:before { - content: "\e014"; -} - -.bootstrap-datetimepicker-widget .btn { - display: inline-block; - padding: 6px 12px; - margin-bottom: 0; - font-size: 14px; - font-weight: normal; - line-height: 1.42857143; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -ms-touch-action: manipulation; - touch-action: manipulation; - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-image: none; - border: 1px solid transparent; - border-radius: 4px; -} - -.bootstrap-datetimepicker-widget.dropdown-menu { - position: absolute; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - font-size: 14px; - text-align: left; - list-style: none; - background-color: #fff; - -webkit-background-clip: padding-box; - background-clip: padding-box; - border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, .15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); - box-shadow: 0 6px 12px rgba(0, 0, 0, .175); -} - -.bootstrap-datetimepicker-widget .list-unstyled { - padding-left: 0; - list-style: none; -} - -.bootstrap-datetimepicker-widget .collapse { - display: none; -} - -.bootstrap-datetimepicker-widget .collapse.in { - display: block; -} - -/* fix for bootstrap4 */ -.bootstrap-datetimepicker-widget .table-condensed > thead > tr > th, -.bootstrap-datetimepicker-widget .table-condensed > tbody > tr > td, -.bootstrap-datetimepicker-widget .table-condensed > tfoot > tr > td { - padding: 5px; -} diff --git a/static/bootstrap_datepicker_plus/js/datepicker-widget.js b/static/bootstrap_datepicker_plus/js/datepicker-widget.js deleted file mode 100644 index 2288b46..0000000 --- a/static/bootstrap_datepicker_plus/js/datepicker-widget.js +++ /dev/null @@ -1,55 +0,0 @@ -jQuery(function ($) { - var datepickerDict = {}; - var isBootstrap4 = $.fn.collapse.Constructor.VERSION.split('.').shift() == "4"; - function fixMonthEndDate(e, picker) { - e.date && picker.val().length && picker.val(e.date.endOf('month').format('YYYY-MM-DD')); - } - $("[dp_config]:not([disabled])").each(function (i, element) { - var $element = $(element), data = {}; - try { - data = JSON.parse($element.attr('dp_config')); - } - catch (x) { } - if (data.id && data.options) { - data.$element = $element.datetimepicker(data.options); - data.datepickerdata = $element.data("DateTimePicker"); - datepickerDict[data.id] = data; - data.$element.next('.input-group-addon').on('click', function(){ - data.datepickerdata.show(); - }); - if(isBootstrap4){ - data.$element.on("dp.show", function (e) { - $('.collapse.in').addClass('show'); - }); - } - } - }); - $.each(datepickerDict, function (id, to_picker) { - if (to_picker.linked_to) { - var from_picker = datepickerDict[to_picker.linked_to]; - from_picker.datepickerdata.maxDate(to_picker.datepickerdata.date() || false); - to_picker.datepickerdata.minDate(from_picker.datepickerdata.date() || false); - from_picker.$element.on("dp.change", function (e) { - to_picker.datepickerdata.minDate(e.date || false); - }); - to_picker.$element.on("dp.change", function (e) { - if (to_picker.picker_type == 'MONTH') fixMonthEndDate(e, to_picker.$element); - from_picker.datepickerdata.maxDate(e.date || false); - }); - if (to_picker.picker_type == 'MONTH') { - to_picker.$element.on("dp.hide", function (e) { - fixMonthEndDate(e, to_picker.$element); - }); - fixMonthEndDate({ date: to_picker.datepickerdata.date() }, to_picker.$element); - } - } - }); - if(isBootstrap4) { - $('body').on('show.bs.collapse','.bootstrap-datetimepicker-widget .collapse',function(e){ - $(e.target).addClass('in'); - }); - $('body').on('hidden.bs.collapse','.bootstrap-datetimepicker-widget .collapse',function(e){ - $(e.target).removeClass('in'); - }); - } -}); diff --git a/tfjm/settings.py b/tfjm/settings.py index af3f842..59ae104 100644 --- a/tfjm/settings.py +++ b/tfjm/settings.py @@ -50,6 +50,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django.forms', + 'bootstrap_datepicker_plus', 'django_extensions', 'polymorphic', 'crispy_forms', @@ -168,9 +169,11 @@ FIXTURE_DIRS = [os.path.join(BASE_DIR, "tfjm/fixtures")] STATIC_URL = '/static/' STATICFILES_DIRS = [ - os.path.join(BASE_DIR, "static"), + os.path.join(BASE_DIR, "tfjm/static"), ] +STATIC_ROOT = os.path.join(BASE_DIR, "static") + MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, "media") diff --git a/tfjm/settings_prod.py b/tfjm/settings_prod.py index fde3682..be0fd79 100644 --- a/tfjm/settings_prod.py +++ b/tfjm/settings_prod.py @@ -4,7 +4,7 @@ import os DEBUG = False # Mandatory ! -ALLOWED_HOSTS = ['inscription.tfjm.org'] +ALLOWED_HOSTS = ['inscription.tfjm.org', 'plateforme.tfjm.org'] SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'CHANGE_ME_IN_ENV_SETTINGS') diff --git a/static/Autorisation_droit_image_majeur.tex b/tfjm/static/Autorisation_droit_image_majeur.tex similarity index 100% rename from static/Autorisation_droit_image_majeur.tex rename to tfjm/static/Autorisation_droit_image_majeur.tex diff --git a/static/Autorisation_droit_image_mineur.tex b/tfjm/static/Autorisation_droit_image_mineur.tex similarity index 100% rename from static/Autorisation_droit_image_mineur.tex rename to tfjm/static/Autorisation_droit_image_mineur.tex diff --git a/static/Autorisation_parentale.tex b/tfjm/static/Autorisation_parentale.tex similarity index 100% rename from static/Autorisation_parentale.tex rename to tfjm/static/Autorisation_parentale.tex diff --git a/static/Fiche synthèse.pdf b/tfjm/static/Fiche synthèse.pdf similarity index 100% rename from static/Fiche synthèse.pdf rename to tfjm/static/Fiche synthèse.pdf diff --git a/static/Fiche synthèse.tex b/tfjm/static/Fiche synthèse.tex similarity index 100% rename from static/Fiche synthèse.tex rename to tfjm/static/Fiche synthèse.tex diff --git a/static/Fiche_sanitaire.pdf b/tfjm/static/Fiche_sanitaire.pdf similarity index 100% rename from static/Fiche_sanitaire.pdf rename to tfjm/static/Fiche_sanitaire.pdf diff --git a/static/Instructions.tex b/tfjm/static/Instructions.tex similarity index 100% rename from static/Instructions.tex rename to tfjm/static/Instructions.tex diff --git a/static/favicon.ico b/tfjm/static/favicon.ico similarity index 100% rename from static/favicon.ico rename to tfjm/static/favicon.ico diff --git a/static/logo.svg b/tfjm/static/logo.svg similarity index 100% rename from static/logo.svg rename to tfjm/static/logo.svg diff --git a/static/logo_animath.png b/tfjm/static/logo_animath.png similarity index 100% rename from static/logo_animath.png rename to tfjm/static/logo_animath.png diff --git a/static/style.css b/tfjm/static/style.css similarity index 100% rename from static/style.css rename to tfjm/static/style.css diff --git a/tfjm/urls.py b/tfjm/urls.py index e9903a6..6e38c02 100644 --- a/tfjm/urls.py +++ b/tfjm/urls.py @@ -38,8 +38,6 @@ urlpatterns = [ path('api/', include('api.urls')), - re_path(r'^{prefix}(?P.*)$'.format(prefix=re.escape(settings.STATIC_URL.lstrip('/'))), serve), - # Supporting old paths path('inscription/', RedirectView.as_view(pattern_name="member:signup")), path('connexion/', RedirectView.as_view(pattern_name="login")),