From 30a481ff23a69db3e358c93a2f70f4ec6a1b56c4 Mon Sep 17 00:00:00 2001 From: Archmonger <16909269+Archmonger@users.noreply.github.com> Date: Thu, 22 Jul 2021 00:58:30 -0700 Subject: [PATCH 1/3] create barebones templatetags --- src/django_idom/static/js/idom.js | 2 ++ src/django_idom/templates/idom/head_content.html | 2 ++ src/django_idom/templates/idom/root.html | 4 ++++ src/django_idom/templatetags/__init__.py | 0 src/django_idom/templatetags/tags.py | 15 +++++++++++++++ 5 files changed, 23 insertions(+) create mode 100644 src/django_idom/static/js/idom.js create mode 100644 src/django_idom/templates/idom/head_content.html create mode 100644 src/django_idom/templates/idom/root.html create mode 100644 src/django_idom/templatetags/__init__.py create mode 100644 src/django_idom/templatetags/tags.py diff --git a/src/django_idom/static/js/idom.js b/src/django_idom/static/js/idom.js new file mode 100644 index 00000000..297f9808 --- /dev/null +++ b/src/django_idom/static/js/idom.js @@ -0,0 +1,2 @@ +// Build.js is going to need to be moved here via your deployment scripts +// This will allow developers to import IDOM the Django way \ No newline at end of file diff --git a/src/django_idom/templates/idom/head_content.html b/src/django_idom/templates/idom/head_content.html new file mode 100644 index 00000000..1140b2ab --- /dev/null +++ b/src/django_idom/templates/idom/head_content.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/django_idom/templates/idom/root.html b/src/django_idom/templates/idom/root.html new file mode 100644 index 00000000..fbd81269 --- /dev/null +++ b/src/django_idom/templates/idom/root.html @@ -0,0 +1,4 @@ + +
\ No newline at end of file diff --git a/src/django_idom/templatetags/__init__.py b/src/django_idom/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/django_idom/templatetags/tags.py b/src/django_idom/templatetags/tags.py new file mode 100644 index 00000000..9f8ffd52 --- /dev/null +++ b/src/django_idom/templatetags/tags.py @@ -0,0 +1,15 @@ +from django import template +from django.urls import reverse + + +register = template.Library() + +# Template tag that renders the IDOM scripts +@register.inclusion_tag("idom/head_content.html") +def idom_scripts(): + pass + +# Template tag that renders an empty idom root object +@register.inclusion_tag("idom/root.html") +def idom_root(html_id): + return {"html_id": html_id} From 8b0b363b1deb7641b25b52d309688c27d3f14106 Mon Sep 17 00:00:00 2001 From: Archmonger <16909269+Archmonger@users.noreply.github.com> Date: Thu, 22 Jul 2021 01:09:28 -0700 Subject: [PATCH 2/3] styling fix attempt re-adding tag stuff styling fix --- src/django_idom/templatetags/{tags.py => idom.py} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename src/django_idom/templatetags/{tags.py => idom.py} (91%) diff --git a/src/django_idom/templatetags/tags.py b/src/django_idom/templatetags/idom.py similarity index 91% rename from src/django_idom/templatetags/tags.py rename to src/django_idom/templatetags/idom.py index 9f8ffd52..268b73b0 100644 --- a/src/django_idom/templatetags/tags.py +++ b/src/django_idom/templatetags/idom.py @@ -1,14 +1,15 @@ from django import template -from django.urls import reverse register = template.Library() + # Template tag that renders the IDOM scripts @register.inclusion_tag("idom/head_content.html") def idom_scripts(): pass + # Template tag that renders an empty idom root object @register.inclusion_tag("idom/root.html") def idom_root(html_id): From 4bcd9bfaea06e8c4e2136a97b0715bad324e3a77 Mon Sep 17 00:00:00 2001 From: Archmonger <16909269+Archmonger@users.noreply.github.com> Date: Sun, 25 Jul 2021 20:06:20 -0700 Subject: [PATCH 3/3] idom_view --- src/django_idom/templatetags/idom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/django_idom/templatetags/idom.py b/src/django_idom/templatetags/idom.py index 268b73b0..ac0a3686 100644 --- a/src/django_idom/templatetags/idom.py +++ b/src/django_idom/templatetags/idom.py @@ -12,5 +12,5 @@ def idom_scripts(): # Template tag that renders an empty idom root object @register.inclusion_tag("idom/root.html") -def idom_root(html_id): +def idom_view(html_id): return {"html_id": html_id}