phoenix_mtm v0.3.0 PhoenixMTM.Helpers

Provides HTML helpers for Phoenix.

Summary

Functions

Generates a list of checkboxes and labels to update a Phoenix many_to_many relationship

Functions

collection_checkboxes(form, field, collection, opts \\ [])

Generates a list of checkboxes and labels to update a Phoenix many_to_many relationship.

Basic Example

<%= PhoenixMTM.Helpers.collection_checkboxes f, :tags, Enum.map(@tags, fn tag -> {tag.name, tag.id} end), selected: Enum.map(f.data.tags, &(&1.id)) %>

Custom and

<%= PhoenixMTM.Helpers.collection_checkboxes f, :tags, Enum.map(@tags, fn tag -> {tag.name, tag.id} end), selected: Enum.map(f.data.tags, &(&1.id)),
      label_opts: [class: "form-input"], input_opts: [class: "form-control"] %>