binda icon indicating copy to clipboard operation
binda copied to clipboard

Temporary choice remains

Open a-barbieri opened this issue 6 years ago • 2 comments

Expected behavior

If I create choices from a task I'd expect the temporary choice to disappear and set as default choice only the first choice I explicitly created.

Actual behavior

The temporary choice remains and it's also the default choice.

How to reproduce the issue

If you run this task you should be able to see it

desc "Create a Intro board and relative field settings"
task :create_intro_board => :environment do
  if Binda::Board.where(slug: "intro").any?
    puts "Intro board already exists"
  else
    intro = Binda::Structure.create!(
      slug: "intro",
      name: "Intro",
      instance_type: "board"
    )
    puts "Intro board has been successfully created"
    radio_setting = field_group.field_settings.create!(
      name: "Text color",
      field_type: "radio",
      allow_null: false
    )
    radio_setting.update_attribute("slug", "intro-text-color")
    radio_setting.choices.create!(
      value: "dark",
      label: "Dark"
    )
    radio_setting.choices.create!(
      value: "light",
      label: "Light"
    )
    puts "Intro text color has been successfully created"
    puts ""
    puts "All done!"
  end
end

System configuration

Binda version: 0.1.9

Rails version: 5.1.2

a-barbieri avatar Sep 04 '18 15:09 a-barbieri

Also it generates a bug when you try to remove the temporary choice from Binda interface.

schermata 2018-09-04 alle 17 17 15

a-barbieri avatar Sep 04 '18 15:09 a-barbieri

~You are able to delete the temporary choice only changing the current default choice, save and after reloading you can delete it.~

This generates another bug because temporary choice is deleted but every component/board still contains temporary choice id reference.

a-barbieri avatar Sep 04 '18 15:09 a-barbieri