Skip to content

varvet/godmin-tags

Repository files navigation

Godmin Tags

Gem Version

Godmin Tags is a tags component for Godmin that adds an f.tags_field to forms.

Installation

Add the gem to the application's Gemfile:

gem "godmin-tags"

Or to the admin engine's gemspec:

s.add_dependency "godmin-tags", "~> x.x.x"

Usage

Use the tags field in your form like so:

<%= form_for(@resource) do |f| %>
  <%= f.text_field :title %>
  <%= f.text_area :body %>

  <%= f.tags_field :tags, data: { collection: Tag.all.pluck(:name) } %>
<% end %>

Or initialize yourself using JavaScript:

Godmin.Tags.initializeTagger($el);

Additional options can be passed down to Godmin.SelectBoxes:

Godmin.Tags.initializeTagger($el, {
  create: false
});

Contributors

https://github.com/varvet/godmin-tags/graphs/contributors

License

Licensed under the MIT license. See the separate MIT-LICENSE file.