Updated device shared fields to provide selections for model and command

Allows you to quickly create a device with safe defaults instead of being forced to pick each time.

Milestone: minor
This commit is contained in:
Brooke Kuhlmann
2026-08-04 10:31:22 -06:00
parent 6faa401305
commit b974c1a558
2 changed files with 11 additions and 5 deletions
@@ -5,7 +5,10 @@
<%= scope(:popover_trigger_button, tip: :info, target: :model).render %>
</label>
<%= form.select :model_id, select_options_for(models), id: :device_model_id, class: :value %>
<%= form.select :model_id,
select_options_for(models, default: default_option(models, "TRMNL OG (2-bit)")),
id: :device_model_id,
class: :value %>
<% end %>
<%= scope(:form_field, key: :playlist_id, errors:).render do %>
@@ -137,7 +140,10 @@
</label>
<%= form.select :command,
select_options(translate("devices.shared._fields.commands")),
select_options(
translate("devices.shared._fields.commands"),
default: ["None", "none"]
),
id: :device_command,
class: :value %>
<% end %>
+3 -3
View File
@@ -12,12 +12,12 @@ RSpec.describe "Devices", :db do
model
visit routes.path(:devices)
click_link "New"
select "None", from: "Command"
select model.label, from: "device[model_id]"
fill_in "device[mac_address]", with: "Bogus!"
click_button "Save"
expect(page).to have_text("must be filled")
expect(page).to have_text("is in invalid format")
select model.label, from: "device[model_id]"
fill_in "device[mac_address]", with: "AA:BB:CC:11:22:33"
click_button "Save"
click_link "View"