diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 5da69b3..3d9d60a 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/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 @@
- - + <%= 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" %>
- - + <%= f.label(:current_password, _('Current Password'), class: 'required') %> + <%= f.password_field(:current_password, class: 'left-indent required input-medium') %>
- - + <%= f.label(:password, _('New Password'), class: 'required') %> + <%= f.password_field(:password, class: 'left-indent required input-medium', id: 'user_new_password') %>
- - + <%= f.label(:password_confirmation, _('Password Confirmation'), class: 'required') %> + <%= f.password_field(:password_confirmation, class: 'left-indent required input-medium') %>
- - + <%= 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 5ee124f..14d676a 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" %>
- - + <%= 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) %>
- - + <%= f.label(:firstname, _('First Name'), class: 'required') %> + <%= f.text_field(:firstname, class: 'input-small required left-indent', value: @user.firstname) %>
- - + <%= f.label(:surname, _('Last Name'), class: 'required') %> + <%= f.text_field(:surname, class: 'input-small required left-indent', value: @user.surname) %>
- - + <%= 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) %>
- - + <%= f.label(:password, _('Password'), class: 'required') %> + <%= f.password_field(:password, class: 'left-indent required input-medium') %>
- + <%= 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 %> - - + <% 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 %> @@ -88,7 +76,7 @@ <% else %> - + <%= label_tag(:scheme_name, scheme.name.capitalize ) %> <% end %>
<%= render partial: "external_identifier_#{scheme.name}", @@ -100,10 +88,9 @@ <% unless @user.api_token.blank? %>
- <%= f.label :api_token, _('API token') %> + <%= f.label(:api_token, _('API token')) %>
<%= @user.api_token %>
- - + <%= label_tag(:api_information, _('API Information')) %>
<%= link_to( _('How to use the API'), controller: "token_permission_types", action: "index")%>
<% end %> diff --git a/app/views/orgs/shibboleth_ds.html.erb b/app/views/orgs/shibboleth_ds.html.erb index 7484fdd..adf3e01 100644 --- a/app/views/orgs/shibboleth_ds.html.erb +++ b/app/views/orgs/shibboleth_ds.html.erb @@ -6,9 +6,7 @@ <%= form_for 'shibboleth_ds', url: shibboleth_ds_path, html: {class: "shibboleth-ds-form roadmap-form"} do |f| %>
- + <%= f.label(:org_name, _('Look up your institution here')) %> <% if @orgs.length <= 10 %> - - <%= raw @templates.collect{|t| "" }.join('') %> - + <%= select_tag(:plan_template_selector, + options_from_collection_for_select(@templates, 'id', 'title'), + class: 'left-indent input-extra-large', + prompt: _('Please select one')) + %>
diff --git a/app/views/plans/_edit_details.html.erb b/app/views/plans/_edit_details.html.erb index 8b63228..9f964b4 100644 --- a/app/views/plans/_edit_details.html.erb +++ b/app/views/plans/_edit_details.html.erb @@ -38,7 +38,7 @@
- + <%= f.label(:data_contact, raw("#{_('Data Contact Person')}"), class: 'no-colon') %>
<%= f.label _('Name'), for: :data_contact %> @@ -50,22 +50,37 @@
 
- + <%= submit_tag(_('Save'), class: 'form-submit') %>
- + <%= f.hidden_field(:visibility, value: visibility) %>
- + <%= f.label(:visibility, _('Plan Visibility')) %>
(<%= _('Limited to finished plans') %>)

-
/><%= raw display_visibility('privately_visible') %>
-
/><%= raw display_visibility('organisationally_visible') %>
-
/><%= raw display_visibility('publicly_visible') %>
+
+ <%= radio_button_tag(:vis, 0, !['publicly_visible', 'organisationally_visible'].include?(visibility), + class: 'right-indent', + id:'privately_visible') %> + <%= raw display_visibility('privately_visible') %> +
+
+ <%= radio_button_tag(:vis, 0, 'organisationally_visible' == visibility, + class: 'right-indent', + id: 'organisationally_visible') %> + <%= raw display_visibility('organisationally_visible') %> +
+
+ <%= radio_button_tag(:vis, 0, 'publicly_visible' == visibility, + class: 'right-indent', + id: 'publicly_visible') %> + <%= raw display_visibility('publicly_visible') %> +
@@ -74,8 +89,7 @@

<%= _('To help you write your plan, %{application_name} can show you guidance from a variety of organisations.') % {application_name: Rails.configuration.branding[:application][:name]} %>


<% _('Select up to 3 organisations to see their guidance.') %>

- -<%= @important_ggs.inspect %> + <% #@important_ggs.inspect %>
<% end %> \ No newline at end of file diff --git a/app/views/plans/new.html.erb b/app/views/plans/new.html.erb index eea3a57..b500f23 100644 --- a/app/views/plans/new.html.erb +++ b/app/views/plans/new.html.erb @@ -15,14 +15,11 @@ <%= _('What research project are you planning?') %>
- - - - + <%= f.text_field(:title, class: 'left-indent', + 'data-toggle': 'tooltip', + 'data-content': _('If applying for funding, state the project title exactly as in the proposal.')) %> + <%= check_box_tag(:is_test, "1", false, class: 'left-indent') %> + <%= label_tag(:is_test, _('mock project for testing, practice, or educational purposes'), class: 'inline checkbox-label') %>
@@ -42,12 +39,12 @@

- <%= _('or') %> -

- - + <%= check_box_tag(:plan_no_org) %> + <%= label_tag(:plan_no_org, raw(" + #{_('My research organisation is not on the list')} + #{_(' or ')} + #{_('no research organisation is associated with this plan')} + "), class: 'checkbox-label') %>
@@ -66,10 +63,8 @@

- <%= _('or') %> -

- - + <%= check_box_tag(:plan_no_funder) %> + <%= label_tag(:plan_no_funder, _('No funder associated with this plan'), class: 'checkbox-label') %>
@@ -81,9 +76,8 @@
- - - + <%= f.hidden_field(:template_id) %> + <%= f.hidden_field(:visibility, value: @is_test ? 'is_test' : Rails.application.config.default_plan_visibility) %> <%= render partial: 'shared/accessible_submit_button', locals: {id: 'create_plan_submit', val: 'Create Plan', 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 %>
- <% if q_format.title == _('Check box') || q_format.title == _('Multi select box') || q_format.title == _('Radio buttons') || q_format.title == _('Dropdown') %> + <% if q_format.option_based? %> <% options = question.question_options.order("number") %> - <% if q_format.title == _('Check box') %> + <% if q_format.checkbox? %> <%if !options.nil? %>
@@ -23,7 +23,7 @@
<% end %> - <% elsif q_format.title == _('Multi select box') %> + <% elsif q_format.multiselectbox? %> <% if !options.nil? %> <% end %> - <% elsif q_format.title == _('Radio buttons') %> + <% elsif q_format.radiobuttons? %> <% if !options.nil? %>
@@ -45,7 +45,7 @@
<% end %> - <% elsif q_format.title == _('Dropdown') %> + <% elsif q_format.dropdown? %> <% if !options.nil? %> + <%= f.label(:email, _('Email'), class: 'required') %> + <%= f.email_field(:email, class: 'left-indent required') %>
@@ -34,14 +34,13 @@
- - + <%= f.label(:password, _('Password'), class: 'required') %> + <%= f.password_field(:password, class: 'left-indent required') %>
- - + <%= label_tag(:password_show, _('Show password'), class: 'checkbox-label') %> + <%= check_box_tag(:password_show, "1", false) %>
diff --git a/app/views/shared/_register_form.html.erb b/app/views/shared/_register_form.html.erb index 675d540..081a0a4 100644 --- a/app/views/shared/_register_form.html.erb +++ b/app/views/shared/_register_form.html.erb @@ -4,23 +4,21 @@
- - + <%= f.label(:firstname, _('First Name'), class: 'required') %> + <%= f.text_field(:firstname, class: 'input-small required left-indent') %>
- - + <%= f.label(:surname, _('Last Name'), class: 'required') %> + <%= f.text_field(:surname, class: 'input-small required left-indent') %>
- - + <%= f.label(:email, _('Email'), class: 'required') %> + <%= f.email_field(:email, class: 'left-indent required') %>
@@ -38,31 +36,31 @@
- - + <%= f.label(:recovery_email, _('Recovery Email'), class: 'required') %> + <%= f.email_field(:recovery_email, + class: 'left-indent required', + title: _('We will only use this address to recover your account if you change institutions')) %>
- - + <%= f.label(:password, _('Password'), class: 'required') %> + <%= f.password_field(:password, class: 'left-indent required') %>
- - + <%= label_tag(:password_show, _('Show password'), class: 'checkbox-label') %> + <%= check_box_tag(:password_show, "1", false) %>
- - + <%= f.check_box(:accept_terms, class: 'required right-indent') %> + <%= f.label(:accept_terms, + raw("#{_('I accept the')} #{_('terms and conditions')}"), + class: 'no-colon') %>
diff --git a/app/views/templates/_edit_template.html.erb b/app/views/templates/_edit_template.html.erb index 0481d27..76e5905 100644 --- a/app/views/templates/_edit_template.html.erb +++ b/app/views/templates/_edit_template.html.erb @@ -18,7 +18,7 @@
- + <%= label_tag(:status, _('Status')) %>
<% if hash[:live].nil? %> <%= _('Unpublished') %> @@ -32,13 +32,13 @@
- + <%= label_tag(:created, _('Created at')) %>
<%= l template.created_at.to_date, formats: :short %>
- + <%= label_tag(:updated, _('Last updated')) %>
<%= l template.updated_at.to_date, formats: :short %>