-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#901, #902, #903 ] Implemented Action-status toggle and added HTMX to backend #347
Conversation
091bb37
to
5390496
Compare
5390496
to
cd4a91a
Compare
a535b07
to
bc1560f
Compare
@@ -75,5 +75,6 @@ <h2 class="modal__title" id="modal__title"></h2> | |||
</div> | |||
|
|||
<script nonce="{{ request.csp_nonce }}" src="{% static 'bundles/open_inwoner-js.js' %}" type="text/javascript"></script> | |||
{% django_htmx_script %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tag adds some development features when DEBUG=True
9b41287
to
229efa0
Compare
@@ -132,3 +135,118 @@ def render(self): | |||
kwargs, | |||
self.template_name, | |||
) | |||
|
|||
|
|||
class RenderableTag: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a black box but the main part from InclusionTagWebTest has been used for testing for a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand why you use it.
Can't we just use django TemplateResponse
or render
shortcut? It does the same things - resolves the template with it's name and then render the content. In the htmx view we return a piece of HTML, why not to do it the way django usually does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that would require to create boilerplate template files that would only have a {% load xyz %} and the tag we want to render with a repeat of all the arguments. This class basically creates that on the fly so we need less files and repeating of argument names/values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
django-htmx
looks interesting,my main question is about the necessity of RenderableTag
@@ -132,3 +135,118 @@ def render(self): | |||
kwargs, | |||
self.template_name, | |||
) | |||
|
|||
|
|||
class RenderableTag: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't understand why you use it.
Can't we just use django TemplateResponse
or render
shortcut? It does the same things - resolves the template with it's name and then render the content. In the htmx view we return a piece of HTML, why not to do it the way django usually does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one remark, I don't know if it's a problem only on my end. When an action is not mine or it's not for me, the options for toggling the status are enabled so I get a 404.
Codecov Report
@@ Coverage Diff @@
## develop #347 +/- ##
===========================================
+ Coverage 96.48% 96.49% +0.01%
===========================================
Files 450 457 +7
Lines 14034 14367 +333
===========================================
+ Hits 13541 13864 +323
- Misses 493 503 +10
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…to a dropdown using components
…selenium base code
…ntacts not connected to the Action
a4d7e01
to
58816f2
Compare
I rebased after merge of the Contact's PR. Note Vasileios had a good spot on his last comment (#347 (review)), but I fixed it in 954a891 |
@svenvandescheur Can you sign-off on this so we can get it merged? Afterwards we need a little style update on the dropdown and button style, see Anna's comment: #347 (comment) |
Happy to merge after Anna or Vasileios approves. Create a separate Taiga task for any styling still necessary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The status toggle works as expected concerning the shared plans now. If Anna is also ok this can be merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If other developers are ok with this approach, I approve.
I'm curious where this approach would be developing, but it looks like worth experimenting
It is quite a lot for a simple button, but this also adds htmx and django-htmx to the project.
Additionally I've added some infrastructure and related tests to be able to render a template-tag to a string.
And then tied that into a base class for a View to handle hx-post requests and respond with a rendered template-tag (this gives convenient partial responses without extra boilerplate templates or hx-select's).
And then expanded on Sven's selenium integration testing.
And then the functionality exists in two flavours (plain Actions and Actions via Plans) so implementation and test cases almost double.