-
-<% if last_question_id == question_id then %>
+<% if last_question_id == question.id then %>
diff --git a/app/views/phases/_edit_phase.html.erb b/app/views/phases/_edit_phase.html.erb
index edbfd90..de7b425 100644
--- a/app/views/phases/_edit_phase.html.erb
+++ b/app/views/phases/_edit_phase.html.erb
@@ -23,14 +23,15 @@
diff --git a/app/views/phases/admin_add.html.erb b/app/views/phases/admin_add.html.erb
index a5141aa..72a9a66 100644
--- a/app/views/phases/admin_add.html.erb
+++ b/app/views/phases/admin_add.html.erb
@@ -47,9 +47,10 @@
| <%= _('Description') %> |
-
+ |
<%= text_area_tag("phase-desc","" , class: "tinymce") %>
+ <%= tinymce %>
<%= link_to( image_tag("help_button.png"), "#", class: "phase_desc_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."))%>
@@ -70,6 +71,4 @@
-
-
-<%= tinymce content_css: asset_path("application.css") %>
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/views/phases/admin_show.html.erb b/app/views/phases/admin_show.html.erb
index e27f41e..321ac60 100644
--- a/app/views/phases/admin_show.html.erb
+++ b/app/views/phases/admin_show.html.erb
@@ -2,7 +2,7 @@
<%= stylesheet_link_tag "admin" %>
<% javascript 'admin.js' %>
-<%= tinymce content_css: asset_path('application.css') %>
+<%= tinymce %>
<%= @phase.template.title %>
diff --git a/app/views/phases/edit.html.erb b/app/views/phases/edit.html.erb
index 9c73d91..8ddbcc2 100644
--- a/app/views/phases/edit.html.erb
+++ b/app/views/phases/edit.html.erb
@@ -11,7 +11,7 @@
- <%= render :partial => "/plans/progress", locals: {nquestions: @nquestions, nanswers: @nanswers} %>
+ <%= render :partial => "/plans/progress", locals: { plan: @plan } %>
@@ -34,26 +34,11 @@
<% end%>
-
-
- <% num_section_questions = section.questions.to_a.count %>
- <% num_section_answers = section.num_answered_questions(@plan.id) %>
- <% question_word = "questions" %>
- <% if num_section_questions == 1 then %>
- <% question_word = "question" %>
- <% end %>
- <% section_status = "#{num_section_questions} #{question_word}, #{num_section_answers} answered" %>
-
<%= _('Export') %>
diff --git a/app/views/questions/_add_question.html.erb b/app/views/questions/_add_question.html.erb
index 9ca04bf..8e9c173 100644
--- a/app/views/questions/_add_question.html.erb
+++ b/app/views/questions/_add_question.html.erb
@@ -138,7 +138,7 @@
| <%= _('Guidance')%> |
-
+ |
<%= text_area_tag("new-question-guidance", "", class: "tinymce") %>
diff --git a/app/views/questions/_edit_question.html.erb b/app/views/questions/_edit_question.html.erb
index a0928df..eb13fd7 100644
--- a/app/views/questions/_edit_question.html.erb
+++ b/app/views/questions/_edit_question.html.erb
@@ -131,7 +131,8 @@
|
| <%= _('Guidance')%> |
-
+
+
<% guidance = question.get_guidance_annotation(current_user.org_id) %>
<% guidance_text = guidance.present? ? guidance.text : "" %>
<%= text_area_tag("question-guidance-#{question.id}", guidance_text , class: "tinymce") %>
diff --git a/app/views/sections/_add_section.html.erb b/app/views/sections/_add_section.html.erb
index ea86b1e..4bbed72 100644
--- a/app/views/sections/_add_section.html.erb
+++ b/app/views/sections/_add_section.html.erb
@@ -30,7 +30,7 @@
| |
| <%= _('Description') %> |
-
+ |
<%= text_area_tag("section-desc", "" , class: "tinymce") %>
diff --git a/app/views/sections/_edit_section.html.erb b/app/views/sections/_edit_section.html.erb
index 60425dd..5ed252c 100644
--- a/app/views/sections/_edit_section.html.erb
+++ b/app/views/sections/_edit_section.html.erb
@@ -43,7 +43,7 @@
|
| <%= _('Description') %> |
-
+ |
<%= text_area_tag("section-desc-#{section.id}", section.description , class: "tinymce") %>
diff --git a/app/views/sections/_progress.html.erb b/app/views/sections/_progress.html.erb
new file mode 100644
index 0000000..7617def
--- /dev/null
+++ b/app/views/sections/_progress.html.erb
@@ -0,0 +1,14 @@
+
+ <% num_section_questions = section.questions.size() %>
+ <% num_section_answers = section.num_answered_questions(plan.id) %>
+ <% question_word = "questions" %>
+ <% if num_section_questions == 1 then %>
+ <% question_word = "question" %>
+ <% end %>
+ <% section_status = "#{num_section_questions} #{question_word}, #{num_section_answers} answered" %>
+ <%= section.title %>
+ <% if num_section_questions.to_i > num_section_answers.to_i then %>
+ (<%= section_status %>)
+ <% else %>
+ (<%= section_status %>)
+ <% end %>
\ 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 b1656c0..a660e7b 100644
--- a/app/views/templates/_edit_template.html.erb
+++ b/app/views/templates/_edit_template.html.erb
@@ -10,12 +10,14 @@
|
| <%= _('Description') %> |
-
+
+
<%= text_area_tag("template-desc", template.description, class: "tinymce") %>
<%= link_to( image_tag('help_button.png'), '#', class: 'template_desc_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/templates/admin_new.html.erb b/app/views/templates/admin_new.html.erb
index ed39d22..e180b4a 100644
--- a/app/views/templates/admin_new.html.erb
+++ b/app/views/templates/admin_new.html.erb
@@ -25,7 +25,8 @@
| <%= _('Description') %> |
-
+
+
<%= text_area_tag("template-desc", "", class: "tinymce") %>
@@ -44,4 +45,4 @@
<% end %>
-<%= tinymce content_css: asset_path("application.css") %>
\ No newline at end of file
+<%= tinymce %>
\ No newline at end of file
diff --git a/app/views/templates/admin_template.html.erb b/app/views/templates/admin_template.html.erb
index afac069..6303ed0 100644
--- a/app/views/templates/admin_template.html.erb
+++ b/app/views/templates/admin_template.html.erb
@@ -59,4 +59,4 @@
<% end %>
-<%= tinymce content_css: asset_path('application.css') %>
+<%= tinymce %>
diff --git a/config/locale/app.pot b/config/locale/app.pot
index cef3cb2..960a80d 100644
--- a/config/locale/app.pot
+++ b/config/locale/app.pot
@@ -8,8 +8,8 @@
msgstr ""
"Project-Id-Version: app 1.0.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2017-05-31 12:56+0100\n"
-"PO-Revision-Date: 2017-05-31 12:56+0100\n"
+"POT-Creation-Date: 2017-06-02 19:14+0100\n"
+"PO-Revision-Date: 2017-06-02 19:14+0100\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"Language: \n"
@@ -57,9 +57,6 @@
msgid " on "
msgstr ""
-msgid " once you click save!"
-msgstr ""
-
msgid " or "
msgstr ""
@@ -69,9 +66,6 @@
msgid " provided by "
msgstr ""
-msgid " saved the following answer:"
-msgstr ""
-
msgid " team"
msgstr ""
@@ -408,9 +402,6 @@
msgid "Collaborators"
msgstr ""
-msgid "Combine their changes with your answer below and then save the answer again."
-msgstr ""
-
msgid "Comment"
msgstr ""
@@ -567,6 +558,9 @@
msgid "Example Answer"
msgstr ""
+msgid "Example of answer"
+msgstr ""
+
msgid "Export"
msgstr ""
@@ -1245,10 +1239,10 @@
msgid "The "
msgstr ""
-msgid "The edits in the box below will overwrite the existing answer from "
+msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
msgstr ""
-msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
+msgid "The following answer cannot be persisted"
msgstr ""
msgid "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
@@ -1404,9 +1398,6 @@
msgid "Which DMP template would you like to use?"
msgstr ""
-msgid "While you were editing "
-msgstr ""
-
msgid "Would you like to save them now?"
msgstr ""
@@ -1563,9 +1554,6 @@
msgid "ago"
msgstr ""
-msgid "answered"
-msgstr ""
-
msgid "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
msgstr ""
@@ -1656,9 +1644,6 @@
msgid "question"
msgstr ""
-msgid "questions"
-msgstr ""
-
msgid "questions answered"
msgstr ""
@@ -1674,6 +1659,9 @@
msgid "select at least one theme"
msgstr ""
+msgid "since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again."
+msgstr ""
+
msgid "template"
msgstr ""
diff --git a/config/locale/de/app.po b/config/locale/de/app.po
index 1da96cc..bbc0715 100644
--- a/config/locale/de/app.po
+++ b/config/locale/de/app.po
@@ -61,9 +61,6 @@
msgid " on "
msgstr ""
-msgid " once you click save!"
-msgstr ""
-
msgid " or "
msgstr ""
@@ -75,9 +72,6 @@
msgid " provided by "
msgstr " von "
-msgid " saved the following answer:"
-msgstr ""
-
#, fuzzy
msgid " team"
msgstr "am"
@@ -438,9 +432,6 @@
msgid "Collaborators"
msgstr "Mitarbeitende"
-msgid "Combine their changes with your answer below and then save the answer again."
-msgstr ""
-
msgid "Comment"
msgstr "Kommentar"
@@ -603,6 +594,10 @@
msgid "Example Answer"
msgstr "Beispielantwort"
+#, fuzzy
+msgid "Example of answer"
+msgstr "Beispielantwort"
+
msgid "Export"
msgstr "Export"
@@ -1306,12 +1301,12 @@
msgid "The "
msgstr ""
-msgid "The edits in the box below will overwrite the existing answer from "
-msgstr ""
-
msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
msgstr "Die E-Mail -Adresse des Administrators in Ihrer Org. Ihre Benutzer werden diese Adresse verwenden, wenn sie Fragen haben."
+msgid "The following answer cannot be persisted"
+msgstr ""
+
msgid "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
msgstr "Die hier ausgewählten Einträge werden in der Tabelle unten angezeigt. Sie können die Daten durch jeden ihrer Tabellenköpfe sortieren oder filtern, indem Sie eine Zeichenkette in der Suchbox eingeben."
@@ -1474,9 +1469,6 @@
msgid "Which DMP template would you like to use?"
msgstr "templates"
-msgid "While you were editing "
-msgstr ""
-
msgid "Would you like to save them now?"
msgstr "Wollen Sie sie jetzt sichern?"
@@ -1658,10 +1650,6 @@
msgstr ""
#, fuzzy
-msgid "answered"
-msgstr "Beantwortet "
-
-#, fuzzy
msgid "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
msgstr "annährend %{space_used}% des verfügbaren Platzes wird verwendet (max. %{num_pages} Seiten)"
@@ -1766,10 +1754,6 @@
msgid "question"
msgstr "Frage"
-#, fuzzy
-msgid "questions"
-msgstr "Fragen"
-
msgid "questions answered"
msgstr "Fragen beantwortet"
@@ -1787,6 +1771,9 @@
msgid "select at least one theme"
msgstr "select at least one theme"
+msgid "since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again."
+msgstr ""
+
#, fuzzy
msgid "template"
msgstr "templates"
diff --git a/config/locale/en_GB/app.po b/config/locale/en_GB/app.po
index 510f97c..f35d162 100644
--- a/config/locale/en_GB/app.po
+++ b/config/locale/en_GB/app.po
@@ -60,9 +60,6 @@
msgid " on "
msgstr " on "
-msgid " once you click save!"
-msgstr " once you click save!"
-
#, fuzzy
msgid " or "
msgstr " on "
@@ -74,9 +71,6 @@
msgid " provided by "
msgstr " by "
-msgid " saved the following answer:"
-msgstr " saved the following answer:"
-
msgid " team"
msgstr " team"
@@ -424,9 +418,6 @@
msgid "Collaborators"
msgstr "Collaborators"
-msgid "Combine their changes with your answer below and then save the answer again."
-msgstr ""
-
msgid "Comment"
msgstr "Comment"
@@ -586,6 +577,10 @@
msgid "Example Answer"
msgstr "Example of answer"
+#, fuzzy
+msgid "Example of answer"
+msgstr "Example of answer"
+
msgid "Export"
msgstr "Export"
@@ -1283,12 +1278,13 @@
msgid "The "
msgstr "The "
-msgid "The edits in the box below will overwrite the existing answer from "
-msgstr "The edits in the box below will overwrite the existing answer from "
-
msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
msgstr "The email address of an administrator at your organisation. Your users will use this address if they have questions."
+#, fuzzy
+msgid "The following answer cannot be persisted"
+msgstr "The "
+
msgid "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
msgstr "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
@@ -1448,9 +1444,6 @@
msgid "Which DMP template would you like to use?"
msgstr "template"
-msgid "While you were editing "
-msgstr ""
-
msgid "Would you like to save them now?"
msgstr "Would you like to save them now?"
@@ -1613,9 +1606,6 @@
msgid "ago"
msgstr "ago"
-msgid "answered"
-msgstr "answered"
-
msgid "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
msgstr "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
@@ -1710,9 +1700,6 @@
msgid "question"
msgstr "question"
-msgid "questions"
-msgstr "questions"
-
msgid "questions answered"
msgstr "questions answered"
@@ -1728,6 +1715,10 @@
msgid "select at least one theme"
msgstr "select at least one theme"
+#, fuzzy
+msgid "since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again."
+msgstr " on "
+
msgid "template"
msgstr "template"
diff --git a/config/locale/en_US/app.po b/config/locale/en_US/app.po
index af5a1be..3bae78c 100644
--- a/config/locale/en_US/app.po
+++ b/config/locale/en_US/app.po
@@ -60,9 +60,6 @@
msgid " on "
msgstr " on "
-msgid " once you click save!"
-msgstr " once you click save!"
-
#, fuzzy
msgid " or "
msgstr " on "
@@ -74,9 +71,6 @@
msgid " provided by "
msgstr " by "
-msgid " saved the following answer:"
-msgstr " saved the following answer:"
-
msgid " team"
msgstr " team"
@@ -424,9 +418,6 @@
msgid "Collaborators"
msgstr "Collaborators"
-msgid "Combine their changes with your answer below and then save the answer again."
-msgstr ""
-
msgid "Comment"
msgstr "Comment"
@@ -586,6 +577,10 @@
msgid "Example Answer"
msgstr "Example of answer"
+#, fuzzy
+msgid "Example of answer"
+msgstr "Example of answer"
+
msgid "Export"
msgstr "Export"
@@ -1283,12 +1278,13 @@
msgid "The "
msgstr "The "
-msgid "The edits in the box below will overwrite the existing answer from "
-msgstr "The edits in the box below will overwrite the existing answer from "
-
msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
msgstr "The email address of an administrator at your organization. Your users will use this address if they have questions."
+#, fuzzy
+msgid "The following answer cannot be persisted"
+msgstr "The "
+
msgid "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
msgstr "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
@@ -1448,9 +1444,6 @@
msgid "Which DMP template would you like to use?"
msgstr "template"
-msgid "While you were editing "
-msgstr ""
-
msgid "Would you like to save them now?"
msgstr "Would you like to save them now?"
@@ -1613,9 +1606,6 @@
msgid "ago"
msgstr "ago"
-msgid "answered"
-msgstr "answered"
-
msgid "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
msgstr "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
@@ -1710,9 +1700,6 @@
msgid "question"
msgstr "question"
-msgid "questions"
-msgstr "questions"
-
msgid "questions answered"
msgstr "questions answered"
@@ -1728,6 +1715,10 @@
msgid "select at least one theme"
msgstr "select at least one theme"
+#, fuzzy
+msgid "since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again."
+msgstr " on "
+
msgid "template"
msgstr "template"
diff --git a/config/locale/es/app.po b/config/locale/es/app.po
index c0cf399..55298f2a 100644
--- a/config/locale/es/app.po
+++ b/config/locale/es/app.po
@@ -60,9 +60,6 @@
msgid " on "
msgstr ""
-msgid " once you click save!"
-msgstr ""
-
msgid " or "
msgstr ""
@@ -73,9 +70,6 @@
msgid " provided by "
msgstr " por "
-msgid " saved the following answer:"
-msgstr ""
-
#, fuzzy
msgid " team"
msgstr "am"
@@ -434,9 +428,6 @@
msgid "Collaborators"
msgstr "Colaboradores"
-msgid "Combine their changes with your answer below and then save the answer again."
-msgstr ""
-
msgid "Comment"
msgstr "Comentario"
@@ -599,6 +590,10 @@
msgid "Example Answer"
msgstr "Respuesta de ejemplo"
+#, fuzzy
+msgid "Example of answer"
+msgstr "Respuesta de ejemplo"
+
msgid "Export"
msgstr "Exportar"
@@ -1299,10 +1294,10 @@
msgid "The "
msgstr ""
-msgid "The edits in the box below will overwrite the existing answer from "
+msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
msgstr ""
-msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
+msgid "The following answer cannot be persisted"
msgstr ""
msgid "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
@@ -1467,9 +1462,6 @@
msgid "Which DMP template would you like to use?"
msgstr "templates"
-msgid "While you were editing "
-msgstr ""
-
msgid "Would you like to save them now?"
msgstr "¿Quere grabar los cambios ahora?"
@@ -1643,10 +1635,6 @@
msgstr ""
#, fuzzy
-msgid "answered"
-msgstr "Contestado "
-
-#, fuzzy
msgid "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
msgstr "aprox. %{space_used}% de disponibilidad del espacio usado (máx. %{num_pages} páginas)"
@@ -1749,10 +1737,6 @@
msgid "question"
msgstr "Pregunta"
-#, fuzzy
-msgid "questions"
-msgstr "Preguntas"
-
msgid "questions answered"
msgstr "preguntas respondidas"
@@ -1770,6 +1754,9 @@
msgid "select at least one theme"
msgstr ""
+msgid "since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again."
+msgstr ""
+
#, fuzzy
msgid "template"
msgstr "templates"
diff --git a/config/locale/fr/app.po b/config/locale/fr/app.po
index 7879c76..5fb2580 100644
--- a/config/locale/fr/app.po
+++ b/config/locale/fr/app.po
@@ -60,9 +60,6 @@
msgid " on "
msgstr ""
-msgid " once you click save!"
-msgstr ""
-
msgid " or "
msgstr ""
@@ -73,9 +70,6 @@
msgid " provided by "
msgstr " par "
-msgid " saved the following answer:"
-msgstr ""
-
#, fuzzy
msgid " team"
msgstr "am"
@@ -432,9 +426,6 @@
msgid "Collaborators"
msgstr "Collaborateurs"
-msgid "Combine their changes with your answer below and then save the answer again."
-msgstr ""
-
msgid "Comment"
msgstr "Commentaire"
@@ -597,6 +588,10 @@
msgid "Example Answer"
msgstr "Exemple de réponse"
+#, fuzzy
+msgid "Example of answer"
+msgstr "Exemple de réponse"
+
msgid "Export"
msgstr "Exporter"
@@ -1296,10 +1291,10 @@
msgid "The "
msgstr ""
-msgid "The edits in the box below will overwrite the existing answer from "
+msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
msgstr ""
-msgid "The email address of an administrator at your organisation. Your users will use this address if they have questions."
+msgid "The following answer cannot be persisted"
msgstr ""
msgid "The items you select here will be displayed in the table below. You can sort the data by each of these headings or filter by entering a text string in the search box."
@@ -1464,9 +1459,6 @@
msgid "Which DMP template would you like to use?"
msgstr "templates"
-msgid "While you were editing "
-msgstr ""
-
msgid "Would you like to save them now?"
msgstr "Voulez-vous faire la sauvegarde maintenant?"
@@ -1640,10 +1632,6 @@
msgstr ""
#, fuzzy
-msgid "answered"
-msgstr "Réponse "
-
-#, fuzzy
msgid "approx. %{space_used}%% of available space used (max %{num_pages} pages)"
msgstr "env. %{space_used}% despace disponible utilisé (%{num_pages} pages maxi)"
@@ -1746,10 +1734,6 @@
msgid "question"
msgstr "Question"
-#, fuzzy
-msgid "questions"
-msgstr "Questions"
-
msgid "questions answered"
msgstr "questions avec réponses"
@@ -1767,6 +1751,9 @@
msgid "select at least one theme"
msgstr ""
+msgid "since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again."
+msgstr ""
+
#, fuzzy
msgid "template"
msgstr "templates"
diff --git a/config/tinymce.yml b/config/tinymce.yml
index bc00326..2b2bb03 100644
--- a/config/tinymce.yml
+++ b/config/tinymce.yml
@@ -1,3 +1,5 @@
+content_css: /assets/application.css
+selector: 'textarea.tinymce'
statusbar: false
menubar: false
toolbar: bold italic | bullist numlist | link | table
diff --git a/lib/assets/javascripts/answers/status.js b/lib/assets/javascripts/answers/status.js
index 3358bd9..ebf5165 100644
--- a/lib/assets/javascripts/answers/status.js
+++ b/lib/assets/javascripts/answers/status.js
@@ -2,14 +2,24 @@
$(document).ready(function(){
$("form.answer").submit(function(){
- var saving = $(this).find('.saving-message');
+ var container = $(this).closest('.question-form');
+ var saving = container.find('.saving-message');
saving.show();
});
$("form.answer fieldset input, form.answer fieldset select").change(function(){
- var unsaved = $(this).closest('form.answer').find('.answer-unsaved');
+ var unsaved = $(this).closest('.question-form').find('.answer-unsaved');
unsaved.show();
+ var notAnswered = $(this).closest('.question-form').find('.not-answered');
+ notAnswered.hide();
});
- // TODO An adequate listener for textarea (e.g. tinymce) that triggers unsaved.show(). Temporary workaround defined at $.fn.toggle_dirty (plans.js)
+ $.fn.change_answer = function(editor){
+ editor.on('change', function(event){
+ var unsaved = $('#'+editor.id).closest('.question-form').find('.answer-unsaved');
+ unsaved.show();
+ var notAnswered = $('#'+editor.id).closest('.question-form').find('.not-answered');
+ notAnswered.hide();
+ });
+ }
$.fn.init_answer_status = function() {
$('abbr.timeago').timeago();
}
diff --git a/lib/assets/javascripts/plans.js b/lib/assets/javascripts/plans.js
index 86acb77..5837312 100644
--- a/lib/assets/javascripts/plans.js
+++ b/lib/assets/javascripts/plans.js
@@ -353,6 +353,7 @@
};
$.fn.toggle_dirty = function(question_id, is_dirty) {
+ console.log($(this));
section_id = $(this).attr("id").split('-')[0];
if (dirty[section_id] == null) {
dirty[section_id] = {};
@@ -360,17 +361,8 @@
dirty[section_id][question_id] = is_dirty;
if (is_dirty) {
$("#"+question_id+"-unsaved").show();
- $("#answer-status-"+question_id).find('.answer-unsaved').show(); // Temporary workaround ONLY triggered when textarea format type changes
}
else {
$("#"+question_id+"-unsaved").hide();
}
};
-
-
-
-
-// this is the function used to hanndle the interface between tinymce and the Dirty stuff
-$.fn.check_textarea = function(editor) {
- $("#"+editor.id).closest(".accordion-group").find(".section-status:first").toggle_dirty(editor.id.split('-')[2], editor.isDirty());
-};
diff --git a/lib/assets/stylesheets/admin.css.less b/lib/assets/stylesheets/admin.css.less
index 075941e..30da02c 100644
--- a/lib/assets/stylesheets/admin.css.less
+++ b/lib/assets/stylesheets/admin.css.less
@@ -1186,7 +1186,7 @@
}
table.dmp_details_table tr td.tinymce{
- min-width: 370px;
+ min-width: 400px;
}
table.dmp_details_table .text_area{
diff --git a/lib/assets/stylesheets/bootstrap_and_overrides.css.less b/lib/assets/stylesheets/bootstrap_and_overrides.css.less
index f083ce1..11fcd58 100644
--- a/lib/assets/stylesheets/bootstrap_and_overrides.css.less
+++ b/lib/assets/stylesheets/bootstrap_and_overrides.css.less
@@ -474,6 +474,7 @@
div.answer_notice {
background-color: #fee;
margin-bottom: 4px;
+ padding: 5px;
}
diff --git a/lib/assets/stylesheets/roadmap-form.scss b/lib/assets/stylesheets/roadmap-form.scss
index 72345a1..5a860ae 100644
--- a/lib/assets/stylesheets/roadmap-form.scss
+++ b/lib/assets/stylesheets/roadmap-form.scss
@@ -45,6 +45,7 @@
/* Fieldset with labels over inputs */
fieldset.standard {
+ padding: 5px;
background-color: $white;
margin-bottom: 25px;
diff --git a/public/shib_logo.png b/public/shib_logo.png
deleted file mode 100644
index 191b508..0000000
--- a/public/shib_logo.png
+++ /dev/null
Binary files differ
diff --git a/test/functional/answers_controller_test.rb b/test/functional/answers_controller_test.rb
index 1d5a3eb..a659295 100644
--- a/test/functional/answers_controller_test.rb
+++ b/test/functional/answers_controller_test.rb
@@ -27,30 +27,33 @@
plan.reload
referrer = "/#{FastGettext.locale}/plans/#{plan.id}/phases/#{question.section.phase.id}/edit"
-
- answer = Answer.create(user: @user, plan: plan, question: question,
- text: "#{format.title} Tester")
if format.option_based
else
# Try creating one first
- form_attributes = {"answer-text-#{question.id}": "#{format.title} Tester",
- answer: {user_id: @user.id, plan_id: plan.id,
- question_id: question.id}}
+ form_attributes = {
+ answer: {user_id: @user.id,
+ plan_id: plan.id,
+ question_id: question.id,
+ text: "#{format.title} Tester",
+ lock_version: 0}
+ }
- put_answer(answer, form_attributes, referrer)
+ put_answer(Answer.new(), form_attributes, referrer)
answer = Answer.find_by(user: @user, plan: plan, question: question)
assert_not answer.id.nil?, "expected the answer to have been created and for an id to be present after creating a #{format.title} question!"
# Try editing it
- form_attributes = {"answer-text-#{question.id}": "Tested",
+ form_attributes = {
answer: {id: answer.id,
user_id: answer.user.id,
plan_id: answer.plan.id,
question_id: answer.question.id,
- lock_version: answer.lock_version}}
+ text: "Tested",
+ lock_version: answer.lock_version}
+ }
put_answer(answer, form_attributes, referrer)
@@ -71,7 +74,6 @@
assert_response :success
assert_equal "text/javascript", @response.content_type
- # last line of JS updates section status with X questions, Y answered
- assert_match /status"\).html\("\([0-9]+ questions, [0-9]+ answered/, @response.body
+ assert_match(/[^\$]*\$\("#answer-locking-[0-9]+"\).html\(""\);[^\$]*\$\("#answer-form-[0-9]+"\)[^\.]*.html\(".+"\);[^\$]*\$\("#answer-status-[0-9]+"\)[^.]*.html\(".+"\);[^\$]*\$.[^$]*\$.[^\$]*\$\(".progress"\).html\(".+"\);[^\$]*\$\("#section-progress-[0-9]+"\)[^.]*.html\(".+"\);/, @response.body)
end
end
diff --git a/test/integration/answer_locking_test.rb b/test/integration/answer_locking_test.rb
index e083dda..824e3f7 100644
--- a/test/integration/answer_locking_test.rb
+++ b/test/integration/answer_locking_test.rb
@@ -33,10 +33,10 @@
assert_equal "Initial answer - by UserA", updated.text
assert_equal @plan.owner.id, updated.user_id
- # Make sure the answer-notice is NOT displayed
- assert_not @response.body.include?(_('Combine their changes with your answer below and then save the answer again.')), "expected there to be no lock error messaging"
- assert @response.body.include?("#{_('by')} #{@plan.owner.name}"), "expected the messaging to say the plan was updated by the plan owner"
- assert @response.body.include?(_('answered')), "expected the messaging to include the status"
+ # Make sure the answers/locking partial is NOT displayed
+ assert_not @response.body.include?(_('The following answer cannot be persisted')), "expected there to be no lock error messaging"
+ assert @response.body.include?(_('Answered'))
+ assert @response.body.include?("#{_(' by')} #{@plan.owner.name}"), "expected the messaging to say the plan was updated by the plan owner"
# Signin as UserB and try to insert the new answer but fail
sign_in @collaborator
@@ -48,9 +48,9 @@
assert_equal @plan.owner.id, updated.user_id
# Make sure the answer-notice IS displayed
- assert @response.body.include?(_('Combine their changes with your answer below and then save the answer again.')), "expected there to be lock error messaging"
- assert @response.body.include?("#{_('by')} #{@plan.owner.name}"), "expected the messaging to STILL say the plan was updated by the plan owner"
- assert @response.body.include?(_('answered')), "expected the messaging to include the status"
+ assert @response.body.include?(_('The following answer cannot be persisted')), "expected there to be lock error messaging"
+ assert @response.body.include?(_('since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again.') % { name: @plan.owner.name}), "expected the messaging to STILL say the plan was updated by the plan owner"
+ assert @response.body.include?(_('Answered')), "expected the messaging to include the status"
end
# ----------------------------------------------------------
@@ -70,10 +70,10 @@
assert_equal "Initial answer - by UserA - Updated by userA", updated.text
assert_equal @plan.owner.id, updated.user_id
- # Make sure the answer-notice is NOT displayed
- assert_not @response.body.include?(_('Combine their changes with your answer below and then save the answer again.')), "expected there to be no lock error messaging"
- assert @response.body.include?("#{_('by')} #{@plan.owner.name}"), "expected the messaging to say the plan was updated by the plan owner"
- assert @response.body.include?(_('answered')), "expected the messaging to include the status"
+ # Make sure the answers/locking partial is NOT displayed
+ assert_not @response.body.include?(_('The following answer cannot be persisted')), "expected there to be no lock error messaging"
+ assert @response.body.include?(_('Answered'))
+ assert @response.body.include?("#{_(' by')} #{@plan.owner.name}"), "expected the messaging to say the plan was updated by the plan owner"
# Signin as UserB and try to insert the new answer but fail
sign_in @collaborator
@@ -87,19 +87,20 @@
assert_equal @plan.owner.id, updated.user_id
# Make sure the answer-notice IS displayed
- assert @response.body.include?(_('Combine their changes with your answer below and then save the answer again.')), "expected there to be lock error messaging"
- assert @response.body.include?("#{_('by')} #{@plan.owner.name}"), "expected the messaging to STILL say the plan was updated by the plan owner"
- assert @response.body.include?(_('answered')), "expected the messaging to include the status"
+ assert @response.body.include?(_('The following answer cannot be persisted')), "expected there to be lock error messaging"
+ assert @response.body.include?(_('since %{name} saved the answer below while you were editing. Please, combine your changes and then save the answer again.') % { name: @plan.owner.name}), "expected the messaging to STILL say the plan was updated by the plan owner"
+ assert @response.body.include?(_('Answered')), "expected the messaging to include the status"
end
# ----------------------------------------------------------
private
def obj_to_params(attributes)
- {"answer-text-#{attributes['question_id']}": "#{attributes['text']}",
+ {
answer: {id: attributes['id'],
user_id: attributes['user_id'],
plan_id: attributes['plan_id'],
question_id: attributes['question_id'],
+ text: attributes['text'],
lock_version: attributes['lock_version']}
}
end
| | |