[bugzilla-gnome-org-extensions] Show drafts on "Enter Bug" and "Choose Attachment"
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Show drafts on "Enter Bug" and "Choose Attachment"
- Date: Thu, 20 Nov 2014 22:18:12 +0000 (UTC)
commit 807736f3beb24588b8dab068af8cf11e406f7232
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Sat Sep 12 18:42:19 2009 -0400
Show drafts on "Enter Bug" and "Choose Attachment"
When we don't have a bug # at all, show drafts (and published
reviews for context) as options along with the "Enter Bug" entry.
When we have a bug # but no attachment, mark the attachments that
have open drafts.
js/splinter.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
web/index.html | 7 ++++++
web/splinter.css | 14 +++++++++++-
3 files changed, 82 insertions(+), 2 deletions(-)
---
diff --git a/js/splinter.js b/js/splinter.js
index ed50b44..93120c9 100644
--- a/js/splinter.js
+++ b/js/splinter.js
@@ -506,9 +506,60 @@ function showEnterBug() {
});
$("#loading").hide();
$("#enterBug").show();
+
+ if (!reviewStorage)
+ return;
+
+ var storedReviews = reviewStorage.listReviews();
+ if (storedReviews.length == 0)
+ return;
+
+ $("#chooseReview").show();
+
+ for (var i = storedReviews.length - 1; i >= 0; i--) {
+ var reviewInfo = storedReviews[i];
+ var href = newPageUrl(reviewInfo.bugId, reviewInfo.attachmentId);
+ var modificationDate = Utils.formatDate(new Date(reviewInfo.modificationTime));
+
+ var extra = reviewInfo.isDraft ? "(draft)" : "";
+
+ $("<tr>"
+ + "<td class='review-bug'>Bug <span></span></td>"
+ + "<td class='review-attachment'><a></a></td>"
+ + "<td class='review-desc'><a></a></td>"
+ + "<td class='review-modification'></td>"
+ + "<td class='review-extra'></td>"
+ + "</tr>")
+ .addClass(reviewInfo.isDraft ? "review-draft" : "")
+ .find(".review-bug span").text(reviewInfo.bugId).end()
+ .find(".review-attachment a")
+ .attr("href", href)
+ .text("Attachment " + reviewInfo.attachmentId).end()
+ .find(".review-desc a")
+ .attr("href", href)
+ .text(reviewInfo.attachmentDescription).end()
+ .find(".review-modification").text(modificationDate).end()
+ .find(".review-extra").text(extra).end()
+ .appendTo("#chooseReview tbody");
+ }
}
function showChooseAttachment() {
+ var drafts = {};
+ var published = {};
+ if (reviewStorage) {
+ var storedReviews = reviewStorage.listReviews();
+ for (var j = 0; j < storedReviews.length; j++) {
+ var reviewInfo = storedReviews[j];
+ if (reviewInfo.bugId == theBug.id) {
+ if (reviewInfo.isDraft)
+ drafts[reviewInfo.attachmentId] = 1;
+ else
+ published[reviewInfo.attachmentId] = 1;
+ }
+ }
+ }
+
for (var i = 0; i < theBug.attachments.length; i++) {
var attachment = theBug.attachments[i];
@@ -521,22 +572,32 @@ function showChooseAttachment() {
var status = (attachment.status && attachment.status != 'none') ? attachment.status : '';
var obsoleteClass = attachment.isObsolete ? "attachment-obsolete" : '';
+ var draftClass = attachment.id in drafts ? "attachment-draft" : '';
+
+ var extra = '';
+ if (attachment.id in drafts)
+ extra = '(draft)';
+ else if (attachment.id in published)
+ extra = '(published)';
$("<tr>"
+ "<td class='attachment-id'><a></a></td>"
+ "<td class='attachment-desc'><a></a></td>"
+ "<td class='attachment-date'></td>"
+ "<td class='attachment-status'></td>"
+ + "<td class='attachment-extra'></td>"
+ "</tr>")
+ .addClass(obsoleteClass)
+ .addClass(draftClass)
.find(".attachment-id a")
.attr("href", href)
.text(attachment.id).end()
.find(".attachment-desc a")
- .addClass(obsoleteClass)
.attr("href", href)
.text(attachment.description).end()
.find(".attachment-date").text(date).end()
.find(".attachment-status").text(status).end()
+ .find(".attachment-extra").text(extra).end()
.appendTo("#chooseAttachment tbody");
}
diff --git a/web/index.html b/web/index.html
index 193d3bf..eafcf0f 100644
--- a/web/index.html
+++ b/web/index.html
@@ -30,6 +30,13 @@
Bug to review:
<input id="enterBugInput"></input>
<input id="enterBugGo" type="button" value="Go"></input>
+ <div id="chooseReview" style="display: none;">
+ Drafts and published reviews:
+ <table>
+ <tbody>
+ </tbody>
+ </table>
+ </div>
</div>
<div id="chooseAttachment" style="display: none;">
Choose patch attachment to review:
diff --git a/web/splinter.css b/web/splinter.css
index 60f0f39..6e02ff5 100644
--- a/web/splinter.css
+++ b/web/splinter.css
@@ -24,11 +24,23 @@ body {
padding: 0.5em;
}
+#chooseReview {
+ margin-top: 1em;
+}
+
+.review-draft .review-desc, .review-draft .review-attachment {
+ font-weight: bold;
+}
+
#chooseAttachment {
padding: 0.5em;
}
-.attachment-obsolete {
+.attachment-draft .attachment-id, .attachment-draft .attachment-desc {
+ font-weight: bold;
+}
+
+.attachment-obsolete .attachment-desc {
text-decoration: line-through ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]