diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index fc3447b..5da69b3 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -77,6 +77,7 @@ @other_organisations = Org.where(parent_id: nil, is_other: true).pluck(:id) @identifier_schemes = IdentifierScheme.where(active: true).order(:name) @languages = Language.sorted_by_abbreviation + @tab = params[:tab] if params[:skip_personal_details] == "true" do_update_password(current_user, params) else @@ -150,7 +151,7 @@ set_gettext_locale #Method defined at controllers/application_controller.rb set_flash_message :notice, _('Details successfully updated.') sign_in current_user, bypass: true # Sign in the user bypassing validation in case his password changed - redirect_to edit_user_registration_path, notice: _('Details successfully updated.') + redirect_to edit_user_registration_path(tab: @tab), notice: _('Details successfully updated.') else flash[:notice] = message.blank? ? failed_update_error(current_user, _('profile')) : message @@ -174,7 +175,7 @@ set_gettext_locale #Method defined at controllers/application_controller.rb set_flash_message :notice, _('Details successfully updated.') sign_in current_user, bypass: true # Sign in the user bypassing validation in case his password changed - redirect_to edit_user_registration_path, notice: _('Details successfully updated.') + redirect_to edit_user_registration_path(tab: @tab), notice: _('Details successfully updated.') else flash[:notice] = message.blank? ? failed_update_error(current_user, _('profile')) : message diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 05796af..9ad13ce 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -21,7 +21,8 @@ # ------------------------------------------------------------- def handle_omniauth(scheme) user = User.from_omniauth(request.env["omniauth.auth"].nil? ? request.env : request.env["omniauth.auth"]) - + identifier = UserIdentifier.where(identifier: request.env["omniauth.auth"].uid).first + # If the user isn't logged in if current_user.nil? # If the uid didn't have a match in the system send them to register @@ -55,7 +56,11 @@ flash[:notice] = _('Unable to link your account to %{scheme}.') % { scheme: scheme.description } end end - + + if identifier.user.id != current_user.id + flash[:notice] = _("The current #{scheme.description} iD has been already linked to a user with email #{identifier.user.email}") + end + # Redirect to the User Profile page redirect_to edit_user_registration_path end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d3b571d..a99407f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -76,9 +76,9 @@ end end end - + @tab = params[:tab] @user.save - redirect_to edit_user_registration_path(@user), notice: _('Preferences successfully updated.') + redirect_to edit_user_registration_path(tab: @tab), notice: _('Preferences successfully updated.') end end diff --git a/app/views/contact_us/contacts/new.html.erb b/app/views/contact_us/contacts/new.html.erb index 645fa50..05ceef9 100644 --- a/app/views/contact_us/contacts/new.html.erb +++ b/app/views/contact_us/contacts/new.html.erb @@ -53,7 +53,7 @@ <% end %>
- +
 
<%= render partial: 'shared/accessible_submit_button', locals: {id: 'create_contact_submit', val: 'Submit', diff --git a/app/views/devise/registrations/_password_details.html.erb b/app/views/devise/registrations/_password_details.html.erb index 6fd93fc..9a93588 100644 --- a/app/views/devise/registrations/_password_details.html.erb +++ b/app/views/devise/registrations/_password_details.html.erb @@ -1,4 +1,4 @@ -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put, class: "roadmap-form white_background"}) do |f| %> +<%= form_for(resource, as: resource_name, url: registration_path(resource_name, tab: 'password-details-tab'), html: {method: :put, class: "roadmap-form white_background"}) do |f| %>
<%= _('If you would like to change your password please complete the following fields.') %> @@ -14,7 +14,7 @@
- @@ -36,7 +36,7 @@
- +
 
<%= render partial: 'shared/accessible_submit_button', locals: {id: 'update', val: 'Save', diff --git a/app/views/devise/registrations/_personal_details.html.erb b/app/views/devise/registrations/_personal_details.html.erb index be39742..c2daadf 100644 --- a/app/views/devise/registrations/_personal_details.html.erb +++ b/app/views/devise/registrations/_personal_details.html.erb @@ -1,4 +1,4 @@ -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put, class: "roadmap-form white_background"}) do |f| %> +<%= form_for(resource, as: resource_name, url: registration_path(resource_name, tab: 'personal-details-tab'), html: {method: :put, class: "roadmap-form white_background"}) do |f| %>

@@ -110,7 +110,7 @@

- +
 
<%= render partial: 'shared/accessible_submit_button', locals: {id: 'update', val: 'Save', diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 5fa5a66..3c922a6 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -35,3 +35,6 @@
+ \ No newline at end of file diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index 4235b74..40b75cc 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -11,7 +11,9 @@ <%= f.label :name %> <%= f.text_field :name, as: :string, class: 'input-medium required' %>
- <%= link_to(image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Add an appropriate name for your guidance group. This name will be used to tell the end user where the guidance has come from. It will be appended to text identifying the theme e.g. "[guidance group name]: guidance on data sharing" so we suggest you just use the institution or department name.')) %> + "> +
@@ -20,9 +22,6 @@
<%= f.label :published %> <%= f.check_box :published %> -
- -
<% end %> @@ -30,14 +29,16 @@ <%= f.label :optional_subset %> <%= f.check_box :optional_subset %> <%= _('e.g. School/ Department') %>
- <%= link_to(image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard.")) %> + "> +

- +
 
<%= f.submit _('Save'), class: 'btn btn-primary' %> <% if @guidance_group.published == false then %> <%= f.submit _('Publish'), name: "save_publish", class: "btn btn-primary" %> diff --git a/app/views/guidance_groups/admin_new.html.erb b/app/views/guidance_groups/admin_new.html.erb index 3563060..bcef054 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -11,21 +11,25 @@ <%= f.label :name %> <%= f.text_field :name, as: :string, class: "input-medium required" %>
- <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Add an appropriate name for your guidance group. This name will be used to tell the end user where the guidance has come from. It will be appended to text identifying the theme e.g. "[guidance group name]: guidance on data sharing" so we suggest you just use the institution or department name.'))%> + "> +
<%= f.label :optional_subset %> <%= f.check_box :optional_subset %> <%= _('e.g. School/ Department') %>
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _("If the guidance is only meant for a subset of users e.g. those in a specific college or institute, check this box. Users will be able to select to display this subset guidance when answering questions in the 'create plan' wizard."))%> + "> +

- +
 
<%= f.submit _('Save'), name: "draft", class: "btn btn-primary" %>
diff --git a/app/views/guidances/_add_guidance.html.erb b/app/views/guidances/_add_guidance.html.erb index ca49a90..54f475f 100644 --- a/app/views/guidances/_add_guidance.html.erb +++ b/app/views/guidances/_add_guidance.html.erb @@ -9,7 +9,9 @@ <%= text_area_tag("guidance-text", "", class: "tinymce") %>
- <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('Enter your guidance here. You can include links where needed.'))%> + +
@@ -23,8 +25,10 @@ Theme.all.order("title"), :id, :title, {prompt: false, include_blank: _('None')}, {multiple: true})%> -
- <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('Select which theme(s) this guidance relates to.'))%> +
+ +
@@ -47,7 +51,9 @@ :id, :name, {prompt: false, include_blank: _('None')}, {multiple: false})%>
- <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('Select which group this guidance relates to.'))%> + +
diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb index 2874554..31e1702 100644 --- a/app/views/guidances/admin_edit.html.erb +++ b/app/views/guidances/admin_edit.html.erb @@ -11,7 +11,9 @@ <%= f.label _('Text'), for: @guidance.text %> <%= text_area_tag("guidance-text", @guidance.text, class: "tinymce") %>
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Enter your guidance here. You can include links where needed.'))%> + +
@@ -19,7 +21,9 @@ <%= f.collection_select(:theme_ids, @themes, :id, :title, {prompt: false, include_blank: 'None'}, {multiple: true})%>
- <%= link_to( image_tag('help_button.png'), '#', class: 'input-medium', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Select which theme(s) this guidance relates to.'))%> + +
@@ -31,13 +35,15 @@ <%= f.collection_select(:guidance_group_id, @guidance_groups, :id, :name, {prompt: false, include_blank: 'None'}, {multiple: false})%>
- <%= link_to( image_tag('help_button.png'), '#', class: 'input-medium', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Select which group this guidance relates to.'))%> + +

- +
 
diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb index 7774ab7..277c775 100644 --- a/app/views/guidances/admin_new.html.erb +++ b/app/views/guidances/admin_new.html.erb @@ -12,7 +12,9 @@ <%= f.label :text %> <%= text_area_tag("guidance-text", "", class: "tinymce") %>
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Enter your guidance here. You can include links where needed.'))%> + +
@@ -20,14 +22,18 @@ <%= f.collection_select(:theme_ids, @themes, :id, :title, {prompt: false, include_blank: 'None'}, {multiple: true}) %>
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Select which theme(s) this guidance relates to.'))%> + +
<%= f.label :published %> <%= f.check_box :published , as: :check_boxes%>
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _("Check this box when you are ready for this guidance to appear on user's plans."))%> + "> +
@@ -35,13 +41,15 @@ <%= f.collection_select(:guidance_group_id, @guidance_groups, :id, :name, {prompt: false, include_blank: 'None'}, {multiple: false})%>
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Select which group this guidance relates to.'))%> + +

- +
 
diff --git a/app/views/orgs/admin_edit.html.erb b/app/views/orgs/admin_edit.html.erb index 6bdb7fd..6dad332 100644 --- a/app/views/orgs/admin_edit.html.erb +++ b/app/views/orgs/admin_edit.html.erb @@ -33,10 +33,8 @@
- -
- <%= text_area_tag("org_banner_text", @org.banner_text, class: "tinymce left-indent top-indent") %> -
+ <%= f.label _('Top banner text'), for: @org.banner_text %> + <%= text_area_tag("org_banner_text", @org.banner_text, class: "tinymce left-indent top-indent") %>
@@ -49,7 +47,7 @@
- +
 
<%= render partial: 'shared/accessible_submit_button', locals: {id: 'save_org_submit', val: 'Save', diff --git a/app/views/phases/_edit_phase.html.erb b/app/views/phases/_edit_phase.html.erb index 6aa8fbb..7e34808 100644 --- a/app/views/phases/_edit_phase.html.erb +++ b/app/views/phases/_edit_phase.html.erb @@ -25,8 +25,10 @@
<%= text_area_tag("phase-desc", phase.description, class: "tinymce") %>
-
- <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _("Enter a basic description. This will be presented to users on the 'Admin Plan' tab, above the summary of the sections and questions which they will be asked to answer."))%> +
diff --git a/app/views/phases/admin_add.html.erb b/app/views/phases/admin_add.html.erb index 9735587..3b005e2 100644 --- a/app/views/phases/admin_add.html.erb +++ b/app/views/phases/admin_add.html.erb @@ -41,13 +41,15 @@ <%= f.label :description %> <%= text_area_tag("phase-desc","" , class: "tinymce") %>
- <%= link_to( image_tag("help_button.png"), "#", 'data-toggle': 'popover', rel: "popover", "data-html" => "true", "data-content" => _("Enter a basic description. This will be presented to users on the 'Admin Plan' tab, above the summary of the sections and questions which they will be asked to answer."))%> + "> +

- +
 
<%= f.submit _('Save'), class: "btn btn-primary" %> <%= link_to _('Cancel'), admin_template_template_path(@template), class: "btn cancel" %>
diff --git a/app/views/phases/admin_show.html.erb b/app/views/phases/admin_show.html.erb index d6239fb..11b95db 100644 --- a/app/views/phases/admin_show.html.erb +++ b/app/views/phases/admin_show.html.erb @@ -43,18 +43,18 @@ <%= render partial: 'sections/show_section', locals: {section: section}%> <% end %>
- <% end %> - - <% if @edit || @phase.template.customization_of.present? %> -

<%= _('Add section') %>

- - - <% end %> + <% end %> + + <% if @edit || @phase.template.customization_of.present? %> +

<%= _('Add section') %>

+ + + <% end %> - - + + diff --git a/app/views/plans/_available_templates.html.erb b/app/views/plans/_available_templates.html.erb index d826258..900fded 100644 --- a/app/views/plans/_available_templates.html.erb +++ b/app/views/plans/_available_templates.html.erb @@ -5,7 +5,7 @@ <%= _('Select a template') %> - <%= raw @templates.collect{|t| "" }.join('') %> diff --git a/app/views/plans/_edit_details.html.erb b/app/views/plans/_edit_details.html.erb index d6c92f9..8b63228 100644 --- a/app/views/plans/_edit_details.html.erb +++ b/app/views/plans/_edit_details.html.erb @@ -49,7 +49,7 @@

- +
 
diff --git a/app/views/plans/_show_details.html.erb b/app/views/plans/_show_details.html.erb index 3f4e681..67195d0 100644 --- a/app/views/plans/_show_details.html.erb +++ b/app/views/plans/_show_details.html.erb @@ -1,39 +1,19 @@ -
-
-
- -
<%= plan.title %>
-
- -
- -
<%= plan.grant_number %>
-
- -
- -
<%= plan.principal_investigator %>
-
- -
- -
<%= raw plan.description %>
-
- -
- -
- -
<%= plan.identifier %>
-
- -
-
- -
-
- -
<%= plan.data_contact %>
-
-
-
\ No newline at end of file +
+
<%= _('Project Title') %>
+
<%= plan.title %>
+
<%= _('Grant Number') %>
+
<%= plan.grant_number %>
+
<%= _('Principal Investigator') %>
+
<%= plan.principal_investigator %>
+
<%= _('Project Abstract') %>
+
<%= raw plan.description %>
+
+
+
+
<%= _('Plan ID') %>
+
<%= plan.identifier %>
+
<%= _('Data Contact Person') %>
+
+
<%= _('Name') %>
+
<%= plan.data_contact %>
+
diff --git a/app/views/questions/_add_question.html.erb b/app/views/questions/_add_question.html.erb index 6675827..25f2202 100644 --- a/app/views/questions/_add_question.html.erb +++ b/app/views/questions/_add_question.html.erb @@ -43,7 +43,9 @@ {}, class: "question_format" %>
- <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("You can choose from:"))%> +
  • - text area (large box for paragraphs);
  • - text field (for a short answer);
  • - checkboxes where options are presented in a list and multiple values can be selected;
  • - radio buttons where options are presented in a list but only one can be selected;
  • - dropdown like this box - only one option can be selected;
  • - multiple select box allows users to select several options from a scrollable list, using the CTRL key;
  • ") %>"> +
    @@ -55,7 +57,10 @@ <%= _('Order')%> <%= _('Text')%> <%= _('Default')%> - <%= link_to( image_tag("help_button.png"), "#", class: "question_options_popover", "data-toggle": "popover",rel: "popover", "data-html" => "true", "data-content" => _('Enter any options that you wish to display. If you want to pre-set one option as selected, check the default box.'))%> + + + @@ -97,7 +102,9 @@
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('Anything you enter here will display in the answer box. If you want an answer in a certain format (e.g. tables), you can enter that style here.'))%> + +
    @@ -113,7 +120,9 @@ <%= text_area_tag(:example_answer, "", class: "tinymce") %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('You can add an example answer to help users respond. These will be presented above the answer box and can be copied/ pasted.'))%> + +
    @@ -127,7 +136,9 @@ <%= text_area_tag(:guidance, "", class: "tinymce") %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("Enter specific guidance to accompany this question. If you have guidance by themes too, this will be pulled in based on your selections below so it's best not to duplicate too much text."))%> + "> +
    @@ -143,7 +154,9 @@ :id, :title, {prompt: false, include_blank: _('None')}, {multiple: true})%>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    "))%> + Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    ") %>"> +
    diff --git a/app/views/questions/_edit_question.html.erb b/app/views/questions/_edit_question.html.erb index 0d721d4..f9f1ad6 100644 --- a/app/views/questions/_edit_question.html.erb +++ b/app/views/questions/_edit_question.html.erb @@ -38,7 +38,9 @@ {}, class: "question_format", id: "#{question.id}-select-format"%>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("You can choose from:"))%> +
  • - text area (large box for paragraphs);
  • - text field (for a short answer);
  • - checkboxes where options are presented in a list and multiple values can be selected;
  • - radio buttons where options are presented in a list but only one can be selected;
  • - dropdown like this box - only one option can be selected;
  • - multiple select box allows users to select several options from a scrollable list, using the CTRL key;
  • ") %>"> +
    @@ -51,7 +53,11 @@ <%= _('Order')%> <%= _('Text')%> <%= _('Default')%> - <%= link_to( image_tag("help_button.png"), "#", class: "question_options_popover", "data-toggle": "popover",rel: "popover", "data-html" => "true", "data-content" => _('Enter any options that you wish to display. If you want to pre-set one option as selected, check the default box.'))%> + + + + @@ -92,7 +98,9 @@
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('Anything you enter here will display in the answer box. If you want an answer in a certain format (e.g. tables), you can enter that style here.'))%> + +
    @@ -116,7 +124,9 @@ <% end %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted.'))%> + +
    @@ -132,7 +142,9 @@ <%= text_area_tag("question-guidance-#{question.id}", guidance_text , class: "tinymce") %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("Enter specific guidance to accompany this question. If you have guidance by themes too, this will be pulled in based on your selections below so it's best not to duplicate too much text."))%> + "> +
    @@ -147,7 +159,9 @@ :id, :title, {prompt: false, include_blank: "None"}, {multiple: true})%>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("

    Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    "))%> + Select themes that are relevant to this question.

    This allows your generic institution-level guidance to be drawn in, as well as that from other sources e.g. the %{organisation_abbreviation} or any Schools/Departments that you provide guidance for.

    You can select multiple themes by using the CTRL button.

    ") %>"> +
    diff --git a/app/views/sections/_add_section.html.erb b/app/views/sections/_add_section.html.erb index 93564b8..61dd490 100644 --- a/app/views/sections/_add_section.html.erb +++ b/app/views/sections/_add_section.html.erb @@ -36,7 +36,9 @@ <%= text_area_tag("section-desc", "" , class: "tinymce") %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("
    Enter a basic description. This could be a summary of what is covered in the section or instructions on how to answer. This text will be displayed in the coloured banner once a section is opened to edit.
    "))%> + "> +
    diff --git a/app/views/sections/_edit_section.html.erb b/app/views/sections/_edit_section.html.erb index 0fff8f5..473c176 100644 --- a/app/views/sections/_edit_section.html.erb +++ b/app/views/sections/_edit_section.html.erb @@ -7,26 +7,28 @@

    <%= _('Section details') %>

    - <%= form_for(section, url: admin_update_section_path(section, phase: phase, edit: edit), html: { method: :put, class: 'roadmap-form bordered'}) do |s| %> -
    -
    - <%= s.label :title %> - <%= s.text_field :title, as: :string, class: 'input-large', placeholder: _('New section title') %> -
    -
    - <%= s.label _('Order of display'), for: :number %> + <%= form_for(section, url: admin_update_section_path(section, phase: phase, edit: edit), html: { method: :put, class: 'roadmap-form bordered'}) do |s| %> +
    +
    + <%= s.label :title %> + <%= s.text_field :title, as: :string, class: 'input-large', placeholder: _('New section title') %> +
    +
    + <%= s.label _('Order of display'), for: :number %> <%= s.number_field :number, in: 1..15, class: "input-small has-tooltip", 'data-toggle' => "tooltip", 'title' => _('This allows you to order sections.') %>
    - <%= s.label :description %> + <%= s.label :description %> <%= text_area_tag("section-desc-#{section.id}", section.description , class: "tinymce") %>
    - <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _("
    Enter a basic description. This could be a summary of what is covered in the section or instructions on how to answer. This text will be displayed in the coloured banner once a section is opened to edit.
    "))%> + "> +
    -
    - +
    +
    - +
     
    <%= s.submit _('Save'), class: 'btn btn-primary' %> <% if section.modifiable %> <%= link_to _('Delete'), admin_destroy_section_path(section_id: section.id), @@ -34,16 +36,16 @@ <% end %> <%= link_to _('Cancel'), :back, class: 'btn cancel' %>
    -
    - <% end %> +
    + <% end %>
    - +

    <%= _('Questions') %>

    <% @questions = section.questions.order("number")%> <% if @questions.length > 0 %> - <% @questions.each do |question| %> -
    -
    "> + <% @questions.each do |question| %> +
    +
    "> <%= render partial: 'questions/show_question', locals: {question: question} %>
    @@ -52,19 +54,19 @@ <%= render partial: 'questions/edit_question', locals: {question: question} %>
    -
    +
    <% end %> <% end %> <% if section.modifiable %> - - + + -
    +
    <%= hidden_field_tag :section_id, section.id, class: "section_id" %> <%= link_to _('Add question'), '#', class: "btn btn-primary add_question_button" %> diff --git a/app/views/shared/_accessible_combobox.html.erb b/app/views/shared/_accessible_combobox.html.erb index e06ec20..4fe65ca 100644 --- a/app/views/shared/_accessible_combobox.html.erb +++ b/app/views/shared/_accessible_combobox.html.erb @@ -21,6 +21,8 @@ " name="<%= name.gsub("_#{attribute}]", "_id]") %>" value="<%= default_selection.id unless default_selection.nil? %>" /> + + " class="error-tooltip left-indent"> \ No newline at end of file diff --git a/app/views/templates/_edit_annotations.html.erb b/app/views/templates/_edit_annotations.html.erb index e69961f..94a7846 100644 --- a/app/views/templates/_edit_annotations.html.erb +++ b/app/views/templates/_edit_annotations.html.erb @@ -59,7 +59,9 @@ <% end %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _('You can add an example or suggested answer to help users respond. These will be presented above the answer box and can be copied/ pasted.'))%> + +
    @@ -74,7 +76,9 @@ <%= text_area_tag("question-guidance-#{question.id}", question.guidance , class: "tinymce") %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("Enter specific guidance to accompany this question. If you have guidance by themes too, this will be pulled in based on your selections below so it's best not to duplicate too much text."))%> + "> +
    diff --git a/app/views/templates/_edit_template.html.erb b/app/views/templates/_edit_template.html.erb index dab4241..0481d27 100644 --- a/app/views/templates/_edit_template.html.erb +++ b/app/views/templates/_edit_template.html.erb @@ -1,59 +1,54 @@ -<%= form_for(template, url: admin_update_template_path(template), html: { method: :put}) do |f| %> -
    - - - - - - - - - - - - - - - - - - - - - -
    <%= _('Title') %><%= f.text_field :title, as: :string, - class: 'text_field has-tooltip', 'data-toggle' => "tooltip", title: _('Please enter a title for your template.') %>
    <%= _('Description') %> -
    - <%= text_area_tag("template-desc", template.description, class: "tinymce") %> -
    -
    - <%= link_to( image_tag('help_button.png'), '#', "data-toggle": "popover", rel: "popover", 'data-html' => "true", 'data-content' => _('Enter a description that helps you to differentiate between templates e.g. if you have ones for different audiences'))%> -
    -
    -
    <%= _('Status') %> +<%= form_for(template, url: admin_update_template_path(template), html: { method: :put, class: 'roadmap-form'}) do |f| %> +
    +
    + <%= f.label :title, class: 'required' %> + <%= f.text_field :title, as: :string, class: 'input-large has-tooltip', + 'data-toggle': "tooltip", + title: _('Please enter a title for your template.') %> +
    +
    + <%= f.label _('Description'), for: template.description %> + <%= text_area_tag("template-desc", template.description, class: "input-large tinymce") %> +
    + + +
    +
    +
    + +
    <% if hash[:live].nil? %> <%= _('Unpublished') %> - + <% elsif hash[:current].dirty? %> <%= _('You have un-published changes') %> - + <% else %> <%= _('Published') %> <% end %> -
    <%= _('Created at') %> - <%= l template.created_at.to_date, formats: :short %> -
    <%= _('Last updated') %> - <%= l template.updated_at.to_date, formats: :short %> -
    - - -
    - <%= f.submit _('Save'), class: 'btn btn-primary' %> - <%= link_to _('Cancel'), admin_template_template_path(template), class: 'btn cancel' %> +
    - -
    - +
    + +
    + <%= l template.created_at.to_date, formats: :short %> +
    +
    +
    + +
    + <%= l template.updated_at.to_date, formats: :short %> +
    +
    + +
    +
    +
     
    + <%= f.submit _('Save'), class: 'form-submit' %> + <%= link_to _('Cancel'), admin_template_template_path(template) %> +
    + <% end %> \ No newline at end of file diff --git a/app/views/templates/_show_phases_sections.html.erb b/app/views/templates/_show_phases_sections.html.erb index 41569e5..62acdb8 100644 --- a/app/views/templates/_show_phases_sections.html.erb +++ b/app/views/templates/_show_phases_sections.html.erb @@ -2,23 +2,23 @@

    <%= phase.title %>

    -
    +

    <%= raw phase.description %>

    -
    +
    - <% if phase_hash[:sections].length > 0 %> - <%= link_to _('Preview'), admin_preview_phase_path(id: phase.id), class: 'btn btn-primary'%> + <%= link_to _('Preview'), admin_preview_phase_path(id: phase.id), class: "link-as-button" %> <% end %> + <% if template == current && phase.modifiable %> <%= link_to _('Delete'), admin_destroy_phase_path(phase_id: phase.id), - confirm: _("You are about to delete '%{phase_title}'. This will affect versions, sections and questions linked to this phase. Are you sure?") % { :phase_title => phase.title }, method: :delete, class: "btn btn-primary"%> + confirm: _("You are about to delete '%{phase_title}'. This will affect versions, sections and questions linked to this phase. Are you sure?") % {phase_title: phase.title}, method: :delete, class: "link-as-button" %> <% b_label = _('Edit phase')%> <% else %> <% b_label = _('View phase')%> <% end %> - <%= link_to b_label, admin_show_phase_path(id: phase.id, edit: (b_label == _('Edit phase'))), class: "btn btn-primary" %> + <%= link_to b_label, admin_show_phase_path(id: phase.id, edit: (b_label == _('Edit phase'))), class: "link-as-button" %>
    <% if phase_hash[:sections].present? %> diff --git a/app/views/templates/_show_template.html.erb b/app/views/templates/_show_template.html.erb index 33abaf6..5f4411a 100644 --- a/app/views/templates/_show_template.html.erb +++ b/app/views/templates/_show_template.html.erb @@ -1,49 +1,35 @@ - -<% if template == current then %> - - <% if template.customization_of.nil? %> -
    - <%= link_to _('Edit template details'), '# ', class: "btn btn-primary", id: "edit_template_button"%> -
    - <% end %> -<% end %> -
    - - - - - - - - - - - - - - - - - - - - - - -
    <%= _('Title') %><%= template.title %>
    <%= _('Description') %><% if !template.description.nil? && template.description != "" then %> - <%= raw template.description %> - <% else %> - - +
    +
    <%= _('Title') %>
    +
    <%= template.title %>
    +
    <%= _('Description') %>
    +
    + <%= (!template.description.nil? && template.description != "" ? raw( template.description) : '-') %> +
    +
    <%= _('Status') %>
    +
    + <% if hash[:live].nil? %> + <%= _('Unpublished') %> + + <% elsif hash[:current].dirty? %> + <%= _('You have un-published changes') %> + + <% else %> + <%= _('Published') %> + <% end %> +
    +
    <%= _('Created at') %>
    +
    <%= l template.created_at.to_date, formats: :short %>
    +
    <%= _('Last updated') %>
    +
    <%= l template.updated_at.to_date, formats: :short %>
    + +
    +
    + <% if template == current then %> + + <% if template.customization_of.nil? %> + <%= _('Edit template details') %> <% end %> -
    <%= _('Status') %> - <% if hash[:live].nil? %> - <%= _('Unpublished') %> - - <% elsif hash[:current].dirty? %> - <%= _('You have un-published changes') %> - - <% else %> - <%= _('Published') %> - <% end %> -
    <%= _('Created at') %><%= l template.created_at.to_date, formats: :short %>
    <%= _('Last updated') %><%= l template.updated_at.to_date, formats: :short %>
    + <% end %> + + diff --git a/app/views/templates/admin_new.html.erb b/app/views/templates/admin_new.html.erb index 0acf208..a1e9bb2 100644 --- a/app/views/templates/admin_new.html.erb +++ b/app/views/templates/admin_new.html.erb @@ -29,7 +29,9 @@ <%= text_area_tag("template-desc", "", class: "tinymce") %>
    - <%= link_to( image_tag("help_button.png"), "#", "data-toggle": "popover", rel: "popover", "data-html" => "true", "data-content" => _("
    Enter a description that helps you to differentiate between templates e.g. if you have ones for different audiences.
    "))%> + +
    diff --git a/app/views/users/_notification_preferences.html.erb b/app/views/users/_notification_preferences.html.erb index cdcb003..81a3c58 100644 --- a/app/views/users/_notification_preferences.html.erb +++ b/app/views/users/_notification_preferences.html.erb @@ -5,7 +5,7 @@
    - <%= form_tag(user_update_preferences_path, html: {method: :put, class: "roadmap-form"}) do |f| %> + <%= form_tag( url_for(controller: 'users', action: 'update_preferences', tab: 'notification-preferences-tab', escape: false), html: {method: :put, class: "roadmap-form"}) do |f| %> <%= hidden_field_tag :user_id, @user.id %> @@ -47,7 +47,7 @@
    - +
     
    <%= submit_tag 'Save', class: 'btn btn-primary' %>
    <% end %> diff --git a/lib/assets/javascripts/dmproadmap/forms.js b/lib/assets/javascripts/dmproadmap/forms.js index 3adfd82..5434b52 100644 --- a/lib/assets/javascripts/dmproadmap/forms.js +++ b/lib/assets/javascripts/dmproadmap/forms.js @@ -1,15 +1,39 @@ // --------------------------------------------------------------------------- +function toggleAutocompleteError(autocomplete, idbox, errorMessage){ + if(autocomplete.length > 0 && idbox.length > 0){ + var err = $(idbox).siblings("span.error-tooltip"); + if(err.length <= 0){ + err = $(idbox).siblings("span.error-tooltip-right"); + } + + // If an error element is available and the error message is not empty and the field + // is not empty + if(err.length > 0 && (errorMessage === '' || $(autocomplete).val().trim().length <= 0)){ + err.html('').attr('role', ''); + $(autocomplete).removeClass('red-border'); + }else{ + err.html(errorMessage).attr('role', 'tooltip'); + $(autocomplete).addClass('red-border'); + } + } +} + +// --------------------------------------------------------------------------- function toggleInputError(input, errorMessage){ var err = $(input).siblings("span.error-tooltip"); if(err.length <= 0){ err = $(input).siblings("span.error-tooltip-right"); } +console.log(err.length + ' - ' + errorMessage + ' - ' + $(input).val().trim().length); + + // If an error element is available and the error message is not empty and the field + // is not empty if(err.length > 0 && (errorMessage === '' || $(input).val().trim().length <= 0)){ err.html('').attr('role', ''); $(input).removeClass('red-border'); }else{ - err.html(__('Error: ') + errorMessage).attr('role', 'tooltip'); + err.html(errorMessage).attr('role', 'tooltip'); $(input).addClass('red-border'); } } diff --git a/lib/assets/javascripts/dmproadmap/tabs.js b/lib/assets/javascripts/dmproadmap/tabs.js index 1c68fdf..31f108b 100644 --- a/lib/assets/javascripts/dmproadmap/tabs.js +++ b/lib/assets/javascripts/dmproadmap/tabs.js @@ -11,11 +11,40 @@ if($(this).attr("href")[0] == '#'){ e.preventDefault(); - var panel = $($(this).attr("href")); + var panel = $($(this).attr("href")); panel.show().attr("aria-hidden", 'false'); $.each($(panel).siblings(), function(i, p){ $(p).hide().attr("aria-hidden", 'true'); }); } }); -}); \ No newline at end of file +}); + +function selectActiveTab(){ + var tab = getURLParameter('tab'); + if (tab != '') + { + // Unselect the other tabs + $("li[role='tab']").removeClass('active').children('a').attr('aria-selected', 'false'); + // Select the current tab + $(".tabs").find('#' + tab).attr('aria-selected', 'true').addClass('active'); + + // Display the corresponding panel if its a page anchor otherwise just follow the target + var panel = $(".tabs").find('#' + tab).children('a').attr("href"); + $(".tab-panels").find(panel).addClass('active'); + $.each($(".tab-panels").find(panel).siblings(), function(i, p){ + $(p).removeClass('active'); + }); + } +} + +function getURLParameter(sParam){ + var sPageURL = window.location.search.substring(1); + var sURLVariables = sPageURL.split('&'); + for (var i = 0; i < sURLVariables.length; i++) { + var sParameterName = sURLVariables[i].split('='); + if (sParameterName[0] == sParam){ + return sParameterName[1]; + } + } +} \ No newline at end of file diff --git a/lib/assets/javascripts/dmproadmap/utils.js b/lib/assets/javascripts/dmproadmap/utils.js index 240510d..8aff27d 100644 --- a/lib/assets/javascripts/dmproadmap/utils.js +++ b/lib/assets/javascripts/dmproadmap/utils.js @@ -23,9 +23,25 @@ $("[data-toggle='tooltip']").on('focus', function(e){ if($(this).attr('data-content') != undefined){ var y = $(this).width() + 35; - $(this).parent().append('
    ' + $(this).attr('data-content') + '' + $(this).attr('data-content') + '
    '); } }).on('blur', function(e){ $(this).parent().find('div.tooltip-message').remove(); }); + + // Display tooltips when the item has focus or hover + $("[data-toggle='popover']").on('click', function(e){ + e.preventDefault(); + + if($(this).attr('data-content') != undefined){ + if($(this).parent().find(".popover-message").length > 0){ + $(this).parent().find(".popover-message").remove(); + }else{ + var y = $(this).width() + 35; + $(this).parent().append('
    ' + $(this).attr('data-content') + '
    '); + } + } + }).on('blur', function(e){ + $(this).parent().find('div.popover-message').remove(); + }); }); diff --git a/lib/assets/javascripts/views/devise/registrations/edit.js b/lib/assets/javascripts/views/devise/registrations/edit.js index ff38153..d5365b8 100644 --- a/lib/assets/javascripts/views/devise/registrations/edit.js +++ b/lib/assets/javascripts/views/devise/registrations/edit.js @@ -20,7 +20,7 @@ }); // Toggle the password field so that its visible/masked - $("#passwords_show").click(function(){ + $("#password_show").click(function(){ var typ = $("#user_current_password").attr('type'); $("#user_current_password").attr('type', (typ === 'password' ? 'text' : 'password')); $("#user_new_password").attr('type', (typ === 'password' ? 'text' : 'password')); @@ -28,7 +28,7 @@ }); // Make sure the show password checkbox is unchecked on load - $("#passwords_show").attr("checked", false); + $("#password_show").attr("checked", false); toggleSubmit(); @@ -49,8 +49,7 @@ var disabled = ($("#user_firstname").val().trim().length <= 0 || $("#user_surname").val().trim().length <= 0 || validateEmail($("#user_email").val()) != '' || - validateEmail($("#user_recovery_email").val()) != '' || - $("#user_new_password").val() != $("#user_password_confirmation").val()); + validateEmail($("#user_recovery_email").val()) != ''); $("#update").attr('aria-disabled', disabled); } }); diff --git a/lib/assets/javascripts/views/plans/new.js b/lib/assets/javascripts/views/plans/new.js index 7bf6e19..5e97d3e 100644 --- a/lib/assets/javascripts/views/plans/new.js +++ b/lib/assets/javascripts/views/plans/new.js @@ -11,6 +11,16 @@ handleComboboxChange(); }); + // If there was no selection, highlight the box and display tooltip + $("#plan_org_id").change(function(){ + var msg = ($(this).val().trim().length <= 0 ? __('Please select a valid research institution from the list') : ''); + toggleAutocompleteError($("#plan_org_name"), $(this), msg); + }); + $("#plan_funder_id").change(function(){ + var msg = ($(this).val().trim().length <= 0 ? __('Please select a valid funding organisation from the list') : ''); + toggleAutocompleteError($("#plan_funder_name"), $(this), msg); + }); + // Make sure the checkbox is unchecked if we're entering text $(".js-combobox").keyup(function(){ var whichOne = $(this).prop('id').split('_')[1]; @@ -24,6 +34,7 @@ handleCheckboxClick(whichOne, this.checked); }); + // When the form receives a valid template id enable the button $("#plan_template_id").change(function(){ $("#create_plan_submit").attr('aria-disabled', ($(this).val().trim().length <= 0)); }); @@ -56,7 +67,8 @@ function handleCheckboxClick(name, checked){ $("#plan_" + name + "_name").prop("disabled", checked); $("#plan_template_id").val("").change(); - + $("#available-templates").fadeOut(); + if(checked){ $("#plan_" + name + "_name").val(""); $("#plan_" + name + "_id").val("").change(); diff --git a/lib/assets/stylesheets/application.scss b/lib/assets/stylesheets/application.scss index 5a1ab6d..7e33cf1 100644 --- a/lib/assets/stylesheets/application.scss +++ b/lib/assets/stylesheets/application.scss @@ -17,8 +17,8 @@ @import "dmproadmap"; @import "dmproadmap/base"; +@import "dmproadmap/tabs"; @import "dmproadmap/accordions"; -@import "dmproadmap/forms"; @import "dmproadmap/modals"; @import "dmproadmap/tables"; -@import "dmproadmap/tabs"; \ No newline at end of file +@import "dmproadmap/forms"; \ No newline at end of file diff --git a/lib/assets/stylesheets/dmproadmap/accordions.scss b/lib/assets/stylesheets/dmproadmap/accordions.scss index 7f1834c..086be4b 100644 --- a/lib/assets/stylesheets/dmproadmap/accordions.scss +++ b/lib/assets/stylesheets/dmproadmap/accordions.scss @@ -26,6 +26,7 @@ } div.accordion-section { + position: relative; background-color: white; } } \ No newline at end of file diff --git a/lib/assets/stylesheets/dmproadmap/base.scss b/lib/assets/stylesheets/dmproadmap/base.scss index d4661cc..64a05c1 100644 --- a/lib/assets/stylesheets/dmproadmap/base.scss +++ b/lib/assets/stylesheets/dmproadmap/base.scss @@ -40,7 +40,8 @@ .top-indent { margin-top: 25px; } .right { - position: relative; + position: absolute; + top: 15px; right: 10px; } @@ -108,6 +109,10 @@ [data-toggle='popover']{ position: relative; + + .fa { + font-size: 18px; + } } div.popover-message { position: absolute; @@ -226,7 +231,8 @@ } .header-org-banner-text { width: 60%; - vertical-align: top; + vertical-align: bottom; + margin-left: 25px; } } .main-nav { @@ -332,6 +338,7 @@ } div.page { + position: relative; width: 100%; background-color: $white; border-radius: 3px; @@ -350,6 +357,36 @@ margin-left: 35px; vertical-align: top; } + + /* Description Lists - Used to display the read-only version of forms */ + dl { + width: 100%; + margin: 0 auto; + + dt { + display: inline-block; + width: 15%; + text-align: right; + margin-right: 10px; + font-weight: bold; + } + dt:not(.dl-buttons):after { + content: " :"; + } + + dd { + display: inline-block; + width: 65%; + } + dd:after { + display: block; + content: " "; + margin-bottom: 10px; + } + dt.dl-buttons { + margin-top: 25px; + } + } } } } diff --git a/lib/assets/stylesheets/dmproadmap/forms.scss b/lib/assets/stylesheets/dmproadmap/forms.scss index 63995e0..44561fa 100644 --- a/lib/assets/stylesheets/dmproadmap/forms.scss +++ b/lib/assets/stylesheets/dmproadmap/forms.scss @@ -18,10 +18,12 @@ input[type="checkbox"], input[type="radio"], select { border: 1px solid $medium-grey; } -div.wysiwyg-textarea { - display: inline-block; - margin: 10px 10px 10px 15px; + +/* Tinymce control hover (e.g. bold, italic, etc.) */ +.mce-btn button:hover { + background-color: $white; } + textarea:focus, select:focus, input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="checkbox"]:focus, input[type="radio"]:focus { @@ -71,8 +73,7 @@ /* Roadmap Form Styling */ /* ------------------------------------------------ */ -form.roadmap-form, -div.read-only-form { +form.roadmap-form { text-align: top; fieldset.padded { @@ -110,16 +111,18 @@ /* Fieldset with labels to the left of inputs */ /* ------------------------------------------ */ - fieldset.side-by-side, - div.side-by-side { + fieldset.side-by-side { border: 0; .mce-tinymce { display: inline-block; + margin-bottom: 15px; + width: 51%; } div { label, + .button-spacer, div.read-only, input[type="checkbox"], .combobox-container, @@ -131,7 +134,7 @@ margin-left: -5px; } - label { + label, .button-spacer { width: 25%; text-align: right; margin-right: 10px; @@ -146,11 +149,9 @@ font-size: 10pt; text-decoration:none; } - } - - .button-spacer { - display: inline-block; - width: 21%; + div.read-only{ + margin-bottom: 15px; + } } } @@ -168,7 +169,17 @@ float: left; /* positions the legend within the fieldset box */ border-bottom: none; } - + + label { + font-weight: bold; + } + label:not(.no-colon):after { + content: " :"; + } + label.required:after { + content: " * :"; + } + .form-input { clear: both; }