This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rhbz1066756 - Hide dashboard layout files.
Also hide projects tab when no projects are maintained by the logged in user.
- Loading branch information
Carlos A. Munoz
committed
Apr 4, 2014
1 parent
93aeeca
commit afefadf
Showing
11 changed files
with
354 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
zanata-war/src/main/java/org/zanata/action/helper/PagedDataHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Copyright 2014, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.action.helper; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Helper class to assist with the paging of data. | ||
* | ||
* @author Carlos Munoz <a href="mailto:camunoz@redhat.com">camunoz@redhat.com</a> | ||
* @see org.zanata.action.PagedListDataModel | ||
*/ | ||
public abstract class PagedDataHandler<T> { | ||
|
||
@Getter | ||
@Setter | ||
private int pageSize = 10; | ||
|
||
@Getter | ||
@Setter | ||
private int pageNumber = 1; | ||
|
||
private List<T> currentPageData; | ||
|
||
private long totalRecords = -1L; | ||
|
||
public void nextPage() { | ||
if(allowsNextPage()) { | ||
pageNumber++; | ||
reset(); | ||
} | ||
} | ||
|
||
public void prevPage() { | ||
if(allowsPrevPage()) { | ||
pageNumber--; | ||
reset(); | ||
} | ||
} | ||
|
||
public long getCurrentPageFirstRecord() { | ||
return (pageNumber-1) * pageSize; | ||
} | ||
|
||
public boolean allowsNextPage() { | ||
return getTotalRecords() < pageNumber * pageSize; | ||
} | ||
|
||
public boolean allowsPrevPage() { | ||
return pageNumber > 1; | ||
} | ||
|
||
public List<T> getCurrentPageData() { | ||
if( currentPageData == null ) { | ||
currentPageData = fetchCurrentPage(); | ||
} | ||
return currentPageData; | ||
} | ||
|
||
public long getTotalRecords() { | ||
if( totalRecords < 0 ) { | ||
totalRecords = fetchTotalRecords(); | ||
} | ||
return totalRecords; | ||
} | ||
|
||
private void reset() { | ||
currentPageData = null; | ||
totalRecords = -1L; | ||
} | ||
|
||
protected abstract List<T> fetchCurrentPage(); | ||
|
||
protected abstract long fetchTotalRecords(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
111 changes: 111 additions & 0 deletions
111
zanata-war/src/main/webapp/WEB-INF/layout/dashboard/projects.xhtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<ui:composition xmlns="http://www.w3.org/1999/xhtml" | ||
xmlns:s="http://jboss.org/schema/seam/taglib" | ||
xmlns:ui="http://java.sun.com/jsf/facelets" | ||
xmlns:f="http://java.sun.com/jsf/core" | ||
xmlns:h="http://java.sun.com/jsf/html" | ||
xmlns:rich="http://richfaces.org/rich" | ||
xmlns:a4j="http://richfaces.org/a4j" | ||
xmlns:zanata="http://java.sun.com/jsf/composite/zanata"> | ||
|
||
<a4j:jsFunction name="nextProjectPage" | ||
render="projectListForm" action="#{dashboardAction.projectList.nextPage}" | ||
status="projectlist-loader"/> | ||
|
||
<a4j:jsFunction name="prevProjectPage" | ||
render="projectListForm" action="#{dashboardAction.projectList.prevPage}" | ||
status="projectlist-loader"/> | ||
|
||
<div class="panel"> | ||
<div class="tabs--accent"> | ||
<!-- Nav content goes here <nav></nav>--> | ||
<div class="tabs__content"> | ||
<header class="panel__sub-header"> | ||
<!-- Header panel options go here --> | ||
<h2 class="panel__heading"> | ||
Maintained Projects | ||
</h2> | ||
</header> | ||
<h:form id="projectListForm"> | ||
<div class="panel__sub-header js-reveal"> | ||
<!-- Search panel goes here --> | ||
<div class="panel__results"> | ||
<div class="panel__results__type"> | ||
<i class="i i--document txt--neutral"></i> | ||
</div> | ||
<ul class="panel__pager"> | ||
<li> | ||
<button class="panel__pager__button" | ||
onclick="prevProjectPage(); return false;"> | ||
<i class="i--huge i--arrow-left"></i> | ||
</button> | ||
</li> | ||
<li> | ||
<button title="Next" class="panel__pager__button" | ||
onclick="nextProjectPage(); return false;"> | ||
<i class="i--huge i--arrow-right"></i> | ||
</button> | ||
</li> | ||
</ul> | ||
<span class="txt--meta"><strong>#{dashboardAction.projectListPageStart}-#{dashboardAction.projectListPageEnd}</strong> of #{dashboardAction.projectList.totalRecords} | ||
<!-- Search buttons go here --> | ||
</span> | ||
</div> | ||
</div> | ||
<ul class="list--stats"> | ||
<ui:repeat value="#{dashboardAction.projectList.currentPageData}" var="project"> | ||
<li class="list__item--actionable"> | ||
<div class="list__item__action"> | ||
<div class="dropdown dropdown--small dropdown--inline dropdown--single list__item__dropdown js-dropdown"> | ||
<a class="dropdown__toggle js-dropdown__toggle txt--meta" title="Project Versions" href="#"><span class="is-invisible">Translate Options</span></a> | ||
<ul class="dropdown__content js-dropdown__content"> | ||
<li class="dropdown__header"><span class="txt--meta"><i class="i i--version i__item__icon"></i> Versions</span></li> | ||
<ui:repeat value="#{project.projectIterations}" var="version"> | ||
<li><a href="#">#{version.slug}</a></li> | ||
</ui:repeat> | ||
<li><a href="#">All versions</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
<a href="#"> | ||
<div class="list__item__content"> | ||
<div class="list__item__info"> | ||
<h3 class="list__title bx--inline-block">#{project.name}</h3> | ||
<p class="list__item__meta">#{project.description}</p> | ||
</div> | ||
<div class="list__item__stats"> | ||
<span class="stats--mini" title="#{dashboardAction.getLastUpdatedTime(project)}"> | ||
<span class="stats__figure">#{dashboardAction.getLastUpdatedTimeLapseMessage(project)}</span> | ||
<span class="stats__unit"><!-- Last updated by goes here --></span> | ||
</span> | ||
</div> | ||
</div> | ||
</a> | ||
</li> | ||
</ui:repeat> | ||
</ul> | ||
<div class="panel__results"> | ||
<div class="panel__results__type"> | ||
<i class="i i--document txt--neutral"></i> | ||
</div> | ||
<ul class="panel__pager"> | ||
<li> | ||
<button class="panel__pager__button" | ||
onclick="prevProjectPage(); return false;"> | ||
<i class="i--huge i--arrow-left"></i> | ||
</button> | ||
</li> | ||
<li> | ||
<button title="Next" class="panel__pager__button" | ||
onclick="nextProjectPage(); return false;"> | ||
<i class="i--huge i--arrow-right"></i> | ||
</button> | ||
</li> | ||
</ul> | ||
<span class="txt--meta"><strong>#{dashboardAction.projectListPageStart}-#{dashboardAction.projectListPageEnd}</strong> of #{dashboardAction.projectList.totalRecords}</span> | ||
</div> | ||
</h:form> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</ui:composition> |
Oops, something went wrong.