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

Commit

Permalink
use multi-file-upload widget on settings tab
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Apr 29, 2014
1 parent dbad9ba commit dbfc5b0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
19 changes: 19 additions & 0 deletions zanata-war/src/main/java/org/zanata/action/VersionHome.java
Expand Up @@ -348,6 +348,25 @@ public void copyProjectTypeFromProject() {
.getMessage("jsf.iteration.CopyProjectType.message"));
}

/**
* @return comma-separated list of accepted file extensions. May be an empty string
*/
public String getAcceptedSourceFileTypes() {
ProjectType type = getProjectType();
if (type == null) {
return "";
}
switch (type) {
case Gettext:
case Podir:
return "pot";
case File:
return "dtd, txt, idml, htm, html, odt, odp, ods, odg";
default:
return "";
}
}

private void updateProjectType() {
if (!StringUtils.isEmpty(selectedProjectType)
&& !selectedProjectType.equals("null")) {
Expand Down
Expand Up @@ -5,7 +5,7 @@
xmlns:rich="http://richfaces.org/rich"
xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:zanata="http://java.sun.com/jsf/composite/zanata">
xmlns:z="http://java.sun.com/jsf/composite/zanata">

<script type="text/javascript">
function onValidationOptionChange(validationId) {
Expand Down Expand Up @@ -154,13 +154,15 @@
<div class="panel">
<div class="panel__header">
<div class="panel__header__actions">
<a href="#" class="button button--snug l--push-top-half"
data-toggle="modal"
data-target="#modal-1" onclick="openUploadSourceDocPanel()"
title="#{messages['jsf.iteration.files.UploadNewSourceDocument']}">

<!-- This is the button to open the modal. -->
<z:multi-file-upload title="#{messages['jsf.iteration.files.UploadNewSourceDocument']}"
url="#{request.contextPath}/files/upload?p=#{versionHome.projectSlug}&amp;v=#{versionHome.slug}"
accepted="#{versionHome.acceptedSourceFileTypes}">
<i class="i i--plus"></i>
</a>
<zanata:sortlist id="settings-document_sorting"
</z:multi-file-upload>

<z:sortlist id="settings-document_sorting"
sortAction="#{versionHomeAction.sortSettingsDocumentList()}"
render="settings-document_form, settingsTabDocumentSearch-pager, settingsTabDocumentSearch-page-info, settingsTabDocumentSearchBottom-pager, settingsTabDocumentSearchBottom-page-info"
sortingList="#{versionHomeAction.settingsDocumentSortingList}"
Expand All @@ -172,7 +174,7 @@
</div>

<div class="panel__sub-header js-reveal">
<zanata:list-filter iconClass="i--document"
<z:list-filter iconClass="i--document"
status="settingsTab-documentsLoader"
listId="settings-document_form"
render="settings-document_form, settingsTabDocumentSearchBottom-pager, settingsTabDocumentSearchBottom-page-info"
Expand Down Expand Up @@ -231,7 +233,7 @@
</ui:repeat>
</ul>
</h:form>
<zanata:list-filter iconClass="i--document" listId="settings-document_form"
<z:list-filter iconClass="i--document" listId="settings-document_form"
render="settings-document_form, settingsTabDocumentSearch-pager, settingsTabDocumentSearch-page-info"
id="settingsTabDocumentSearchBottom" bottomPanel="true"
placeholder="#{messages['jsf.document.search.placeholder']}"
Expand All @@ -245,7 +247,7 @@

<h:form id="settings-languages-form" styleClass="l--push-bottom-0">

<zanata:checkbox onValueChanged="bindCustomizedLocales"
<z:checkbox onValueChanged="bindCustomizedLocales"
checked="#{!versionHome.instance.overrideLocales}"
value="inheritesLanguage"
label="#{messages['jsf.iteration.inheriteLanguage.label']}"
Expand All @@ -272,7 +274,7 @@
#{messages['jsf.AddALanguage']}
</label>

<zanata:autocomplete
<z:autocomplete
actionBean="#{versionHome.localeAutocomplete}"
maxlength="80" searchWhenFocus="true"
id="languageAutocomplete"
Expand All @@ -281,7 +283,7 @@
placeholder="#{messages['jsf.language.search.placeholder']}">
#{result.retrieveDisplayName()}<span
class="txt--understated l--push-left-quarter">[#{result.localeId}]</span>
</zanata:autocomplete>
</z:autocomplete>
</li>
</ul>
</s:fragment>
Expand All @@ -295,7 +297,7 @@
<h3 class="heading--secondary">#{messages['jsf.label.review']}</h3>

<div class="is-active" id="translation-review-form">
<zanata:checkbox
<z:checkbox
label="#{messages['jsf.iteration.requireTranslationReview']}"
onValueChanged="bindRequireReviewValue"
checked="#{versionHome.instance.requireTranslationReview}"
Expand Down Expand Up @@ -430,7 +432,7 @@
</s:div>
<s:div
styleClass="g__item w--2-3 l--push-top-half #{copyTransAction.inProgress? '': 'is-hidden'}">
<zanata:progressBar id="copy-trans-progress-bar"
<z:progressBar id="copy-trans-progress-bar"
actionBean="#{copyTransAction}"
render="copy-trans-progress-messages"
onCompleteRender="copy-trans"/>
Expand Down

0 comments on commit dbfc5b0

Please sign in to comment.