-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3210d0
commit a7c14eb
Showing
26 changed files
with
143 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ame}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/clearable_file_input.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
{% from 'forms/clearable_file_input.jinja' import clearable_file_input_widget %} | ||
{{clearable_file_input_widget(widget, id=widget.attrs.id)}} | ||
{{clearable_file_input_widget(widget)}} |
2 changes: 1 addition & 1 deletion
2
...kiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/date.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
{% from 'forms/date_datetime.jinja' import date_datetime_widget %} {{ | ||
date_datetime_widget(widget, id=widget.attrs.id, date=True) }} | ||
date_datetime_widget(widget, date=True) }} |
2 changes: 1 addition & 1 deletion
2
...utter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/datetime.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
{% from 'forms/date_datetime.jinja' import date_datetime_widget %} {{ | ||
date_datetime_widget(widget, id=widget.attrs.id, true) }} | ||
date_datetime_widget(widget, time=True, date=True) }} |
3 changes: 1 addition & 2 deletions
3
...iecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/input.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
{% from 'forms/input.jinja' import input_widget %} {{input_widget(widget, | ||
id=widget.attrs.id)}} | ||
{% from 'forms/input.jinja' import input_widget %} {{input_widget(widget)}} |
5 changes: 2 additions & 3 deletions
5
...r.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/input_option.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
{% from 'forms/input_option.jinja' import widget_to_input_option %} | ||
|
||
{{widget_to_input_option(widget)}} | ||
{% from 'forms/input_option.jinja' import input_option_widget %} | ||
{{input_option_widget(widget)}} |
4 changes: 1 addition & 3 deletions
4
...utter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/password.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
{% from 'forms/password.jinja' import widget_to_password %} | ||
|
||
{{widget_to_password(widget)}} | ||
{% from 'forms/password.jinja' import password_widget %} {{password_widget(widget)}} |
4 changes: 1 addition & 3 deletions
4
...iecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/radio.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
{% from 'forms/radio.jinja' import widget_to_radio %} | ||
|
||
{{ widget_to_radio(widget) }} | ||
{% from 'forms/radio.jinja' import radio_widget %} {{ radio_widget(widget) }} |
3 changes: 1 addition & 2 deletions
3
...ecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/select.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
{% from 'forms/select.jinja' import select_widget %} {{select_widget(widget, | ||
id=widget.attrs.id)}} | ||
{% from 'forms/select.jinja' import select_widget %} {{select_widget(widget)}} |
4 changes: 1 addition & 3 deletions
4
....repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/select_option.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
{% from 'forms/select.jinja' import select_option %} | ||
|
||
{{ select_option(widget.value, widget.label, widget.attrs) }} | ||
{% from 'forms/select.jinja' import select_option %} {{ select_option(widget) }} |
3 changes: 1 addition & 2 deletions
3
...utter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/textarea.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
{% from 'forms/textarea.jinja' import textarea_widget %} {{textarea_widget(widget, | ||
id=widget.attrs.id)}} | ||
{% from 'forms/textarea.jinja' import textarea_widget %} {{textarea_widget(widget)}} |
2 changes: 2 additions & 0 deletions
2
...kiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/time.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% from 'forms/date_datetime.jinja' import date_datetime_widget %} {{ | ||
date_datetime_widget(widget, time=True) }} |
4 changes: 1 addition & 3 deletions
4
...ecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/django/forms/widgets/toggle.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
{% from 'forms/toggle.jinja' import widget_to_toggle %} | ||
|
||
{{widget_to_toggle(widget)}} | ||
{% from 'forms/toggle.jinja' import toggle_widget %} {{toggle_widget(widget)}} |
13 changes: 2 additions & 11 deletions
13
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/forms/checkbox.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
...ecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/forms/clearable_file_input.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
{% from 'forms/input.jinja' import input_widget %} | ||
{% from "forms/wrappers.jinja" import file_shell %} | ||
{% from 'forms/checkbox.jinja' import checkbox_widget %} | ||
{% from 'components/util.jinja' import get_event_name_from_id %} | ||
|
||
{% macro clearable_file_input_field(field, errors) %} | ||
{{ clearable_file_input_widget(field.field.widget, value=field.value(), id=field.id_for_label)}} | ||
{{ file_shell(field, errors) }} | ||
{% endmacro %} | ||
|
||
{% macro clearable_file_input_widget(widget, value=None, id="") %} | ||
{% macro clearable_file_input_widget(widget) %} | ||
{% set attrs = widget.attrs or {} %} | ||
{% set event_name = get_event_name_from_id(id) %} | ||
{% set event_name = get_event_name_from_id(attrs.id) %} | ||
|
||
<div | ||
class="w-full input flex items-center pb-2"> | ||
{% if is_initial %} | ||
{{widget.initial_text}}: <a href="{{value.url}}">{{value}}</a> | ||
{{widget.initial_text}}: <a href="{{widget.value.url}}">{{widget.value}}</a> | ||
{% if not required %} | ||
{{ checkbox_widget({"type": "checkbox", "name": widget.checkbox_name, "attrs":{'id': widget.checkbox_id, 'disabled': attrs.disabled}}) }} | ||
<label for="{{widget.checkbox_id}}">{{widget.clear_checkbox_label}}</label> | ||
{% endif %} | ||
<br> | ||
{{widget.input_text}}: | ||
{% endif %} | ||
{{ input_widget(widget, type="file", input_classes="flex justify-center text-sm file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-primary file:text-white hover:file:bg-primary-focus") }} | ||
{{ input_widget(widget, input_classes="flex justify-center text-sm file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-primary file:text-white hover:file:bg-primary-focus") }} | ||
</div> | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 12 additions & 12 deletions
24
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/forms/input.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
{% from 'components/util.jinja' import attributes, get_event_name_from_id %} | ||
{% from "forms/wrappers.jinja" import input_shell %} | ||
|
||
{% macro input_field(field, errors, input_classes="") %} | ||
{{ input_shell(field, errors, input_widget(field.field.widget, value=field.value(), id=field.id_for_label, input_classes=input_classes)) }} | ||
{% macro input_field(field, errors) %} | ||
{{ input_shell(field, errors) }} | ||
{% endmacro %} | ||
|
||
{% macro number_field(field, errors, input_classes="") %} | ||
{{ input_shell(field, errors, input_widget(field.field.widget, value=field.value(), id=field.id_for_label, type="number", input_classes=input_classes)) }} | ||
{% macro number_field(field, errors) %} | ||
{{ input_shell(field, errors) }} | ||
{% endmacro %} | ||
|
||
{% macro email_field(field, errors, input_classes="") %} | ||
{{ input_shell(field, errors, input_widget(field.field.widget, value=field.value(), id=field.id_for_label, type="email", input_classes=input_classes)) }} | ||
{% macro email_field(field, errors) %} | ||
{{ input_shell(field, errors) }} | ||
{% endmacro %} | ||
|
||
{% macro url_field(field, errors, input_classes="") %} | ||
{{ input_shell(field, errors, input_widget(field.field.widget, value=field.value(), id=field.id_for_label, type="url", input_classes=input_classes)) }} | ||
{% macro url_field(field, errors) %} | ||
{{ input_shell(field, errors) }} | ||
{% endmacro %} | ||
|
||
{# password_field has it's own file "password.jinja" #} | ||
|
||
{% macro input_widget(widget, value=None, id="", type="text", input_classes="") %} | ||
{% macro input_widget(widget, input_classes="") %} | ||
{% set attrs = widget.attrs or {} %} | ||
{% do attrs.update({"name": widget.name, "value": value, "type": type, "id": id}) %} | ||
{% do attrs.update({"name": widget.name, "value": widget.value, "type": widget.type}) %} | ||
{% set disabled, readonly = widget.attrs.disabled, attrs.readonly %} | ||
{% set noedit = disabled or readonly %} | ||
{% set event_name = get_event_name_from_id(id) %} | ||
{% set event_name = get_event_name_from_id(widget.attrs.id) %} | ||
<input | ||
x-model.debounce.500ms="value" | ||
:class="{'has-focus': active}" | ||
x-data="input('{{ event_name }}', '{{ value or "" }}')" | ||
x-data="input('{{ event_name }}', '{{ widget.value or "" }}')" | ||
x-ref="input" class="input {{ input_classes or ""}} {{attrs.classes or ""}}" {{ attributes(attrs)}} | ||
/> | ||
{% endmacro %} |
17 changes: 6 additions & 11 deletions
17
{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/forms/input_option.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,7 @@ | ||
{% from 'forms/input.jinja' import input %} | ||
{% macro input_option(type="text", name=none, value=none, event_name="", color='primary', attrs={}, left_icon='', right_icon='', wrap_label=False, label="") %} | ||
{% if wrap_label %} | ||
<label{% if attrs.id %} for="{{ attrs.id }}"{% endif %}> | ||
{% endif %} | ||
{{ input(type=type, name=name, value=value, event_name=event_name, color=color, attrs=attrs, left_icon=left_icon, right_icon=right_icon) }} | ||
{% if wrap_label %} {{ label }}</label>{% endif %} | ||
{% endmacro %} | ||
{# takes a django widget and calls our input macro with the appropriate args #} | ||
{% macro widget_to_input_option(widget) %} | ||
{{ input_option(type=widget.type, name=widget.name, value=widget.value, event_name=widget.attrs.id, attrs=widget.attrs, wrap_label=widget.wrap_label, label=widget.label) }} | ||
{% from 'forms/input.jinja' import input_widget %} | ||
|
||
{% macro input_option_widget(widget) %} | ||
{% if widget.wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% endif %} | ||
{{ input_widget(widget) }} | ||
{% if widget.wrap_label %} {{ widget.label }}</label>{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.