-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow download of links with specific statuses
The previous behaviour of clicking a link to download broken links has been modified so that the user can select specific statuses for which they want to download links. Only links with the selected status will be present in the downloaded csv file. They are initially all selected by default.
- Loading branch information
Alan Gabbianelli
committed
Apr 16, 2019
1 parent
cf1108e
commit f5dee13
Showing
9 changed files
with
218 additions
and
96 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
document.addEventListener("DOMContentLoaded", function(event) { | ||
var checkboxes = document.getElementsByClassName('links_status_checkbox'); | ||
var links_download_button = document.getElementById('links_download_button'); | ||
var url = links_download_button.href.split('?')[0]; | ||
|
||
for (var i = 0; i < checkboxes.length; i++) { | ||
checkboxes[i].addEventListener('change', function() { | ||
var params = []; | ||
for (var j = 0; j < checkboxes.length; j++) { | ||
if (checkboxes[j].checked) { | ||
params.push(checkboxes[j].name + '=' + checkboxes[j].value) | ||
} | ||
} | ||
links_download_button.href = url + '?' + params.join('&') | ||
}); | ||
} | ||
}); |
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,9 +1,34 @@ | ||
<%= javascript_include_tag params[:controller] %> | ||
|
||
<div class="page-title"> | ||
<h1><%= authority.name %></h1> | ||
<p> | ||
Homepage <%= link_to_if(authority.homepage_url, nil, authority.homepage_url) %><br> | ||
<span class="<%= authority.label_status_class %> text-muted"><b><%= authority.homepage_status %></b></span> | ||
<span class="text-muted"><%= authority.homepage_link_last_checked %></span> | ||
<p><%= link_to('Download broken links', broken_links_csv_local_authority_path, class: "btn btn-default btn-s") %></p> | ||
<p> | ||
<%= check_box_tag(:ok, :ok, true, class: 'links_status_checkbox') %> | ||
<%= label_tag(:ok, 'OK') %> | ||
<%= check_box_tag(:broken, :broken, true, class: 'links_status_checkbox') %> | ||
<%= label_tag(:broken, 'Broken') %> | ||
<%= check_box_tag(:caution, :caution, true, class: 'links_status_checkbox') %> | ||
<%= label_tag(:caution, 'Caution') %> | ||
<%= check_box_tag(:missing, :missing, true, class: 'links_status_checkbox') %> | ||
<%= label_tag(:missing, 'Missing') %> | ||
<%= check_box_tag(:pending, :pending, true, class: 'links_status_checkbox') %> | ||
<%= label_tag(:pending, 'Pending') %> | ||
<%= link_to( | ||
'Download links', | ||
links_csv_local_authority_path( | ||
ok: :ok, | ||
broken: :broken, | ||
caution: :caution, | ||
missing: :missing, | ||
pending: :pending | ||
), | ||
class: "btn btn-default btn-s", | ||
id: "links_download_button" | ||
) %> | ||
</p> | ||
</p> | ||
</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
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
Oops, something went wrong.