From 71fe5d672e516ee7c6ed9833a828b99acf9e6d13 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 3 Jul 2014 14:38:40 +0200 Subject: [PATCH 1/2] Fixed dialogs styling, reversed buttons Default dialog button is now on the right, other one on the left. --- core/css/jquery.ocdialog.css | 11 +++++++++ core/js/jquery.ocdialog.js | 7 ++++++ core/js/oc-dialogs.js | 46 +++++++++++++++++------------------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/core/css/jquery.ocdialog.css b/core/css/jquery.ocdialog.css index a1221137bc..93930bf435 100644 --- a/core/css/jquery.ocdialog.css +++ b/core/css/jquery.ocdialog.css @@ -31,6 +31,17 @@ margin-top: 10px; width: 100%; } +/* align primary button to right, other buttons to left */ +.oc-dialog-buttonrow.twobuttons button:nth-child(1) { + float: left; +} +.oc-dialog-buttonrow.twobuttons button:nth-child(2) { + float: right; +} + +.oc-dialog-buttonrow.onebutton button { + float: right; +} .oc-dialog-close { position:absolute; diff --git a/core/js/jquery.ocdialog.js b/core/js/jquery.ocdialog.js index af32591ce5..e48e3e8df6 100644 --- a/core/js/jquery.ocdialog.js +++ b/core/js/jquery.ocdialog.js @@ -111,6 +111,13 @@ var $buttonrow = $('
'); this.$buttonrow = $buttonrow.appendTo(this.$dialog); } + if (value.length === 1) { + this.$buttonrow.addClass('onebutton'); + } else if (value.length === 2) { + this.$buttonrow.addClass('twobuttons'); + } else if (value.length === 3) { + this.$buttonrow.addClass('threebuttons'); + } $.each(value, function(idx, val) { var $button = $('