[IMP] AUTOMATIONS: Add horilla automations
This commit is contained in:
37
horilla_views/templates/generic/horilla_form.html
Normal file
37
horilla_views/templates/generic/horilla_form.html
Normal file
@@ -0,0 +1,37 @@
|
||||
{% for field_tuple in dynamic_create_fields %}
|
||||
<div
|
||||
class="oh-modal"
|
||||
id="dynamicModal{{field_tuple.0}}"
|
||||
role="dialog"
|
||||
aria-labelledby="dynamicModal{{field_tuple.0}}"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div
|
||||
class="oh-modal__dialog"
|
||||
id="dynamicModal{{field_tuple.0}}Body"
|
||||
></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<form id="{{view_id}}" hx-post="{{request.path}}?{{request.GET.urlencode}}" hx-swap="outerHTML">{{form.structured}}</form>
|
||||
{% for field_tuple in dynamic_create_fields %}
|
||||
<button
|
||||
hidden
|
||||
id="modalButton{{field_tuple.0}}"
|
||||
hx-get="dynamic-path-{{field_tuple.0}}-{{request.session.session_key}}?dynamic_field={{field_tuple.0}}"
|
||||
hx-target="#dynamicModal{{field_tuple.0}}Body"
|
||||
onclick="$('#dynamicModal{{field_tuple.0}}').addClass('oh-modal--show');"
|
||||
>
|
||||
{{field_tuple.0}}</button>
|
||||
<button hidden class="reload-field" hx-get="{% url "reload-field" %}?form_class_path={{form_class_path}}&dynamic_field={{field_tuple.0}}" hx-target="#dynamic_field_{{field_tuple.0}}" data-target="{{field_tuple.0}}">
|
||||
Reload Field
|
||||
</button>
|
||||
<script>
|
||||
$("#{{view_id}} [name={{field_tuple.0}}]").change(function (e) {
|
||||
if (this.value=="dynamic_create") {
|
||||
$("#modalButton{{field_tuple.0}}").click()
|
||||
$(this).val("").change();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user