diff options
author | luxagraf <sng@luxagraf.net> | 2024-03-05 09:58:59 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2024-03-05 09:58:59 -0600 |
commit | 89e3735883c03239270d33a3dc841a43f789f17e (patch) | |
tree | b172bcd9676733ab03cc1e8f060fb1060eebcba9 | |
parent | a08bda7e08de6f510748fa094fb55bbbdb673c12 (diff) |
gtd: added deal code
-rw-r--r-- | app/gtd/templates/gtd/deal_code.html | 67 | ||||
-rw-r--r-- | app/gtd/urls.py | 5 | ||||
-rw-r--r-- | app/gtd/views.py | 5 |
3 files changed, 77 insertions, 0 deletions
diff --git a/app/gtd/templates/gtd/deal_code.html b/app/gtd/templates/gtd/deal_code.html new file mode 100644 index 0000000..1b174f2 --- /dev/null +++ b/app/gtd/templates/gtd/deal_code.html @@ -0,0 +1,67 @@ +<html> + <head> +<style> +body { + padding-top: 30px; +} +.button { + color: white; + padding: 1rem; + text-decoration: none; + background-color: #2ea44f; + border: 1px solid rgba(27, 31, 35, .15); + border-radius: 6px; + box-shadow: rgba(27, 31, 35, .1) 0 1px 0; + box-sizing: border-box; + color: #fff; + cursor: pointer; + display: inline-block; + font-family: -apple-system,system-ui,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"; + font-size: 14px; + font-weight: 600; + line-height: 20px; + padding: 6px 16px; + position: relative; + text-align: center; + text-decoration: none; + user-select: none; + -webkit-user-select: none; + touch-action: manipulation; + vertical-align: middle; + white-space: nowrap; +} +</style> + </head> + <body> + <h4 id="title"><a id="link" href=""></a></h4> + <!-- +<a class="button" href="#" onclick="CopyToClipboard('markdown');return false;">Copy Markdown</a> + +<textarea id="markdown" style="min-width: 35rem; height: 15rem;"> + +</textarea> +--!> +<script> +let params = new URL(document.location).searchParams; +var str = "####"+" ["+params.get("title")+"]("+params.get("url")+")\n\n+++button-group\n\n[Amazon]("+params.get("url")+" \"Amazon\"){: target=\"_blank\"}\n\n+++"; +function setText() { + var el = document.getElementById('link'); + el.innerHTML = params.get("title") + " for $tk ($tk off)"; + el.href = params.get("url"); +} + +window.onload = function() { // Or window.addEventListener("load", function() { + setText(); +} +function CopyToClipboard(id) +{ +var r = document.createRange(); +r.selectNode(document.getElementById(id)); +window.getSelection().removeAllRanges(); +window.getSelection().addRange(r); +document.execCommand('copy'); +window.getSelection().removeAllRanges(); +} +</script> +</body> +</html> diff --git a/app/gtd/urls.py b/app/gtd/urls.py index 565ea6b..2d883c1 100644 --- a/app/gtd/urls.py +++ b/app/gtd/urls.py @@ -6,6 +6,11 @@ app_name = "gtd" urlpatterns = [ path( + r'deal', + views.WiredGenerateDealCodeView.as_view(), + name="code" + ), + path( r'todo', views.GTDNoteTODOView.as_view(), name="todo-list" diff --git a/app/gtd/views.py b/app/gtd/views.py index 22b1190..cb3cefd 100644 --- a/app/gtd/views.py +++ b/app/gtd/views.py @@ -1,4 +1,5 @@ from django.views.generic import UpdateView, DetailView, ListView, CreateView, DeleteView, RedirectView +from django.views.generic.base import TemplateView from django.urls import reverse, reverse_lazy from django.db.models import Q @@ -291,6 +292,10 @@ class WiredPostUpdateView(UpdateView): return reverse('gtd:wiredpost-list') +class WiredGenerateDealCodeView(TemplateView): + template_name = "gtd/deal_code.html" + + class GTDNoteDeleteView(DeleteView): # specify the model you want to use model = GTDNote |