Skip to content

Commit

Permalink
Use HTML5 structural elements
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne authored and cbeer committed Sep 9, 2016
1 parent 77dd08e commit ebf70d8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
8 changes: 5 additions & 3 deletions app/views/catalog/_document.html.erb
@@ -1,4 +1,6 @@
<% # container for a single doc -%>
<div class="document <%= render_document_class document %> document-position-<%= document_counter%> " data-document-counter="<%= document_counter %>" itemscope itemtype="<%= document.itemtype %>">
<%= render_document_partials document, blacklight_config.view_config(document_index_view_type).partials, :document_counter => document_counter %>
</div>
<article class="document <%= render_document_class document %> document-position-<%= document_counter%> " data-document-counter="<%= document_counter %>" itemscope itemtype="<%= document.itemtype %>">
<%= render_document_partials document,
blacklight_config.view_config(document_index_view_type).partials,
document_counter: document_counter %>
</article>
4 changes: 2 additions & 2 deletions app/views/catalog/_index_header_default.html.erb
@@ -1,5 +1,5 @@
<%# header bar for doc items in index view -%>
<div class="documentHeader row">
<header class="documentHeader row">
<%# main title container for doc partial view
How many bootstrap columns need to be reserved
for bookmarks control depends on size.
Expand All @@ -19,4 +19,4 @@
</h3>
<%= document_actions %>
</div>
</header>
8 changes: 4 additions & 4 deletions app/views/catalog/index.html.erb
@@ -1,13 +1,13 @@
<div id="sidebar" class="<%= sidebar_classes %>">
<section id="sidebar" class="<%= sidebar_classes %>">
<%= render 'search_sidebar' %>
</div>
</section>

<div id="content" class="<%= main_content_classes %>">
<section id="content" class="<%= main_content_classes %>">
<% unless has_search_parameters? %>
<%# if there are no input/search related params, display the "home" partial -%>
<%= render 'home' %>
<%= render 'shared/sitelinks_search_box' %>
<% else %>
<%= render 'search_results' %>
<% end %>
</div>
</section>
8 changes: 4 additions & 4 deletions app/views/catalog/show.html.erb
@@ -1,7 +1,7 @@
<div id="content" class="<%= show_content_classes %>">
<section id="content" class="<%= show_content_classes %>">
<%= render_document_main_content_partial %>
</div>
</section>

<div id="sidebar" class="<%= show_sidebar_classes %>">
<section id="sidebar" class="<%= show_sidebar_classes %>">
<%= render_document_sidebar_partial %>
</div>
</section>
8 changes: 4 additions & 4 deletions spec/views/catalog/_document.html.erb_spec.rb
Expand Up @@ -17,8 +17,8 @@
expect(rendered).to match /document_header/
expect(rendered).to match /thumbnail_default/
expect(rendered).to match /index_default/
expect(rendered).to have_selector('div.document[@itemscope]')
expect(rendered).to have_selector('div.document[@itemtype="http://schema.org/Thing"]')
expect(rendered).to have_selector('.document[@itemscope]')
expect(rendered).to have_selector('.document[@itemtype="http://schema.org/Thing"]')
end

it "uses the index.partials parameter to determine the partials to render" do
Expand All @@ -35,12 +35,12 @@
it 'has a css class with the document position' do
allow(view).to receive(:render_document_partials)
render partial: 'catalog/document', locals: { document: document, document_counter: 5 }
expect(rendered).to have_selector 'div.document-position-5'
expect(rendered).to have_selector '.document-position-5'
end

it 'has a data attribute with the document position' do
allow(view).to receive(:render_document_partials)
render partial: 'catalog/document', locals: { document: document, document_counter: 5 }
expect(rendered).to have_selector 'div.document[@data-document-counter="5"]'
expect(rendered).to have_selector '.document[@data-document-counter="5"]'
end
end

0 comments on commit ebf70d8

Please sign in to comment.