Commit 8edbac56 authored by ∞'s avatar 💻

New bottom modal

parent bf85fef9
......@@ -29,14 +29,12 @@ export default class extends Controller {
var parser = new DOMParser()
var doc = parser.parseFromString(res, 'text/html')
var newbody = doc.getElementById('modal-body-ajax')
if (doc.querySelector('body.modal-fixed-footer')) {
this.modal.classList.add('modal-fixed-footer')
} else {
this.modal.classList.remove('modal-fixed-footer')
}
var modalClass = this.element.getAttribute('data-modal-class')
var modalInit = this.element.getAttribute('data-modal-init')
this.modal.className = modalClass === null ? 'modal fade' : modalClass
this.modal.innerHTML = newbody.innerHTML
loader.hide()
this.initmodal()
modalInit === null ? this.initmodal() : this[modalInit]()
}).catch(error => {
loader.hide()
M.toast({
......@@ -47,17 +45,6 @@ export default class extends Controller {
})
}
childmodal() {
var childmodal = this.element.querySelector('.childmodal')
this.modal.innerHTML = childmodal.innerHTML
if (childmodal.classList.contains('modal-fixed-footer')) {
this.modal.classList.add('modal-fixed-footer')
} else {
this.modal.classList.remove('modal-fixed-footer')
}
this.initmodal()
}
initmodal() {
init(this.modal)
var instance = M.Modal.init(document.getElementById('modal'), {
......@@ -65,4 +52,14 @@ export default class extends Controller {
})
instance.open()
}
show() {
init(this.modal)
this.modal.style.display = 'block'
this.modal.style.opacity = 1
this.modal.style.top = null
this.modal.style.transform = null
this.modal.style.position = 'relative'
window.scrollTo(0, document.body.scrollHeight)
}
}
......@@ -108,6 +108,10 @@ h4.col
max-width: 95% !important
width: 95% !important
.modal-bottom
background-color: white
z-index: 999
@keyframes slidein
from
bottom: -64px
......
......@@ -27,6 +27,7 @@
{% elif text %}
{{ text }}
{% endif %}
{{ view.link_attributes }}
</a>
{%- endmacro %}
......
......@@ -2,6 +2,11 @@
class="{{ view.color|default('') }} {{ extra_class|default('') }} waves-effect waves-light btn-floating"
href="{{ view.url }}"
title="{{ view.title }}"
{% if view.link_attributes %}
{% for key, value in view.link_attributes.items() %}
{{ key }}="{{ value }}"
{% endfor %}
{% endif %}
{% if view.controller %}
data-controller="{{ view.controller }}"
{% endif %}
......
<a style="padding-left: 1em" class="breadcrumb" href="{{ crudlfap_site.views['home'].url }}">{{ _('Home') }}</a>
{% if view.model %}
{% if view.model and view.model in crudlfap_site and crudlfap_site[view.model].get('list', None) %}
{% set v = crudlfap_site[view.model]['list'](request=request) %}
{% if v.has_perm() %}
<a
......
......@@ -52,7 +52,7 @@
<main>
{% include 'crudlfap/_messages.html' %}
{% block before_container %}{% endblock %}
{% block content_open %}<div class="{% if view.body_class|default('') != 'full-width' %}container{% endif %}" id="modal-body-ajax">{% endblock %}
{% block content_open %}<div class="{{ view.body_class|default('') }}" id="modal-body-ajax">{% endblock %}
{% block form_open %}{% endblock %}
<div class="modal-content">
{% block title_heading %}
......@@ -63,7 +63,7 @@
>{{ view.title_heading }}</h4>
{% endif %}
{% endblock %}
{% block content %}{% block form %}{% endblock %}{% endblock %}
{% block content %}{% block form %}{% endblock %}{% endblock %}
</div>
<div class="modal-footer">
{% block buttons %}{% endblock %}
......
......@@ -173,6 +173,14 @@ class Router(object):
)
)
def get(self, urlname, *args):
try:
return self[urlname]
except KeyError:
if args:
return args[0]
raise
def generate_views(self, *views):
"""
Generate views for this router, core of the automation in CRUDLFA+.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment