Revision: 41609
Author:   jreijn
Date:     2013-11-05 15:52:10 +0100 (Tue, 05 Nov 2013)
Log Message:
-----------
CMS7-7351: Disable "create new channel" button when pressing create channel, so 
that a user can't click twice on the button.

Modified Paths:
--------------
    
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelFormPanel.js
    
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.js

Modified: 
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelFormPanel.js
===================================================================
--- 
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelFormPanel.js
   2013-11-05 13:38:00 UTC (rev 41608)
+++ 
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/ChannelFormPanel.js
   2013-11-05 14:52:10 UTC (rev 41609)
@@ -144,7 +144,7 @@
             return str !== null && suffix !== null && str.indexOf(suffix, 
str.length - suffix.length) !== -1;
         },
 
-        submitForm: function() {
+        submitForm: function(enableNextButtonCallback) {
             var form, panel;
             form = this.getForm();
             panel = this;
@@ -170,6 +170,7 @@
                                 panel.showError(action.result.message);
                                 break;
                         }
+                        enableNextButtonCallback(true);
                     }
                 });
             }

Modified: 
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.js
===================================================================
--- 
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.js
  2013-11-05 13:38:00 UTC (rev 41608)
+++ 
hippo-cms7/addons/addon-channel-manager/trunk/frontend/src/main/java/org/onehippo/cms7/channelmanager/RootPanel.js
  2013-11-05 14:52:10 UTC (rev 41609)
@@ -277,6 +277,7 @@
 
         resetWizard: function() {
             this.showBlueprintChoice();
+            Ext.getCmp('nextButton').enable();
         },
 
         processPreviousStep: function() {
@@ -289,9 +290,15 @@
             if (Ext.getCmp('card-container').layout.activeItem.id === 
'blueprints-panel') {
                 this.showChannelForm();
             } else { //current item is the form panel so call submit on it.
-                Ext.getCmp('channel-form-panel').submitForm();
+                Ext.getCmp('nextButton').disable();
+                
Ext.getCmp('channel-form-panel').submitForm(function(enableNextButton){
+                    if(enableNextButton) {
+                        //in case of an error on the form
+                        Ext.getCmp('nextButton').enable();
             }
+                });
         }
+        }
     });
 
 }());

_______________________________________________
Hippocms-svn mailing list
[email protected]
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to