diff --git a/app/controllers/concerns/paginable.rb b/app/controllers/concerns/paginable.rb index d07f4d4..0c58199 100644 --- a/app/controllers/concerns/paginable.rb +++ b/app/controllers/concerns/paginable.rb @@ -55,7 +55,7 @@ # Generates an HTML link to sort given a sort field. # sort_field {String} - Represents the column name for a table def paginable_sort_link(sort_field) - return link_to(sort_link_name(sort_field), sort_link_url(sort_field), 'data-remote': true, class: 'paginable-action') + return link_to(sort_link_name(sort_field), sort_link_url(sort_field), 'data-remote': true, class: 'paginable-action', "aria-label": "#{sort_field}") end # Determines whether or not the latest request included the search functionality def searchable? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 992c6ab..a2a6012 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -37,4 +37,8 @@ def fingerprinted_asset(name) Rails.env.production? ? "#{name}-#{ASSET_FINGERPRINT}" : name end + + def title(page_title) + content_for(:title) { page_title } + end end diff --git a/app/views/contact_us/contacts/new.html.erb b/app/views/contact_us/contacts/new.html.erb index f98ec59..aca3edd 100644 --- a/app/views/contact_us/contacts/new.html.erb +++ b/app/views/contact_us/contacts/new.html.erb @@ -1,3 +1,4 @@ +<% title 'Contact Us' %>

<%= _("Contact Us") %>

diff --git a/app/views/devise/invitations/edit.html.erb b/app/views/devise/invitations/edit.html.erb index 255dcfd..41e592a 100644 --- a/app/views/devise/invitations/edit.html.erb +++ b/app/views/devise/invitations/edit.html.erb @@ -1,3 +1,4 @@ +<% title 'Create an account to view the plan' %>

<%= _("Create an account to view the plan") %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index cabaa15..1fef16b 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,3 +1,4 @@ +<% title 'Change your password' %>

<%= _('Change your password') %>

diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index a4bfb2e..77308ee 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,3 +1,4 @@ +<% title 'Forgot your password?' %>
<% unless @user.errors[:email].empty? %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 75e0d7f..964db44 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,3 +1,4 @@ +<% title 'Edit Profile' %>

<%= _('Edit profile') %>

diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index 1730ddd..4b7d473 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -1,3 +1,4 @@ +<% title 'Guidance group' %>

<%= _('Guidance group') %>

diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index 2a65260..08ea9c5 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -1,3 +1,4 @@ +<% title 'Guidance group' %>

<%= _('Guidance group') %>

diff --git a/app/views/guidances/admin_index.html.erb b/app/views/guidances/admin_index.html.erb index b2500e8..30b66f5 100644 --- a/app/views/guidances/admin_index.html.erb +++ b/app/views/guidances/admin_index.html.erb @@ -1,3 +1,4 @@ +<% title 'Guidance' %>

<%= _('Guidance') %>

diff --git a/app/views/guidances/new_edit.html.erb b/app/views/guidances/new_edit.html.erb index 8b38a7d..d9fb1a2 100644 --- a/app/views/guidances/new_edit.html.erb +++ b/app/views/guidances/new_edit.html.erb @@ -1,3 +1,4 @@ +<% title 'Guidance' %> <%# locals: { guidance, themes, guidance_groups, options } %>
diff --git a/app/views/home/_welcome.html.erb b/app/views/home/_welcome.html.erb index 6348ccd..7d5ce6a 100644 --- a/app/views/home/_welcome.html.erb +++ b/app/views/home/_welcome.html.erb @@ -1,5 +1,6 @@ +<% title _("Welcome to #{Rails.configuration.branding[:application][:name]}.") %>
-

<%= _('Welcome.')%>

+

<%= _("Welcome to #{Rails.configuration.branding[:application][:name]}.")%>

<%= raw _('

%{application_name} has been developed by the %{organisation_name} to help you write data management plans.

') % {:application_name => Rails.configuration.branding[:application][:name], :organisation_name => Rails.configuration.branding[:organisation][:name]} %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 21a535a..a9e62a1 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,10 +1,9 @@ - - <%= _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %> + <title><%= content_for?(:title) ? yield(:title) : _('%{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %> - <%= favicon_link_tag "favicon.ico" %> + <%= favicon_link_tag "favicon.ico" %> diff --git a/app/views/plans/index.html.erb b/app/views/plans/index.html.erb index 9d05e58..6c267cd 100644 --- a/app/views/plans/index.html.erb +++ b/app/views/plans/index.html.erb @@ -1,3 +1,4 @@ +<% title 'My Dashboard' %>

<%= _('My Dashboard') %>

diff --git a/app/views/plans/new.html.erb b/app/views/plans/new.html.erb index 1b1b261..c628eee 100644 --- a/app/views/plans/new.html.erb +++ b/app/views/plans/new.html.erb @@ -1,3 +1,4 @@ +<% title 'Create a new plan' %>

<%= _('Create a new plan') %>

@@ -15,7 +16,7 @@

<%= _('What research project are you planning?') %>

- <%= f.text_field(:title, class: 'form-control', 'aria-describedby': 'project-title', 'aria-required': 'true', + <%= f.text_field(:title, class: 'form-control', 'aria-describedby': 'project-title', 'aria-required': 'true', 'aria-label': 'project-title', 'data-toggle': 'tooltip', title: _('If applying for funding, state the project title exactly as in the proposal.')) %>
diff --git a/app/views/plans/overview.html.erb b/app/views/plans/overview.html.erb index c9ebc5f..a063650 100644 --- a/app/views/plans/overview.html.erb +++ b/app/views/plans/overview.html.erb @@ -1,4 +1,5 @@ <%# locals: { plan } %> +<% title "#{plan.title}" %>

<%= plan.title %>

diff --git a/app/views/plans/share.html.erb b/app/views/plans/share.html.erb index 0a679b3..c3fa79c 100644 --- a/app/views/plans/share.html.erb +++ b/app/views/plans/share.html.erb @@ -1,3 +1,4 @@ +<% title "#{@plan.title} - Share" %>
diff --git a/app/views/plans/show.html.erb b/app/views/plans/show.html.erb index f44bae3..6515930 100644 --- a/app/views/plans/show.html.erb +++ b/app/views/plans/show.html.erb @@ -1,3 +1,4 @@ +<% title "#{@plan.title}" %>
diff --git a/app/views/public_pages/plan_index.html.erb b/app/views/public_pages/plan_index.html.erb index d4d47aa..9cf0452 100644 --- a/app/views/public_pages/plan_index.html.erb +++ b/app/views/public_pages/plan_index.html.erb @@ -1,3 +1,4 @@ +<% title 'Public DMPs'%>

<%= raw _('Public DMPs') %>

diff --git a/app/views/public_pages/template_index.html.erb b/app/views/public_pages/template_index.html.erb index 6ee943f..1db4f7d 100644 --- a/app/views/public_pages/template_index.html.erb +++ b/app/views/public_pages/template_index.html.erb @@ -1,3 +1,4 @@ +<% title 'DMP Templates'%>

<%= raw _('DMP Templates') %>

diff --git a/app/views/shared/_accessible_combobox.html.erb b/app/views/shared/_accessible_combobox.html.erb index af6653a..0a06f81 100644 --- a/app/views/shared/_accessible_combobox.html.erb +++ b/app/views/shared/_accessible_combobox.html.erb @@ -16,6 +16,7 @@ data-combobox-allow-suggestion-on-empty="true" data-toggle="<%= title == '' ? '' : 'tooltip' %>" title="<%= title %>" + aria-label= "<%= title %>", value="<%= default_selection[attribute] unless default_selection.nil? %>" /> <% models.each do |model| %> diff --git a/app/views/shared/_my_org.html.erb b/app/views/shared/_my_org.html.erb index 66b3415..89d1d87 100644 --- a/app/views/shared/_my_org.html.erb +++ b/app/views/shared/_my_org.html.erb @@ -13,7 +13,8 @@
<%= f.text_field :other_organisation, autocomplete: "off", class: "form-control hide", - placeholder: _('Please enter the name of your organisation') %> + placeholder: _('Please enter the name of your organisation'), + "aria-label": "other_organisation" %>
diff --git a/app/views/shared/_search.html.erb b/app/views/shared/_search.html.erb index 5efe38e..53f6967 100644 --- a/app/views/shared/_search.html.erb +++ b/app/views/shared/_search.html.erb @@ -5,7 +5,7 @@ - <%= text_field_tag(:search, search_term, class: 'form-control', 'aria-describedby': 'search-addon', 'aria-required': true) %> + <%= text_field_tag(:search, search_term, class: 'form-control', 'aria-labelledby': 'search', 'aria-describedby': 'search-addon', 'aria-required': true) %>
<%= submit_tag(_('Search'), class: 'btn btn-default', style: 'margin-top: 8px;') %> diff --git a/app/views/static_pages/about_us.html.erb b/app/views/static_pages/about_us.html.erb index e6f108e..3963aeb 100644 --- a/app/views/static_pages/about_us.html.erb +++ b/app/views/static_pages/about_us.html.erb @@ -1,3 +1,4 @@ +<% title _('About %{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %>

<%= _('About %{application_name}') % { :application_name => Rails.configuration.branding[:application][:name] } %>

diff --git a/app/views/static_pages/help.html.erb b/app/views/static_pages/help.html.erb index 1ef6932..efb8132 100644 --- a/app/views/static_pages/help.html.erb +++ b/app/views/static_pages/help.html.erb @@ -1,3 +1,4 @@ +<% title 'Help' %>

<%= _('Help')%>

diff --git a/app/views/static_pages/privacy.html.erb b/app/views/static_pages/privacy.html.erb index 22f50c4..27f4a23 100644 --- a/app/views/static_pages/privacy.html.erb +++ b/app/views/static_pages/privacy.html.erb @@ -1,3 +1,4 @@ +<% title 'Privacy statement' %>

<%= _('Privacy statement') %>

diff --git a/app/views/static_pages/termsuse.html.erb b/app/views/static_pages/termsuse.html.erb index efb6daa..b5ae00c 100644 --- a/app/views/static_pages/termsuse.html.erb +++ b/app/views/static_pages/termsuse.html.erb @@ -1,3 +1,4 @@ +<% title 'Terms of use' %>

<%= _('Terms of use')%>

diff --git a/app/views/super_admin/orgs/index.html.erb b/app/views/super_admin/orgs/index.html.erb index 845c1b2..47c5f6d 100644 --- a/app/views/super_admin/orgs/index.html.erb +++ b/app/views/super_admin/orgs/index.html.erb @@ -1,4 +1,5 @@ <%# Available locals: orgs %> +<% title 'Organisations' %>

diff --git a/app/views/super_admin/themes/index.html.erb b/app/views/super_admin/themes/index.html.erb index 938a1e8..06db92f 100644 --- a/app/views/super_admin/themes/index.html.erb +++ b/app/views/super_admin/themes/index.html.erb @@ -1,3 +1,4 @@ +<% title 'Themes' %>

<%= _('Themes') %>

diff --git a/app/views/super_admin/themes/new_edit.html.erb b/app/views/super_admin/themes/new_edit.html.erb index ca5c4a2..65dbcff 100644 --- a/app/views/super_admin/themes/new_edit.html.erb +++ b/app/views/super_admin/themes/new_edit.html.erb @@ -1,4 +1,5 @@ <%# locals: { theme, options } %> +<% title "#{options[:title]}" %>

<%= options[:title] %>

<%= form_for theme, url: options[:url], method: options[:method], html: { class: 'theme' } do |f| %>
diff --git a/app/views/super_admin/users/edit.html.erb b/app/views/super_admin/users/edit.html.erb index afd88bb..5e02f14 100644 --- a/app/views/super_admin/users/edit.html.erb +++ b/app/views/super_admin/users/edit.html.erb @@ -1,3 +1,4 @@ +<% title _('Editing profile for %{username}') % { username: user.name(false) } %>

diff --git a/app/views/users/admin_index.html.erb b/app/views/users/admin_index.html.erb index 45f4b8e..89db83a 100644 --- a/app/views/users/admin_index.html.erb +++ b/app/views/users/admin_index.html.erb @@ -1,3 +1,4 @@ +<% title 'User accounts' %>

<%= _('User accounts') %>

diff --git a/test/functional/sessions_controller_test.rb b/test/functional/sessions_controller_test.rb index a428d8f..cc9e3dc 100644 --- a/test/functional/sessions_controller_test.rb +++ b/test/functional/sessions_controller_test.rb @@ -29,7 +29,7 @@ # ---------------------------------------------------------- test "unknown user's session[:locale] set to FastGettext.default_locale" do post user_session_path, {user: {email: 'testing.session@example.org'}} - assert_equal nil, session[:locale], "expected the new user's locale to be empty" + assert_nil session[:locale], "expected the new user's locale to be empty" assert_equal FastGettext.default_locale, FastGettext.locale, "expected the FastGettext to use the default locale" assert_response :redirect assert_redirected_to root_path @@ -51,7 +51,7 @@ # ---------------------------------------------------------- test "delete the user session" do delete destroy_user_session_path - assert_equal nil, session[:locale], "expected the locale to have been deleted from the session" + assert_nil session[:locale], "expected the locale to have been deleted from the session" assert_response :redirect if Rails.application.config.shibboleth_enabled assert_redirected_to Rails.application.config.shibboleth_logout_url + root_url diff --git a/test/integration/authentication_test.rb b/test/integration/authentication_test.rb index c647877..3c7dc0f 100644 --- a/test/integration/authentication_test.rb +++ b/test/integration/authentication_test.rb @@ -39,7 +39,7 @@ get root_path # Make sure that the user is sent to the page that lists their plans - assert_select 'h1', _('Welcome.') + assert_select 'h1', _('Welcome to DMPRoadmap.') end # ---------------------------------------------------------- @@ -58,7 +58,7 @@ # Make sure that the user is sent to the page that lists their plans assert_response :success - assert_select 'h1', _('Welcome.') + assert_select 'h1', _('Welcome to DMPRoadmap.') end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 0c0f4c7..79bbf1f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -412,7 +412,7 @@ follow_redirects assert_response :success - assert_select 'main h1', _('Welcome.') + assert_select 'main h1', _('Welcome to DMPRoadmap.') end # ----------------------------------------------------------------------