Mathijs den Burger pushed to branch release/4.0 at cms-community / hippo-cms


Commits:
9cb7f438 by Mathijs den Burger at 2016-08-04T15:04:25+02:00
CMS-10321 Translate wizard buttons

The setLabel call in AjaxWizardButton did not do anything (that
label is only used in validator messages). Instead the label model
is now given to the constructor. The wizard labels were also not
translated anywhere, so added a .properties file for them. Finally,
the hardcoded 'value' in the <input> elements overrode the
translation in the model, so removed those. Also changed the input
elements to type 'button' since we are submitted via Ajax anyway.

(cherry picked from commit 1d9e0aa68243139d823b375d347f401df2e03444)

- - - - -


3 changed files:

- 
api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.java
- 
api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButtonBar.html
- + 
api/src/main/resources/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.properties


Changes:

=====================================
api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.java
=====================================
--- 
a/api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.java
+++ 
b/api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.java
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2008-2013 Hippo B.V. (http://www.onehippo.com)
+ *  Copyright 2008-2016 Hippo B.V. (http://www.onehippo.com)
  * 
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@ import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.extensions.wizard.IWizard;
 import org.apache.wicket.extensions.wizard.IWizardModel;
 import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.ResourceModel;
+import org.hippoecm.frontend.plugins.standards.ClassResourceModel;
 
 public abstract class AjaxWizardButton extends AjaxButton {
     private static final long serialVersionUID = 1L;
@@ -30,8 +30,7 @@ public abstract class AjaxWizardButton extends AjaxButton {
     private final IWizard wizard;
 
     public AjaxWizardButton(String id, IWizard wizard, final Form form, String 
labelResourceKey) {
-        super(id, form);
-        this.setLabel(new ResourceModel(labelResourceKey));
+        super(id, new ClassResourceModel(labelResourceKey, 
AjaxWizardButton.class), form);
         this.wizard = wizard;
     }
 


=====================================
api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButtonBar.html
=====================================
--- 
a/api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButtonBar.html
+++ 
b/api/src/main/java/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButtonBar.html
@@ -1,5 +1,5 @@
 <!--
-  * Copyright 2008-2015 Hippo B.V. (http://www.onehippo.com)
+  * Copyright 2008-2016 Hippo B.V. (http://www.onehippo.com)
   *
   * Licensed under the Apache License, Version 2.0 (the  "License");
   * you may not use this file except in compliance with the License.
@@ -16,11 +16,10 @@
 <html  xmlns:wicket="http://wicket.apache.org/";>
   <wicket:panel>
     <div class="wizard-button-bar">
-      <input wicket:id="cancel" type="submit" value="cancel" 
class="wizard-button"/>
-      <input wicket:id="previous" type="submit" value="previous" 
wicket:message="value:wizard.previous" class="wizard-button"/>
-      <input wicket:id="next" type="submit" value="next" 
wicket:message="value:wizard.next" class="wizard-button"/>
-      <input wicket:id="finish" type="submit" value="finish" 
wicket:message="value:wizard.finish" class="wizard-button"/>
-      <input wicket:id="last" type="submit" value="last" 
class="wizard-button"/>
+      <input wicket:id="cancel" type="button" class="wizard-button"/>
+      <input wicket:id="previous" type="button" class="wizard-button"/>
+      <input wicket:id="next" type="button" class="wizard-button"/>
+      <input wicket:id="finish" type="button" class="wizard-button"/>
     </div>
   </wicket:panel>
 </html>


=====================================
api/src/main/resources/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.properties
=====================================
--- /dev/null
+++ 
b/api/src/main/resources/org/hippoecm/frontend/plugins/standards/wizard/AjaxWizardButton.properties
@@ -0,0 +1,4 @@
+cancel=Cancel
+finish=Finish
+next=Next
+prev=Previous



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-cms/commit/9cb7f43854ed110222ac26792b25fb77bf478284
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to