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

Commit

Permalink
avoid inadvertant setting of project type in project and version edit…
Browse files Browse the repository at this point in the history
… forms
  • Loading branch information
davidmason committed Feb 22, 2013
1 parent 9922873 commit 2e9a156
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
9 changes: 9 additions & 0 deletions zanata-war/src/main/java/org/zanata/action/SlugHome.java
Expand Up @@ -94,6 +94,7 @@ public List<SelectItem> getProjectTypeList()
{
if (projectTypeList.isEmpty())
{
projectTypeList.add(new SelectItem(null, getMessages().get("jsf.projectType.NoSelection")));
for (ProjectType projectType : ProjectType.values())
{
SelectItem option = new SelectItem(projectType, projectType.name());
Expand All @@ -105,6 +106,14 @@ public List<SelectItem> getProjectTypeList()
@Override
public int compare(SelectItem o1, SelectItem o2)
{
if (o1.getValue() == null)
{
return -1;
}
if (o2.getValue() == null)
{
return 1;
}
return o1.getLabel().compareTo(o2.getLabel());
}
});
Expand Down
7 changes: 6 additions & 1 deletion zanata-war/src/main/resources/messages.properties
Expand Up @@ -493,7 +493,6 @@ jsf.profile.MergeAccount.confirm=Do It
jsf.profile.MergeAccount.confirmationMessage=You are about to merge in the following account:<br/><br/>Username: #{accountMergeAction.obsoleteAccount.username}<br/>Name: #{accountMergeAction.obsoleteAccount.person.name}<br/>Email: #{accountMergeAction.obsoleteAccount.person.email}<br/><br/>This change is permanent and cannot be taken back.<br/><br/>The account mentioned above will be inactivated and all of its permissions revoked. Your current account will inherit all these permissions.<br/><br/><b>Are you sure you want to do this?</b>
jsf.profile.MergeAccount.info=Log in to the account you want to merge. You will need to use one of the authentication methods offered below. You will be asked for further confirmation after this.

jsf.projectType=Project Type
jsf.project.CopyTransOpts.linkTitle=Copy Trans Options
jsf.project.CopyTransOpts.saved=Copy Trans options saved.
jsf.project.CopyTransOpts.title=Copy Trans Options
Expand All @@ -508,6 +507,12 @@ jsf.Project=Project
jsf.ProjectName=Project Name
jsf.ProjectMaintainers=Project Maintainers
jsf.Projects=Projects
jsf.projectType=Project Type
jsf.projectType.Description=Determines how the project is treated for upload and download by clients or through the website.
jsf.projectType.DefaultBehaviour=The default type will be applied to versions under this project that do not specify their own type.
jsf.projectType.NotSpecifiedBehaviour=If no project type is specified, the type from containing project is used.
jsf.projectType.MoreInfo=For more information, see https://github.com/zanata/zanata/wiki/Project-Types
jsf.projectType.NoSelection=-- No selection --
jsf.ProjectId=Project ID
jsf.ProjectIdExample=Example: my-project
jsf.ProjectVersionId=Version ID
Expand Down
Expand Up @@ -21,14 +21,22 @@
<a4j:support event="onblur" reRender="slugField" ajaxSingle="true"/>
</h:inputText>
</s:decorate>

<s:decorate id="projectTypeField" template="edit.xhtml">
<ui:define name="label">#{messages['jsf.projectType']}</ui:define>
<h:selectOneMenu id="projectType" value="#{projectIterationHome.projectType}">
<f:selectItems value="#{projectIterationHome.projectTypeList}"/>
</h:selectOneMenu>
<s:span styleClass="icon-info-circle-2 input_help" id="projectTypeHelp">
<rich:toolTip>
#{messages['jsf.projectType.Description']}<br/>
#{messages['jsf.projectType.NotSpecifiedBehaviour']}<br/>
<br/>
<em>#{messages['jsf.projectType.MoreInfo']}</em><br/>
</rich:toolTip>
</s:span>
</s:decorate>

<s:decorate id="statusField" template="edit.xhtml">
<ui:define name="label">#{messages['jsf.Status']}</ui:define>
<h:selectOneMenu id="status" value="#{projectIterationHome.instance.status}">
Expand Down
14 changes: 11 additions & 3 deletions zanata-war/src/main/webapp/WEB-INF/layout/project_edit_form.xhtml
Expand Up @@ -38,12 +38,20 @@
<h:inputText id="description" required="false"
value="#{projectHome.instance.description}" style="width:400px;"/>
</s:decorate>

<s:decorate id="projectTypeField" template="edit.xhtml">
<ui:define name="label">#{messages['jsf.projectType']}</ui:define>
<h:selectOneMenu id="selectField" value="#{projectHome.instance.defaultProjectType}">
<f:selectItems value="#{projectHome.projectTypeList}"/>
</h:selectOneMenu>
<f:selectItems value="#{projectHome.projectTypeList}"/>
</h:selectOneMenu>
<s:span styleClass="icon-info-circle-2 input_help" id="defaultProjectTypeHelp">
<rich:toolTip>
#{messages['jsf.projectType.Description']}<br/>
#{messages['jsf.projectType.DefaultBehaviour']}<br/>
<br/>
<em>#{messages['jsf.projectType.MoreInfo']}</em><br/>
</rich:toolTip>
</s:span>
</s:decorate>

<s:decorate id="humanViewableSourceUrlField" template="edit.xhtml">
Expand Down

0 comments on commit 2e9a156

Please sign in to comment.