Added ability to edit hardware

This commit is contained in:
2025-05-30 01:30:36 -04:00
parent 28b6cc66bb
commit cf9235cb18
3 changed files with 55 additions and 0 deletions

32
views/hardware/edit.erb Normal file
View File

@ -0,0 +1,32 @@
<div class="grid-x grid-margin-x">
<div class="cell small-12">
<h1>Editing: <%= hardware.name %></h1>
</div>
</div>
<div class="grid-x grid-margin-x">
<form class="cell small-12" action="/hardware/<%= hardware.id %>/edit" method="post">
<div class="grid-x grid-padding-x">
<div class="cell medium-9">
<label>
Hardware name
<input type="text" name="hardware_name" placeholder="Example hardware" value="<%= hardware.name %>">
</label>
</div>
<div class="cell medium-3">
<label>
Type
<select name="hardware_type">
<option value="gpu" <% if hardware.type == 'gpu' %>selected<% end %>>Graphics card</option>
<option value="cpu" <% if hardware.type == 'cpu' %>selected<% end %>>Processor</option>
</select>
</label>
</div>
</div>
<input type="submit" class="button" value="Submit">
</form>
</div>

View File

@ -6,6 +6,10 @@
<div class="cell small-12">
Hardware type: <%= hardware.type %>
</div>
<div class="cell small-12">
<p><a href="/hardware/<%= hardware.id %>/edit">Edit</a></p>
</div>
</div>
<hr>