1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 01:44:25 +04:00

form elements fixes

This commit is contained in:
codecalm
2020-01-27 23:01:12 +01:00
parent 5c1827f431
commit 11344f472f
9 changed files with 82 additions and 44 deletions

View File

@@ -12,11 +12,30 @@ users:
tags: tags:
max-items: 15 max-items: 15
value: dev, test multiple: true
value: [HTML, JavaScript, Bootstrap]
options: options:
- dev - HTML
- live - JavaScript
- test - CSS
- jQuery
- Bootstrap
- Ruby
- Python
tags-advanced:
max-items: 15
multiple: true
removable: true
value: [Ruby, Python]
options:
- HTML
- JavaScript
- CSS
- jQuery
- Bootstrap
- Ruby
- Python
countries: countries:
value: pl value: pl

View File

@@ -30,23 +30,3 @@
<label class="form-label">Input with appended icon links</label> <label class="form-label">Input with appended icon links</label>
{% include ui/form/input-group.html append-button="x:Clear search,sliders:Search settings,bell:Add notification" class="input-group-flat" %} {% include ui/form/input-group.html append-button="x:Clear search,sliders:Search settings,bell:Add notification" class="input-group-flat" %}
</div> </div>
<div class="mb-3">
<label class="form-label">Tags</label>
{% include ui/form/selectize.html key="tags" %}
</div>
<div class="mb-3">
<label class="form-label">Top person</label>
{% include ui/form/selectize.html key="users" %}
</div>
<div class="mb-3">
<label class="form-label">Users list</label>
{% include ui/form/selectize.html key="people" %}
</div>
<div class="mb-3">
<label class="form-label">Countries</label>
{% include ui/form/selectize.html key="countries" %}
</div>

View File

@@ -14,3 +14,6 @@
<input type="text" class="form-control is-valid is-valid-lite mb-2" placeholder="Valid State.."> <input type="text" class="form-control is-valid is-valid-lite mb-2" placeholder="Valid State..">
<input type="text" class="form-control is-invalid is-invalid-lite" placeholder="Invalid State.."> <input type="text" class="form-control is-invalid is-invalid-lite" placeholder="Invalid State..">
</div> </div>
<label class="form-label">Form fieldset</label>
{% include parts/form-fieldset.html %}

View File

@@ -1,5 +1,3 @@
<label class="form-label">Form fieldset</label>
{% include parts/form-fieldset.html %}
{% include parts/input-selectgroups.html %} {% include parts/input-selectgroups.html %}
{% include parts/form-payments.html %} {% include parts/form-payments.html %}

View File

@@ -26,3 +26,28 @@
<label class="form-label">Form control flush</label> <label class="form-label">Form control flush</label>
<input type="text" class="form-control form-control-flush" name="Form control flush" placeholder="Text.."> <input type="text" class="form-control form-control-flush" name="Form control flush" placeholder="Text..">
</div> </div>
<div class="mb-3">
<label class="form-label">Tags input</label>
{% include ui/form/selectize.html key="tags" %}
</div>
<div class="mb-3">
<label class="form-label">Advanced tags input</label>
{% include ui/form/selectize.html key="tags-advanced" %}
</div>
<div class="mb-3">
<label class="form-label">Advanced select</label>
{% include ui/form/selectize.html key="users" %}
</div>
<div class="mb-3">
<label class="form-label">Select with avatars</label>
{% include ui/form/selectize.html key="people" %}
</div>
<div class="mb-3">
<label class="form-label">Select with flags</label>
{% include ui/form/selectize.html key="countries" %}
</div>

View File

@@ -1,8 +1,8 @@
<div class="mb-3"> <div class="mb-3">
<label class="form-label">Range input</label> <label class="form-label">Range input</label>
{% include ui/slider.html value=40 %} {% include ui/form/range.html value=40 %}
{% include ui/slider.html value="20" id="simple" connect=true %} {% include ui/form/range.html value="20" id="simple" connect=true %}
{% include ui/slider.html value="60,90" id="connect" %} {% include ui/form/range.html value="60,90" id="connect" %}
{% include ui/slider.html value="40" id="color" class="text-green" connect=true %} {% include ui/form/range.html value="40" id="color" class="text-green" connect=true %}
</div> </div>

View File

@@ -1,26 +1,28 @@
{% assign key = include.key | default: 'people' %} {% assign key = include.key | default: 'people' %}
{% assign data = site.data.selects[key] %} {% assign data = site.data.selects[key] %}
{% assign options = data.options %} {% assign options = data.options %}
<select name="{{ key }}" id="select-{{ key }}" class="form-select">
<select name="{{ key }}" id="select-{{ key }}" class="form-select"{% if data.multiple %} multiple{% endif %}>
{% if options == 'people' %} {% if options == 'people' %}
{% for person in site.data.people limit: 20 %} {% for person in site.data.people limit: 20 %}
{% capture avatar %} {% capture avatar %}
{% include ui/avatar.html person=person class="avatar-xs rounded mr-2 ml-n1" %} {% include ui/avatar.html person=person class="avatar-xs rounded mr-2 ml-n1" %}
{% endcapture %} {% endcapture %}
<option value="{{ person.id }}" data-data='{"avatar": "{{ avatar | strip | replace: '"', '\"' }}"}'{% if person.id == value %} selected{% endif %}>{{ person.full_name }}</option> <option value="{{ person.id }}" data-data='{"avatar": "{{ avatar | strip | replace: '"', '\"' }}"}'{% if person.id == data.value %} selected{% endif %}>{{ person.full_name }}</option>
{% endfor %} {% endfor %}
{% else %} {% else %}
{% for option in options %} {% for option in options %}
{% if option[1] %} {% if option[1] %}
{% assign value = option[0] %} {% assign current-value = option[0] %}
{% assign name = option[1].name %} {% assign current-name = option[1].name %}
{% assign all-data = option[1] %} {% assign all-data = option[1] %}
{% else %} {% else %}
{% assign value = option %} {% assign current-value = option %}
{% assign name = option %} {% assign current-name = option %}
{% endif %} {% endif %}
<option value="{{ value }}"{% if all-data.image %} data-data='{"image": "{{ site.base }}/{{ all-data.image }}"}'{% elsif all-data.flag %} data-data='{"flag": "{{ all-data.flag }}"}'{% endif %}{% if data.value == value %} selected{% endif %}>{{ name }}</option>
<option value="{{ current-value }}"{% if all-data.image %} data-data='{"image": "{{ site.base }}/{{ all-data.image }}"}'{% elsif all-data.flag %} data-data='{"flag": "{{ all-data.flag }}"}'{% endif %}{% if data.value == current-value or data.value contains current-value %} selected{% endif %}>{{ current-name }}</option>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@@ -31,7 +33,7 @@
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#select-{{ key }}').selectize({ $('#select-{{ key }}').selectize({
{% if key == "countries" %} {% if key == "countries" %}
render: { render: {
option: function (data, escape) { option: function (data, escape) {
return '<div class="option"><span class="flag flag-country-' + data.flag + ' mr-2 ml-n1"></span>' + escape(data.text) + '</div>'; return '<div class="option"><span class="flag flag-country-' + data.flag + ' mr-2 ml-n1"></span>' + escape(data.text) + '</div>';
@@ -40,7 +42,7 @@
return '<div class="d-flex align-items-center"><span class="flag flag-country-' + data.flag + ' mr-2 ml-n1"></span>' + escape(data.text) + '</div>'; return '<div class="d-flex align-items-center"><span class="flag flag-country-' + data.flag + ' mr-2 ml-n1"></span>' + escape(data.text) + '</div>';
} }
} }
{% elsif key == "people" %} {% elsif key == "people" %}
render: { render: {
option: function (data, escape) { option: function (data, escape) {
return '<div class="option">' + data.avatar + '' + escape(data.text) + '</div>'; return '<div class="option">' + data.avatar + '' + escape(data.text) + '</div>';
@@ -49,10 +51,14 @@
return '<div class="d-flex align-items-center">' + data.avatar + '' + escape(data.text) + '</div>'; return '<div class="d-flex align-items-center">' + data.avatar + '' + escape(data.text) + '</div>';
} }
} }
{% endif %} {% endif %}
{% if data.max-items %} {% if data.max-items %}
maxItems: {{ data.max-items }} maxItems: {{ data.max-items }},
{% endif %} {% endif %}
{% if data.removable %}
plugins: ['remove_button'],
{% endif %}
}); });
}); });
</script> </script>

View File

@@ -10,6 +10,13 @@
background-color: $gray-200; background-color: $gray-200;
color: inherit; color: inherit;
} }
.remove {
font-size: inherit !important;
font-weight: normal !important;
border-left: 0 !important;
color: $text-muted !important;
}
} }
.selectize-input { .selectize-input {