-
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.
This adds a toggle that will allow you to choose to see all imports or only imports you have created. Connected to curationexperts/in-house#424
- Loading branch information
Showing
5 changed files
with
55 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
.desc::after { | ||
content: ' ▾' | ||
content: ' ▾' | ||
} | ||
.asc::after { | ||
content: ' ▴' | ||
content: ' ▴' | ||
} | ||
|
||
.toggle-imports { | ||
margin-bottom: 1em; | ||
} |
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
7 changes: 7 additions & 0 deletions
7
app/views/zizia/csv_import_details/_toggle_my_imports.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="btn-group" role="group" aria-label="Table Visibility Controls"> | ||
<% if request.params[:user] %> | ||
<%= link_to 'View All Imports', request.params.except(:user), class: 'btn btn-default toggle-imports view-all-imports' %> | ||
<% else %> | ||
<%= link_to 'View My Imports', request.params.merge(user: current_user.email), class: 'btn btn-default toggle-imports view-my-imports' %> | ||
<% end %> | ||
</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
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 |
---|---|---|
|
@@ -2,23 +2,33 @@ | |
include Warden::Test::Helpers | ||
|
||
RSpec.describe 'viewing the csv import detail page' 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) } | ||
let(:csv_import_detail) { FactoryBot.create_list(:csv_import_detail, 12, created_at: Time.parse('Tue, 29 Oct 2019 14:20:02 UTC +00:00').utc) } | ||
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') } | ||
let(:user) { FactoryBot.create(:admin) } | ||
let(:second_csv_import) { FactoryBot.create(:csv_import, id: 2, user_id: 2) } | ||
let(:csv_import_detail) { FactoryBot.create_list(:csv_import_detail, 12, created_at: Time.parse('Tue, 29 Oct 2019 14:20:02 UTC +00:00').utc, depositor_id: user.id) } | ||
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) } | ||
|
||
before do | ||
user.save | ||
second_user.save | ||
|
||
csv_import.user_id = user.id | ||
csv_import.save | ||
|
||
second_csv_import.user_id = second_user.id | ||
second_csv_import.save | ||
|
||
csv_import_detail.each(&:save) | ||
csv_import_detail_second.save | ||
csv_import_detail_third.save | ||
login_as user | ||
end | ||
|
||
it 'displays the metadata when you visit the page' do | ||
visit ('/csv_import_details/index') | ||
expect(page).to have_content('CSV Imports ID') | ||
expect(page).to have_content('ID') | ||
expect(page).to have_content('Status') | ||
expect(page).to have_content('undetermined') | ||
click_on '1' | ||
|
@@ -53,7 +63,7 @@ | |
|
||
it 'displays the metadata when you visit the page' do | ||
visit ('/csv_import_details/index') | ||
expect(page).to have_content('CSV Imports ID') | ||
expect(page).to have_content('ID') | ||
click_on '1' | ||
expect(page).to have_content('Total Size') | ||
end | ||
|
@@ -85,6 +95,7 @@ | |
|
||
visit('/csv_import_details/index') | ||
expect(page).to have_content('Next') | ||
|
||
end | ||
|
||
it 'has pagination at 10' do | ||
|
@@ -93,4 +104,12 @@ | |
click_on 'Next' | ||
expect(page).to have_content('Previous') | ||
end | ||
|
||
it 'allows you to view only your imports' do | ||
visit('/csv_import_details/index') | ||
click_on 'View My Imports' | ||
expect(page).not_to have_content('[email protected]') | ||
click_on 'View All Imports' | ||
expect(page).to have_content('[email protected]') | ||
end | ||
end |