diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/posts/admin.py | 2 | ||||
-rw-r--r-- | app/products/static/product-loader.js | 39 |
2 files changed, 2 insertions, 39 deletions
diff --git a/app/posts/admin.py b/app/posts/admin.py index d5d1e37..b2961cc 100644 --- a/app/posts/admin.py +++ b/app/posts/admin.py @@ -90,7 +90,7 @@ class PostAdmin(OSMGeoAdmin): openlayers_url = '/static/admin/js/OpenLayers.js' class Media: - js = ('product-loader.js', 'image-loader.js','next-prev-links.js') + js = ('image-loader.js', 'product-loader.js', 'next-prev-links.js') css = { "all": ("my_styles.css",) } diff --git a/app/products/static/product-loader.js b/app/products/static/product-loader.js index 9c163b8..9d98fc4 100644 --- a/app/products/static/product-loader.js +++ b/app/products/static/product-loader.js @@ -1,47 +1,10 @@ function add_products(){ - var el = document.getElementById("images_id"); + var el = document.getElementById("id_body_markdown"); if (el){ var iframe = '<iframe frameborder="0" style="border: #dddddd 1px solid;margin-left: 20px;width:330px; height:720px;" src="/luxproduct/insert/?textarea='+el.id+'"></iframe>'; el.insertAdjacentHTML('afterend', iframe); } - - var featured_image = document.getElementById("id_featured_image") - - if (featured_image) { - featured_image.querySelectorAll('li').forEach(function(element) { - var cur = element.dataset.imageid; - var loop = Number(element.dataset.loopcounter); - if (cur != "") { - if (loop <= 100) { - console.log(loop); - var request = new XMLHttpRequest(); - request.open('GET', '/photos/luximage/data/admin/tn/'+cur+'/', true); - request.onload = function() { - if (request.status >= 200 && request.status < 400) { - var data = JSON.parse(request.responseText); - var el = element.getElementsByTagName('label')[0]; - url = "url('"+data['url']+"');"; - //console.log(url); - el.style.backgroundImage = 'url('+data["url"]+')'; - - //console.log(el.style); - } else { - console.log("server error", request.statusText); - } - }; - request.onerror = function() { - console.log("error on request"); - }; - request.send(); - } - } - }); - } - } document.addEventListener("DOMContentLoaded", function(event) { add_products(); - md = document.forms["entry_form"].elements["body_markdown"]; - md.style.maxHeight = "300rem"; - md.style.maxWidth = "300rem"; }); |