adjust filename for ePub to be more user friendly
closes CNVS-25065 test plan: - export an ePub that has unsupported media types - the ePub filename should reflect courseName-Timestamp - the zip filename should reflect the local timestamp - timestamp pattern should be 2015-Nov-16_18-22-40 - a course name over 200 chars in length should be truncated to the 200th char Change-Id: I39829d1df050b30544381c7ef20deba5c8c414d1 Reviewed-on: https://gerrit.instructure.com/67205 Reviewed-by: John Corrigan <jcorrigan@instructure.com> Tested-by: Jenkins QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com> Product-Review: Cosme Salazar <cosme@instructure.com>
This commit is contained in:
parent
165276745b
commit
047609a62c
|
@ -54,7 +54,9 @@ module CC::Exporter::Epub
|
|||
end
|
||||
|
||||
def filename
|
||||
"#{pub_id}.#{title}.epub"
|
||||
name = CanvasTextHelper.truncate_text(title, {:max_length => 200, :ellipsis => ''})
|
||||
timestamp = Time.zone.now.strftime('%Y-%b-%d_%H-%M-%S')
|
||||
"#{name}-#{timestamp}.epub"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ module CC::Exporter::Epub
|
|||
end
|
||||
|
||||
def filename
|
||||
@_filename ||= "#{SecureRandom.uuid}.zip"
|
||||
@_filename ||= "#{Time.zone.now.strftime('%Y-%b-%d_%H-%M-%S')}.zip"
|
||||
end
|
||||
|
||||
def zip_file
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<p><%= item[:lock_at] ? I18n.t("Lock at: %{time}",{time: friendly_date(item[:lock_at])}) : nil %></p>
|
||||
<p><%= item[:grading_type] ? I18n.t("Grading Type: %{type}",{type: item[:grading_type]}) : nil %></p>
|
||||
<p><%= item[:points_possible] ? I18n.t("Points: %{points}",{points: item[:points_possible]}) : nil %></p>
|
||||
<% if item[:submission_types].any? %>
|
||||
<% if item[:submission_types].try(:any?) %>
|
||||
<p><%= I18n.t("Submitting: %{types}", { types: item[:submission_types].join(', ') }) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -19,12 +19,17 @@ describe "Exportable" do
|
|||
end
|
||||
|
||||
context "#convert_to_epub" do
|
||||
|
||||
before do
|
||||
@epub_export = ExportableTest.new.convert_to_epub
|
||||
end
|
||||
|
||||
let(:epub_path) do
|
||||
ExportableTest.new.convert_to_epub.first
|
||||
@epub_export.first
|
||||
end
|
||||
|
||||
let(:zip_path) do
|
||||
ExportableTest.new.convert_to_epub.last
|
||||
@epub_export.last
|
||||
end
|
||||
|
||||
let(:epub) do
|
||||
|
|
Loading…
Reference in New Issue