]> source.dussan.org Git - gitblit.git/commitdiff
Added git stylesheets to MyTickets.
authorHybris95 <hybris_95@hotmail.com>
Thu, 17 Apr 2014 13:44:16 +0000 (15:44 +0200)
committerJames Moger <james.moger@gitblit.com>
Thu, 1 May 2014 20:14:14 +0000 (16:14 -0400)
Added links to Repositories containing the tickets.

src/main/java/com/gitblit/wicket/pages/MyTicketsPage.html
src/main/java/com/gitblit/wicket/pages/MyTicketsPage.java
src/main/resources/gitblit.css

index 5222c35ce603d926cb54ba252aebbe9819a59388..5d11fbbb528a8c4fa9af01f28871b625b073f5d3 100644 (file)
@@ -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>
index 6e656ae4c9e986ca7d65a8134344ae8cfb2ae35d..6cd80a3fee16a8190d9496b2025541d7287ab990 100644 (file)
@@ -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", "&nbsp;").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);
        }
 }
index 748a3198b41e79e1c73c8382ec5cbe02f9597583..ea663a66a3a8adf8a297417cd7fb81fa20c8d0c7 100644 (file)
@@ -1599,6 +1599,54 @@ table.repositories tr.group td a {
        color: black;\r
 }\r
 \r
+table.tickets {        \r
+       border:1px solid #ddd;\r
+       border-spacing: 0px;\r
+       width: 100%;\r
+}\r
+\r
+table.tickets th {\r
+       padding: 4px;\r
+       border:0;\r
+}\r
+\r
+table.tickets th.right {       \r
+       border-right: 1px solid #ddd;   \r
+}      \r
+\r
+table.tickets td {\r
+       padding: 2px;\r
+       border-left: 0;\r
+}\r
+\r
+table.tickets td.rightAlign {  \r
+       text-align: right;\r
+       border-right: 1px solid #ddd;   \r
+}      \r
+\r
+table.tickets td.icon img {\r
+       vertical-align: top;\r
+}\r
+\r
+table.tickets tr.group {\r
+       background-color: #ccc;\r
+       border-left: 1px solid #ccc;\r
+       border-right: 1px solid #ccc;\r
+}\r
+\r
+table.tickets tr.group td {\r
+       font-weight: bold;              \r
+       color: black;\r
+       background-color: #ddd;\r
+       padding-left: 5px;\r
+       border-top: 1px solid #aaa;     \r
+       border-bottom: 1px solid #aaa; \r
+}\r
+\r
+table.tickets tr.group td a {\r
+       color: black;\r
+}\r
+\r
 table.palette { border:0; width: 0 !important; }\r
 table.palette td.header { \r
        font-weight: bold; \r