Created
August 28, 2009 18:11
-
-
Save awood/177130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CmdUtils.CreateCommand({ | |
names: ["rhbug"], | |
arguments: [{role: "object", | |
nountype: noun_arb_text, | |
label: "bug number"}], | |
description: "Look up a bug in Red Hat's Bugzilla.", | |
author: { name: "Alex Wood", email: "[email protected]"}, | |
icon: "https://bugzilla.redhat.com/images/favicon.ico", | |
_bugPage: function(id) { | |
return "https://bugzilla.redhat.com/show_bug.cgi?id=" + encodeURIComponent(id); | |
}, | |
preview: function( pblock, {object: {text}} ) { | |
if (! text) { | |
this.previewDefault(pblock); | |
return; | |
} | |
var bugLocation = this._bugPage(text); | |
CmdUtils.previewGet( pblock, bugLocation, null, function(data) { | |
var results = jQuery(data); | |
var summary = jQuery("#comment_text_0", results).html(); | |
var template = "<pre>${summary}</pre>"; | |
pblock.innerHTML = CmdUtils.renderTemplate(template, { summary:summary }); | |
}, "html"); | |
}, | |
execute: function(args) { | |
Utils.openUrlInBrowser(this._bugPage(args.object.text)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment