Skip to content

Commit 80f9813

Browse files
committed
views: Items#show: Use <DL/> for item info
This replaces the odd collection of form-group <DIV/>s with H5 titles. Now we use a <DL/>. This is not only more accessible, but clearer in both semantic meaning and a nicer UX. Fixes: ADA-399
1 parent b3c2b27 commit 80f9813

File tree

1 file changed

+29
-37
lines changed

1 file changed

+29
-37
lines changed

app/views/items/show.html.erb

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,47 @@
11
<h1>Item history</h1>
22

33
<h2>Current values</h2>
4-
<div class="form-group row">
5-
<h5 class="col-2">Date found</h5>
6-
<div class="col-4"><%= @item.date_found.strftime('%m/%d/%Y') %></div>
7-
</div>
8-
<div class="form-group row">
9-
<h5 class="col-2">Time found</h5>
10-
<div class="col-4"><%= @item.datetime_found&.strftime('%l:%M %P') || 'None' %></div>
11-
</div>
124

13-
<div class="form-group row">
14-
<h5 class="col-2">Found by</h5>
15-
<div class="col-4"><%= @item.found_by || 'No one' %></div>
16-
</div>
5+
<dl class="row">
6+
<dt class="col-2">Date found</dt>
7+
<dd class="col-4"><%= @item.date_found.strftime('%m/%d/%Y') %></dd>
178

18-
<div class="form-group row">
19-
<h5 class="col-2">Item location</h5>
20-
<div class="col-4"><%= @item.location %></div>
21-
</div>
9+
<dt class="col-2">Time found</dt>
10+
<dd class="col-4"><%= @item.datetime_found&.strftime('%l:%M %P') || 'None' %></dd>
2211

23-
<div class="form-group row">
24-
<h5 class="col-2">Type of item</h5>
25-
<div class="col-4"><%= @item.item_type %></div>
26-
</div>
12+
<dt class="col-2">Found by</dt>
13+
<dd class="col-4"><%= @item.found_by || 'No one' %></dd>
2714

28-
<div class="form-group row">
29-
<h5 class="col-2">Item description</h5>
30-
<div class="col-4"><%= @item.description %></div>
31-
</div>
15+
<dt class="col-2">Item location</dt>
16+
<dd class="col-4"><%= @item.location %></dd>
3217

33-
<div class="form-group row">
34-
<h5 class="col-2">Item image</h5>
18+
<dt class="col-2">Type of item</dt>
19+
<dd class="col-4"><%= @item.item_type %></dd>
20+
21+
<dt class="col-2">Item description</dt>
22+
<dd class="col-4"><%= @item.description %></dd>
23+
24+
<dt class="col-2">Item image</dt>
25+
<dd class="col-4">
3526
<% if @item.image.attached? %>
3627
<img class="preview_image" alt="image of item" src="<%= (url_for(@item.image)) %>">
3728
<% else %>
38-
<div class="col-4">No image</div>
29+
No image
3930
<% end %>
40-
</div>
41-
<div class="form-group row">
42-
<h5 class="col-2">Last updated by</h5>
43-
<div class="col-4"><%= @item.updated_by || 'None' %></div>
44-
</div>
45-
<div class="form-group row">
46-
<h5 class="col-2">Last updated</h5>
31+
</dd>
32+
33+
<dt class="col-2">Last updated by</dt>
34+
<dd class="col-4"><%= @item.updated_by || 'None' %></dd>
35+
36+
<dt class="col-2">Last updated</dt>
37+
<dd class="col-4">
4738
<% if @item.updated_at != @item.created_at %>
48-
<div class="col-4"><%= @item.updated_at.in_time_zone.strftime('%m/%d/%Y %l:%M %P') %></div>
39+
<%= @item.updated_at.in_time_zone.strftime('%m/%d/%Y %l:%M %P') %>
4940
<% else %>
50-
<div class="col-4">None</div>
41+
None
5142
<% end %>
52-
</div>
43+
</dd>
44+
</dl>
5345

5446
<h2>Change history</h2>
5547
<table class="table mt-5">

0 commit comments

Comments
 (0)