Skip to content

Commit

Permalink
Fix dashboard headings (#3659)
Browse files Browse the repository at this point in the history
Fix dashboard headings by using the correct header tags.
  • Loading branch information
ashton22305 authored Jul 5, 2024
1 parent d320f07 commit 9ef9b09
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion apps/dashboard/app/views/dashboard/_motd_markdown.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h3><%= @motd.title %></h3>
<h2><%= @motd.title %></h2>
<hr />
<div data-motd-md="true"><%= @motd.content %></div>
4 changes: 2 additions & 2 deletions apps/dashboard/app/views/dashboard/_motd_osc.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<h3><%= @motd.title %></h3>
<h2><%= @motd.title %></h2>

<% if @motd.messages.each do |m| %>

<hr>
<div class="motd">
<h4 class="motd_title"><%= m.date %> - <%= m.title %></h4>
<h3 class="motd_title"><%= m.date %> - <%= m.title %></h3>
<div class="motd_body"><p><%=raw markdown( m.body ) %></p></div>
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h3><%= @motd.title %></h3>
<h2><%= @motd.title %></h2>
<hr />
<pre class="motd-monospaced"><%= @motd.content %></pre>
4 changes: 2 additions & 2 deletions apps/dashboard/app/views/dashboard/_motd_rss.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<h3><%= @motd.title %></h3>
<h2><%= @motd.title %></h2>
<hr />
<% if @motd.content %>
<% @motd.content.items.each do |item| %>
<div>
<%= content_tag(:strong, item.pubDate.strftime("%m-%d-%Y")) if item.pubDate %>
<h4><a href="<%= item.link %>"><%= item.title %></a></h4>
<h3><a href="<%= item.link %>"><%= item.title %></a></h3>
<%= render_motd_rss_item(item) %>
<hr />
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard/app/views/widgets/_pinned_apps.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%- if pinned_apps? -%>
<h3><%= t('dashboard.pinned_apps_title') %> <small><%= t('dashboard.pinned_apps_caption_html', all_apps_url: apps_index_path) %></small></h3>
<h2><%= t('dashboard.pinned_apps_title') %> <small><%= t('dashboard.pinned_apps_caption_html', all_apps_url: apps_index_path) %></small></h2>

<%- if @user_configuration.pinned_apps_group_by.present? -%>
<%= render(partial: "/widgets/pinned_apps/group", collection: OodAppGroup.groups_for(apps: @pinned_apps, group_by: @user_configuration.pinned_apps_group_by.to_sym)) %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h4 class="apps-section-header-blue"><%= group.title || I18n.t('dashboard.not_grouped') %></h4>
<h3 class="apps-section-header-blue"><%= group.title || I18n.t('dashboard.not_grouped') %></h3>

<div class="row">
<%= render partial: "/widgets/pinned_apps/app", collection: group.apps %>
Expand Down
10 changes: 5 additions & 5 deletions apps/dashboard/test/integration/dashboard_layout_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_env
assert_select 'div.row', 1
assert_select 'div.row > div.col-md-12', 1
assert_select 'div.row > div.col-md-12 > div.motd', 3
assert_select 'div.row > div.col-md-12 > div.motd > h4', 3
assert_select 'div.row > div.col-md-12 > div.motd > h3', 3
assert_select 'div.row > div.col-md-12 > div.motd > div.motd_body', 3
end

Expand Down Expand Up @@ -128,7 +128,7 @@ def test_env
assert_select 'div.row', 1
assert_select 'div.row > div.col-md-8', 1
assert_select 'div.row > div.col-md-8 > div.motd', 3
assert_select 'div.row > div.col-md-8 > div.motd > h4', 3
assert_select 'div.row > div.col-md-8 > div.motd > h3', 3
assert_select 'div.row > div.col-md-8 > div.motd > div.motd_body', 3

assert_select 'div.row > div.col-md-4', 1
Expand Down Expand Up @@ -166,7 +166,7 @@ def test_env

assert_select 'div.row > div.col-md-4', 1
assert_select 'div.row > div.col-md-4 > div.motd', 3
assert_select 'div.row > div.col-md-4 > div.motd > h4', 3
assert_select 'div.row > div.col-md-4 > div.motd > h3', 3
assert_select 'div.row > div.col-md-4 > div.motd > div.motd_body', 3

assert_select pinned_app_row_css_query('8'), 4
Expand Down Expand Up @@ -221,7 +221,7 @@ def test_env
assert_select 'div.row', 3 # one extra row because pinned_apps makes rows for every 'group'
assert_select 'div.row > div.col-md-8', 1
assert_select 'div.row > div.col-md-8 > div.motd', 3
assert_select 'div.row > div.col-md-8 > div.motd > h4', 3
assert_select 'div.row > div.col-md-8 > div.motd > h3', 3
assert_select 'div.row > div.col-md-8 > div.motd > div.motd_body', 3

assert_select 'div.row > div.col-md-4', 1
Expand Down Expand Up @@ -299,7 +299,7 @@ def test_env
assert_select 'div.row > div.col-md-6', 2

assert_select 'div.row > div.col-md-6 > div.motd', 3
assert_select 'div.row > div.col-md-6 > div.motd > h4', 3
assert_select 'div.row > div.col-md-6 > div.motd > h3', 3
assert_select 'div.row > div.col-md-6 > div.motd > div.motd_body', 3

assert_select 'div.row > div.col-md-6 > #my-test-partial', 1
Expand Down
60 changes: 30 additions & 30 deletions apps/dashboard/test/integration/pinned_apps_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ def teardown
assert_select pinned_app_link('/apps/show/pseudofun'), 1
assert_select pinned_app_link('/batch_connect/sys/bc_desktop/owens/session_contexts/new'), 1

assert_select 'h3', 2
assert_equal I18n.t('dashboard.motd_title'), css_select('h3')[1].text
assert_select 'h2', 2
assert_equal I18n.t('dashboard.motd_title'), css_select('h2')[1].text

assert_select "div[class='motd']", 3
assert_select "h4[class='motd_title']", 3
assert_select "h3[class='motd_title']", 3
end

test 'shows pinned apps when XDMOD is present' do
Expand Down Expand Up @@ -238,11 +238,11 @@ def teardown
assert_select pinned_app_link('/apps/show/pseudofun'), 1
assert_select pinned_app_link('/batch_connect/sys/bc_desktop/owens/session_contexts/new'), 1

assert_select 'h3', 2
assert_equal I18n.t('dashboard.motd_title'), css_select('h3')[1].text
assert_select 'h2', 2
assert_equal I18n.t('dashboard.motd_title'), css_select('h2')[1].text

assert_select "div[class='motd']", 3
assert_select "h4[class='motd_title']", 3
assert_select "h3[class='motd_title']", 3

assert_select "div[class='xdmod']", 2
assert_select "div[id='jobsEfficiencyReportPanelDiv']", 1
Expand All @@ -262,11 +262,11 @@ def teardown
get '/'
end

assert_select 'h3', 1
assert_equal I18n.t('dashboard.motd_title'), css_select('h3').text
assert_select 'h2', 1
assert_equal I18n.t('dashboard.motd_title'), css_select('h2').text

assert_select "div[class='motd']", 3
assert_select "h4[class='motd_title']", 3
assert_select "h3[class='motd_title']", 3
end

test 'still shows XDMOD when no pinned apps' do
Expand Down Expand Up @@ -301,11 +301,11 @@ def teardown
get '/'
end

assert_select 'h3', 1
assert_equal I18n.t('dashboard.motd_title'), css_select('h3').text
assert_select 'h2', 1
assert_equal I18n.t('dashboard.motd_title'), css_select('h2').text

assert_select "div[class='motd']", 3
assert_select "h4[class='motd_title']", 3
assert_select "h3[class='motd_title']", 3

assert_select "div[class='xdmod']", 2
assert_select "div[id='jobsEfficiencyReportPanelDiv']", 1
Expand All @@ -329,10 +329,10 @@ def teardown
get '/'
end

assert_select "h4[class='apps-section-header-blue']", 2
assert_select "h3[class='apps-section-header-blue']", 2
assert_select pinned_app_links, 3
assert_equal 'Gateway Apps', css_select("h4[class='apps-section-header-blue']")[0].text
assert_equal 'Interactive Apps', css_select("h4[class='apps-section-header-blue']")[1].text
assert_equal 'Gateway Apps', css_select("h3[class='apps-section-header-blue']")[0].text
assert_equal 'Interactive Apps', css_select("h3[class='apps-section-header-blue']")[1].text
end

test 'groups the apps by sub-categories' do
Expand All @@ -351,10 +351,10 @@ def teardown
get '/'
end

assert_select "h4[class='apps-section-header-blue']", 2
assert_select "h3[class='apps-section-header-blue']", 2
assert_select pinned_app_links, 3
assert_equal 'Apps', css_select("h4[class='apps-section-header-blue']")[0].text
assert_equal 'Biomedical Informatics', css_select("h4[class='apps-section-header-blue']")[1].text
assert_equal 'Apps', css_select("h3[class='apps-section-header-blue']")[0].text
assert_equal 'Biomedical Informatics', css_select("h3[class='apps-section-header-blue']")[1].text
end

test 'still shows ungroupable apps' do
Expand All @@ -373,9 +373,9 @@ def teardown
get '/'
end

assert_select "h4[class='apps-section-header-blue']", 1
assert_select "h3[class='apps-section-header-blue']", 1
assert_select pinned_app_links, 3
assert_equal I18n.t('dashboard.not_grouped'), css_select("h4[class='apps-section-header-blue']")[0].text
assert_equal I18n.t('dashboard.not_grouped'), css_select("h3[class='apps-section-header-blue']")[0].text
end

test 'group by metadata fields works' do
Expand All @@ -394,11 +394,11 @@ def teardown
get '/'
end

assert_select "h4[class='apps-section-header-blue']", 3
assert_select "h3[class='apps-section-header-blue']", 3
assert_select pinned_app_links, 3
assert_equal 'go erLANG python', css_select("h4[class='apps-section-header-blue']")[0].text
assert_equal 'python julia R Ruby', css_select("h4[class='apps-section-header-blue']")[1].text
assert_equal I18n.t('dashboard.not_grouped'), css_select("h4[class='apps-section-header-blue']")[2].text
assert_equal 'go erLANG python', css_select("h3[class='apps-section-header-blue']")[0].text
assert_equal 'python julia R Ruby', css_select("h3[class='apps-section-header-blue']")[1].text
assert_equal I18n.t('dashboard.not_grouped'), css_select("h3[class='apps-section-header-blue']")[2].text
end

test 'shows only the shared apps that have been configured' do
Expand All @@ -418,12 +418,12 @@ def teardown
assert_select pinned_app_links, 1
assert_select pinned_app_link('/apps/show/my_shared_app/usr/me'), 1

assert_select 'h3', 1
assert css_select('h3')[0].text.to_s.start_with?(I18n.t('dashboard.pinned_apps_title'))
assert_select 'h2', 1
assert css_select('h2')[0].text.to_s.start_with?(I18n.t('dashboard.pinned_apps_title'))

# no MOTD or xdmod
assert_select "div[class='motd']", 0
assert_select "h4[class='motd_title']", 0
assert_select "h3[class='motd_title']", 0
assert_select "div[class='xdmod']", 0
end

Expand Down Expand Up @@ -458,12 +458,12 @@ def teardown
assert_select pinned_app_link('/batch_connect/sys/bc_jupyter/session_contexts/new'), 1
assert_select pinned_app_link('/batch_connect/sys/bc_paraview/session_contexts/new'), 1

assert_select 'h3', 1
assert css_select('h3')[0].text.to_s.start_with?(I18n.t('dashboard.pinned_apps_title'))
assert_select 'h2', 1
assert css_select('h2')[0].text.to_s.start_with?(I18n.t('dashboard.pinned_apps_title'))

# no MOTD or xdmod
assert_select "div[class='motd']", 0
assert_select "h4[class='motd_title']", 0
assert_select "h3[class='motd_title']", 0
assert_select "div[class='xdmod']", 0
end

Expand Down

0 comments on commit 9ef9b09

Please sign in to comment.