Skip to content

Commit 1344908

Browse files
committed
Merge branch 'master' into development
2 parents 996c9ac + e494cd9 commit 1344908

File tree

13 files changed

+2546
-1109
lines changed

13 files changed

+2546
-1109
lines changed

app/controllers/org_admin/plans_controller.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def feedback_complete
3737
# rubocop:enable LineLength
3838
else
3939
redirect_to org_admin_plans_path,
40-
alert: _("Unable to notify user that you have finished providing feedback."
41-
)
40+
alert: _("Unable to notify user that you have finished providing feedback.")
4241
end
4342
end
4443

app/controllers/org_admin/templates_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def update
192192
rescue ActiveSupport::JSON.parse_error
193193
render(json: {
194194
status: :bad_request,
195-
msg: _("Error parsing links for a #{template_type(template)}")
195+
msg: _("Error parsing links for a %{template}") %
196+
{ template: template_type(template) }
196197
})
197198
return
198199
rescue => e

app/controllers/plan_exports_controller.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def show
88
@plan = Plan.includes(:answers).find(params[:plan_id])
99

1010
if privately_authorized? && export_params[:form].present?
11+
skip_authorization
1112
@show_coversheet = export_params[:project_details].present?
1213
@show_sections_questions = export_params[:question_headings].present?
1314
@show_unanswered = export_params[:unanswered_questions].present?
@@ -93,7 +94,11 @@ def publicly_authorized?
9394
end
9495

9596
def privately_authorized?
96-
authorize @plan, :export?
97+
if current_user.present?
98+
PlanPolicy.new(current_user, @plan).export?
99+
else
100+
false
101+
end
97102
end
98103

99104
def export_params

app/models/concerns/exportable_plan.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,21 @@ def prepare_coversheet
117117
def prepare_coversheet_for_csv(csv, headings, hash)
118118
csv << [ hash[:attribution].many? ?
119119
_("Creators: ") :
120-
_("Creator:"), _(hash[:attribution].join(", ")) ]
121-
csv << [ "Affiliation: ", _(hash[:affiliation]) ]
120+
_("Creator:"), _("%{authors}") % { authors: hash[:attribution].join(", ") } ]
121+
csv << [ "Affiliation: ", _("%{affiliation}") % { affiliation: hash[:affiliation] } ]
122122
if hash[:funder].present?
123-
csv << [ _("Template: "), _(hash[:funder]) ]
123+
csv << [ _("Template: "), _("%{funder}") % { funder: hash[:funder] } ]
124124
else
125-
csv << [ _("Template: "), _(hash[:template] + hash[:customizer]) ]
125+
csv << [ _("Template: "), _("%{template}") % { template: hash[:template] + hash[:customizer] } ]
126126
end
127127
if self.grant_number.present?
128-
csv << [ _("Grant number: "), _(self.grant_number) ]
128+
csv << [ _("Grant number: "), _("%{grant_number}") % { grant_number: self.grant_number } ]
129129
end
130130
if self.description.present?
131-
csv << [ _("Project abstract: "), _(Nokogiri::HTML(self.description).text) ]
131+
csv << [ _("Project abstract: "), _("%{description}") %
132+
{ description: Nokogiri::HTML(self.description).text } ]
132133
end
133-
csv << [ _("Last modified: "), _(self.updated_at.to_date.strftime("%d-%m-%Y")) ]
134+
csv << [ _("Last modified: "), _("%{date}") % { date: self.updated_at.to_date.strftime("%d-%m-%Y") } ]
134135
csv << [ _("Copyright information:"),
135136
_("The above plan creator(s) have agreed that others may use as
136137
much of the text of this plan as they would like in their own plans,

app/views/user_mailer/sharing_notification.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
<%= _('Hello %{user_name}') %{ :user_name => user_name } %>
1010
</p>
1111
<p>
12-
<%= _("Your colleague %{inviter_name} has invited you to contribute to "\
13-
" their Data Management Plan in %{tool_name}") % {
12+
<%= _("Your colleague %{inviter_name} has invited you to contribute to
13+
their Data Management Plan in %{tool_name}") % {
1414
tool_name: tool_name,
1515
inviter_name: @inviter.name(false)
1616
} %>

0 commit comments

Comments
 (0)