diff options
author | James Moger <james.moger@gitblit.com> | 2014-09-08 16:17:56 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-09-08 16:17:56 -0400 |
commit | 805f8878b9457d41f277c81ff8d6e64b5d494903 (patch) | |
tree | 5a52700291c689b48e43f09cdd8de28d79e5422f /src/main/java/com | |
parent | 671b5a456c48028d21855fe05c1fbc9013a180b7 (diff) | |
parent | bf68143bda275e31dd22ee2268621bb0e0541a72 (diff) | |
download | gitblit-805f8878b9457d41f277c81ff8d6e64b5d494903.tar.gz gitblit-805f8878b9457d41f277c81ff8d6e64b5d494903.zip |
Merge branch 'ticket/171' into develop
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/gitblit/wicket/panels/TicketListPanel.java | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java b/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java index 1ca483ce..c7079c85 100644 --- a/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java +++ b/src/main/java/com/gitblit/wicket/panels/TicketListPanel.java @@ -64,11 +64,10 @@ public class TicketListPanel extends BasePanel { @Override protected void populateItem(Item<QueryResult> item) { final QueryResult ticket = item.getModelObject(); - final RepositoryModel repository = app().repositories().getRepositoryModel(ticket.repository); if (showSwatch) { // set repository color - String color = StringUtils.getColor(StringUtils.stripDotGit(repository.name)); + String color = StringUtils.getColor(StringUtils.stripDotGit(ticket.repository)); WicketUtils.setCssStyle(item, MessageFormat.format("border-left: 2px solid {0};", color)); } @@ -121,13 +120,24 @@ public class TicketListPanel extends BasePanel { @Override public void populateItem(final Item<String> labelItem) { - BugtraqProcessor btp = new BugtraqProcessor(app().settings()); - Repository db = app().repositories().getRepository(repository.name); - String content = btp.processText(db, repository.name, labelItem.getModelObject()); - db.close(); - Label label = new Label("label", content); - label.setEscapeModelStrings(false); - TicketLabel tLabel = app().tickets().getLabel(repository, labelItem.getModelObject()); + RepositoryModel repository = app().repositories().getRepositoryModel(ticket.repository); + Label label; + TicketLabel tLabel; + if (repository == null) { + label = new Label("label", labelItem.getModelObject()); + tLabel = new TicketLabel(labelItem.getModelObject()); + } else { + Repository db = app().repositories().getRepository(repository.name); + BugtraqProcessor btp = new BugtraqProcessor(app().settings()); + String content = btp.processText(db, repository.name, labelItem.getModelObject()); + db.close(); + + label = new Label("label", content); + label.setEscapeModelStrings(false); + + tLabel = app().tickets().getLabel(repository, labelItem.getModelObject()); + } + String background = MessageFormat.format("background-color:{0};", tLabel.color); label.add(new SimpleAttributeModifier("style", background)); labelItem.add(label); |