Made data_bind handling of Template Plugin more easier
allowBindings: true is automatically added if necessary, regardless of plugin_supplied data_bind value, should make usage easier.
This commit is contained in:
parent
5180fc70d2
commit
f619c1f8c4
4 changed files with 15 additions and 18 deletions
|
|
@ -199,9 +199,7 @@ class TemplatePlugin(Plugin):
|
|||
or if a custom binding will be used by the plugin (``true``, default).
|
||||
data_bind
|
||||
Additional knockout data bindings to apply to the navbar entry, can be used to add further behaviour to
|
||||
the container based on internal state if necessary. Note that if you include this and set ``custom_bindings``
|
||||
to ``True``, you need to also supply ``allowBindings: true`` as part of your custom data binding, otherwise
|
||||
it won't work.
|
||||
the container based on internal state if necessary.
|
||||
classes
|
||||
Additional classes to apply to the navbar entry, as a list of individual classes
|
||||
(e.g. ``classes=["myclass", "myotherclass"]``) which will be joined into the correct format by the template engine.
|
||||
|
|
@ -231,9 +229,7 @@ class TemplatePlugin(Plugin):
|
|||
or if a custom binding will be used by the plugin (``true``, default).
|
||||
data_bind
|
||||
Additional knockout data bindings to apply to the template container, can be used to add further behaviour to
|
||||
the container based on internal state if necessary. Note that if you include this and set ``custom_bindings``
|
||||
to ``True``, you need to also supply ``allowBindings: true`` as part of your custom data binding, otherwise
|
||||
it won't work.
|
||||
the container based on internal state if necessary.
|
||||
classes
|
||||
Additional classes to apply to both the wrapper around the sidebar box as well as the content pane itself, as a
|
||||
list of individual classes (e.g. ``classes=["myclass", "myotherclass"]``) which will be joined into the correct
|
||||
|
|
@ -267,9 +263,7 @@ class TemplatePlugin(Plugin):
|
|||
in the navigation (``false``) or if a custom binding will be used by the plugin (``true``, default).
|
||||
data_bind
|
||||
Additional knockout data bindings to apply to the template container, can be used to add further behaviour to
|
||||
the container based on internal state if necessary. Note that if you include this and set ``custom_bindings``
|
||||
to ``True``, you need to also supply ``allowBindings: true`` as part of your custom data binding, otherwise
|
||||
it won't work.
|
||||
the container based on internal state if necessary.
|
||||
classes
|
||||
Additional classes to apply to both the wrapper around the sidebar box as well as the content pane itself, as a
|
||||
list of individual classes (e.g. ``classes=["myclass", "myotherclass"]``) which will be joined into the correct
|
||||
|
|
@ -303,9 +297,7 @@ class TemplatePlugin(Plugin):
|
|||
in the navigation (``false``) or if a custom binding will be used by the plugin (``true``, default).
|
||||
data_bind
|
||||
Additional knockout data bindings to apply to the template container, can be used to add further behaviour to
|
||||
the container based on internal state if necessary. Note that if you include this and set ``custom_bindings``
|
||||
to ``True``, you need to also supply ``allowBindings: true`` as part of your custom data binding, otherwise
|
||||
it won't work.
|
||||
the container based on internal state if necessary.
|
||||
classes
|
||||
Additional classes to apply to both the wrapper around the navigation link as well as the content pane itself, as a
|
||||
list of individual classes (e.g. ``classes=["myclass", "myotherclass"]``) which will be joined into the correct
|
||||
|
|
|
|||
|
|
@ -300,6 +300,11 @@ def _process_template_config(name, implementation, rule, config=None, counter=1)
|
|||
data["template"] = rule["template"](name)
|
||||
if not "name" in data:
|
||||
data["name"] = implementation._plugin_name
|
||||
if not "custom_bindings" in data or data["custom_bindings"]:
|
||||
data_bind = "allowBindings: true"
|
||||
if "data_bind" in data:
|
||||
data_bind = data_bind + ", " + data["data_bind"]
|
||||
data["data_bind"] = data_bind
|
||||
|
||||
return data
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
{% else %}
|
||||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<li id="{{ data._div }}_link"
|
||||
{% if "data_bind" in data %} data-bind="{{ data.data_bind }}" {% elif "custom_bindings" not in data or data["custom_bindings"] %} data-bind="allowBindings: true" {% endif %}
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
class="{% if not active_set %}active{% set active_set = true %}{% endif %} {% if "classes_link" in data %}{{ data.classes_link|join(' ') }}{% elif "classes" in data %}{{ data.classes|join(' ') }}{% endif %}"
|
||||
{% if "styles_link" in data %} style="{{ data.styles_link|join(', ') }}" {% elif "styles" in data %} style="{{ data.styles|join(', ') }}" {% endif %}
|
||||
>
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
{% if data is not none %}
|
||||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<div id="{{ data._div }}"
|
||||
{% if "data_bind" in data %} data-bind="{{ data.data_bind }}" {% elif "custom_bindings" not in data or data["custom_bindings"] %} data-bind="allowBindings: true" {% endif %}
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
class="tab-pane {% if not active_set %}active{% set active_set = true %}{% endif %} {% if classes_content in data %}{{ data.classes_content|join(' ') }}{% elif classes in data %}{{ data.classes|join(' ') }}{% endif %}"
|
||||
{% if "styles_content" in data %} style="{{ data.styles_content|join(', ') }}" {% elif styles in data %} style="{{ data.styles|join(', ') }}" {% endif %}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
{% for data in navbarEntries %}
|
||||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<li id="{{ data._div }}"
|
||||
data-bind="{% if "data_bind" in data %}{{ data.data_bind }}{% elif "custom_bindings" not in data or data["custom_bindings"] %}allowBindings: true{% endif %}"
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
{% if "classes" in data %}class="{{ data.classes|join(' ') }}"{% endif %}
|
||||
{% if "styles" in data %}style="{{ data.styles|join(', ') }}"{% endif %}
|
||||
>
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<div id="{{ data._div }}_wrapper"
|
||||
class="accordion-group {% if "classes_wrapper" in data %}{{ data.classes_wrapper|join(' ') }}{% elif "classes" in data %}{{ data.classes|join(' ') }}{% endif %}"
|
||||
data-bind="{% if "data_bind" in data %}{{ data.data_bind }}{% elif "custom_bindings" not in data or data["custom_bindings"] %}allowBindings: true{% endif %}"
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
{% if "styles_wrapper" in data %} style="{{ data.styles_wrapper|join(', ') }}" {% elif "styles" in data %} style="{{ data.styles|join(', ') }}" {% endif %}
|
||||
>
|
||||
<div class="accordion-heading">
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<li id="{{ data._div }}_link"
|
||||
class="{% if loop.first %}active{% endif %} {% if "classes_link" in data %}{{ data.classes_link|join(' ') }}{% elif "classes" in data %}{{ data.classes|join(' ') }}{% endif %}"
|
||||
data-bind="{% if "data_bind" in data %}{{ data.data_bind }}{% elif "custom_bindings" not in data or data["custom_bindings"] %}allowBindings: true{% endif %}"
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
{% if "styles_link" in data %} style="{{ data.styles_link|join(', ') }}" {% elif "styles" in data %} style="{{ data.styles|join(', ') }}" {% endif %}
|
||||
>
|
||||
<a href="#{{ data._div }}" data-toggle="tab">{{ entry }}</a>
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
{% if "custom_bindings" not in data or data["custom_bindings"] %}<!-- ko allowBindings: false -->{% endif %}
|
||||
<div id="{{ data._div }}"
|
||||
class="tab-pane{% if loop.first %} active{% endif %}{% if "additional_classes" in data %} {{ data.additional_classes|join(' ') }}{% endif %}"
|
||||
data-bind="{% if "data_bind" in data %}{{ data.data_bind }}{% elif "custom_bindings" not in data or data["custom_bindings"] %}allowBindings: true{% endif %}"
|
||||
{% if "data_bind" in data %}data-bind="{{ data.data_bind }}"{% endif %}
|
||||
{% if "styles_content" in data %} style="{{ data.styles_content|join(', ') }}" {% elif "styles" in data %} style="{{ data.styles|join(', ') }}" {% endif %}
|
||||
>
|
||||
{% include data.template ignore missing %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue