Skip to content

Instantly share code, notes, and snippets.

@markhalliwell
Last active November 7, 2016 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markhalliwell/a0157df7ea8f780ad0eb8a2abc030ea7 to your computer and use it in GitHub Desktop.
Save markhalliwell/a0157df7ea8f780ad0eb8a2abc030ea7 to your computer and use it in GitHub Desktop.
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