diff --git a/app/controllers/settings/plans_controller.rb b/app/controllers/settings/plans_controller.rb index 9708521..c9be594 100644 --- a/app/controllers/settings/plans_controller.rb +++ b/app/controllers/settings/plans_controller.rb @@ -23,6 +23,7 @@ if params[:commit] == 'Reset' s.formatting = nil s.fields = nil + s.title = nil else s.formatting = export_params[:formatting] s.fields = export_params[:fields] @@ -31,13 +32,13 @@ end if settings.save - respond_to do |format| - format.html { redirect_to(export_project_path(@plan.project)) } - end + flash[:notice] = _('Export settings updated successfully.') else - settings.formatting = nil - @export_settings = settings - render(action: :show) + flash[:alert] = _('An error has occurred while saving/resetting your export settings.') + end + respond_to do |format| + format.html { redirect_to(show_export_plan_path(@plan.id)) } + # format.json { render json: settings_json } end end diff --git a/app/models/exported_plan.rb b/app/models/exported_plan.rb index ae52513..44b0e3a 100644 --- a/app/models/exported_plan.rb +++ b/app/models/exported_plan.rb @@ -100,6 +100,11 @@ @admin_details ||= self.settings(:export).fields[:admin] end + # Retrieves the title field + def title + self.settings(:export).title + end + # Export formats def as_csv diff --git a/app/views/plans/_export.html.erb b/app/views/plans/_export.html.erb index b33c2ea..cd7ed05 100644 --- a/app/views/plans/_export.html.erb +++ b/app/views/plans/_export.html.erb @@ -4,6 +4,6 @@
<%= section.title %>
<%= section.title %>
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.phases.count == 1 %> - <%= render :partial => "/shared/export_links", locals: {plan: @plan} %> + <%= render :partial => "/shared/export_links", locals: {plan: @plan, phase: @phan.phases[0]} %> <%else%> <% @plan.phases.each do |phase| %>