From: Hybris95 Date: Thu, 17 Apr 2014 13:44:16 +0000 (+0200) Subject: Added git stylesheets to MyTickets. X-Git-Tag: v1.6.0~98^2~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=75796a0e2798e256a94f725961c9676746fc107a;p=gitblit.git Added git stylesheets to MyTickets. Added links to Repositories containing the tickets. --- diff --git a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html index 5222c35c..5d11fbbb 100644 --- a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html +++ b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html @@ -9,49 +9,36 @@
[my tickets message]
- - Responsible Tickets +
+ - - - - - - -
- - - Author Tickets - - - - - - - -
- - - Voted Tickets - - - - - - - -
- - - Watched Tickets - - - - - - - + + + +
+ + + + + + Repository + + Ticket + Description + Responsible + + + + + + + [repository name] + + [ticket name] + [ticket description] + [ticket responsible] +
diff --git a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java index 6e656ae4..6cd80a3f 100644 --- a/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java +++ b/src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java @@ -1,19 +1,28 @@ package com.gitblit.wicket.pages; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; -import com.gitblit.Keys; +import com.gitblit.models.RepositoryModel; import com.gitblit.models.UserModel; import com.gitblit.models.TicketModel; import com.gitblit.tickets.ITicketService; import com.gitblit.wicket.GitBlitWebApp; import com.gitblit.wicket.GitBlitWebSession; +import com.gitblit.wicket.WicketUtils; import com.gitblit.wicket.panels.LinkPanel; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.list.ListItem; import org.apache.wicket.markup.html.list.ListView; +import org.apache.wicket.markup.html.panel.Fragment; +import org.apache.wicket.markup.repeater.Item; +import org.apache.wicket.markup.repeater.data.DataView; +import org.apache.wicket.markup.repeater.data.IDataProvider; +import org.apache.wicket.markup.repeater.data.ListDataProvider; +import org.apache.wicket.model.IModel; +import org.apache.wicket.Component; import org.apache.wicket.PageParameters; public class MyTicketsPage extends RootPage { @@ -34,103 +43,75 @@ public class MyTicketsPage extends RootPage { } String username = currentUser.getName(); + // TODO - Recover the Welcome message String message = "Welcome on GitBlit"; - this.add(new Label("myTicketsMessage", message)); + this.add(new Label("myTicketsMessage", message)); + + Fragment fragment = new Fragment("headerContent", "ticketsHeader", this); + add(fragment); ITicketService tickets = GitBlitWebApp.get().tickets(); List returnedTickets = tickets.getTickets(null); + List yourTickets = new ArrayList(); - List responsibleTickets = new ArrayList(); - List authorTickets = new ArrayList(); - List votedTickets = new ArrayList(); - List watchedTickets = new ArrayList(); for(int i = 0; i < returnedTickets.size(); i++) { TicketModel ticket = returnedTickets.get(i); if(ticket.isOpen()) { - if(ticket.isResponsible(username)) - { - responsibleTickets.add(ticket); - } - if(ticket.isAuthor(username)) - { - authorTickets.add(ticket); - } - if(ticket.isVoter(username)) + if(ticket.isResponsible(username) || ticket.isAuthor(username) + || ticket.isVoter(username) || ticket.isWatching(username)) { - votedTickets.add(ticket); - } - if(ticket.isWatching(username)) - { - watchedTickets.add(ticket); + yourTickets.add(ticket); } } } - ListView responsibleView = new ListView("responsibleTickets", responsibleTickets) - { - private static final long serialVersionUID = 1L; - - @Override - public void populateItem(final ListItem item) - { - final TicketModel ticket = item.getModelObject(); - String ticketUrl = app().tickets().getTicketUrl(ticket); - item.add(new Label("repositoryName", ticket.repository)); - item.add(new LinkPanel("ticketName", "", ticket.title, ticketUrl)); - item.add(new Label("ticketDescription", ticket.body)); - } - }; + final ListDataProvider dp = new ListDataProvider(yourTickets); - ListView authorView = new ListView("authorTickets", authorTickets) - { + DataView dataView = new DataView("row", dp) { private static final long serialVersionUID = 1L; - - @Override - public void populateItem(final ListItem item) - { - final TicketModel ticket = item.getModelObject(); - String ticketUrl = app().tickets().getTicketUrl(ticket); - item.add(new Label("repositoryName", ticket.repository)); - item.add(new LinkPanel("ticketName", "", ticket.title, ticketUrl)); - item.add(new Label("ticketDescription", ticket.body)); - } - }; - - ListView votedView = new ListView("votedTickets", votedTickets) - { - private static final long serialVersionUID = 1L; - - @Override - public void populateItem(final ListItem item) - { - final TicketModel ticket = item.getModelObject(); - String ticketUrl = app().tickets().getTicketUrl(ticket); - item.add(new Label("repositoryName", ticket.repository)); - item.add(new LinkPanel("ticketName", "", ticket.title, ticketUrl)); - item.add(new Label("ticketDescription", ticket.body)); - } - }; - - ListView watchedView = new ListView("watchedTickets", watchedTickets) - { - private static final long serialVersionUID = 1L; - + @Override - public void populateItem(final ListItem item) - { - final TicketModel ticket = item.getModelObject(); - String ticketUrl = app().tickets().getTicketUrl(ticket); - item.add(new Label("repositoryName", ticket.repository)); - item.add(new LinkPanel("ticketName", "", ticket.title, ticketUrl)); - item.add(new Label("ticketDescription", ticket.body)); + protected void populateItem(Item item) { + TicketModel ticketModel = item.getModelObject(); + RepositoryModel repository = app().repositories().getRepositoryModel(ticketModel.repository); + + Fragment row = new Fragment("rowContent", "ticketRow", this); + item.add(row); + + Component swatch; + if(repository.isBare) + { + swatch = new Label("repositorySwatch", " ").setEscapeModelStrings(false); + } + else + { + swatch = new Label("repositorySwatch", "!"); + WicketUtils.setHtmlTooltip(swatch, getString("gb.workingCopyWarning")); + } + WicketUtils.setCssBackground(swatch, repository.toString()); + row.add(swatch); + + PageParameters pp = WicketUtils.newRepositoryParameter(repository.name); + Class linkPage; + if (repository.hasCommits) { + // repository has content + linkPage = SummaryPage.class; + } else { + // new/empty repository OR proposed repository + linkPage = EmptyRepositoryPage.class; + } + + String ticketUrl = app().tickets().getTicketUrl(ticketModel); + + row.add(new LinkPanel("repositoryName", "list", repository.name, linkPage, pp)); + row.add(new LinkPanel("ticketName", "list", ticketModel.title, ticketUrl)); + row.add(new LinkPanel("ticketDescription", "list", ticketModel.body, ticketUrl)); + row.add(new Label("ticketResponsible", ticketModel.responsible)); } }; - add(responsibleView); - add(authorView); - add(votedView); - add(watchedView); + add(dataView); } } diff --git a/src/main/resources/gitblit.css b/src/main/resources/gitblit.css index 748a3198..ea663a66 100644 --- a/src/main/resources/gitblit.css +++ b/src/main/resources/gitblit.css @@ -1599,6 +1599,54 @@ table.repositories tr.group td a { color: black; } +table.tickets { + border:1px solid #ddd; + border-spacing: 0px; + width: 100%; +} + +table.tickets th { + padding: 4px; + border:0; +} + +table.tickets th.right { + border-right: 1px solid #ddd; +} + +table.tickets td { + padding: 2px; + border-left: 0; +} + +table.tickets td.rightAlign { + text-align: right; + border-right: 1px solid #ddd; +} + +table.tickets td.icon img { + vertical-align: top; +} + +table.tickets tr.group { + background-color: #ccc; + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; +} + +table.tickets tr.group td { + font-weight: bold; + color: black; + background-color: #ddd; + padding-left: 5px; + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; +} + +table.tickets tr.group td a { + color: black; +} + table.palette { border:0; width: 0 !important; } table.palette td.header { font-weight: bold;