Skip to content

Commit

Permalink
Merge pull request #453 from commercekitchen/develop
Browse files Browse the repository at this point in the history
Merge develop into staging
  • Loading branch information
tmichaelreis authored Apr 23, 2020
2 parents 4763fdc + 74f373b commit 06f038a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@


<div class='fields'>
<%= render partial: 'admin/courses/forms/attachment_list', locals: { type: 'additional-resource', allow_delete: true } %>
<%= render partial: 'admin/courses/forms/attachment_upload', locals: { attachment_form: a, attachment_type: 'additional-resource', removable: false } %>
<%= render partial: 'admin/courses/forms/attachment_list',
locals: { attachments: @course.additional_resource_attachments, allow_delete: true } %>
<%= render partial: 'admin/courses/forms/attachment_upload',
locals: { attachment_form: a, attachment_type: 'additional-resource', removable: false } %>
<%= link_to_add_fields "Add Attachment", f, :attachments, "additional-resource" %>
</div>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/courses/forms/_attachment_list.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class='attachment-list'>
<% @course.attachments.where(doc_type: type).each do |a| %>
<% attachments.each do |a| %>
<div class='attachment'>
<div class='attachment-filename'>
<%= a.document_file_name %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/courses/forms/_text_copy_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</i></p>

<div class='fields'>
<%= render partial: 'admin/courses/forms/attachment_list', locals: { type: 'text-copy', allow_delete: !@imported_course } %>
<%= render partial: 'admin/courses/forms/attachment_list', locals: { attachments: @course.text_copy_attachments, allow_delete: !@imported_course } %>
<% unless @imported_course %>
<%= render partial: 'admin/courses/forms/attachment_upload', locals: { attachment_form: a, attachment_type: 'text-copy', removable: false } %>
<%= link_to_add_fields "Add Attachment", f, :attachments, 'text-copy' %>
Expand Down
1 change: 0 additions & 1 deletion app/views/errors/error404.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<html>
<body>
<div class="error_head">
Expand Down
16 changes: 11 additions & 5 deletions spec/features/admin/edit_course_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,24 @@
fixture_file_upload(Rails.root.join('spec', 'fixtures', 'BasicSearch1.zip'), 'application/zip')
end

let(:file_attachment) do
let(:additional_resource_file) do
fixture_file_upload(Rails.root.join('spec', 'fixtures', 'testfile.pdf'), 'application/pdf')
end

let(:text_copy_file) do
fixture_file_upload(Rails.root.join('spec', 'fixtures', 'Why_Use_a_Computer_1.pdf'), 'application/pdf')
end

let(:pla) { FactoryBot.create(:default_organization) }
let(:user) { FactoryBot.create(:user, :admin) }
let(:org) { user.organization }
let(:pla_course) { FactoryBot.create(:course, organization: pla) }
let(:subsite_course) { FactoryBot.create(:course, organization: org, parent: pla_course) }
let!(:course_attachment) do
FactoryBot.create(:attachment, document: file_attachment, doc_type: 'additional-resource', course: subsite_course)
let!(:additional_resource_attachment) do
FactoryBot.create(:attachment, document: additional_resource_file, doc_type: 'additional-resource', course: subsite_course)
end
let!(:text_copy_attachment) do
FactoryBot.create(:attachment, document: file_attachment, doc_type: 'text-copy', course: subsite_course)
FactoryBot.create(:attachment, document: text_copy_file, doc_type: 'text-copy', course: pla_course)
end

let!(:topic) { FactoryBot.create(:topic) }
Expand Down Expand Up @@ -52,11 +56,13 @@
expect(page).to_not have_field('course_other_topic_text')

expect(page).to have_link('Delete', count: 1)

expect(page).to have_content('Upload any supplemental materials for further learning. These files are available to users after completing the course.')
expect(page).to have_css('.attachment-upload-fields', count: 1)
expect(page).to have_link('Add Attachment', count: 1)

expect(page).to have_content('Text copies of the course to allow users to download content and view offline or follow along with the online course.')
expect(page).to have_content('Upload any supplemental materials for further learning. These files are available to users after completing the course.')
expect(page).to have_content(text_copy_attachment.document_file_name)

expect(page).to have_button('Save Course')
expect(page).to have_content('If you wish to edit additional details of this course and use the PLA-created Storyline files, please contact a PLA Administrator.')
Expand Down
2 changes: 1 addition & 1 deletion spec/services/course_import_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

let(:document) { fixture_file_upload(Rails.root.join('spec', 'fixtures', 'testfile.pdf'), 'application/pdf') }
let!(:text_copy_attachment) { FactoryBot.create(:attachment, doc_type: 'text-copy', document: document, course: pla_course) }
let!(:additional_resource_attachment) { FactoryBot.create(:attachment, doc_type: 'additional-resource', document: document, course: pla_course) }
let!(:additional_resource_attachment) { FactoryBot.create(:attachment, doc_type: 'additional-resource', document: document, course: pla_course) }

let(:subsite) { FactoryBot.create(:organization) }

Expand Down

0 comments on commit 06f038a

Please sign in to comment.