From 31b2bbe4b252578b61759290ab71b15a31cb419e Mon Sep 17 00:00:00 2001 From: Alex Eng Date: Mon, 10 Feb 2014 15:23:15 +1000 Subject: [PATCH] Implement suggested changes from code review --- .../org/zanata/action/AbstractSortAction.java | 49 ++--- .../java/org/zanata/action/SortingType.java | 5 +- .../zanata/action/VersionGroupHomeAction.java | 70 +++---- .../src/main/resources/messages.properties | 1 + .../layout/version-group/languages-tab.xhtml | 72 +++---- .../main/webapp/WEB-INF/template/banner.xhtml | 5 +- .../webapp/WEB-INF/template/scripts.xhtml | 3 - .../script/component-autocomplete.js | 136 ------------- .../resources/script/components-script.js | 190 ++++++++++++++++++ .../main/webapp/resources/script/script.js | 70 ------- .../main/webapp/resources/zanata/loader.xhtml | 12 +- .../webapp/version-group/version_group.xhtml | 9 +- 12 files changed, 304 insertions(+), 318 deletions(-) delete mode 100644 zanata-war/src/main/webapp/resources/script/component-autocomplete.js create mode 100644 zanata-war/src/main/webapp/resources/script/components-script.js delete mode 100644 zanata-war/src/main/webapp/resources/script/script.js diff --git a/zanata-war/src/main/java/org/zanata/action/AbstractSortAction.java b/zanata-war/src/main/java/org/zanata/action/AbstractSortAction.java index c9b0d6d729..133f693a45 100644 --- a/zanata-war/src/main/java/org/zanata/action/AbstractSortAction.java +++ b/zanata-war/src/main/java/org/zanata/action/AbstractSortAction.java @@ -22,26 +22,25 @@ package org.zanata.action; -import com.google.common.collect.Lists; import lombok.AllArgsConstructor; import lombok.Getter; -import lombok.Setter; -import org.zanata.model.HLocale; -import org.zanata.service.VersionLocaleKey; + import org.zanata.ui.model.statistic.WordStatistic; import org.zanata.util.StatisticsUtil; -import java.util.Comparator; +import com.google.common.collect.Lists; /** * @author Alex Eng aeng@redhat.com + * + * Action Handler for sort component - sortlist.xhtml */ public abstract class AbstractSortAction { // reset all page cached statistics abstract void resetPageData(); - abstract protected void loadStatistic(); + abstract protected void loadStatistics(); abstract String getMessage(String key, Object... args); @@ -56,28 +55,30 @@ protected DisplayUnit getDisplayUnit(SortingType.SortOption sortOption, WordStatistic statistic) { DisplayUnit displayUnit; - if (sortOption.equals(SortingType.SortOption.HOURS)) { + switch (sortOption) { + case HOURS: displayUnit = new DisplayUnit("", StatisticsUtil.formatHours(statistic .getRemainingHours()), getMessage("jsf.stats.HoursRemaining")); - } else if (sortOption.equals(SortingType.SortOption.WORDS)) { + break; + + case WORDS: displayUnit = new DisplayUnit("", String.valueOf(statistic .getUntranslated()), getMessage("jsf.Words")); - } else { + break; + + default: String figure = StatisticsUtil.formatPercentage(statistic .getPercentTranslated()) + "%"; - if (statistic.getPercentTranslated() == 0) { - displayUnit = - new DisplayUnit("txt--neutral", figure, - getMessage("jsf.Translated")); - } else { - displayUnit = - new DisplayUnit("txt--success", figure, - getMessage("jsf.Translated")); - } + String style = + statistic.getPercentTranslated() == 0 ? "txt--neutral" + : "txt--success"; + displayUnit = + new DisplayUnit(style, figure, getMessage("jsf.Translated")); + break; } return displayUnit; } @@ -92,17 +93,19 @@ public final class DisplayUnit { public int compareWordStatistic(WordStatistic stats1, WordStatistic stats2, SortingType.SortOption sortOption) { - if (sortOption.equals(SortingType.SortOption.HOURS)) { + switch (sortOption) { + case HOURS: return Double.compare(stats1.getRemainingHours(), stats2.getRemainingHours()); - } else if (sortOption.equals(SortingType.SortOption.PERCENTAGE)) { + + case PERCENTAGE: return Double.compare(stats1.getPercentTranslated(), stats2.getPercentTranslated()); - - } else if (sortOption.equals(SortingType.SortOption.WORDS)) { + case WORDS: return Double.compare(stats1.getUntranslated(), stats2.getUntranslated()); + default: + return 0; } - return 0; } } diff --git a/zanata-war/src/main/java/org/zanata/action/SortingType.java b/zanata-war/src/main/java/org/zanata/action/SortingType.java index 70c97c78ee..74f810e394 100644 --- a/zanata-war/src/main/java/org/zanata/action/SortingType.java +++ b/zanata-war/src/main/java/org/zanata/action/SortingType.java @@ -33,8 +33,9 @@ public void setSelectedSortOption(SortOption selectedSortOption) { } public enum SortOption { - PERCENTAGE("%"), HOURS("hours"), WORDS("words"), ALPHABETICAL( - "alphabetical"); + PERCENTAGE("percent translated"), HOURS("hours remaining"), WORDS( + "words remaining"), ALPHABETICAL("alphabetical"), LAST_UPDATED( + "last updated"), LAST_TRANSLATED("last translated"); @Getter String display; diff --git a/zanata-war/src/main/java/org/zanata/action/VersionGroupHomeAction.java b/zanata-war/src/main/java/org/zanata/action/VersionGroupHomeAction.java index ca06df06c2..26db17a657 100644 --- a/zanata-war/src/main/java/org/zanata/action/VersionGroupHomeAction.java +++ b/zanata-war/src/main/java/org/zanata/action/VersionGroupHomeAction.java @@ -27,8 +27,12 @@ import java.util.List; import java.util.Map; import java.util.Set; + import javax.annotation.Nullable; +import lombok.Getter; +import lombok.Setter; + import org.apache.commons.lang.StringUtils; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.In; @@ -48,14 +52,12 @@ import org.zanata.ui.model.statistic.WordStatistic; import org.zanata.util.StatisticsUtil; import org.zanata.util.ZanataMessages; + import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -import lombok.Getter; -import lombok.Setter; - /** * @author Alex Eng aeng@redhat.com */ @@ -127,7 +129,7 @@ public class VersionGroupHomeAction extends AbstractSortAction implements public void setPageRendered(boolean pageRendered) { if (pageRendered) { - loadStatistic(); + loadStatistics(); } this.pageRendered = pageRendered; } @@ -176,17 +178,15 @@ public int compare(HLocale compareFrom, HLocale compareTo) { selectedVersionId, item2.getLocaleId())); } - if (selectedSortOption - .equals(SortingType.SortOption.PERCENTAGE)) { + switch (selectedSortOption) { + case PERCENTAGE: return Double.compare( wordStatistic1.getPercentTranslated(), wordStatistic2.getPercentTranslated()); - } else if (selectedSortOption - .equals(SortingType.SortOption.HOURS)) { + case HOURS: return Double.compare(wordStatistic1.getRemainingHours(), wordStatistic2.getRemainingHours()); - } else if (selectedSortOption - .equals(SortingType.SortOption.WORDS)) { + case WORDS: return Double.compare(wordStatistic1.getUntranslated(), wordStatistic2.getUntranslated()); } @@ -239,23 +239,17 @@ public int compare(HProjectIteration compareFrom, wordStatistic2 = getStatisticForProject(item2.getId()); } - if (selectedSortOption - .equals(SortingType.SortOption.PERCENTAGE)) { + switch (selectedSortOption) { + case PERCENTAGE: return Double.compare( wordStatistic1.getPercentTranslated(), wordStatistic2.getPercentTranslated()); - } else if (selectedSortOption - .equals(SortingType.SortOption.HOURS)) { + case HOURS: return Double.compare(wordStatistic1.getRemainingHours(), wordStatistic2.getRemainingHours()); - } else if (selectedSortOption - .equals(SortingType.SortOption.WORDS)) { - if (wordStatistic1.getUntranslated() == wordStatistic2 - .getUntranslated()) { - return 0; - } - return wordStatistic1.getTotal() > wordStatistic2 - .getTotal() ? 1 : -1; + case WORDS: + return Double.compare(wordStatistic1.getUntranslated(), + wordStatistic2.getUntranslated()); } } else { return item1.getProject().getName().toLowerCase() @@ -331,13 +325,13 @@ public List getActiveLocales() { } public List getFilteredLocales() { - List list = getActiveLocales(); + List unfiltered = getActiveLocales(); if (StringUtils.isEmpty(languageQuery)) { - return list; + return unfiltered; } Collection filtered = - Collections2.filter(list, new Predicate() { + Collections2.filter(unfiltered, new Predicate() { @Override public boolean apply(@Nullable HLocale input) { return input.retrieveDisplayName().toLowerCase() @@ -487,7 +481,7 @@ public boolean isLocaleActivatedInVersion(HProjectIteration version, * group. */ @Override - protected void loadStatistic() { + protected void loadStatistics() { statisticMap = Maps.newHashMap(); for (HLocale locale : getActiveLocales()) { @@ -515,20 +509,22 @@ public List getProjectIterations() { } public List getFilteredProjectIterations() { - List list = getProjectIterations(); + List unfiltered = getProjectIterations(); if (StringUtils.isEmpty(projectQuery)) { - return list; + return unfiltered; } Collection filtered = - Collections2.filter(list, new Predicate() { - @Override - public boolean apply(@Nullable HProjectIteration input) { - HProject project = input.getProject(); - return project.getName().toLowerCase() - .contains(projectQuery.toLowerCase()); - } - }); + Collections2.filter(unfiltered, + new Predicate() { + @Override + public boolean apply( + @Nullable HProjectIteration input) { + HProject project = input.getProject(); + return project.getName().toLowerCase() + .contains(projectQuery.toLowerCase()); + } + }); return Lists.newArrayList(filtered); } @@ -540,7 +536,7 @@ public void resetPageData() { selectedLocale = null; selectedVersion = null; missingLocaleVersionMap = null; - loadStatistic(); + loadStatistics(); } @Override diff --git a/zanata-war/src/main/resources/messages.properties b/zanata-war/src/main/resources/messages.properties index 6c036624f2..1297f619a0 100644 --- a/zanata-war/src/main/resources/messages.properties +++ b/zanata-war/src/main/resources/messages.properties @@ -627,6 +627,7 @@ jsf.ServerConfiguration=Server Configuration jsf.ManageUsers=Manage Users jsf.ManageRoles=Manage Roles jsf.ManageLanguage=Manage Languages +jsf.ManageProjects=Manage Projects jsf.ManageSearch=Manage Search jsf.OverallStatistics=Overall Statistics jsf.RoleAssignmentRules=Role Assignment Rules diff --git a/zanata-war/src/main/webapp/WEB-INF/layout/version-group/languages-tab.xhtml b/zanata-war/src/main/webapp/WEB-INF/layout/version-group/languages-tab.xhtml index cc808db8fa..e802f4d9ce 100644 --- a/zanata-war/src/main/webapp/WEB-INF/layout/version-group/languages-tab.xhtml +++ b/zanata-war/src/main/webapp/WEB-INF/layout/version-group/languages-tab.xhtml @@ -48,8 +48,8 @@
- #{versionGroupHomeAction.activeLocales.size()} + #{versionGroupHomeAction.activeLocales.size()} @@ -84,28 +84,28 @@ styleClass="bx--block">
- - #{hLocale.retrieveDisplayName()} - - #{versionGroupHomeAction.getMissingVersion(hLocale.localeId).size()} - - + + #{hLocale.retrieveDisplayName()} + + #{versionGroupHomeAction.getMissingVersion(hLocale.localeId).size()} + +
- - - #{displayUnit.figure} - - - #{displayUnit.unit} - - + + + #{displayUnit.figure} + + + #{displayUnit.unit} + +
@@ -191,28 +191,28 @@

#{version.project.name}

- - #{version.slug} + + #{version.slug} - - #{messages['jsf.Missing']} - - + + #{messages['jsf.Missing']} + +
- - - #{displayUnit.figure} - - - #{displayUnit.unit} - - + + + #{displayUnit.figure} + + + #{displayUnit.unit} + +
diff --git a/zanata-war/src/main/webapp/WEB-INF/template/banner.xhtml b/zanata-war/src/main/webapp/WEB-INF/template/banner.xhtml index 016eff099b..9ef4375a7f 100644 --- a/zanata-war/src/main/webapp/WEB-INF/template/banner.xhtml +++ b/zanata-war/src/main/webapp/WEB-INF/template/banner.xhtml @@ -4,11 +4,10 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.org/schema/seam/taglib" xmlns:rich="http://richfaces.org/rich" - xmlns:zanata="http://java.sun.com/jsf/composite/zanata" - xmlns:a4j="http://richfaces.org/a4j"> + xmlns:zanata="http://java.sun.com/jsf/composite/zanata"> + src="#{request.contextPath}/resources/script/components-script.js"> - - diff --git a/zanata-war/src/main/webapp/resources/script/component-autocomplete.js b/zanata-war/src/main/webapp/resources/script/component-autocomplete.js deleted file mode 100644 index 960e51a2e0..0000000000 --- a/zanata-war/src/main/webapp/resources/script/component-autocomplete.js +++ /dev/null @@ -1,136 +0,0 @@ -/* - * - * * Copyright 2013, 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. - */ - -jQuery(document).ready(function() { - jQuery(this).click(function(event) { - if (jQuery(event.target).attr("class") != 'autocomplete__results') { - jQuery('.autocomplete__results').remove(); - } - }); - - //prevent form submit when enter key pressed in the input field. - jQuery('.autocomplete__input').keydown(function(event) { - if (isEnterKey(event)) { - event.preventDefault(); - } - }); -}); - -function onResultKeyPressed(autocomplete, event, selectItemAction, - selectItemFunction) { - var currentSelected = jQuery(autocomplete).find('.autocomplete__results') - .children('.is-selected'); - - if (isEnterKey(event)) { - event.preventDefault(); - if (currentSelected.length != 0) { - onSelectItem(currentSelected, selectItemAction, selectItemFunction); - } - } else if (event.keyCode == 40) { - // key: down - deselectRow(currentSelected); - if (currentSelected.length == 0 - || jQuery(currentSelected).next().length == 0) { - selectRow(jQuery(autocomplete).find('.autocomplete__results').children( - 'li').first()); - } else { - selectRow(jQuery(currentSelected).next("li")); - } - } else if (event.keyCode == 38) { - // key: up - deselectRow(currentSelected); - if (currentSelected.length == 0) { - selectRow(jQuery(autocomplete).find('.autocomplete__results').children( - 'li').last()); - } else { - selectRow(jQuery(currentSelected).prev("li")); - } - } -} - -function onSelectItem(row, selectItemAction, selectItemFunction) { - selectItemAction(jQuery(row).children("input").first().val()); - if (selectItemFunction) { - selectItemFunction(row); - } - jQuery(row).parent().parent().parent().children("input").first().val(""); - jQuery(row).parent().remove(); -} - -function selectRow(row) { - jQuery(row).addClass("is-selected"); -} - -function deselectRow(row) { - jQuery(row).removeClass("is-selected"); -} - -function isArrowKey(keyCode) { - return keyCode == 38 || keyCode == 40 || keyCode == 39 || keyCode == 37; -} - -function isEnterKey(event) { - return event.keyCode == 13; -} - -function onInputFocus(inputField, renderResultFn) { - if (jQuery(inputField).next('input').next('input').val() == 'true') { - renderResultFn(jQuery(inputField).val()); - } -} - -function onValueChange(inputField, event, renderResultFn) { - if (!isArrowKey(event.keyCode)) { - var minLength = parseInt(jQuery(inputField).next().val()); - if (jQuery(inputField).val().length >= minLength) { - renderResultFn(jQuery(inputField).val()); - } - } -} - -function registerMouseEvent(autocompleteId, selectItemAction, - selectItemFunction) { - jQuery("[id='" + autocompleteId + "']").find('.autocomplete__results') - .children('.autocomplete__result').each(function() { - jQuery(this).mouseover(function() { - selectRow(this); - }); - - jQuery(this).mouseout(function() { - deselectRow(this); - }); - - jQuery(this).click(function() { - onSelectItem(this, selectItemAction, selectItemFunction); - }); - }); - - var firstResult = jQuery("[id='" + autocompleteId + "']").find( - '.autocomplete__results').children('.autocomplete__result').first(); - if (firstResult.length != 0) { - selectRow(firstResult); - } -} - -function filterList(input, filterFn) { - filterFn(jQuery(input).val()); -} diff --git a/zanata-war/src/main/webapp/resources/script/components-script.js b/zanata-war/src/main/webapp/resources/script/components-script.js new file mode 100644 index 0000000000..df02657603 --- /dev/null +++ b/zanata-war/src/main/webapp/resources/script/components-script.js @@ -0,0 +1,190 @@ +jQuery(document).ready(function() { + registerJsTab(); +}); + +function registerJsTab() { + jQuery('.js-tab').each(function() { + jQuery(this).click(function() { + onTabClick(this); + }); + }); +} + +function onTabClick(tab) { + jQuery(tab).parent().siblings("li").children("a").removeClass('is-active'); + jQuery(tab).addClass("is-active"); + jQuery(tab).parents('.tabs--lined').children('.tabs__content') + .children('div').addClass('is-hidden'); + jQuery(jQuery(tab).attr('href') + '_content').removeClass('is-hidden'); +} + +function checkHashUrl(defaultTabId, defaultSettingsTabId) { + var originalHashUrl = window.location.hash; + + if (window.location.hash) { + if (window.location.hash.substring(0, 9) == '#settings') { + window.location.hash = "#settings"; + } + + if (elementExists(window.location.hash + "_tab")) { + defaultTabId = window.location.hash + "_tab"; + } + } + onTabClick(defaultTabId); + window.location.hash = defaultTabId.replace("_tab", ""); + + if (window.location.hash.substring(0, 9) == "#settings") { + handleSettingsTab(defaultSettingsTabId, originalHashUrl); + } +} + +function handleSettingsTab(defaultSettingsTabId, hashUrl) { + var selectedSettingsTabId = defaultSettingsTabId; + if (elementExists(hashUrl)) { + selectedSettingsTabId = hashUrl + "_tab"; + } + jQuery(selectedSettingsTabId)[0].click(); +} + +function elementExists(hashId) { + return jQuery(hashId).length != 0; +} + +function updateActiveRow(clickedElement) { + var parent = jQuery(clickedElement).parent(); + + jQuery(parent).siblings("li").removeClass('is-active'); + jQuery(parent).siblings("li").children("a").removeClass('is-active'); + + jQuery(clickedElement).addClass("is-active"); + jQuery(parent).addClass('is-active'); +} + +function toggleColumn(tabId) { + jQuery('#' + tabId).find('.panels--2').toggleClass('panel__active-2'); +} + +function removeActiveRows(listId) { + jQuery('#' + listId).children('li').removeClass('is-active'); + jQuery('#' + listId).children('li').children("a").removeClass('is-active'); +} + +/* ----------------------------------------------------------- */ +/*----------------zanata-autocomplete component----------------*/ +/* ----------------------------------------------------------- */ + +jQuery(document).ready(function() { + jQuery(this).click(function(event) { + if (jQuery(event.target).attr("class") != 'autocomplete__results') { + jQuery('.autocomplete__results').remove(); + } + }); + + //prevent form submit when enter key pressed in the input field. + jQuery('.autocomplete__input').keydown(function(event) { + if (isEnterKey(event)) { + event.preventDefault(); + } + }); +}); + +function onResultKeyPressed(autocomplete, event, selectItemAction, + selectItemFunction) { + var currentSelected = jQuery(autocomplete).find('.autocomplete__results') + .children('.is-selected'); + + if (isEnterKey(event)) { + event.preventDefault(); + if (currentSelected.length != 0) { + onSelectItem(currentSelected, selectItemAction, selectItemFunction); + } + } else if (event.keyCode == 40) { + // key: down + deselectRow(currentSelected); + if (currentSelected.length == 0 + || jQuery(currentSelected).next().length == 0) { + selectRow(jQuery(autocomplete).find('.autocomplete__results').children( + 'li').first()); + } else { + selectRow(jQuery(currentSelected).next("li")); + } + } else if (event.keyCode == 38) { + // key: up + deselectRow(currentSelected); + if (currentSelected.length == 0) { + selectRow(jQuery(autocomplete).find('.autocomplete__results').children( + 'li').last()); + } else { + selectRow(jQuery(currentSelected).prev("li")); + } + } +} + +function onSelectItem(row, selectItemAction, selectItemFunction) { + selectItemAction(jQuery(row).children("input").first().val()); + if (selectItemFunction) { + selectItemFunction(row); + } + jQuery(row).parent().parent().parent().children("input").first().val(""); + jQuery(row).parent().remove(); +} + +function selectRow(row) { + jQuery(row).addClass("is-selected"); +} + +function deselectRow(row) { + jQuery(row).removeClass("is-selected"); +} + +function isArrowKey(keyCode) { + return keyCode == 38 || keyCode == 40 || keyCode == 39 || keyCode == 37; +} + +function isEnterKey(event) { + return event.keyCode == 13; +} + +function onInputFocus(inputField, renderResultFn) { + if (jQuery(inputField).next('input').next('input').val() == 'true') { + renderResultFn(jQuery(inputField).val()); + } +} + +function onValueChange(inputField, event, renderResultFn) { + if (!isArrowKey(event.keyCode)) { + var minLength = parseInt(jQuery(inputField).next().val()); + if (jQuery(inputField).val().length >= minLength) { + renderResultFn(jQuery(inputField).val()); + } + } +} + +function registerMouseEvent(autocompleteId, selectItemAction, + selectItemFunction) { + jQuery("[id='" + autocompleteId + "']").find('.autocomplete__results') + .children('.autocomplete__result').each(function() { + jQuery(this).mouseover(function() { + selectRow(this); + }); + + jQuery(this).mouseout(function() { + deselectRow(this); + }); + + jQuery(this).click(function() { + onSelectItem(this, selectItemAction, selectItemFunction); + }); + }); + + var firstResult = jQuery("[id='" + autocompleteId + "']").find( + '.autocomplete__results').children('.autocomplete__result').first(); + if (firstResult.length != 0) { + selectRow(firstResult); + } +} + +function filterList(input, filterFn) { + filterFn(jQuery(input).val()); +} + diff --git a/zanata-war/src/main/webapp/resources/script/script.js b/zanata-war/src/main/webapp/resources/script/script.js deleted file mode 100644 index 35369d1162..0000000000 --- a/zanata-war/src/main/webapp/resources/script/script.js +++ /dev/null @@ -1,70 +0,0 @@ -jQuery(document).ready(function() { - registerJsTab(); -}); - -function registerJsTab() { - jQuery('.js-tab').each(function() { - jQuery(this).click(function() { - onTabClick(this); - }); - }); -} - -function onTabClick(tab) { - jQuery(tab).parent().siblings("li").children("a").removeClass('is-active'); - jQuery(tab).addClass("is-active"); - jQuery(tab).parents('.tabs--lined').children('.tabs__content') - .children('div').addClass('is-hidden'); - jQuery(jQuery(tab).attr('href') + '_content').removeClass('is-hidden'); -} - -function checkHashUrl(defaultTabId, defaultSettingsTabId) { - var originalHashUrl = window.location.hash; - - if (window.location.hash) { - if (window.location.hash.substring(0, 9) == '#settings') { - window.location.hash = "#settings"; - } - - if (elementExist(window.location.hash + "_tab")) { - defaultTabId = window.location.hash + "_tab"; - } - } - onTabClick(defaultTabId); - window.location.hash = defaultTabId.replace("_tab", ""); - - if (window.location.hash.substring(0, 9) == "#settings") { - handleSettingsTab(defaultSettingsTabId, originalHashUrl); - } -} - -function handleSettingsTab(defaultSettingsTabId, hashUrl) { - var selectedSettingsTabId = defaultSettingsTabId; - if (elementExist(hashUrl)) { - selectedSettingsTabId = hashUrl + "_tab"; - } - jQuery(selectedSettingsTabId)[0].click(); -} - -function elementExist(hashId) { - return jQuery(hashId).length != 0; -} - -function updateActiveRow(clickedElement) { - var parent = jQuery(clickedElement).parent(); - - jQuery(parent).siblings("li").removeClass('is-active'); - jQuery(parent).siblings("li").children("a").removeClass('is-active'); - - jQuery(clickedElement).addClass("is-active"); - jQuery(parent).addClass('is-active'); -} - -function toggleColumn(tabId) { - jQuery('#' + tabId).find('.panels--2').toggleClass('panel__active-2'); -} - -function removeActiveRows(listId) { - jQuery('#' + listId).children('li').removeClass('is-active'); - jQuery('#' + listId).children('li').children("a").removeClass('is-active'); -} diff --git a/zanata-war/src/main/webapp/resources/zanata/loader.xhtml b/zanata-war/src/main/webapp/resources/zanata/loader.xhtml index 615a8adfbb..52f4879d35 100644 --- a/zanata-war/src/main/webapp/resources/zanata/loader.xhtml +++ b/zanata-war/src/main/webapp/resources/zanata/loader.xhtml @@ -5,11 +5,19 @@ xmlns:s="http://jboss.org/schema/seam/taglib"> - + + + + + + + + + diff --git a/zanata-war/src/main/webapp/version-group/version_group.xhtml b/zanata-war/src/main/webapp/version-group/version_group.xhtml index 79ce077e21..c702b7c8e4 100644 --- a/zanata-war/src/main/webapp/version-group/version_group.xhtml +++ b/zanata-war/src/main/webapp/version-group/version_group.xhtml @@ -55,7 +55,7 @@

- +

#{messages['jsf.TotalSourceContains']} @@ -84,11 +84,8 @@ -

- -
+