diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 239354b..c377ae7 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -3,7 +3,7 @@
def edit
@user.create_default_preferences if @user.prefs == {}
- @languages = Language.all.order("name")
+ @languages = Language.sorted_by_abbreviation
@orgs = Org.where(parent_id: nil).order("name")
@other_organisations = Org.where(parent_id: nil, is_other: true).pluck(:id)
@identifier_schemes = IdentifierScheme.where(active: true).order(:name)
diff --git a/app/models/language.rb b/app/models/language.rb
index 2d02783..1d86727 100644
--- a/app/models/language.rb
+++ b/app/models/language.rb
@@ -11,4 +11,6 @@
scope :sorted_by_abbreviation, -> { all.order(:abbreviation) }
scope :default, -> { where(default_language: true).first }
+ # Retrieves the id for a given abbreviation of a language
+ scope :id_for, -> (abbreviation) { where(abbreviation: abbreviation).pluck(:id).first }
end
\ No newline at end of file
diff --git a/app/views/annotations/_add_annotation.html.erb b/app/views/annotations/_add_annotation.html.erb
index 8add942..d84fef9 100644
--- a/app/views/annotations/_add_annotation.html.erb
+++ b/app/views/annotations/_add_annotation.html.erb
@@ -25,8 +25,8 @@
- <%= submit_tag _('Save'), class: "btn btn-primary" %>
+ <%= submit_tag _('Save'), class: "btn btn-primary", role: 'button' %>
<%= hidden_field_tag :question_id, question.id, class: "question_id" %>
- <%= link_to _('Cancel'), "#", class: "btn cancel cancel_add_annotations" %>
+ <%= link_to _('Cancel'), "#", class: "btn cancel cancel_add_annotations", role: 'button' %>
<%end%>
diff --git a/app/views/annotations/_edit_annotation.html.erb b/app/views/annotations/_edit_annotation.html.erb
index 3a59362..cae438b 100644
--- a/app/views/annotations/_edit_annotation.html.erb
+++ b/app/views/annotations/_edit_annotation.html.erb
@@ -27,17 +27,17 @@
- <%= submit_tag _('Save'), class: 'btn btn-primary' %>
+ <%= submit_tag _('Save'), class: 'btn btn-primary', role: 'button' %>
<% if example_answer.present? %>
<%= link_to _('Delete Example Answer'), admin_destroy_annotation_path(id: example_answer.id),
- confirm: _("You are about to delete an example answer for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%>
+ confirm: _("You are about to delete an example answer for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary", role: 'button' %>
<% end %>
<% if guidance.present? %>
<%= link_to _('Delete Example Answer'), admin_destroy_annotation_path(id: guidance.id),
- confirm: _("You are about to delete a guidance for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%>
+ confirm: _("You are about to delete a guidance for '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary", role: 'button'%>
<% end %>
<%= hidden_field_tag :question_id, question.id, class: "question_id" %>
- <%= link_to _('Cancel'), '#', class: 'btn cancel cancel_edit_annotations' %>
+ <%= link_to _('Cancel'), '#', class: 'btn cancel cancel_edit_annotations', role: 'button' %>
<% end %>
diff --git a/app/views/annotations/_show_annotation.html.erb b/app/views/annotations/_show_annotation.html.erb
index a790d70..9ed4d19 100644
--- a/app/views/annotations/_show_annotation.html.erb
+++ b/app/views/annotations/_show_annotation.html.erb
@@ -22,5 +22,5 @@
<%= hidden_field_tag :question_id, question.id, class: "question_id" %>
- <%= link_to _('Edit Annotations'), '# ', class: "btn btn-primary edit_form_for_annotations"%>
+ <%= link_to _('Edit Annotations'), '# ', class: "btn btn-primary edit_form_for_annotations", role: 'button'%>
diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb
index a82a78f..93dbcfc 100644
--- a/app/views/devise/passwords/edit.html.erb
+++ b/app/views/devise/passwords/edit.html.erb
@@ -16,7 +16,7 @@
- <%= f.submit t('helpers.save'), :class => 'btn btn-primary' %>
+ <%= f.submit t('helpers.save'), :class => 'btn btn-primary', role: 'button'%>
<% end %>
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb
index 201002d..6be60ae 100644
--- a/app/views/devise/passwords/new.html.erb
+++ b/app/views/devise/passwords/new.html.erb
@@ -4,7 +4,7 @@
<%= _('The email address you entered is not registered.') %>
<% end %>
-<%= t('helpers.forgot_password') %>
+<%= _('Forgot your password?') %>
<%= _('Please enter your email below and we will send you instructions on how to reset your password.') %>
@@ -13,9 +13,8 @@
- <%= _('Email') %>
-
+ <%= f.label(:email, _('Email'), class: 'required') %>
+ <%= f.email_field(:email, class: 'left-indent required input-small') %>
@@ -29,5 +28,4 @@
<% end %>
-
-
+
\ No newline at end of file
diff --git a/app/views/devise/registrations/_password_details.html.erb b/app/views/devise/registrations/_password_details.html.erb
index 9a93588..561f8d7 100644
--- a/app/views/devise/registrations/_password_details.html.erb
+++ b/app/views/devise/registrations/_password_details.html.erb
@@ -5,33 +5,29 @@
<%= hidden_field_tag :skip_personal_details, "true" %>
- <%= _('Current Password') %>
-
+ <%= f.label(:current_password, _('Current Password'), class: 'required') %>
+ <%= f.password_field(:current_password, class: 'left-indent required input-medium') %>
- <%= _('New Password') %>
-
+ <%= f.label(:password, _('New Password'), class: 'required') %>
+ <%= f.password_field(:password, class: 'left-indent required input-medium', id: 'user_new_password') %>
- <%= _('Password Confirmation') %>
-
+ <%= f.label(:password_confirmation, _('Password Confirmation'), class: 'required') %>
+ <%= f.password_field(:password_confirmation, class: 'left-indent required input-medium') %>
- <%= _('Show passwords') %>
-
+ <%= label_tag(:password_show, _('Show passwords')) %>
+ <%= check_box_tag(:password_show, "1", false, class: 'left-indent') %>
diff --git a/app/views/devise/registrations/_personal_details.html.erb b/app/views/devise/registrations/_personal_details.html.erb
index 1a509fe..4437580 100644
--- a/app/views/devise/registrations/_personal_details.html.erb
+++ b/app/views/devise/registrations/_personal_details.html.erb
@@ -16,47 +16,40 @@
<%= hidden_field_tag :skip_personal_details, "false" %>
- <%= _('Email') %>*
-
+ <%= f.label(:email, _('Email'), class: 'required') %>
+ <%= f.email_field(:email, class: 'left-indent required input-medium',
+ title: _('Please enter your current password below when changing your email address.'),
+ value: @user.email) %>
- <%= _('First Name') %>*
-
+ <%= f.label(:firstname, _('First Name'), class: 'required') %>
+ <%= f.text_field(:firstname, class: 'input-small required left-indent', value: @user.firstname) %>
- <%= _('Last Name') %>*
-
+ <%= f.label(:surname, _('Last Name'), class: 'required') %>
+ <%= f.text_field(:surname, class: 'input-small required left-indent', value: @user.surname) %>
- <%= _('Recovery Email') %>*
-
+ <%= f.label(:recovery_email, _('Recovery Email'), class: 'required') %>
+ <%= f.email_field(:recovery_email, class: 'left-indent required input-medium',
+ title: _('This email will be used to recover your account if you change institutions'),
+ value: @user.recovery_email) %>
- <%= _('Password') %>
-
+ <%= f.label(:password, _('Password'), class: 'required') %>
+ <%= f.password_field(:password, class: 'left-indent required input-medium') %>
-
<%= _('Organisation') %>
+ <%= f.label(:org_name, _('Organisation')) %>
<%= render partial: "shared/accessible_combobox",
locals: {name: "#{resource_name}[org_name]",
id: "#{resource_name}_org_name",
@@ -68,16 +61,11 @@
<% if MANY_LANGUAGES %>
- <% lang = current_user.language.nil? ? FastGettext.default_locale : current_user.language.abbreviation %>
- <%= _('Language') %>
-
- <%= @languages.each do |l| %>
- >
- <%= l.name %>
-
- <% end %>
-
+ <% lang_id = current_user.language.nil? ? Language.id_for(FastGettext.default_locale) : current_user.language.id %>
+ <%= f.label(:language_id, _('Language')) %>
+ <%= select_tag("user[language_id]",
+ options_from_collection_for_select(@languages, "id", "name", lang_id),
+ class: 'input-small left-indent') %>
<% end %>
@@ -89,7 +77,7 @@
<% else %>
-
<%= scheme.name.capitalize %>
+ <%= label_tag(:scheme_name, scheme.name.capitalize ) %>
<% end %>
<%= render partial: "external_identifier_#{scheme.name}",
@@ -101,10 +89,9 @@
<% unless @user.api_token.blank? %>
<% end %>
@@ -127,6 +114,6 @@
diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb
index 23ff6e3..cfd27cc 100644
--- a/app/views/guidance_groups/admin_edit.html.erb
+++ b/app/views/guidance_groups/admin_edit.html.erb
@@ -45,9 +45,9 @@
diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb
index 2303226..a22ae2b 100644
--- a/app/views/guidance_groups/admin_new.html.erb
+++ b/app/views/guidance_groups/admin_new.html.erb
@@ -30,7 +30,7 @@
<% end %>
diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb
index 78f15be..8f617f8 100644
--- a/app/views/guidances/admin_edit.html.erb
+++ b/app/views/guidances/admin_edit.html.erb
@@ -36,7 +36,7 @@
<%end%>
diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb
index d838f14..a487cb5 100644
--- a/app/views/guidances/admin_new.html.erb
+++ b/app/views/guidances/admin_new.html.erb
@@ -33,7 +33,7 @@
<%= f.collection_select(:guidance_group_id, @guidance_groups,
:id, :name, {prompt: false, include_blank: 'None'}, {multiple: false, title: _('Select which group this guidance relates to.')})%>
-
+
diff --git a/app/views/plans/_available_templates.html.erb b/app/views/plans/_available_templates.html.erb
index 900fded..a8842e7 100644
--- a/app/views/plans/_available_templates.html.erb
+++ b/app/views/plans/_available_templates.html.erb
@@ -1,14 +1,13 @@
<%= _('Which DMP template would you like to use?') %>
-
- <%= _('Select a template') %>
-
+ <%= label_tag(:plan_template_selector, _('Select a template')) %>
-
+ <%= select_tag(:plan_template_selector,
+ options_from_collection_for_select(@templates, 'id', 'title'),
+ class: 'left-indent input-extra-large',
+ prompt: _('Please select one'))
+ %>
@@ -82,9 +77,8 @@
diff --git a/app/views/questions/_edit_question.html.erb b/app/views/questions/_edit_question.html.erb
index a37a2d5..154a500 100644
--- a/app/views/questions/_edit_question.html.erb
+++ b/app/views/questions/_edit_question.html.erb
@@ -175,13 +175,13 @@
- <%= f.submit _('Save'), class: "btn btn-primary" %>
+ <%= f.submit _('Save'), class: "btn btn-primary", role:'button' %>
<% if !question.section.phase.template.published? %>
<%= link_to _('Delete'), admin_destroy_question_path(question_id: question.id),
- confirm: _("You are about to delete '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary"%>
+ confirm: _("You are about to delete '%{question_text}'. Are you sure?") % { :question_text => question.text }, method: :delete, class: "btn btn-primary", role:'button'%>
<% end %>
<%= hidden_field_tag :question_id, question.id, class: "question_id" %>
- <%= link_to _('Cancel'), "#", class: "btn cancel cancel_edit_question" %>
+ <%= link_to _('Cancel'), "#", class: "btn cancel cancel_edit_question", role:'button' %>
diff --git a/app/views/questions/_preview_question.html.erb b/app/views/questions/_preview_question.html.erb
index d4a709c..625cc84 100644
--- a/app/views/questions/_preview_question.html.erb
+++ b/app/views/questions/_preview_question.html.erb
@@ -3,15 +3,15 @@
- <% q_format = question.question_format%>
+ <% q_format = question.question_format %>