-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organizer can download CSV with applications
- Loading branch information
1 parent
1fb0b02
commit f592971
Showing
10 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 +1,5 @@ | ||
module AdminEventsHelper | ||
def download_csv_link(event) | ||
link_to t('.download_csv'), admin_event_path(id: event.id, format: :csv), class: "btn btn-save", title: t('.download_data') | ||
link_to 'Download CSV', admin_event_path(id: event.id, format: :csv), class: "btn btn-save", title: 'Download Data' | ||
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
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 |
---|---|---|
|
@@ -333,6 +333,31 @@ class EventsControllerTest < ActionController::TestCase | |
assert_equal 'You are not allowed to access this event.', flash[:alert] | ||
assert_redirected_to request.env["HTTP_REFERER"] | ||
end | ||
|
||
describe 'download event details as CSV' do | ||
it 'shows the event details page in csv format to organizer' do | ||
user = make_user(admin: false) | ||
event = make_event(organizer_id: user.id) | ||
sign_in_as(user) | ||
|
||
get :show, params: { id: event.id }, format: :csv | ||
|
||
assert_equal request.format, :csv | ||
end | ||
|
||
it 'does not show the event details page in csv format to other users' do | ||
user = make_user(admin: false) | ||
different_user = make_user(admin: false, email: "[email protected]") | ||
event = make_event(organizer_id: user.id) | ||
request.env["HTTP_REFERER"] = 'http://www.somewhere.net' | ||
sign_in_as(different_user) | ||
|
||
get :show, params: { id: event.id }, format: :csv | ||
|
||
assert_equal 'You are not allowed to access this event.', flash[:alert] | ||
assert_redirected_to request.env["HTTP_REFERER"] | ||
end | ||
end | ||
end | ||
|
||
describe '#preview' do | ||
|
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