summaryrefslogtreecommitdiff
path: root/design/templates
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-11-05 11:15:30 -0500
committerluxagraf <sng@luxagraf.net>2019-11-05 11:15:30 -0500
commitb1057c9dc9ff6b6e1786d31e3401ad9571eb7f1d (patch)
treec3247bc40c63bf5df1c6fecee75a81b7c2ebafde /design/templates
parent725e3d2f798d228a386466823490b6f25647a4db (diff)
added products
Diffstat (limited to 'design/templates')
-rw-r--r--design/templates/admin/insert_products.html82
1 files changed, 82 insertions, 0 deletions
diff --git a/design/templates/admin/insert_products.html b/design/templates/admin/insert_products.html
new file mode 100644
index 0000000..b38389e
--- /dev/null
+++ b/design/templates/admin/insert_products.html
@@ -0,0 +1,82 @@
+{% load get_image_by_size %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<head>
+<style>
+.item-wrapper {
+ display: flex;
+ flex-wrap: wrap;
+ margin-bottom: 6px;
+ font-family: sans-serif;
+ font-size: 11px;
+ padding: 6px 0 4px;
+ border-top: #ccc 1px solid;
+}
+.item { }
+.item img { margin: 0 0 4px 0;}
+h5 {
+ max-width: 180px;
+ font-size: 18px;
+ line-height: 22px;
+ margin: 12px;
+}
+.actions {
+ list-style-type: none;
+ margin: 0 0 0 10px;
+ padding: 0;
+}
+.actions li {
+ margin: 3px 0;
+}
+.actions a {
+ color: #666;
+}
+</style>
+<script>
+function buildImage(id, prod_name) {
+ html = '<div id="product-'+id+'">'+prod_name+'</div>';
+ return html;
+}
+function openInNewTab(url) {
+ var win = window.open(url, '_blank');
+ win.focus();
+ return false;
+}
+</script>
+</head>
+<body>
+ <input type="button" value="Refresh" onClick="window.location.reload()">
+ <button id="add_id_image" onClick="window.parent.open('/admin/products/product/add/?_to_field=id&amp;_popup=1')">Add Product
+ <img src="/static/admin/img/icon-addlink.svg" alt="Add">
+ </button>
+ <div class="up-wrapper">{% for object in object_list %}
+ <div class="item-wrapper images">
+ <h5 class="item" >
+ {{object.get_full_name}}
+ </h5>
+ <ul class="actions">
+ <li><a data-id="{{object.id}}" data-name="{{object.get_full_name}}" onclick="insertProduct(this);return false;" href="#" >Insert Product</a></li>
+ <li><a onclick='openInNewTab("/admin/photos/luximage/{{object.pk}}/change/");' href="#">Edit Image</a></li>
+ </ul>
+ </div>
+{% endfor %}
+</div>
+
+<!-- "next page" action -->
+<a class="nextPage browse right"></a>
+<script>
+function insertProduct(item) {
+ var code = buildImage(item.dataset.id, item.dataset.name);
+ var el = parent.document.getElementById('{{textarea_id}}');
+ var start = el.selectionStart;
+ var end = el.selectionEnd;
+ var text = el.value;
+ var before = text.substring(0, start);
+ var after = text.substring(end, text.length);
+ el.value = (before + code + after);
+ el.selectionStart = el.selectionEnd = start + code.length;
+ el.focus();
+}
+</script>
+</body>
+</html>