<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>
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 {
}
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);
}
}