-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix file manager sorting for Koppie (#6217)
* Use the presenter, not a form. * Remove unused file. * Fix test, small refactor.
- Loading branch information
1 parent
f27f71c
commit 04b6ecd
Showing
10 changed files
with
68 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# frozen_string_literal: true | ||
@curation_concern = Wings::ActiveFedoraConverter.convert(resource: @curation_concern) if | ||
@curation_concern.is_a? Hyrax::Resource | ||
@curation_concern = ::Wings::ActiveFedoraConverter.convert(resource: @curation_concern) if | ||
@curation_concern.is_a?(Hyrax::Resource) && Object.const_defined?("Wings") | ||
|
||
json.extract! @curation_concern, *[:id] + @curation_concern.class.fields.reject { |f| [:has_model].include? f } | ||
json.version @curation_concern.try(:etag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
RSpec.describe "file manager" do | ||
let(:user) { FactoryBot.create(:admin) } | ||
let!(:work) do | ||
FactoryBot.valkyrie_create(:monograph, :with_member_file_sets, :public, | ||
title: ["Toothbrush"]) | ||
end | ||
let(:file_set) do | ||
Hyrax.query_service.find_members(resource: work).first | ||
end | ||
before do | ||
sign_in user | ||
visit "/concern/monographs/#{work.id}/file_manager" | ||
end | ||
|
||
it "looks like a file manager" do | ||
# has a bulk edit header | ||
expect(page.html).to include "<h1>#{I18n.t('hyrax.file_manager.link_text')}</h1>" | ||
|
||
# displays each file set's label | ||
expect(page).to have_selector "input[name='file_set[title][]'][type='text'][value='#{file_set.title.first}']" | ||
|
||
# has a link to edit each file set | ||
expect(page).to have_selector("a[href='/concern/parent/#{work.id}/file_sets/#{file_set.id}']") | ||
|
||
# has a link back to parent | ||
expect(page).to have_link work.title.first, href: hyrax_monograph_path(id: work.id, locale: :en) | ||
|
||
# renders a form for each member | ||
expect(page).to have_selector("#sortable form", count: work.member_ids.length) | ||
|
||
# Defines the order property | ||
expect(page).to have_selector("#sortable[data-sort-property='member_ids']") | ||
|
||
# renders an input for titles | ||
expect(page).to have_selector("input[name='file_set[title][]']") | ||
|
||
# renders a resource form for the entire resource | ||
expect(page).to have_selector("form#resource-form") | ||
|
||
# renders a hidden field for the resource form thumbnail id | ||
expect(page).to have_selector("#resource-form input[type=hidden][name='monograph[thumbnail_id]']", visible: false) | ||
|
||
# renders a thumbnail field for each member | ||
expect(page).to have_selector("input[name='thumbnail_id']", count: work.member_ids.length) | ||
|
||
# renders a hidden field for the resource form representative id | ||
expect(page).to have_selector("#resource-form input[type=hidden][name='monograph[representative_id]']", visible: false) | ||
|
||
# renders a representative field for each member | ||
expect(page).to have_selector("input[name='representative_id']", count: work.member_ids.length) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.