mirror of
https://github.com/pa11y/pa11y-dashboard.git
synced 2025-09-24 22:31:15 +00:00
Make edit route work and add options dropdown
This commit is contained in:
2
public/css/site.min.css
vendored
2
public/css/site.min.css
vendored
File diff suppressed because one or more lines are too long
@@ -87,14 +87,10 @@
|
||||
margin-bottom:0;
|
||||
}
|
||||
}
|
||||
.delete-button {
|
||||
.options-button {
|
||||
position:absolute;
|
||||
top:5px;
|
||||
right:20px;
|
||||
color:@brand-danger;
|
||||
}
|
||||
.delete-button:hover {
|
||||
color:lighten(@brand-danger, 8%);
|
||||
}
|
||||
.footer a, .breadcrumb a {
|
||||
text-decoration:underline;
|
||||
@@ -188,10 +184,10 @@
|
||||
transition: background 0.5s;
|
||||
-webkit-transition: background 0.5s;
|
||||
}
|
||||
.delete-button {
|
||||
.options-button {
|
||||
display:none;
|
||||
}
|
||||
&:hover .delete-button {
|
||||
&:hover .options-button {
|
||||
display:block;
|
||||
}
|
||||
.task-card-link:hover,
|
||||
@@ -211,6 +207,9 @@
|
||||
text-align:center;
|
||||
color:@badge-color;
|
||||
}
|
||||
.dropdown-menu {
|
||||
top:25px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
var _ = require('underscore');
|
||||
var presentTask = require('../../view/presenter/task');
|
||||
var getStandards = require('../../data/standards');
|
||||
|
||||
module.exports = route;
|
||||
|
||||
@@ -13,7 +14,21 @@ function route (app) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
var standards = getStandards().map(function (standard) {
|
||||
if (standard.title === task.standard) {
|
||||
standard.selected = true;
|
||||
}
|
||||
standard.rules = standard.rules.map(function (rule) {
|
||||
if (task.ignore.indexOf(rule.name) !== -1) {
|
||||
rule.ignored = true;
|
||||
}
|
||||
return rule;
|
||||
});
|
||||
return standard;
|
||||
});
|
||||
res.render('task/edit', {
|
||||
edited: (typeof req.query.edited !== 'undefined'),
|
||||
standards: standards,
|
||||
task: presentTask(task),
|
||||
isTaskPage: true
|
||||
});
|
||||
@@ -21,12 +36,7 @@ function route (app) {
|
||||
});
|
||||
|
||||
app.express.post('/:id/edit', function (req, res, next) {
|
||||
app.webservice.task(req.params.id).remove(function (err) {
|
||||
if (err) {
|
||||
return next();
|
||||
}
|
||||
res.redirect('index');
|
||||
});
|
||||
res.redirect('/' + req.params.id + '/edit?edited');
|
||||
});
|
||||
|
||||
}
|
||||
|
@@ -24,19 +24,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- ########### Functionality to be done ############# -->
|
||||
<!-- List of other URLs -->
|
||||
<!-- <div class="other-tasks well">
|
||||
<h4 class="crunch-top ruled-sm">Your other tracked URLs</h4>
|
||||
<p>No other URLs</p>
|
||||
|
||||
|
||||
<ul class="list-unstyled crunch-bottom">
|
||||
<li><a href="empty-task">rowanmanning.com</a></li>
|
||||
<li><a href="task">nature.com</a></li>
|
||||
</ul>
|
||||
</div> -->
|
||||
<!-- ##################### End ######################## -->
|
||||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
|
@@ -7,9 +7,15 @@
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-3 text-right run-details">
|
||||
{{#unless readonly}}
|
||||
<a href="{{task.hrefRun}}" class="btn btn-success" data-test="run-task">
|
||||
Run <span class="glyphicon glyphicon-play"></span>
|
||||
</a>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">Options <span class="caret"></span></button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="/{{task.id}}/edit">Edit URL</a></li>
|
||||
<li><a href="/{{task.id}}/delete">Delete URL</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{{task.hrefRun}}" data-test="run-task">Run pa11y</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{#if mainResult}}
|
||||
<div class="date">Last run : {{date-format mainResult.date format="DD MMM YYYY"}}</div>
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<ul class="list-unstyled clearfix crunch-bottom">
|
||||
<li class="col-md-4 col-sm-6 task-card add-task">
|
||||
{{#if readonly}}
|
||||
{{! TODO PERRY: make this look disabled }}
|
||||
<span class="well task-card-link crunch-bottom">
|
||||
<p class="h3 crunch">Add new URL</p>
|
||||
<p class="supersize-me crunch">+</p>
|
||||
@@ -33,7 +32,15 @@
|
||||
{{/if}}
|
||||
</a>
|
||||
{{#unless ../readonly}}
|
||||
<a title="Delete this URL" class="delete-button" href="{{hrefDelete}}"><span class="sr-only">Delete </span><span class="glyphicon glyphicon-remove"></span></a>
|
||||
<div class="btn-group options-button text-right">
|
||||
<button type="button" class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown"><span class="sr-only">Options</span><span class="glyphicon glyphicon-cog"></span></button>
|
||||
<ul class="dropdown-menu pull-right" role="menu">
|
||||
<li><a href="{{href}}/edit">Edit URL</a></li>
|
||||
<li><a href="{{href}}/delete">Delete URL</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="{{href}}/run" data-test="run-task">Run pa11y</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{/unless}}
|
||||
</li>
|
||||
{{/each}}
|
||||
|
@@ -3,7 +3,17 @@
|
||||
Edit URL
|
||||
{{/content}}
|
||||
|
||||
<form role="form" class="col-md-12" action="/new" method="post" data-test="new-url-form">
|
||||
{{#edited}}
|
||||
<div class="col-md-12 clearfix" data-test="error">
|
||||
<div class="alert alert-success">
|
||||
<button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
|
||||
<strong>Success!</strong>
|
||||
<p>Your changes have been saved.</p>
|
||||
</div>
|
||||
</div>
|
||||
{{/edited}}
|
||||
|
||||
<form role="form" class="col-md-12" action="/{{task.id}}/edit" method="post" data-test="edit-url-form">
|
||||
|
||||
<div class="legend">
|
||||
<h1 class="h2 crunch-top">Edit URL</h1>
|
||||
@@ -11,9 +21,11 @@
|
||||
|
||||
{{#error}}
|
||||
<div class="col-md-12 clearfix" data-test="error">
|
||||
<div class="alert alert-danger">
|
||||
<strong>Oh my gosh!</strong>
|
||||
<p>{{.}}</p>
|
||||
<div class="row">
|
||||
<div class="alert alert-danger">
|
||||
<strong>Oh my gosh!</strong>
|
||||
<p>{{.}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/error}}
|
||||
@@ -40,7 +52,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-sm-4 col-xs-6">
|
||||
<label class="control-label" for="new-task-standard">Standard</label>
|
||||
<p class="form-control" disabled>{{task.standard}}</p>
|
||||
<select data-role="new-task-select" class="form-control" id="new-task-standard" name="standard" disabled>
|
||||
{{#standards}}
|
||||
<option {{#selected}}selected{{/selected}}>{{title}}</option>
|
||||
{{/standards}}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -65,6 +81,7 @@
|
||||
{{/standards}}
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-success">Save changes <span class="glyphicon glyphicon-plus"></span></button>
|
||||
<button type="submit" class="btn btn-success">Save changes <span class="glyphicon glyphicon-save"></span></button>
|
||||
<a href="/{{task.id}}/edit" class="btn btn-primary">Undo <span class="glyphicon glyphicon-refresh"></span></a>
|
||||
|
||||
</form>
|
||||
|
Reference in New Issue
Block a user