Skip to content

The Unified and Autonomous Development Platform

Handle enter key press and set focus to first input when a modal dialog is displayed.

robin shineb1c551f0352c
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/modal/modal.js b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/modal/modal.js
index 0d3a8e922a..a2919f5689 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/modal/modal.js
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/modal/modal.js
@@ -32,9 +32,12 @@ function showModal(modalId, contentLoader) {
if (!modal.find(">.modal-dialog>.content")[0])
contentLoader();
+ else
+ modal.find("input:visible:first").focus();
}
function modalLoaded(modalId) {
+ $("#" + modalId).find("input:visible:first").focus();
}
function hideModal(modalId) {
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
index 5887846175..7fec06a9d3 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/assets/css/page.css
@@ -428,8 +428,8 @@ table.table-blob { width: 100%; }
.gate-keeper-add:hover, .gate-keeper-add:focus {background-color: #EBEBEB; border-color: #ADADAD; cursor: pointer;}
.gate-keeper-selector {width: 600px; max-height: 600px; overflow: auto;}
.gate-keeper-selector .panel {border: none; border-radius: 0;}
-.gate-keeper-selector .panel-heading {border-top: 2px solid #CCCCCC; border-radius: 0;}
-.gate-keeper-selector .panel-group>.panel:first-child>.panel-heading {border-width: 1px;}
+.gate-keeper-selector .panel-heading {border-top: 1px solid #CCCCCC; border-radius: 0;}
+.gate-keeper-selector .panel-group>.panel:first-child>.panel-heading {border-top: none;}
.gate-keeper-selector .panel-heading.collapsed:hover, .gate-keeper-selector .panel-heading.collapsed:focus {
border-color: #999999; background-color: #E0E0E0; cursor: pointer;}
.gate-keeper-selector .panel-group .panel + .panel {margin-top: 0px;}
@@ -441,7 +441,7 @@ table.table-blob { width: 100%; }
.gate-keeper-name {font-size: 15px; margin-top: -4px;}
.gate-keeper-editor {max-height: 600px; overflow: auto;}
.gate-keeper-editor .gate-keeper-name {font-weight: bold; font-size: 16px; margin-top: 0; margin-bottom: 4px;}
-.gate-keeper-editor .icon {width: 20px; margin-right: 8px;}
+.gate-keeper-editor .icon {width: 20px; margin-right: 8px; margin-top: 4px;}
.gate-keeper .panel-title {font-size: 14px;}
.gate-keeper .panel-heading {padding: 8px;}
.gate-keeper .icon {margin-left: 8px; cursor: pointer;}
diff --git a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/gatekeeper/GateKeeperEditor.html b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/gatekeeper/GateKeeperEditor.html
index 238bfadaf9..26576b2fda 100644
--- a/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/gatekeeper/GateKeeperEditor.html
+++ b/gitop.web/src/main/java/com/pmease/gitop/web/page/project/settings/gatekeeper/GateKeeperEditor.html
@@ -11,7 +11,7 @@
<div wicket:id="beanEditor" class="modal-body"></div>
<div class="modal-footer">
<a wicket:id="cancel" class="btn btn-default">Cancel</a>
- <a wicket:id="save" class="btn btn-primary">Save</a>
+ <input type="submit" wicket:id="save" class="btn btn-primary" value="Save"></input>
</div>
</form>
</div>