diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 1600e12..f98ff45 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -226,6 +226,8 @@ def show_export @plan = Plan.find(params[:id]) authorize @plan + @phase_options = @plan.phases.order(:number).pluck(:title,:id) + @export_settings = @plan.settings(:export) render 'show_export' end @@ -235,9 +237,8 @@ @plan = Plan.find(params[:id]) authorize @plan - # If no format is specified, default to PDF - params[:format] = 'pdf' if params[:format].nil? - + # We should re-work this into something more useful than creating a new one + # every time a plan gets exported @exported_plan = ExportedPlan.new.tap do |ep| ep.plan = @plan ep.phase_id = params[:phase_id] @@ -250,14 +251,23 @@ end end + # setup some variables we will need in the export views + # here, if custom sections are included, we want all sections, otherwise, + # we only want those which are not modifiable, as they are the original template + @sections = params[:export][:custom_sections].present? || @plan.template.customization_of.nil? ? @exported_plan.sections.order(:number) : Phase.find(params[:phase_id]).sections.where(modifiable: false) # prefetch questions? + @unanswered_questions = params[:export][:unanswered_questions].present? + @question_headings = params[:export][:question_headings].present? + @show_details = params[:export][:project_details].present? + + begin @exported_plan.save! file_name = @exported_plan.settings(:export)[:value]['title'].gsub(/ /, "_") respond_to do |format| format.html - format.csv { send_data @exported_plan.as_csv, filename: "#{file_name}.csv" } - format.text { send_data @exported_plan.as_txt, filename: "#{file_name}.txt" } + format.csv { send_data @exported_plan.as_csv(@sections, @unanswered_question, @question_headings), filename: "#{file_name}.csv" } + format.text { send_data @exported_plan.as_txt(@sections, @unanswered_question, @question_headings, @show_details), filename: "#{file_name}.txt" } format.docx { render docx: 'export', filename: "#{file_name}.docx" } format.pdf do @formatting = @plan.settings(:export).formatting @@ -272,6 +282,7 @@ end end rescue ActiveRecord::RecordInvalid => e + @phase_options = @plan.phases.order(:number).pluck(:title,:id) redirect_to show_export_plan_path(@plan), alert: _('%{format} is not a valid exporting format. Available formats to export are %{available_formats}.') % {format: params[:format], available_formats: ExportedPlan::VALID_FORMATS.to_s} end @@ -318,6 +329,7 @@ end end rescue ActiveRecord::RecordInvalid => e + @phase_options = @plan.phases.order(:number).pluck(:title,:id) redirect_to show_export_plan_path(@plan), alert: _('Unable to download the DMP at this time.') end end diff --git a/app/controllers/settings/plans_controller.rb b/app/controllers/settings/plans_controller.rb index c406401..07b2789 100644 --- a/app/controllers/settings/plans_controller.rb +++ b/app/controllers/settings/plans_controller.rb @@ -36,6 +36,7 @@ flash[:alert] = _('An error has occurred while saving/resetting your export settings.') end respond_to do |format| + @phase_options = @plan.phases.order(:number).pluck(:title,:id) format.html { redirect_to(show_export_plan_path(@plan.id)) } # format.json { render json: settings_json } end diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index 0bd9ef1..c14979f 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -99,24 +99,40 @@ # Export formats - def as_csv + def as_csv(sections, unanswered_questions, question_headings) CSV.generate do |csv| - csv << [_('Section'),_('Question'),_('Answer'),_('Selected option(s)'),_('Answered by'),_('Answered at')] - self.sections.each do |section| - questions = self.questions_for_section(section) - if questions.present? - questions.each do |question| - answer = self.plan.answer(question.id) - q_format = question.question_format - if q_format.option_based? - options_string = answer.question_options.collect {|o| o.text}.join('; ') - else - options_string = '' - end + if question_headings + csv << [_('Section'),_('Question'),_('Answer'),_('Selected option(s)'),_('Answered by'),_('Answered at')] + else + csv << [_('Section'),_('Answer'),_('Selected option(s)'),_('Answered by'),_('Answered at')] + end + sections.each do |section| + section.questions.each do |question| + answer = Answer.where(plan_id: self.plan_id, question_id: question.id).first + # skip unansewered questions + if answer.blank? && !unanswered_questions + next + end + answer_text = answer.present? ? answer.text : '' + q_format = question.question_format + if q_format.option_based? + options_string = answer.question_options.collect {|o| o.text}.join('; ') + else + options_string = '' + end + if question_headings csv << [ section.title, sanitize_text(question.text), - question.option_comment_display ? sanitize_text(answer.text) : '', + question.option_comment_display ? sanitize_text(answer_text) : '', + options_string, + user.name, + answer.updated_at + ] + else + csv << [ + section.title, + question.option_comment_display ? sanitize_text(answer_text) : '', options_string, user.name, answer.updated_at @@ -127,40 +143,42 @@ end end - def as_txt + def as_txt(sections, unanswered_questions, question_headings, details) output = "#{self.plan.title}\n\n#{self.plan.template.title}\n" output += "\n"+_('Details')+"\n\n" - - self.admin_details.each do |at| - value = self.send(at) - if value.present? - output += admin_field_t(at.to_s) + ": " + value + "\n" - else - output += admin_field_t(at.to_s) + ": " + _('-') + "\n" - end + if details + self.admin_details.each do |at| + value = self.send(at) + if value.present? + output += admin_field_t(at.to_s) + ": " + value + "\n" + else + output += admin_field_t(at.to_s) + ": " + _('-') + "\n" + end + end end - self.sections.each do |section| - questions = self.questions_for_section(section) - if questions.present? - output += "\n#{section.title}\n" - questions.each do |question| + sections.each do |section| + output += "\n#{section.title}\n" + section.questions.each do |question| + answer = self.plan.answer(question.id, false) + #skip if question un-answered + if answer.nil? && !unanswered_questions then next end + + if question_headings qtext = sanitize_text( question.text.gsub(/
  • /, ' * ') ) output += "\n* #{qtext}" - answer = self.plan.answer(question.id, false) - - if answer.nil? - output += _('Question not answered.')+ "\n" - else - q_format = question.question_format - if q_format.option_based? - output += answer.question_options.collect {|o| o.text}.join("\n") - if question.option_comment_display - output += "\n#{sanitize_text(answer.text)}\n" - end - else + end + if answer.nil? + output += _('Question not answered.')+ "\n" + else + q_format = question.question_format + if q_format.option_based? + output += answer.question_options.collect {|o| o.text}.join("\n") + if question.option_comment_display output += "\n#{sanitize_text(answer.text)}\n" end + else + output += "\n#{sanitize_text(answer.text)}\n" end end end diff --git a/app/views/plans/export.docx.erb b/app/views/plans/export.docx.erb index 69602bb..6ae681d 100644 --- a/app/views/plans/export.docx.erb +++ b/app/views/plans/export.docx.erb @@ -2,7 +2,7 @@

    <%= @plan.template.title %>

    <% details = @exported_plan.admin_details %> -<% if details.present? %> +<% if details.present? && @show_details %>

    <%= _('Admin Details') %>

    <% details.each do |field| %> <% value = @exported_plan.send(field) %> @@ -15,32 +15,31 @@ -<% @exported_plan.sections.each do |section| %> - <% questions = @exported_plan.questions_for_section(section.id) - if questions.present? - %> -

    <%= section.title %>

    - <% questions.each do |question| %> - <%= raw question.text %> - <% answer = @plan.answer(question.id, false) %> - <% if answer.nil? %> -

    <%= _('Question not answered') %>

    - <% else %> - <% q_format = question.question_format %> - <% if q_format.option_based? %> - - <% if question.option_comment_display %> - <%= raw answer.text %> - <% end %> - <% else %> - <%= raw answer.text %> - <% end %> - <% end%> -

    - <% end %> - <% end %> +<% @sections.each do |section| %> +

    <%= section.title %>

    + <% section.questions.each do |question| %> + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? && !@unanswered_questions then next end %> + <% if @question_headings %> + <%= raw question.text %> + <% end %> + <% if answer.nil? %> +

    <%= _('Question not answered') %>

    + <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> + + <% if question.option_comment_display %> + <%= raw answer.text %> + <% end %> + <% else %> + <%= raw answer.text %> + <% end %> + <% end%> +

    + <% end %> <% end %> diff --git a/app/views/plans/export.html.erb b/app/views/plans/export.html.erb index 27a6b1b..d982182 100644 --- a/app/views/plans/export.html.erb +++ b/app/views/plans/export.html.erb @@ -1,76 +1,78 @@
    -

    <%= @plan.title %>

    -

    <%= @plan.template.title %>

    -
    -
    - <% - details = @exported_plan.admin_details - if details.present? - %> -

    <%= _('Admin Details') %>

    - - - - - - - - - <% - details.each do |field| - value = @exported_plan.send(field) - %> - - - - - <% end %> - -
    <%= _('Title')%><%= _('Description')%>

    - <%= admin_field_t(field.to_s) -%>

    <%= value.present? ? value : _('-') %>
    - <% end %> - <% @exported_plan.sections.each do |section| %> - <% questions = @exported_plan.questions_for_section(section.id) - if questions.present? %> -

    <%= section.title %>

    - - - - - - - - - <% questions.each do |question| %> - - - - - <% end %> - -
    <%= _('Questions')%><%= _('Answers')%>
    -

    - <%= raw question.text %>

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

    <%= _('Question not answered') %>

    - <% else %> - <% q_format = question.question_format %> - <% if q_format.option_based? %> -
      - <% answer.question_options.each do |option| %> -
    • <%= option.text %>
    • - <% end %> -
    - <% if question.option_comment_display == true %> - <%= raw answer.text %> - <% end %> - <% else%> - <%= raw answer.text %> - <% end%> - <% end %> -
    - <% end %> - <% end %> -
    -
    -
    +

    <%= @plan.title %>

    +

    <%= @plan.template.title %>

    +
    +
    + <% details = @exported_plan.admin_details %> + <% if details.present? && @show_details %> +

    <%= _('Admin Details') %>

    + + + + + + + + + <% + details.each do |field| + value = @exported_plan.send(field) + %> + + + + + <% end %> + +
    <%= _('Title')%><%= _('Description')%>

    - <%= admin_field_t(field.to_s) -%>

    <%= value.present? ? value : _('-') %>
    + <% end %> + <% @sections.each do |section| %> +

    <%= section.title %>

    + + + + <% if @question_headings %> + + <% end %> + + + + + <% section.questions.order(:number).each do |question| %> + + <% answer = @plan.answer(question.id, false) %> + <% if !@unanswered_questions && answer.blank? + next # skip unanswered questions + end %> + <% if @question_headings %> + + <% end %> + + + <% end %> + +
    <%= _('Questions')%><%= _('Answers')%>
    +

    - <%= raw question.text %>

    +
    + <% if answer.nil? %> +

    <%= _('Question not answered') %>

    + <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> +
      + <% answer.question_options.each do |option| %> +
    • <%= option.text %>
    • + <% end %> +
    + <% if question.option_comment_display == true %> + <%= raw answer.text %> + <% end %> + <% else%> + <%= raw answer.text %> + <% end%> + <% end %> +
    + <% end %> +
    +
    + \ No newline at end of file diff --git a/app/views/plans/export.pdf.erb b/app/views/plans/export.pdf.erb index b9ab084..c23fcbe 100644 --- a/app/views/plans/export.pdf.erb +++ b/app/views/plans/export.pdf.erb @@ -19,50 +19,51 @@

    <%= @plan.title %>

    - <% @exported_plan.admin_details.each do |field| - value = @exported_plan.send(field) - if value.present? %> -

    <%= admin_field_t(field.to_s) -%> <%= value -%>

    - <% else %> -

    <%= admin_field_t(field.to_s) -%> <%= _('-') %>

    + <% if @show_details %> + <% @exported_plan.admin_details.each do |field| + value = @exported_plan.send(field) + if value.present? %> +

    <%= admin_field_t(field.to_s) -%> <%= value -%>

    + <% else %> +

    <%= admin_field_t(field.to_s) -%> <%= _('-') %>

    + <% end %> <% end %> <% end %> - <% @exported_plan.sections.each do |section| %> - <% questions = @exported_plan.questions_for_section(section.id) - if questions.present? - %> -

    <%= section.title %>

    - <% questions.each do |question| %> -
    -

    <%= raw question.text %>

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

    <%= _('Question not answered.') -%>

    - <% else %> - <% q_format = question.question_format %> - <% if q_format.option_based? %> - - - <% if question.option_comment_display == true then%> - <% if !answer.text.nil? then %> - <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> - <%end%> - <%end%> - <%else%> - - <% if !answer.text.nil? then %> - <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> - <%end%> - <% end %> - <% end %> -
    + <% @sections.each do |section| %> +

    <%= section.title %>

    + <% section.questions.each do |question| %> + <% answer = @plan.answer(question.id, false) %> + <% if answer.nil? && !@unanswered_questions then next end %> +
    + <% if @question_headings %> +

    <%= raw question.text %>

    + <% end %> + <% if answer.nil? %> +

    <%= _('Question not answered.') -%>

    + <% else %> + <% q_format = question.question_format %> + <% if q_format.option_based? %> + + + <% if question.option_comment_display == true %> + <% if !answer.text.nil? %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <% end %> + <% end %> + <% else %> + + <% if !answer.text.nil? %> + <%= raw answer.text.gsub(/(\s||<\/td>| )*(<\/tr>|)/,"") %> + <% end %> <% end %> - <% end %> - <% end %> + <% end %> +
    + <% end %> + <% end %> \ No newline at end of file diff --git a/app/views/plans/show_export.html.erb b/app/views/plans/show_export.html.erb index 9b70ec5..390da67 100644 --- a/app/views/plans/show_export.html.erb +++ b/app/views/plans/show_export.html.erb @@ -1,4 +1,5 @@ <%- model_class = Plan -%> +<% javascript('views/plans/export_configure.js') %>

    <%= @plan.title %>

    @@ -6,17 +7,18 @@
    +
      - + <% @plan.template.phases.each do |phase| %> <% end %> - + @@ -30,23 +32,89 @@
      -

      <%= _("From here you can download your plan in various formats. This may be useful if you need to submit your plan as part of a grant application.") %>

      -

      <%= _(" Select what format you wish to use and click to 'Export'.") %>

      - - <% if @plan.template.phases.count == 1 %> - <%= render :partial => "/shared/export_links", locals: {plan: @plan, phase: @plan.template.phases.first} %> - - <%else%> -
      - <% @plan.template.phases.each do |phase| %> -

      <%= phase.title %>

      -
      - <%= render :partial => "/shared/export_links", locals: {plan: @plan, phase: phase} %> +

      <%= _("Download Settings") %>

      +
      + <%= form_tag( export_plan_path(@plan), method: :get, html: {class: "roadmap-form"}) do |f| %> + <% if @phase_options.length > 1 %> +

      <%= _("Select Phase to Download") %>

      +
      + <%= label_tag(:phase_id, _("Phase")) %> + <%= select_tag(:phase_id, options_for_select(@phase_options, @phase_options[0])) %>
      - <%end%> -
      - <%end%> -
      + <% else %> + <%= hidden_field_tag(:phase_id, @phase_options[0][1]) %> + <% end %> +

      <%= _("Optional plan components") %>

      +
      + <%= check_box_tag 'export[project_details]', true, false %> + <%= label_tag 'export[project_details]', _('project details coversheet'), class: 'checkbox-label' %> +
      +
      + <%= check_box_tag 'export[question_headings]', true, true, class: 'question-headings'%> + <%= label_tag 'export[question_headings]', _('questions as headings'), class: 'checkbox-label' %> +
      +
      + <%= check_box_tag 'export[unanswered_questions]', true, true, class: 'unanswered-questions' %> + <%= label_tag 'export[unanswered_questions]', _('unanswered questions'), class: 'checkbox-label' %> +
      + <% if @plan.template.customization_of.present? %> +
      + <%= check_box_tag 'export[custom_sections]', true, false %> + <%= label_tag 'export[custom_sections]', _('supplimental section(s) not requested by funding organisation'), class: 'checkbox-label' %> +
      + <% end %> + + +
      +
      + <%= label_tag(:format, _('Format')) %> + <%= select_tag(:format, options_for_select(ExportedPlan::VALID_FORMATS, :pdf), class: 'export-format-selection') %> +
      + + +
      +
      +

      <%= _('PDF Formatting') %>

      +
      + <%= _('Font') -%> +
      + <%= label_tag("export[formatting][font_face]", _('Face')) %> + <%= select_tag("export[formatting][font_face]", options_for_select(Settings::Template::VALID_FONT_FACES, @export_settings.formatting[:font_face]), { "data-default" => @plan.template.settings(:export).formatting[:font_face] }) %> +
      +
      + <%= label_tag("export[formatting][font_size]", _('Size') + " (pt)") %> + <%= select_tag("export[formatting][font_size]", options_for_select(Settings::Template::VALID_FONT_SIZE_RANGE.to_a, @export_settings.formatting[:font_size]), { "data-default" => @plan.template.settings(:export).formatting[:font_size] }) %> +
      +
      +
      + <%= _('Margin') -%> (mm) +
      + <%= label_tag("export[formatting][margin][top]", _('Top')) %> + <%= select_tag("export[formatting][margin][top]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:top]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:top] }) %> +
      +
      + <%= label_tag("export[formatting][margin][bottom]", _('Bottom')) %> + <%= select_tag("export[formatting][margin][bottom]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:bottom]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:bottom] }) %> +
      +
      + <%= label_tag("export[formatting][margin][left]", _('Left')) %> + <%= select_tag("export[formatting][margin][left]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:left]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:left] }) %> +
      +
      + <%= label_tag("export[formatting][margin][right]", _('Right')) %> + <%= select_tag("export[formatting][margin][right]", options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a, @export_settings.formatting[:margin][:right]), { "data-default" => @plan.template.settings(:export).formatting[:margin][:rigth] }) %> +
      +
      +
      + +
      +
       
      + <%= submit_tag _('Download Plan'), class: 'btn btn-primary', role: 'button' %> +
      + + <% end %> + +
    \ No newline at end of file diff --git a/app/views/settings/phases/_export_formatting_form.html.erb b/app/views/settings/phases/_export_formatting_form.html.erb index 915bce1..3633722 100644 --- a/app/views/settings/phases/_export_formatting_form.html.erb +++ b/app/views/settings/phases/_export_formatting_form.html.erb @@ -111,4 +111,4 @@
    -<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/users/_notification_preferences.html.erb b/app/views/users/_notification_preferences.html.erb index ef6e11a..46051d2 100644 --- a/app/views/users/_notification_preferences.html.erb +++ b/app/views/users/_notification_preferences.html.erb @@ -1,6 +1,6 @@

    - <%= link_to 'Select all', '#', id: 'select_all' %> | - <%= link_to 'Deselect all', '#', id: 'deselect_all' %> + <%= link_to _('Select all'), '#', id: 'select_all' %> | + <%= link_to _('Deselect all'), '#', id: 'deselect_all' %>

    @@ -12,17 +12,17 @@
    <%= hidden_field_tag 'prefs[users][new_comment]', false %> <%= check_box_tag 'prefs[users][new_comment]', true, @prefs[:users][:new_comment] %> - <%= label_tag 'prefs[users][new_comment]', 'A new comment has been added to my DMP', :class => 'checkbox-label' %> + <%= label_tag 'prefs[users][new_comment]', _('A new comment has been added to my DMP'), :class => 'checkbox-label' %>
    <%= hidden_field_tag 'prefs[users][added_as_coowner]', false %> <%= check_box_tag 'prefs[users][added_as_coowner]', true, @prefs[:users][:added_as_coowner] %> - <%= label_tag 'prefs[users][added_as_coowner]', 'A plan has been shared with me', :class => 'checkbox-label' %> + <%= label_tag 'prefs[users][added_as_coowner]', _('A plan has been shared with me'), :class => 'checkbox-label' %>
    <%= hidden_field_tag 'prefs[users][admin_privileges]', false %> <%= check_box_tag 'prefs[users][admin_privileges]', true, @prefs[:users][:admin_privileges] %> - <%= label_tag 'prefs[users][admin_privileges]', 'Admin privileges granted to me', :class => 'checkbox-label' %> + <%= label_tag 'prefs[users][admin_privileges]', _('Admin privileges granted to me'), :class => 'checkbox-label' %>

    @@ -30,7 +30,7 @@
    <%= hidden_field_tag 'prefs[owners_and_coowners][visibility_changed]', false %> <%= check_box_tag 'prefs[owners_and_coowners][visibility_changed]', true, @prefs[:owners_and_coowners][:visibility_changed] %> - <%= label_tag 'prefs[owners_and_coowners][visibility_changed]', "My DMP's visibility has changed", :class => 'checkbox-label' %> + <%= label_tag 'prefs[owners_and_coowners][visibility_changed]', _("My DMP's visibility has changed"), :class => 'checkbox-label' %>

    @@ -38,23 +38,23 @@
    <%= hidden_field_tag 'prefs[admins][template_published]', false %> <%= check_box_tag 'prefs[admins][template_published]', true, @prefs[:admins][:template_published] %> - <%= label_tag 'prefs[admins][template_published]', 'An organisational template is published', :class => 'checkbox-label' %> + <%= label_tag 'prefs[admins][template_published]', _('An organisational template is published'), :class => 'checkbox-label' %>
    <%= hidden_field_tag 'prefs[admins][template_unpublished]', false %> <%= check_box_tag 'prefs[admins][template_unpublished]', true, @prefs[:admins][:template_unpublished] %> - <%= label_tag 'prefs[admins][template_unpublished]', 'An organisational template is unpublished', :class => 'checkbox-label' %> + <%= label_tag 'prefs[admins][template_unpublished]', _('An organisational template is unpublished'), :class => 'checkbox-label' %>
    <%= hidden_field_tag 'prefs[admins][feedback_requested]', false %> <%= check_box_tag 'prefs[admins][feedback_requested]', true, @prefs[:admins][:feedback_requested] %> - <%= label_tag 'prefs[admins][feedback_requested]', 'A user has requested feedback on a DMP', :class => 'checkbox-label' %> + <%= label_tag 'prefs[admins][feedback_requested]', _('A user has requested feedback on a DMP'), :class => 'checkbox-label' %>

     
    - <%= submit_tag 'Save', class: 'btn btn-primary', role: 'button' %> + <%= submit_tag _('Save'), class: 'btn btn-primary', role: 'button' %>
    <% end %> diff --git a/db/schema.rb b/db/schema.rb index e975ca7..57917c1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -13,426 +13,442 @@ ActiveRecord::Schema.define(version: 20170712084314) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + create_table "annotations", force: :cascade do |t| - t.integer "question_id", limit: 4 - t.integer "org_id", limit: 4 - t.text "text", limit: 65535 - t.integer "type", limit: 4, default: 0, null: false + t.integer "question_id" + t.integer "org_id" + t.text "text" + t.integer "type", default: 0, null: false t.datetime "created_at" t.datetime "updated_at" end - add_index "annotations", ["org_id"], name: "fk_rails_aca7521f72" - add_index "annotations", ["question_id"], name: "fk_rails_0e08e753b6" + add_index "annotations", ["question_id"], name: "index_annotations_on_question_id", using: :btree create_table "answers", force: :cascade do |t| - t.text "text", limit: 65535 - t.integer "plan_id", limit: 4 - t.integer "user_id", limit: 4 - t.integer "question_id", limit: 4 + t.text "text" + t.integer "plan_id" + t.integer "user_id" + t.integer "question_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "lock_version", limit: 4, default: 0 + t.integer "lock_version", default: 0 end - add_index "answers", ["plan_id"], name: "fk_rails_84a6005a3e" - add_index "answers", ["question_id"], name: "fk_rails_3d5ed4418f" - add_index "answers", ["user_id"], name: "fk_rails_584be190c2" - create_table "answers_question_options", id: false, force: :cascade do |t| - t.integer "answer_id", limit: 4, null: false - t.integer "question_option_id", limit: 4, null: false + t.integer "answer_id", null: false + t.integer "question_option_id", null: false end - add_index "answers_question_options", ["answer_id", "question_option_id"], name: "answer_question_option_index" - add_index "answers_question_options", ["question_option_id", "answer_id"], name: "question_option_answer_index" + add_index "answers_question_options", ["answer_id"], name: "index_answers_question_options_on_answer_id", using: :btree create_table "exported_plans", force: :cascade do |t| - t.integer "plan_id", limit: 4 - t.integer "user_id", limit: 4 - t.string "format", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "phase_id", limit: 4 + t.integer "plan_id" + t.integer "user_id" + t.string "format" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "phase_id" end create_table "file_types", force: :cascade do |t| - t.string "name", limit: 255 - t.string "icon_name", limit: 255 - t.integer "icon_size", limit: 4 - t.string "icon_location", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name" + t.string "icon_name" + t.integer "icon_size" + t.string "icon_location" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "file_uploads", force: :cascade do |t| - t.string "name", limit: 255 - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.integer "size", limit: 4 + t.string "name" + t.string "title" + t.text "description" + t.integer "size" t.boolean "published" - t.string "location", limit: 255 - t.integer "file_type_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "location" + t.integer "file_type_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", limit: 255, null: false - t.integer "sluggable_id", limit: 4, null: false + t.string "slug", null: false + t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 40 t.datetime "created_at" end - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", unique: true - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" + add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", unique: true, using: :btree + add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree + add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree create_table "guidance_groups", force: :cascade do |t| - t.string "name", limit: 255 - t.integer "org_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name" + t.integer "org_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.boolean "optional_subset" t.boolean "published" end - add_index "guidance_groups", ["org_id"], name: "fk_rails_819c1dbbc7" + add_index "guidance_groups", ["org_id"], name: "index_guidance_groups_on_org_id", using: :btree create_table "guidances", force: :cascade do |t| - t.text "text", limit: 65535 - t.integer "guidance_group_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "question_id", limit: 4 + t.text "text" + t.integer "guidance_group_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "question_id" t.boolean "published" end - add_index "guidances", ["guidance_group_id"], name: "fk_rails_20d29da787" + add_index "guidances", ["guidance_group_id"], name: "index_guidances_on_guidance_group_id", using: :btree create_table "identifier_schemes", force: :cascade do |t| - t.string "name", limit: 255 - t.string "description", limit: 255 + t.string "name" + t.string "description" t.boolean "active" t.datetime "created_at" t.datetime "updated_at" - t.string "logo_url", limit: 255 - t.string "user_landing_url", limit: 255 + t.string "logo_url" + t.string "user_landing_url" end create_table "languages", force: :cascade do |t| - t.string "abbreviation", limit: 255 - t.string "description", limit: 255 - t.string "name", limit: 255 + t.string "abbreviation" + t.string "description" + t.string "name" t.boolean "default_language" end create_table "notes", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.text "text", limit: 65535 + t.integer "user_id" + t.text "text" t.boolean "archived" - t.integer "answer_id", limit: 4 - t.integer "archived_by", limit: 4 + t.integer "answer_id" + t.integer "archived_by" t.datetime "created_at" t.datetime "updated_at" end - add_index "notes", ["answer_id"], name: "fk_rails_907f8d48bf" - add_index "notes", ["user_id"], name: "fk_rails_7f2323ad43" + add_index "notes", ["answer_id"], name: "index_notes_on_answer_id", using: :btree create_table "org_identifiers", force: :cascade do |t| - t.string "identifier", limit: 255 - t.string "attrs", limit: 255 + t.string "identifier" + t.string "attrs" t.datetime "created_at" t.datetime "updated_at" - t.integer "org_id", limit: 4 - t.integer "identifier_scheme_id", limit: 4 + t.integer "org_id" + t.integer "identifier_scheme_id" end - add_index "org_identifiers", ["identifier_scheme_id"], name: "fk_rails_189ad2e573" - add_index "org_identifiers", ["org_id"], name: "fk_rails_36323c0674" - create_table "org_token_permissions", force: :cascade do |t| - t.integer "org_id", limit: 4 - t.integer "token_permission_type_id", limit: 4 + t.integer "org_id" + t.integer "token_permission_type_id" t.datetime "created_at" t.datetime "updated_at" end - add_index "org_token_permissions", ["org_id"], name: "fk_rails_e1db1b22c5" - add_index "org_token_permissions", ["token_permission_type_id"], name: "fk_rails_2aa265f538" + add_index "org_token_permissions", ["org_id"], name: "index_org_token_permissions_on_org_id", using: :btree create_table "orgs", force: :cascade do |t| - t.string "name", limit: 255 - t.string "abbreviation", limit: 255 - t.string "target_url", limit: 255 - t.string "wayfless_entity", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "parent_id", limit: 4 + t.string "name" + t.string "abbreviation" + t.string "target_url" + t.string "wayfless_entity" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "parent_id" t.boolean "is_other" - t.string "sort_name", limit: 255 - t.text "banner_text", limit: 65535 - t.string "logo_file_name", limit: 255 - t.integer "region_id", limit: 4 - t.integer "language_id", limit: 4 - t.string "logo_uid", limit: 255 - t.string "logo_name", limit: 255 - t.string "contact_email", limit: 255 - t.integer "org_type", limit: 4, default: 0, null: false + t.string "sort_name" + t.text "banner_text" + t.string "logo_file_name" + t.integer "region_id" + t.integer "language_id" + t.string "logo_uid" + t.string "logo_name" + t.string "contact_email" + t.integer "org_type", default: 0, null: false end - add_index "orgs", ["language_id"], name: "fk_rails_5640112cab" - add_index "orgs", ["region_id"], name: "fk_rails_5a6adf6bab" - create_table "perms", force: :cascade do |t| - t.string "name", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "perms", ["name"], name: "index_perms_on_name" - add_index "perms", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id" + add_index "perms", ["name"], name: "index_perms_on_name", using: :btree + add_index "perms", ["name"], name: "index_roles_on_name_and_resource_type_and_resource_id", using: :btree create_table "phases", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.integer "number", limit: 4 - t.integer "template_id", limit: 4 + t.string "title" + t.text "description" + t.integer "number" + t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" - t.string "slug", limit: 255 + t.string "slug" t.boolean "modifiable" end - add_index "phases", ["template_id"], name: "index_phases_on_template_id" + add_index "phases", ["template_id"], name: "index_phases_on_template_id", using: :btree create_table "plans", force: :cascade do |t| - t.string "title", limit: 255 - t.integer "template_id", limit: 4 + t.string "title" + t.integer "template_id" t.datetime "created_at" t.datetime "updated_at" - t.string "slug", limit: 255 - t.string "grant_number", limit: 255 - t.string "identifier", limit: 255 - t.text "description", limit: 65535 - t.string "principal_investigator", limit: 255 - t.string "principal_investigator_identifier", limit: 255 - t.string "data_contact", limit: 255 - t.string "funder_name", limit: 255 - t.integer "visibility", limit: 4, default: 0, null: false - t.string "data_contact_email", limit: 255 - t.string "data_contact_phone", limit: 255 + t.string "slug" + t.string "grant_number" + t.string "identifier" + t.text "description" + t.string "principal_investigator" + t.string "principal_investigator_identifier" + t.string "data_contact" + t.string "funder_name" + t.integer "visibility", default: 0, null: false + t.string "data_contact_email" + t.string "data_contact_phone" t.string "principal_investigator_email" end - add_index "plans", ["template_id"], name: "index_plans_on_template_id" + add_index "plans", ["template_id"], name: "index_plans_on_template_id", using: :btree create_table "plans_guidance_groups", force: :cascade do |t| - t.integer "guidance_group_id", limit: 4 - t.integer "plan_id", limit: 4 + t.integer "guidance_group_id" + t.integer "plan_id" end - add_index "plans_guidance_groups", ["guidance_group_id"], name: "fk_rails_ec1c5524d7" - add_index "plans_guidance_groups", ["plan_id"], name: "fk_rails_13d0671430" - create_table "prefs", force: :cascade do |t| t.string "settings" t.integer "user_id" end create_table "question_formats", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "option_based", default: false - t.integer "formattype", limit: 4, default: 0 + t.string "title" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "option_based", default: false + t.integer "formattype", default: 0 end create_table "question_options", force: :cascade do |t| - t.integer "question_id", limit: 4 - t.string "text", limit: 255 - t.integer "number", limit: 4 + t.integer "question_id" + t.string "text" + t.integer "number" t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" end - add_index "question_options", ["question_id"], name: "fk_rails_b9c5f61cf9" + add_index "question_options", ["question_id"], name: "index_question_options_on_question_id", using: :btree create_table "questions", force: :cascade do |t| - t.text "text", limit: 65535 - t.text "default_value", limit: 65535 - t.integer "number", limit: 4 - t.integer "section_id", limit: 4 + t.text "text" + t.text "default_value" + t.integer "number" + t.integer "section_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "question_format_id", limit: 4 - t.boolean "option_comment_display", default: true + t.integer "question_format_id" + t.boolean "option_comment_display", default: true t.boolean "modifiable" end - add_index "questions", ["question_format_id"], name: "fk_rails_4fbc38c8c7" - add_index "questions", ["section_id"], name: "index_questions_on_section_id" + add_index "questions", ["section_id"], name: "index_questions_on_section_id", using: :btree create_table "questions_themes", id: false, force: :cascade do |t| - t.integer "question_id", limit: 4, null: false - t.integer "theme_id", limit: 4, null: false + t.integer "question_id", null: false + t.integer "theme_id", null: false end - add_index "questions_themes", ["question_id", "theme_id"], name: "question_theme_index" - add_index "questions_themes", ["theme_id", "question_id"], name: "theme_question_index" + add_index "questions_themes", ["question_id"], name: "index_questions_themes_on_question_id", using: :btree create_table "regions", force: :cascade do |t| - t.string "abbreviation", limit: 255 - t.string "description", limit: 255 - t.string "name", limit: 255 - t.integer "super_region_id", limit: 4 + t.string "abbreviation" + t.string "description" + t.string "name" + t.integer "super_region_id" end create_table "roles", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "plan_id", limit: 4 + t.integer "user_id" + t.integer "plan_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "access", limit: 4, default: 0, null: false + t.integer "access", default: 0, null: false end - add_index "roles", ["plan_id"], name: "fk_rails_a1ce6c2772" - add_index "roles", ["user_id"], name: "fk_rails_ab35d699f0" + add_index "roles", ["plan_id"], name: "index_roles_on_plan_id", using: :btree + add_index "roles", ["user_id"], name: "index_roles_on_user_id", using: :btree create_table "sections", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.integer "number", limit: 4 + t.string "title" + t.text "description" + t.integer "number" t.datetime "created_at" t.datetime "updated_at" t.boolean "published" - t.integer "phase_id", limit: 4 + t.integer "phase_id" t.boolean "modifiable" end - add_index "sections", ["phase_id"], name: "index_sections_on_phase_id" + add_index "sections", ["phase_id"], name: "index_sections_on_phase_id", using: :btree create_table "settings", force: :cascade do |t| - t.string "var", limit: 255, null: false - t.text "value", limit: 65535 - t.integer "target_id", limit: 4, null: false - t.string "target_type", limit: 255, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "var", null: false + t.text "value" + t.integer "target_id", null: false + t.string "target_type", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true + add_index "settings", ["target_type", "target_id", "var"], name: "index_settings_on_target_type_and_target_id_and_var", unique: true, using: :btree create_table "splash_logs", force: :cascade do |t| - t.string "destination", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.string "destination" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "templates", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 + t.string "title" + t.text "description" t.boolean "published" - t.integer "org_id", limit: 4 - t.string "locale", limit: 255 + t.integer "org_id" + t.string "locale" t.boolean "is_default" t.datetime "created_at" t.datetime "updated_at" - t.integer "version", limit: 4 - t.integer "visibility", limit: 4 - t.integer "customization_of", limit: 4 - t.integer "dmptemplate_id", limit: 4 + t.integer "version" + t.integer "visibility" + t.integer "customization_of" + t.integer "dmptemplate_id" t.boolean "migrated" - t.boolean "dirty", default: false + t.boolean "dirty", default: false end - add_index "templates", ["org_id", "dmptemplate_id"], name: "template_organisation_dmptemplate_index" - add_index "templates", ["org_id"], name: "index_templates_on_org_id" + add_index "templates", ["org_id", "dmptemplate_id"], name: "template_organisation_dmptemplate_index", using: :btree + add_index "templates", ["org_id"], name: "index_templates_on_org_id", using: :btree create_table "themes", force: :cascade do |t| - t.string "title", limit: 255 - t.text "description", limit: 65535 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "locale", limit: 255 + t.string "title" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "locale" end create_table "themes_in_guidance", id: false, force: :cascade do |t| - t.integer "theme_id", limit: 4 - t.integer "guidance_id", limit: 4 + t.integer "theme_id" + t.integer "guidance_id" end - add_index "themes_in_guidance", ["guidance_id"], name: "fk_rails_a5ab9402df" - add_index "themes_in_guidance", ["theme_id"], name: "fk_rails_7d708f6f1e" + add_index "themes_in_guidance", ["guidance_id"], name: "index_themes_in_guidance_on_guidance_id", using: :btree + add_index "themes_in_guidance", ["theme_id"], name: "index_themes_in_guidance_on_theme_id", using: :btree create_table "token_permission_types", force: :cascade do |t| - t.string "token_type", limit: 255 - t.text "text_description", limit: 65535 + t.string "token_type" + t.text "text_description" t.datetime "created_at" t.datetime "updated_at" end create_table "user_identifiers", force: :cascade do |t| - t.string "identifier", limit: 255 + t.string "identifier" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id", limit: 4 - t.integer "identifier_scheme_id", limit: 4 + t.integer "user_id" + t.integer "identifier_scheme_id" end - add_index "user_identifiers", ["identifier_scheme_id"], name: "fk_rails_fe95df7db0" - add_index "user_identifiers", ["user_id"], name: "fk_rails_65c9a98cdb" + add_index "user_identifiers", ["user_id"], name: "index_user_identifiers_on_user_id", using: :btree create_table "users", force: :cascade do |t| - t.string "firstname", limit: 255 - t.string "surname", limit: 255 - t.string "email", limit: 255, default: "", null: false - t.string "orcid_id", limit: 255 - t.string "shibboleth_id", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.string "encrypted_password", limit: 255, default: "" - t.string "reset_password_token", limit: 255 + t.string "firstname" + t.string "surname" + t.string "email", default: "", null: false + t.string "orcid_id" + t.string "shibboleth_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "encrypted_password", default: "" + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", limit: 4, default: 0 + t.integer "sign_in_count", default: 0 t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 - t.string "confirmation_token", limit: 255 + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" - t.string "invitation_token", limit: 255 + t.string "invitation_token" t.datetime "invitation_created_at" t.datetime "invitation_sent_at" t.datetime "invitation_accepted_at" - t.string "other_organisation", limit: 255 + t.string "other_organisation" t.boolean "accept_terms" - t.integer "org_id", limit: 4 - t.string "api_token", limit: 255 - t.integer "invited_by_id", limit: 4 - t.string "invited_by_type", limit: 255 - t.integer "language_id", limit: 4 - t.string "recovery_email", limit: 255 + t.integer "org_id" + t.string "api_token" + t.integer "invited_by_id" + t.string "invited_by_type" + t.integer "language_id" + t.string "recovery_email" end - add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true - add_index "users", ["language_id"], name: "fk_rails_45f4f12508" - add_index "users", ["org_id"], name: "fk_rails_e73753bccb" - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree + add_index "users", ["org_id"], name: "index_users_on_org_id", using: :btree create_table "users_perms", id: false, force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "perm_id", limit: 4 + t.integer "user_id" + t.integer "perm_id" end - add_index "users_perms", ["perm_id"], name: "fk_rails_457217c31c" - add_index "users_perms", ["user_id", "perm_id"], name: "index_users_perms_on_user_id_and_perm_id" + add_index "users_perms", ["user_id"], name: "index_users_perms_on_user_id", using: :btree + add_foreign_key "annotations", "orgs" + add_foreign_key "annotations", "questions" + add_foreign_key "answers", "plans" + add_foreign_key "answers", "questions" + add_foreign_key "answers", "users" + add_foreign_key "answers_question_options", "answers" + add_foreign_key "answers_question_options", "question_options" + add_foreign_key "guidance_groups", "orgs" + add_foreign_key "guidances", "guidance_groups" + add_foreign_key "notes", "answers" + add_foreign_key "notes", "users" + add_foreign_key "org_identifiers", "identifier_schemes" + add_foreign_key "org_identifiers", "orgs" + add_foreign_key "org_token_permissions", "orgs" + add_foreign_key "org_token_permissions", "token_permission_types" + add_foreign_key "orgs", "languages" + add_foreign_key "orgs", "regions" + add_foreign_key "phases", "templates" + add_foreign_key "plans", "templates" + add_foreign_key "plans_guidance_groups", "guidance_groups" + add_foreign_key "plans_guidance_groups", "plans" + add_foreign_key "question_options", "questions" + add_foreign_key "questions", "question_formats" + add_foreign_key "questions", "sections" + add_foreign_key "questions_themes", "questions" + add_foreign_key "questions_themes", "themes" + add_foreign_key "roles", "plans" + add_foreign_key "roles", "users" + add_foreign_key "sections", "phases" + add_foreign_key "templates", "orgs" + add_foreign_key "themes_in_guidance", "guidances" + add_foreign_key "themes_in_guidance", "themes" + add_foreign_key "user_identifiers", "identifier_schemes" + add_foreign_key "user_identifiers", "users" + add_foreign_key "users", "languages" + add_foreign_key "users", "orgs" + add_foreign_key "users_perms", "perms" + add_foreign_key "users_perms", "users" end diff --git a/lib/assets/javascripts/views/plans/export_configure.js b/lib/assets/javascripts/views/plans/export_configure.js index 2229eee..5e7bf31 100644 --- a/lib/assets/javascripts/views/plans/export_configure.js +++ b/lib/assets/javascripts/views/plans/export_configure.js @@ -116,4 +116,16 @@ $('#pdf-format-options').hide(); } }); -}); + + /*---------------- + Listener for select that disables the unanswered questions + ------------------*/ + $('.question-headings').click(function(e){ + if($(this).is(':checked')){ + $('.unanswered-questions').removeAttr("disabled"); + }else{ + $('.unanswered-questions').prop("checked", false); + $('.unanswered-questions').prop("disabled", true); + } + }); +}); \ No newline at end of file diff --git a/lib/assets/stylesheets/dmproadmap/forms.scss b/lib/assets/stylesheets/dmproadmap/forms.scss index 00cf310..e71b02b 100644 --- a/lib/assets/stylesheets/dmproadmap/forms.scss +++ b/lib/assets/stylesheets/dmproadmap/forms.scss @@ -34,7 +34,7 @@ select { margin-top: 10px; vertical-align: top; - height: 25px; + height: 30px; } select[multiple="true"], select[multiple="multiple"] { @@ -733,4 +733,21 @@ #banner-text div.inline { width: 70%; } +} + +/* Plan Export Page */ +/* ------------------------------------------------ */ +#pdf-format-options { + select, label{ + display: block; + height: 30px; + width: 100%; + min-width: initial; + } + .font, .margins { + display: inline-block; + div{ + display: inline-block; + } + } } \ No newline at end of file diff --git a/test/functional/plans_controller_test.rb b/test/functional/plans_controller_test.rb index 69a51d7..6de8db2 100644 --- a/test/functional/plans_controller_test.rb +++ b/test/functional/plans_controller_test.rb @@ -266,9 +266,24 @@ test "export the plan" do # Should redirect user to the root path if they are not logged in! try_no_user_and_unauthorized(export_plan_path(@plan)) - + export_params = {"utf8"=>"✓", + "phase_id"=>"5470", + "export"=>{"project_details"=>"true", + "question_headings"=>"true", + "unanswered_questions"=>"true", + "formatting"=>{"font_face"=>"Arial, + Helvetica, + Sans-Serif", + "font_size"=>"12", + "margin"=>{"top"=>"20", + "bottom"=>"20", + "left"=>"20", + "right"=>"20"}}}, + "format"=>"docx", + "commit"=>"Download Plan", + "id"=>"18009"} sign_in @user - get export_plan_path(@plan) + get export_plan_path(@plan), export_params assert_response :success assert assigns(:plan)