-
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.
- Loading branch information
Alan Gabbianelli
committed
Apr 15, 2019
1 parent
9a00e0f
commit 7115d5f
Showing
10 changed files
with
211 additions
and
97 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,15 @@ | ||
document.addEventListener("DOMContentLoaded", function(event) { | ||
var links_download_button = document.getElementById('links_download_button'); | ||
var href = links_download_button.href; | ||
|
||
links_download_button.addEventListener('mouseenter', function() { | ||
var checkboxes = document.getElementsByClassName('link_status_checkbox'); | ||
var params = []; | ||
for (var i = 0; i < checkboxes.length; i++) { | ||
if (checkboxes[i].checked) { | ||
params.push(checkboxes[i].name + '=' + checkboxes[i].value + '&') | ||
} | ||
} | ||
links_download_button.href = href + '?' + 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,28 @@ | ||
<%= 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: 'link_status_checkbox') %> | ||
<%= label_tag(:ok, 'OK') %> | ||
<%= check_box_tag(:broken, :broken, true, class: 'link_status_checkbox') %> | ||
<%= label_tag(:broken, 'Broken') %> | ||
<%= check_box_tag(:caution, :caution, true, class: 'link_status_checkbox') %> | ||
<%= label_tag(:caution, 'Caution') %> | ||
<%= check_box_tag(:missing, :missing, true, class: 'link_status_checkbox') %> | ||
<%= label_tag(:missing, 'Missing') %> | ||
<%= check_box_tag(:pending, :pending, true, class: 'link_status_checkbox') %> | ||
<%= label_tag(:pending, 'Pending') %> | ||
<%= link_to( | ||
'Download links', | ||
links_csv_local_authority_path, | ||
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.