diff --git a/amadeus/static/css/base/amadeus.css b/amadeus/static/css/base/amadeus.css index 8d42216..8c4baaf 100755 --- a/amadeus/static/css/base/amadeus.css +++ b/amadeus/static/css/base/amadeus.css @@ -960,3 +960,24 @@ ul, li { /* subjects app ends */ +/* Themes */ +.page_selector h4 { + margin-bottom: 20px; + border-bottom: 1px solid #e5e5e5; +} +.page_selector:hover, .page_selector:focus { + text-decoration: none; +} + +.filedrag{ + display: none; + font-weight: bold; + text-align: center; + padding: 1em 0; + margin: 1em 0; + color: #555; + border: 2px dashed #555; + border-radius: 7px; + cursor: pointer; +} +/* End Themes */ \ No newline at end of file diff --git a/amadeus/static/js/themes.js b/amadeus/static/js/themes.js new file mode 100644 index 0000000..505b6c0 --- /dev/null +++ b/amadeus/static/js/themes.js @@ -0,0 +1,37 @@ +// check if browser supports drag n drop +// call initialization file +if (window.File && window.FileList && window.FileReader) { + Init(); +} + +// initialize +function Init() { + var small = $("#id_small_logo"), + large = $("#id_large_logo"), + filedrag = $(".filedrag"), + common = $(".common-file-input"); + + // file select + small.on("change", FileSelectHandler); + large.on("change", FileSelectHandler); + + // is XHR2 available? + var xhr = new XMLHttpRequest(); + if (xhr.upload) { + // file drop + filedrag.on("drop", FileSelectHandler); + filedrag.attr('style', 'display:block'); + common.attr('style', 'display:none'); + } +} + +// file selection +function FileSelectHandler(e) { + var files = e.target.files || e.dataTransfer.files, + parent = $(e.target.offsetParent); + + // process all File objects + for (var i = 0, f; f = files[i]; i++) { + parent.find('.filedrag').html(f.name); + } +} \ No newline at end of file diff --git a/amadeus/templates/base.html b/amadeus/templates/base.html index d7a605d..ff0935c 100644 --- a/amadeus/templates/base.html +++ b/amadeus/templates/base.html @@ -115,7 +115,7 @@
diff --git a/amadeus/urls.py b/amadeus/urls.py index 42c0ca9..6ef90b7 100644 --- a/amadeus/urls.py +++ b/amadeus/urls.py @@ -29,6 +29,7 @@ urlpatterns = [ url(r'^subjects/', include('subjects.urls', namespace = 'subjects')), url(r'^mailsender/', include('mailsender.urls', namespace = 'mailsender')), url(r'^security/', include('security.urls', namespace = 'security')), + url(r'^themes/', include('themes.urls', namespace = 'themes')), #API url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')), #S3Direct diff --git a/security/templates/security/update.html b/security/templates/security/update.html index cf0aeaf..f05b6ca 100644 --- a/security/templates/security/update.html +++ b/security/templates/security/update.html @@ -16,10 +16,25 @@