Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

many_to_many checkbox labels #441

Open
tim2CF opened this issue Jun 11, 2018 · 0 comments
Open

many_to_many checkbox labels #441

tim2CF opened this issue Jun 11, 2018 · 0 comments

Comments

@tim2CF
Copy link

tim2CF commented Jun 11, 2018

I have ExAdmin form like this (simplified real example)

  register_resource Role do

    action_items except: [:delete]
    filter [:id, :name]

    form data do
      inputs do
        input data, :name
        inputs :reactions, fields: [:enum], as: :check_boxes, collection: Reaction.all
      end
    end

    query do
      %{
        all: [
          preload: [
            [reactions: :substance],
          ]
        ],
      }
    end
  end

Relation between Role and Reaction ecto models is many_to_many:

  schema "roles" do
    field         :name,              :string
    many_to_many  :reactions,         Reaction,     join_through: "roles_reactions"
  end

  schema "reactions" do
    field         :enum,      Reaction.EctoEnum
    belongs_to    :substance, Substance
    many_to_many  :roles,     Role,  join_through: "roles_reactions"
  end

In ExAdmin web interface I expect to see checkboxes with labels (:enum field), but actually I see this

screen shot 2018-06-11 at 17 18 57

Full structure is just presented as is. Also I would like to construct label of checkbox not only from :enum field of Reaction, but from :enum field of Substance as well (it should be preloaded). Is it possible to do it in ExAdmin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant