introduce a form_id block, replace if/else with 'default' filter

This commit is contained in:
Frantisek Holop 2018-01-12 15:39:30 +01:00
parent 6ce9013fd7
commit d452058e80
4 changed files with 5 additions and 18 deletions

View file

@ -83,24 +83,13 @@ FobiCore.prototype = {
$(activeTabSelector + ' a:first').trigger('click');
}
}
};
/**
* Replaces "-" with "_". For the rest is the jQuery-Slugify-Plugin package is used.
* @param <string> str:
* @return <string>
*/
//var fobiSlugify = function(str) {
// return str.replace(/[\-]+/g, '_');
//};
var fobiCore = new FobiCore();
$(document).ready(function() {
// Slugify form element name from label
$('#form_element_entry_form #id_name').slugify(
'#form_element_entry_form #id_label',
@ -111,5 +100,3 @@ $(document).ready(function() {
}
);
});
//window.fobiCore = fobiCore;

View file

@ -6,6 +6,6 @@
{% blocktrans with form_element_plugin.name as plugin_name %}Add "{{ plugin_name }}" element to the form{% endblocktrans %}
{% endblock form_page_title %}
{% block form_extra_attrs %} id="form_element_entry_form" {% endblock %}
{% block form_id %}form_element_entry_form{% endblock %}
{% block form_primary_button_text %}{% trans "Add" %}{% endblock %}

View file

@ -6,6 +6,6 @@
{% blocktrans with form_element_plugin.name as plugin_name %}Edit "{{ plugin_name }}" element of the form{% endblocktrans %}
{% endblock form_page_title %}
{% block form_primary_button_text %}{% trans "Submit" %}{% endblock %}
{% block form_id %}form_element_entry_form{% endblock %}
{% block form_extra_attrs %} id="form_element_entry_form" {% endblock %}
{% block form_primary_button_text %}{% trans "Submit" %}{% endblock %}

View file

@ -6,7 +6,7 @@
</div>
{% endblock %}
<form method="{% block form_method %}post{% endblock %}" action="{% block form_action %}{% if form_entry.action %}{{ form_entry.action }}{% else %}{{ request.path }}{% endif %}{% endblock %}" {% block form_enctype %}enctype="multipart/form-data"{% endblock %} class="{% block form_html_class %}{% endblock %}" {% block form_extra_attrs %}{% endblock %}>
<form id="{% block form_id %}fobi-form{% endblock %}" method="{% block form_method %}post{% endblock %}" action="{% block form_action %}{{ form_entry.action|default:request.path }}{% endblock %}" {% block form_enctype %}enctype="multipart/form-data"{% endblock %} class="{% block form_html_class %}{% endblock %}" {% block form_extra_attrs %}{% endblock %}>
{% csrf_token %}
{% include fobi_theme.form_snippet_template_name %}
<div class="{% block form_button_outer_wrapper_html_class %}{% endblock %}">