diff --git a/app/assets/javascripts/admin.js b/app/assets/javascripts/admin.js index c0aac55..45e9f4e 100644 --- a/app/assets/javascripts/admin.js +++ b/app/assets/javascripts/admin.js @@ -129,9 +129,10 @@ } }); $('#phases_select').show(); - $('#versions_select').hide(); - $('#sections_select').hide(); - $('#questions_select').hide(); + //$('#versions_select').hide(); + //$('#sections_select').hide(); + //$('#questions_select').hide(); + return false; }); $('#phases_select').change(function() { @@ -143,10 +144,11 @@ phase_id : $('#phases_select').val() } }); - $('#phases_select').show(); + //$('#phases_select').show(); $('#versions_select').show(); - $('#sections_select').hide(); - $('#questions_select').hide(); + //$('#sections_select').hide(); + //$('#questions_select').hide(); + return false; }); $('#versions_select').change(function() { $.ajax({ @@ -157,10 +159,11 @@ version_id : $('#versions_select').val() } }); - $('#phases_select').show(); - $('#versions_select').show(); + //$('#phases_select').show(); + //$('#versions_select').show(); $('#sections_select').show(); - $('#questions_select').hide(); + //$('#questions_select').show(); + return false; }); $('#sections_select').change(function() { $.ajax({ @@ -171,9 +174,9 @@ section_id : $('#sections_select').val() } }); - $('#phases_select').show(); - $('#versions_select').show(); - $('#sections_select').show(); + //$('#phases_select').show(); + //$('#versions_select').show(); + //$('#sections_select').show(); $('#questions_select').show(); }); diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index 6d21897..68fe5bf 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -84,7 +84,7 @@ answer = self.plan.answer(question.id) options_string = answer.options.collect {|o| o.text}.join('; ') - csv << [section.title, question.text, sanitize_text(answer.text), options_string, answer.try(:user).try(:name), answer.created_at] + csv << [section.title, sanitize_text(question.text), sanitize_text(answer.text), options_string, answer.try(:user).try(:name), answer.created_at] end end end @@ -97,7 +97,8 @@ output += "\n#{section.title}\n" self.questions_for_section(section).each do |question| - output += "\n#{question.text}\n" + qtext = sanitize_text( question.text.gsub(/
  • /, ' * ') ) + output += "\n#{qtext}\n" answer = self.plan.answer(question.id, false) if answer.nil? || answer.text.nil? then diff --git a/app/models/question.rb b/app/models/question.rb index 4cce243..dcee097 100644 --- a/app/models/question.rb +++ b/app/models/question.rb @@ -30,6 +30,14 @@ "#{text}" end + def select_text + cleantext = text.gsub(/<[^<]+>/, '') + if cleantext.length > 120 + cleantext = cleantext.slice(0,120) + end + cleantext + end + amoeba do include_association :options include_association :suggested_answers diff --git a/app/views/plans/export.docx.caracal b/app/views/plans/export.docx.caracal index b75f64d..ab4b974 100644 --- a/app/views/plans/export.docx.caracal +++ b/app/views/plans/export.docx.caracal @@ -46,7 +46,7 @@ docx.h3 section.title.upcase, italic: false, font: 'Arial', color: '000000' @exported_plan.questions_for_section(section.id).each do |question| - docx.p question.text, bold: true + docx.p strip_tags(question.text.gsub(/
  • /, ' * ')), bold: true answer = @exported_plan.plan.answer(question.id, false) if answer.nil? diff --git a/app/views/plans/export.html.erb b/app/views/plans/export.html.erb index 2643963..8f5acb5 100644 --- a/app/views/plans/export.html.erb +++ b/app/views/plans/export.html.erb @@ -44,7 +44,7 @@ <% questions.each do |question| %> -

    - <%= question.text %>

    +

    - <%= raw question.text %>

    <% answer = @plan.answer(question.id, false) %> diff --git a/app/views/plans/export.pdf.erb b/app/views/plans/export.pdf.erb index 9eca87a..1c33a50 100644 --- a/app/views/plans/export.pdf.erb +++ b/app/views/plans/export.pdf.erb @@ -37,7 +37,7 @@ <% questions.each_with_index do |question, idx| %>
    <% unless idx == 0 && question.text == section.title %> -

    <%= question.text %>

    +

    <%= raw question.text %>

    <% end %> <% answer = @plan.answer(question.id, false) %> <% if answer.nil? then %>