-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: add autocomplete to form builder (#408)
- Loading branch information
Showing
7 changed files
with
59 additions
and
6 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class Product | ||
include ActiveModel::Model | ||
|
||
attr_accessor :title, :status, :country, :selected_markets | ||
attr_accessor :title, :status, :country, :selected_markets, :tags | ||
end |
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
15 changes: 15 additions & 0 deletions
15
demo/app/previews/form_builder_component_preview/autocomplete.html.erb
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,15 @@ | ||
<%= form_with(model: product, builder: Polaris::FormBuilder) do |form| %> | ||
<%= form.polaris_autocomplete(:tags) do |autocomplete| %> | ||
<% autocomplete.with_text_field(label: "Tags", placeholder: "Search") do |c| %> | ||
<% c.with_prefix do %> | ||
<%= polaris_icon(name: "SearchIcon") %> | ||
<% end %> | ||
<% end %> | ||
<% autocomplete.with_option(label: "Rustic", value: "rustic") %> | ||
<% autocomplete.with_option(label: "Antique", value: "antique") %> | ||
<% autocomplete.with_option(label: "Vinyl", value: "vinyl") %> | ||
<% autocomplete.with_option(label: "Vintage", value: "vintage") %> | ||
<% autocomplete.with_option(label: "Refurbished", value: "refurbished") %> | ||
<% end %> | ||
<% end %> |
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