diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb
index a5deb9a..30a8b2b 100644
--- a/app/controllers/plans_controller.rb
+++ b/app/controllers/plans_controller.rb
@@ -266,6 +266,7 @@
@plan = Plan.find(params[:id])
authorize @plan
@phase_options = @plan.phases.order(:number).pluck(:title,:id)
+ @phase_options.unshift([_('All'), nil])
@export_settings = @plan.settings(:export)
render 'download'
end
@@ -285,6 +286,10 @@
@formatting = params[:export][:formatting] || @plan.settings(:export).formatting
file_name = @plan.title.gsub(/ /, "_")
+ if params[:phase_id].present?
+ phase_nb = @plan.phases.find_by(id: params[:phase_id]).number
+ @hash[:phases] = @hash[:phases].select { |p| p[:number] == phase_nb }
+ end
respond_to do |format|
format.html { render layout: false }
diff --git a/app/views/plans/_download_form.html.erb b/app/views/plans/_download_form.html.erb
index 296e2e0..9adf2ac 100644
--- a/app/views/plans/_download_form.html.erb
+++ b/app/views/plans/_download_form.html.erb
@@ -30,7 +30,7 @@
<%= label_tag "export[formatting][font_face]", _('Face'), class: 'control-label' %>
- <%= select_tag "export[formatting][font_face]",
- options_for_select(Settings::Template::VALID_FONT_FACES,
- @export_settings.formatting[:font_face]),
- class: 'form-control',
+ <%= select_tag "export[formatting][font_face]",
+ options_for_select(Settings::Template::VALID_FONT_FACES,
+ @export_settings.formatting[:font_face]),
+ class: 'form-control',
"data-default": @plan.template.settings(:export).formatting[:font_face] %>
<%= label_tag "export[formatting][font_size]", _('Size') + " (pt)", class: 'control-label' %>
- <%= select_tag "export[formatting][font_size]",
+ <%= select_tag "export[formatting][font_size]",
options_for_select(Settings::Template::VALID_FONT_SIZE_RANGE.to_a, @export_settings.formatting[:font_size]),
- class: 'form-control',
+ class: 'form-control',
"data-default": @plan.template.settings(:export).formatting[:font_size] %>
- <%= label_tag "export[formatting][margin][top]", _('Top'),
+ <%= label_tag "export[formatting][margin][top]", _('Top'),
class: 'control-label' %>
- <%= select_tag "export[formatting][margin][top]",
- options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
- @export_settings.formatting[:margin][:top]),
- class: 'form-control',
+ <%= select_tag "export[formatting][margin][top]",
+ options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
+ @export_settings.formatting[:margin][:top]),
+ class: 'form-control',
"data-default": @plan.template.settings(:export).formatting[:margin][:top] %>
- <%= label_tag "export[formatting][margin][bottom]", _('Bottom'),
+ <%= label_tag "export[formatting][margin][bottom]", _('Bottom'),
class: 'control-label' %>
- <%= select_tag "export[formatting][margin][bottom]",
- options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
- @export_settings.formatting[:margin][:bottom]),
- class: 'form-control',
+ <%= select_tag "export[formatting][margin][bottom]",
+ options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
+ @export_settings.formatting[:margin][:bottom]),
+ class: 'form-control',
"data-default": @plan.template.settings(:export).formatting[:margin][:bottom] %>
- <%= label_tag "export[formatting][margin][left]", _('Left'),
+ <%= label_tag "export[formatting][margin][left]", _('Left'),
class: 'control-label' %>
- <%= select_tag "export[formatting][margin][left]",
- options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
- @export_settings.formatting[:margin][:left]),
- class: 'form-control',
+ <%= select_tag "export[formatting][margin][left]",
+ options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
+ @export_settings.formatting[:margin][:left]),
+ class: 'form-control',
"data-default": @plan.template.settings(:export).formatting[:margin][:left] %>
- <%= label_tag "export[formatting][margin][right]", _('Right'),
+ <%= label_tag "export[formatting][margin][right]", _('Right'),
class: 'control-label' %>
- <%= select_tag "export[formatting][margin][right]",
- options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
- @export_settings.formatting[:margin][:right]),
- class: 'form-control',
+ <%= select_tag "export[formatting][margin][right]",
+ options_for_select(Settings::Template::VALID_MARGIN_RANGE.to_a,
+ @export_settings.formatting[:margin][:right]),
+ class: 'form-control',
"data-default": @plan.template.settings(:export).formatting[:margin][:rigth] %>
-
+
<%= button_tag(_('Download Plan'), class: "btn btn-primary", type: "submit") %>
<% end %>