Skip to content

Commit

Permalink
Enable translation of the export's filename
Browse files Browse the repository at this point in the history
This way users will have a named in Catalan which will be more user
friendly for them.
  • Loading branch information
sauloperez committed Oct 8, 2020
1 parent 9142118 commit c621ad2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
module Decidim
module ActionDelegator
class ExportConsultationResultsJob < ApplicationJob
EXPORT_NAME = "consultation_results"

queue_as :default

def perform(user, consultation)
@consultation = consultation

export_data = Decidim::Exporters.find_exporter("CSV").new(collection, serializer).export
ExportMailer.export(user, EXPORT_NAME, export_data).deliver_now
ExportMailer.export(user, I18n.t("decidim.admin.consultations.results.export_name"), export_data).deliver_now
end

private
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ en:
consultations:
results:
export: Export
export_name: "consultation_results"
membership_type: Membership type
membership_weight: Weight
authorization_handlers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module Decidim::ActionDelegator
it "sends an export mail" do
expect(Decidim::ExportMailer)
.to receive(:export)
.with(user, "consultation_results", kind_of(Decidim::Exporters::ExportData))
.with(user, I18n.t("decidim.admin.consultations.results.export_name"), kind_of(Decidim::Exporters::ExportData))
.and_return(mailer)

subject.perform_now(user, consultation)
Expand Down

0 comments on commit c621ad2

Please sign in to comment.