mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
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:
@@ -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 %>
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user