Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Display all locales in the project version page.
Browse files Browse the repository at this point in the history
Also make the highliting stronger when showing the user's language teams on that same page.
Reinstate chaching at the component level for methods that are called multiple times in a single page render.
  • Loading branch information
Carlos Munoz committed Aug 8, 2012
1 parent d3f3f90 commit a2616fa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 38 deletions.
Expand Up @@ -38,6 +38,8 @@
import org.joda.time.Period;
import org.joda.time.format.PeriodFormatter;
import org.joda.time.format.PeriodFormatterBuilder;
import org.zanata.annotation.CachedMethodResult;
import org.zanata.annotation.CachedMethods;
import org.zanata.common.EntityStatus;
import org.zanata.common.TransUnitWords;
import org.zanata.dao.ProjectIterationDAO;
Expand All @@ -60,6 +62,7 @@

@Name("viewAllStatusAction")
@Scope(ScopeType.PAGE)
@CachedMethods
public class ViewAllStatusAction implements Serializable
{
private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -111,8 +114,6 @@ public class ViewAllStatusAction implements Serializable

private String searchTerm;

private boolean showAllLocales = false;

private HProjectIteration projectIteration;

private List<HIterationGroup> searchResults;
Expand Down Expand Up @@ -195,6 +196,7 @@ public void validateIteration()
}
}

@CachedMethodResult
public List<Status> getAllStatus()
{
List<Status> result = new ArrayList<Status>();
Expand Down Expand Up @@ -240,17 +242,6 @@ public List<Status> getAllStatus()
return result;
}


public boolean getShowAllLocales()
{
return showAllLocales;
}

public void setShowAllLocales(boolean showAllLocales)
{
this.showAllLocales = showAllLocales;
}

public HProjectIteration getProjectIteration()
{
if (this.projectIteration == null)
Expand Down Expand Up @@ -419,14 +410,7 @@ private String formatTimePeriod( long durationInMillis )

private List<HLocale> getDisplayLocales()
{
if (this.showAllLocales || authenticatedAccount == null)
{
return localeServiceImpl.getSupportedLangugeByProjectIteration(this.projectSlug, this.iterationSlug);
}
else
{
return localeServiceImpl.getTranslation(projectSlug, iterationSlug, authenticatedAccount.getUsername());
}
return localeServiceImpl.getSupportedLangugeByProjectIteration(this.projectSlug, this.iterationSlug);
}

public List<HIterationGroup> getSearchResults()
Expand Down
3 changes: 1 addition & 2 deletions zanata-war/src/main/resources/messages.properties
Expand Up @@ -266,8 +266,7 @@ jsf.ImportJavaLocales=Import Java Locales
jsf.InvalidActivationKey=Invalid activation key
jsf.Version=Version
jsf.iteration.ShowAllLocales=Show All Locales
jsf.iteration.ShowAllLocales.title=Shows all available locales for this version (Teams for which you belong will be higlighted in yellow).
jsf.iteration.ShowAllLocales.title=Your teams will be <span class='highlighted_datatable_row'>highlighted</span> below.
jsf.iteration.CopyTrans=Copy Translations
jsf.iteration.CopyTrans.inProgress=Copy Trans in progress...
jsf.iteration.CopyTrans.noDocuments=Please add documents to this version first.
Expand Down
20 changes: 6 additions & 14 deletions zanata-war/src/main/webapp/iteration/view.xhtml
Expand Up @@ -57,15 +57,7 @@
<a4j:region id="langTableRegion">
<s:token allowMultiplePosts="true" />

<h:selectBooleanCheckbox id="show_all_locales"
value="#{viewAllStatusAction.showAllLocales}"
title="#{messages['jsf.iteration.ShowAllLocales.title']}"
rendered="#{identity.loggedIn}">
<a4j:support event="onclick"
ajaxSingle="true"
reRender="data_table"/>
</h:selectBooleanCheckbox>
<h:outputText value="#{messages['jsf.iteration.ShowAllLocales']}" rendered="#{identity.loggedIn}"/>
<h:outputText escape="false" value="#{messages['jsf.iteration.ShowAllLocales.title']}" rendered="#{identity.loggedIn}"/>
<rich:spacer width="10px;"/>
<br/>
<rich:spacer height="10px;"/>
Expand All @@ -74,7 +66,7 @@
value="#{viewAllStatusAction.getAllStatus().toArray()}" var="stats"
styleClass="iteration_inline_tribes" rowClasses="odd,even">
<rich:column sortBy="#{stats.locale}"
styleClass="#{viewAllStatusAction.showAllLocales and stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
styleClass="#{stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
<f:facet name="header">#{messages['jsf.Language']}</f:facet>
<h:outputLink rendered="#{identity.loggedIn}"
value="#{request.contextPath}/webtrans/Application.html"
Expand All @@ -89,7 +81,7 @@
rendered="#{not identity.loggedIn}" />
</rich:column>
<rich:column sortBy="#{stats.nativeName}"
styleClass="#{viewAllStatusAction.showAllLocales and stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
styleClass="#{stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
<f:facet name="header">#{messages['jsf.Name']}</f:facet>
<h:outputLink rendered="#{identity.loggedIn}"
value="#{request.contextPath}/webtrans/Application.html"
Expand All @@ -105,7 +97,7 @@
</rich:column>
<rich:column id="translate"
rendered="#{identity.loggedIn and not viewAllStatusAction.isIterationObsolete()}"
styleClass="#{viewAllStatusAction.showAllLocales and stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
styleClass="#{stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
<h:outputLink
rendered="#{not applicationConfiguration.debug and not viewAllStatusAction.isUserAllowedToTranslate(stats.locale) }"
value="#{request.contextPath}/webtrans/Application.html" styleClass="iteration_link">
Expand Down Expand Up @@ -150,7 +142,7 @@
</rich:column>
<rich:column id="files"
rendered="#{identity.loggedIn}"
styleClass="#{viewAllStatusAction.showAllLocales and stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
styleClass="#{stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
<s:link
view="/iteration/files.xhtml" propagation="none"
value="#{messages['jsf.Files']}" styleClass="iteration_link">
Expand All @@ -160,7 +152,7 @@
</s:link>
</rich:column>
<rich:column sortBy="#{stats.per}"
styleClass="#{viewAllStatusAction.showAllLocales and stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
styleClass="#{stats.userInLanguageTeam ? 'highlighted_datatable_row' : ''}">
<f:facet name="header">#{messages['jsf.iteration.stats.Percentage']}</f:facet>
<ui:param name="tstatus" value="#{stats.wordStats}" />
<ui:include src="../WEB-INF/layout/statsbar.xhtml">
Expand Down
2 changes: 1 addition & 1 deletion zanata-war/src/main/webapp/stylesheet/zanata.css
Expand Up @@ -1014,7 +1014,7 @@ a.version_link:hover {
}

.highlighted_datatable_row {
background-color: lightYellow;
background-color: #ffff00;
}
/* ----------------------- End project iteration CSS -------------------------*/

Expand Down

0 comments on commit a2616fa

Please sign in to comment.