Skip to content

Commit

Permalink
Add multiselect/tom-select to Design Guide's form page (decidim#12961)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreslucena authored Jun 7, 2024
1 parent 0741e14 commit c1294ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions decidim-design/app/packs/stylesheets/design.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "tom-select/dist/scss/tom-select";

.design__layout {
@apply grid md:grid-cols-12 container min-h-screen before:content-[''] before:absolute before:-z-10 before:w-1/2 before:h-full before:inset-0 before:bg-background;

Expand Down
14 changes: 14 additions & 0 deletions decidim-design/app/views/decidim/design/components/forms.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<a href="#error"><%= t(".errors") %></a>
<a href="#length"><%= t(".min_max_length") %></a>
<a href="#emoji"><%= t(".emojis") %></a>
<a href="#multiselect"><%= t(".multiselect") %></a>
<% end %>

<%
Expand Down Expand Up @@ -233,3 +234,16 @@
</label>
</div>
</section>

<section id="multiselect" class="design__section">
<h2 class="h2"><%= t(".multiselect") %></h2>

<div class="form__wrapper">
<p><%= t(".multiselect_description_html") %></p>

<label>
input type="text" class="js-tags-container" value="abc, 123"
<input type="text" class="js-tags-container" value="abc, 123">
</label>
</div>
</section>
2 changes: 2 additions & 0 deletions decidim-design/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ en:
html_regular_inputs: HTML regular inputs
min_max_length: Min/Max length
min_max_length_description: Only works for input type='text' and textarea
multiselect: Multiselect
multiselect_description_html: Multiselects are a javascript feature available thanks to an external library called <a href="https://tom-select.js.org/" target="_blank" rel="noopener noreferrer">Tom Select</a>.
regular_inputs_description: 'Only displays common types, full available list: date, datetime-local, email, month, number, password, search, tel, text, time, url, week'
textarea_required: textarea required
title: Forms
Expand Down

0 comments on commit c1294ea

Please sign in to comment.