diff --git a/src/newsreader/news/core/templates/news/core/widgets/rule.html b/src/newsreader/news/core/templates/news/core/widgets/rule.html index 11cdef5..c8535e8 100644 --- a/src/newsreader/news/core/templates/news/core/widgets/rule.html +++ b/src/newsreader/news/core/templates/news/core/widgets/rule.html @@ -1,7 +1,7 @@ {% load filters %} {% with option.instance|id_for_label:"category" as id_for_label %} - {% include "components/form/checkbox.html" with name=option.name value=option.value|stringformat:'s' id=id_for_label id_for_label=id_for_label checked=option.selected only %} + {% include "components/form/checkbox.html" with widget=option checked=option.selected id_for_label=id_for_label only %} {% endwith %} {% if option.instance.favicon %} diff --git a/src/newsreader/templates/components/form/attrs.html b/src/newsreader/templates/components/form/attrs.html new file mode 100644 index 0000000..50aec9b --- /dev/null +++ b/src/newsreader/templates/components/form/attrs.html @@ -0,0 +1,18 @@ +{% spaceless %} + {% for name, value in widget.attrs.items %} + {% if value is not False %} + {{ name }} + + {% if value is not True %} + ="{{ value|stringformat:'s' }}" + {% endif %} + {% endif %} + {% endfor %} + + {% if id %} id="{{ id }}"{% endif %} + {% if type %} type="{{ type }}"{% endif %} + {% if value %} value="{{ value }}"{% endif %} + {% if name %} name="{{ name }}"{% endif %} + {% if data_input %} data-input="{{ data_input }}"{% endif %} + {% if checked %} checked {% endif %} +{% endspaceless %} diff --git a/src/newsreader/templates/components/form/checkbox.html b/src/newsreader/templates/components/form/checkbox.html index 5840ae2..42ac691 100644 --- a/src/newsreader/templates/components/form/checkbox.html +++ b/src/newsreader/templates/components/form/checkbox.html @@ -1,12 +1,10 @@