-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from curationexperts/toggle-files-table
Toggle files table
- Loading branch information
Showing
3 changed files
with
40 additions
and
23 deletions.
There are no files selected for viewing
49 changes: 27 additions & 22 deletions
49
app/views/zizia/csv_import_details/_pre_ingest_files_table.html.erb
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,24 +1,29 @@ | ||
<table id="files-table" class="dataTable display responsive nowrap table table-striped works-list" style="width:100%"> | ||
<tr> | ||
<th>Filename</th> | ||
<th>Size</th> | ||
<th>Row Number</th> | ||
<th>Date Created</th> | ||
</tr> | ||
<% pre_ingest_work.pre_ingest_files.each do |pre_ingest_file| %> | ||
<div class="pre-ingest-file-table"> | ||
<a class="btn btn-primary" data-toggle="collapse" href="#files-table-<%= pre_ingest_work.id %>" role="button" aria-expanded="false" aria-controls="files-table-<%= pre_ingest_work.id %>"> | ||
View Files | ||
</a> | ||
<table id="files-table-<%= pre_ingest_work.id %>" class="responsive collapse nowrap table table-striped works-list"> | ||
<tr> | ||
<td> | ||
<%= pre_ingest_file.basename %> | ||
</td> | ||
<td> | ||
<%= number_to_human_size(pre_ingest_file.size) %> | ||
</td> | ||
<td> | ||
<%= pre_ingest_file.row_number %> | ||
</td> | ||
<td> | ||
<%= pre_ingest_file.created_at.strftime("%B %-d, %Y %H:%M") %> | ||
</td> | ||
<th>Filename</th> | ||
<th>Size</th> | ||
<th>Row Number</th> | ||
<th>Date Created</th> | ||
</tr> | ||
<% end %> | ||
</table> | ||
<% pre_ingest_work.pre_ingest_files.each do |pre_ingest_file| %> | ||
<tr> | ||
<td> | ||
<%= pre_ingest_file.basename %> | ||
</td> | ||
<td> | ||
<%= number_to_human_size(pre_ingest_file.size) %> | ||
</td> | ||
<td> | ||
<%= pre_ingest_file.row_number %> | ||
</td> | ||
<td> | ||
<%= pre_ingest_file.created_at.strftime("%B %-d, %Y %H:%M") %> | ||
</td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
</div> |
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,7 +1,7 @@ | ||
require 'rails_helper' | ||
include Warden::Test::Helpers | ||
|
||
RSpec.describe 'viewing the csv import detail page' do | ||
RSpec.describe 'viewing the csv import detail page', js: true do | ||
let(:user) { FactoryBot.create(:admin, email: '[email protected]')} | ||
let(:second_user) { FactoryBot.create(:user, email: '[email protected]') } | ||
let(:csv_import) { FactoryBot.create(:csv_import) } | ||
|
@@ -10,6 +10,7 @@ | |
let(:csv_import_detail_second) { FactoryBot.create(:csv_import_detail, created_at: Time.parse('Thur, 31 Oct 2019 14:20:02 UTC +00:00').utc, status: 'zippy', update_actor_stack: 'ZiziaTesting', depositor_id: user.id) } | ||
let(:csv_import_detail_third) { FactoryBot.create(:csv_import_detail, created_at: Time.parse('Wed, 30 Oct 2019 14:20:02 UTC +00:00').utc, depositor_id: second_user.id, csv_import_id: 2) } | ||
let(:csv_pre_ingest_works) { FactoryBot.create_list(:pre_ingest_work, 12, csv_import_detail_id: 4) } | ||
let(:csv_pre_ingest_work_second) { FactoryBot.create(:pre_ingest_work, csv_import_detail_id: 5, created_at: Time.parse('Thur, 31 Oct 2019 14:20:02 UTC +00:00').utc) } | ||
|
||
before do | ||
user.save | ||
|
@@ -25,6 +26,7 @@ | |
csv_import_detail_second.save | ||
csv_import_detail_third.save | ||
csv_pre_ingest_works.each(&:save) | ||
csv_pre_ingest_work_second.save | ||
login_as user | ||
end | ||
|
||
|
@@ -123,4 +125,13 @@ | |
click_on 'Next' | ||
expect(page).to have_content 'Previous' | ||
end | ||
|
||
it 'can hide/show a PreIngestFiles table' do | ||
visit('/csv_import_details/index') | ||
click_on '5' | ||
expect(page).to have_content 'View Files' | ||
expect(page).not_to have_content 'Row Number' | ||
click_on 'View Files' | ||
expect(page).to have_content 'Row Number' | ||
end | ||
end |
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