mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 22:31:15 +00:00
Add url helper to simplify url names
This commit is contained in:
1
app.js
1
app.js
@@ -38,6 +38,7 @@ function initApp (config, callback) {
|
|||||||
|
|
||||||
// View helpers
|
// View helpers
|
||||||
require('./view/helper/date')(hbs.registerHelper);
|
require('./view/helper/date')(hbs.registerHelper);
|
||||||
|
require('./view/helper/url')(hbs.registerHelper);
|
||||||
|
|
||||||
// Populate view locals
|
// Populate view locals
|
||||||
app.express.locals({
|
app.express.locals({
|
||||||
|
12
view/helper/url.js
Normal file
12
view/helper/url.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = helper;
|
||||||
|
|
||||||
|
function helper (register) {
|
||||||
|
|
||||||
|
// Simplify url by removing (eg http://, https://, trailing slashes) from url
|
||||||
|
register('simplify-url', function (context) {
|
||||||
|
return context.replace(/^https?:\/\//i, '').replace(/\/$/, '');
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@@ -9,7 +9,7 @@
|
|||||||
{{#tasks}}
|
{{#tasks}}
|
||||||
<li class="col-md-4 col-sm-6 task-card">
|
<li class="col-md-4 col-sm-6 task-card">
|
||||||
<a class="well" href="/{{id}}">
|
<a class="well" href="/{{id}}">
|
||||||
<p class="h3">{{url}}</p>
|
<p class="h3">{{simplify-url url}}</p>
|
||||||
<p class="h5">({{standard}})</p>
|
<p class="h5">({{standard}})</p>
|
||||||
{{#if last_result}}
|
{{#if last_result}}
|
||||||
<ul class="clearfix list-unstyled floated-list task-stats">
|
<ul class="clearfix list-unstyled floated-list task-stats">
|
||||||
|
Reference in New Issue
Block a user