Skip to content

Instantly share code, notes, and snippets.

@markcarver markcarver/index.html
Last active Nov 7, 2016

Embed
What would you like to do?
Stand alone Dreditor UI patch reviewer
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Patch Review</title>
<link type="text/css" rel="stylesheet" href="/sites/all/libraries/prism/prism.css" media="all">
<link type="text/css" rel="stylesheet" href="/sites/all/libraries/dreditor/dist/css/dreditor.css" media="all">
<link type="text/css" rel="stylesheet" href="/sites/all/libraries/dreditor-ui/dist/css/dreditor-ui.css" media="all">
</head>
<body>
<select id="patches" multiple>
<option value="/files/issues/D8-8.2.x-2759479-25-StableSort-proof-of-concept-PermissionHandler-FIXED.patch" selected>D8-8.2.x-2759479-25-StableSort-proof-of-concept-PermissionHandler-FIXED.patch</option>
<option value="/files/issues/document-2761099-23.patch">document-2761099-23.patch</option>
</select>
<button id="load">Load patch</button>
<div id="content"></div>
<script src="/misc/jquery.js"></script>
<script src="/sites/all/libraries/prism/prism.js"></script>
<script src="/sites/all/libraries/dreditor/dist/js/dreditor.js"></script>
<script src="/sites/all/libraries/dreditor-ui/dist/js/dreditor-ui.js"></script>
<script>
/**
* @type {DreditorUI}
*/
var dreditor = new DreditorUI({
comments: true,
// Map Drupal extensions to their appropriate Prism language.
prismExtensionLanguageMap: {
coffee: ['coffeescript', 'javascript'],
engine: 'php',
htaccess: 'apacheconf',
inc: 'php',
info: 'ini',
install: 'php',
make: 'ini',
md: 'markdown',
module: 'php',
profile: 'php',
test: 'php',
theme: 'php',
yml: 'yaml'
},
// Router options.
router: {
// Change the route prefix from "/dreditor" to "/review".
prefix: 'review'
}
});
function getAbsoluteUrl(url) {
var a = document.createElement('a');
a.href = url;
return a.href;
}
var patches = document.getElementById('patches');
document.getElementById('load').addEventListener('click', function () {
var url = patches.value || patches.options[patches.selectedIndex].value;
if (!url) window.alert('You must select a patch to load.');
dreditor.navigate(getAbsoluteUrl(url));
}, false);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.