<%= 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 @@
<% 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;
}