diff --git a/README.rst b/README.rst index 82481df..ef17b8f 100644 --- a/README.rst +++ b/README.rst @@ -50,6 +50,8 @@ Basic usage path('admin/linkcheck/', include('linkcheck.urls')) +#. Run ``./manage.py collectstatic`` if you're deploying your app in production environment. + #. View ``/admin/linkcheck/`` from your browser. We are aware that this documentation is on the brief side of things so any diff --git a/linkcheck/static/linkcheck/css/styles.css b/linkcheck/static/linkcheck/css/styles.css new file mode 100644 index 0000000..8bc4690 --- /dev/null +++ b/linkcheck/static/linkcheck/css/styles.css @@ -0,0 +1,96 @@ + +.objecttype { + width: 99%!important; + margin-bottom: 30px; + border: 0 !important; +} + +.objecttype td { + border: 0; +} + +.module { + width: 100%!important; + border: 0 !important; +} + +.object { + width: 100%!important; + margin: 0; + padding: 35px 0 0 0; +} + +.links { + width: 100%!important; + background-color: white; + border: 1px solid #ddd; + margin: 10px 0 0 0; +} + +.links td, .links tr { + border: 1px solid #ddd; +} + +.links th { + border: 0!important; +} + +td.actioncell { + border-left: 0 !important; + width: 60px !important; +} + +#linkcheck-nav { + width: 100%; + margin-left: auto; + margin-right: auto; + text-align: center; + padding: 10px; +} + +#linkcheck-nav a { + text-decoration: underline; +} + +/* Header Styles */ +.header-cell { + padding: 0; +} + +.header-table-small { + width: 20%; +} + +.header-table-big { + width: 40%; + +} + +.header-report { + display: inline; + padding-left: 5px; +} + +.header-link { + text-decoration: underline; +} + +/* table body styles */ +.emphasis { + font-weight: bold; +} +.coloured-green { + color: green; +} +.coloured-red { + color: red; +} + +/* other styles */ +.current { + margin: 0 25px; +} + +.center-aligned { + text-align: center; +} \ No newline at end of file diff --git a/linkcheck/static/linkcheck/js/script.js b/linkcheck/static/linkcheck/js/script.js new file mode 100644 index 0000000..a39180e --- /dev/null +++ b/linkcheck/static/linkcheck/js/script.js @@ -0,0 +1,55 @@ +function showProgressDots(numberOfDots) { + var progress = document.getElementById('progressDots'); + if (!progress) return; + switch(numberOfDots) { + case 1: + progress.innerHTML = '. '; + timerHandle = setTimeout(function() { showProgressDots(2); }, 200); + break; + case 2: + progress.innerHTML = '.. '; + timerHandle = setTimeout(function() { showProgressDots(3); }, 200); + break; + case 3: + progress.innerHTML = '...'; + timerHandle = setTimeout(function() { showProgressDots(1); }, 200); + break; + } +} + +$(document).ready(function() { + + const csrfToken = document.querySelector('[name=csrfmiddlewaretoken]').value; + + $(".ignore").submit(function(){ + $.post(this.action, {'csrfmiddlewaretoken': csrfToken}, (data) => { + $('tr#link' + data.link).hide('medium'); + var ignored_count = parseInt($('#ignored_count').text()); + ignored_count++; + $('#ignored_count').text(ignored_count); + }); + return false; + }); + + $(".unignore").submit(function(){ + $.post(this.action, {'csrfmiddlewaretoken': csrfToken}, (data) => { + $('tr#link' + data.link).hide('medium'); + var ignored_count = parseInt($('#ignored_count').text()); + ignored_count--; + $('#ignored_count').text(ignored_count); + }); + return false; + }); + + $(".recheck").submit(function(){ + $(this).closest('tr').find('td.link_message').html('Checking'); + showProgressDots(1); + $.post(this.action, {'csrfmiddlewaretoken': csrfToken}, (data) => { + var links = data['links']; + for (var link in links) { + $('tr#link'+links[link]).find('td.link_message').text(data['message']).css('color', data['colour']); + } + }); + return false; + }); +}); diff --git a/linkcheck/templates/linkcheck/base_linkcheck.html b/linkcheck/templates/linkcheck/base_linkcheck.html index 03bdcd8..e32de44 100644 --- a/linkcheck/templates/linkcheck/base_linkcheck.html +++ b/linkcheck/templates/linkcheck/base_linkcheck.html @@ -1,8 +1,16 @@ {% extends "admin/change_list.html" %} +{% load static %} {% load i18n %} {% block title %} - {% translate "Link Checker" %} {{ block.super }} + {% translate "Link Checker" %} +{% endblock %} + +{% block extrahead %} + {{ block.super }} + + + {% endblock %} {% block breadcrumbs %} diff --git a/linkcheck/templates/linkcheck/coverage.html b/linkcheck/templates/linkcheck/coverage.html index 0f1c4eb..f0a8954 100644 --- a/linkcheck/templates/linkcheck/coverage.html +++ b/linkcheck/templates/linkcheck/coverage.html @@ -26,10 +26,10 @@ {% for model in coverage_data %}
{{content_type.content_type|get_verbose_name_plural}}+ | |||||||||||||||||||
{{content_type.content_type|get_verbose_name_plural}}{% for object in content_type.object_list %}
- {{report_type}} in '{{object.object}}'- {% blocktrans with content_type_name=content_type.content_type.name %}View {{ content_type_name }}{% endblocktrans %} - {% if object.admin_url %}{% blocktrans with content_type_name=content_type.content_type.name %}Edit {{ content_type_name }}{% endblocktrans %}{% endif %} +{{report_type}} in '{{object.object}}'+ {% blocktrans with content_type_name=content_type.content_type.name %}View {{ content_type_name }}{% endblocktrans %} + {% if object.admin_url %}{% blocktrans with content_type_name=content_type.content_type.name %}Edit {{ content_type_name }}{% endblocktrans %}{% endif %}
|