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 fa6cf0a..9a93588 100644 --- a/app/views/devise/registrations/_password_details.html.erb +++ b/app/views/devise/registrations/_password_details.html.erb @@ -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 a245c30..c2daadf 100644 --- a/app/views/devise/registrations/_personal_details.html.erb +++ b/app/views/devise/registrations/_personal_details.html.erb @@ -110,7 +110,7 @@
- +
 
<%= render partial: 'shared/accessible_submit_button', locals: {id: 'update', val: 'Save', diff --git a/app/views/guidance_groups/admin_edit.html.erb b/app/views/guidance_groups/admin_edit.html.erb index 4235b74..a239fe3 100644 --- a/app/views/guidance_groups/admin_edit.html.erb +++ b/app/views/guidance_groups/admin_edit.html.erb @@ -37,7 +37,7 @@
- +
 
<%= 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..de8cf5d 100644 --- a/app/views/guidance_groups/admin_new.html.erb +++ b/app/views/guidance_groups/admin_new.html.erb @@ -25,7 +25,7 @@
- +
 
<%= f.submit _('Save'), name: "draft", class: "btn btn-primary" %>
diff --git a/app/views/guidances/admin_edit.html.erb b/app/views/guidances/admin_edit.html.erb index 2874554..4701487 100644 --- a/app/views/guidances/admin_edit.html.erb +++ b/app/views/guidances/admin_edit.html.erb @@ -37,7 +37,7 @@
- +
 
diff --git a/app/views/guidances/admin_new.html.erb b/app/views/guidances/admin_new.html.erb index 7774ab7..51be5f8 100644 --- a/app/views/guidances/admin_new.html.erb +++ b/app/views/guidances/admin_new.html.erb @@ -41,7 +41,7 @@
- +
 
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/admin_add.html.erb b/app/views/phases/admin_add.html.erb index 9735587..2007449 100644 --- a/app/views/phases/admin_add.html.erb +++ b/app/views/phases/admin_add.html.erb @@ -47,7 +47,7 @@
- +
 
<%= f.submit _('Save'), class: "btn btn-primary" %> <%= link_to _('Cancel'), admin_template_template_path(@template), class: "btn cancel" %>
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/sections/_edit_section.html.erb b/app/views/sections/_edit_section.html.erb index 0fff8f5..3419af2 100644 --- a/app/views/sections/_edit_section.html.erb +++ b/app/views/sections/_edit_section.html.erb @@ -26,7 +26,7 @@
- +
 
<%= s.submit _('Save'), class: 'btn btn-primary' %> <% if section.modifiable %> <%= link_to _('Delete'), admin_destroy_section_path(section_id: section.id), 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_template.html.erb b/app/views/templates/_edit_template.html.erb index dab4241..8eb53e8 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/users/_notification_preferences.html.erb b/app/views/users/_notification_preferences.html.erb index c3e5337..81a3c58 100644 --- a/app/views/users/_notification_preferences.html.erb +++ b/app/views/users/_notification_preferences.html.erb @@ -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/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/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; }