diff options
author | Hybris95 <hybris_95@hotmail.com> | 2014-04-17 15:44:16 +0200 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-05-01 16:14:14 -0400 |
commit | 75796a0e2798e256a94f725961c9676746fc107a (patch) | |
tree | 822408d3043a126e45384497d5e622a583481cc8 | |
parent | 7d19224c99f118351ad15a77942762e74940536f (diff) | |
download | gitblit-75796a0e2798e256a94f725961c9676746fc107a.tar.gz gitblit-75796a0e2798e256a94f725961c9676746fc107a.zip |
Added git stylesheets to MyTickets.
Added links to Repositories containing the tickets.
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html | 69 | ||||
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java | 137 | ||||
-rw-r--r-- | src/main/resources/gitblit.css | 48 |
3 files changed, 135 insertions, 119 deletions
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 @@ <div class="container"> <div class="markdown" style="padding: 10px 0px 5px 0px;" wicket:id="myTicketsMessage">[my tickets message]</div> - <table> - <span>Responsible Tickets</span> + <table class="tickets"> + <span wicket:id="headerContent"></span> <tbody> - <tr wicket:id="responsibleTickets"> - <td><span wicket:id="repositoryName"></span></td> - <td><span wicket:id="ticketName"></span></td> - <td><span wicket:id="ticketDescription"></span></td> - </tr> - </tbody> - </table> - - <table> - <span>Author Tickets</span> - <tbody> - <tr wicket:id="authorTickets"> - <td><span wicket:id="repositoryName"></span></td> - <td><span wicket:id="ticketName"></span></td> - <td><span wicket:id="ticketDescription"></span></td> - </tr> - </tbody> - </table> - - <table> - <span>Voted Tickets</span> - <tbody> - <tr wicket:id="votedTickets"> - <td><span wicket:id="repositoryName"></span></td> - <td><span wicket:id="ticketName"></span></td> - <td><span wicket:id="ticketDescription"></span></td> - </tr> - </tbody> - </table> - - <table> - <span>Watched Tickets</span> - <tbody> - <tr wicket:id="watchedTickets"> - <td><span wicket:id="repositoryName"></span></td> - <td><span wicket:id="ticketName"></span></td> - <td><span wicket:id="ticketDescription"></span></td> - </tr> - </tbody> + <tr wicket:id="row"> + <span wicket:id="rowContent"></span> + </tr> + </tbody> </table> + + <wicket:fragment wicket:id="ticketsHeader"> + <tr> + <th class="left"> + <img style="vertical-align: middle;" src="git-black-16x16.png"/> + <wicket:message key="gb.repository">Repository</wicket:message> + </th> + <th class="hidden-phone" ><span><wicket:message key="gb.ticket">Ticket</wicket:message></span></th> + <th class="hidden-phone" ><span><wicket:message key="gb.description">Description</wicket:message></span></th> + <th class="hidden-tablet hidden-phone right"><span><wicket:message key="gb.responsible">Responsible</wicket:message></span></th> + </tr> + </wicket:fragment> + + <wicket:fragment wicket:id="ticketRow"> + <td class="left" style="padding-left:3px;"> + <b><span class="repositorySwatch" wicket:id="repositorySwatch"></span></b> + <span style="padding-left:3px;" wicket:id="repositoryName">[repository name]</span> + </td> + <td class="hidden-phone"><span class="list" wicket:id="ticketName">[ticket name]</span></td> + <td class="hidden-phone"><span class="list" wicket:id="ticketDescription">[ticket description]</span></td> + <td class="hidden-tablet hidden-phone author right"><span wicket:id="ticketResponsible">[ticket responsible]</span></td> + </wicket:fragment> </div> </wicket:extend> </body> 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<TicketModel> returnedTickets = tickets.getTickets(null); + List<TicketModel> yourTickets = new ArrayList<TicketModel>(); - List<TicketModel> responsibleTickets = new ArrayList<TicketModel>(); - List<TicketModel> authorTickets = new ArrayList<TicketModel>(); - List<TicketModel> votedTickets = new ArrayList<TicketModel>(); - List<TicketModel> watchedTickets = new ArrayList<TicketModel>(); 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<TicketModel> responsibleView = new ListView<TicketModel>("responsibleTickets", responsibleTickets) - { - private static final long serialVersionUID = 1L; - - @Override - public void populateItem(final ListItem<TicketModel> 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<TicketModel> dp = new ListDataProvider<TicketModel>(yourTickets); - ListView<TicketModel> authorView = new ListView<TicketModel>("authorTickets", authorTickets) - { + DataView<TicketModel> dataView = new DataView<TicketModel>("row", dp) { private static final long serialVersionUID = 1L; - - @Override - public void populateItem(final ListItem<TicketModel> 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<TicketModel> votedView = new ListView<TicketModel>("votedTickets", votedTickets) - { - private static final long serialVersionUID = 1L; - - @Override - public void populateItem(final ListItem<TicketModel> 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<TicketModel> watchedView = new ListView<TicketModel>("watchedTickets", watchedTickets) - { - private static final long serialVersionUID = 1L; - + @Override - public void populateItem(final ListItem<TicketModel> 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<TicketModel> 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<? extends BasePage> 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;
|