From bb67020c30e3832c95e93f93cfffc7633d10e142 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Thu, 6 Mar 2014 11:22:35 -0500 Subject: [PATCH] Fixed buttons on inventory help dialog. The Prev button never enabled and Next button never disabled. --- awx/ui/static/lib/ansible/Utilities.js | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/awx/ui/static/lib/ansible/Utilities.js b/awx/ui/static/lib/ansible/Utilities.js index 53e09d3f52..496a2bcce5 100644 --- a/awx/ui/static/lib/ansible/Utilities.js +++ b/awx/ui/static/lib/ansible/Utilities.js @@ -338,10 +338,10 @@ angular.module('Utilities', ['RestServices', 'Utilities']) text: "Prev", click: function (e) { if (current_step - 1 === 0) { - $(e.target).button('disable'); + $('#help-prev-button').prop('disabled', true); } if (current_step - 1 < defn.story.steps.length - 1) { - $(e.target).next().button('enable'); + $('#help-next-button').prop('disabled', false); } showHelp(current_step - 1); }, @@ -349,12 +349,12 @@ angular.module('Utilities', ['RestServices', 'Utilities']) }); btns.push({ text: "Next", - click: function (e) { + click: function() { if (current_step + 1 > 0) { - $(e.target).prev().button('enable'); + $('#help-prev-button').prop('disabled', false); } - if (current_step + 1 === defn.story.steps.length - 1) { - $(e.target).button('disable'); + if (current_step + 1 >= defn.story.steps.length - 1) { + $('#help-next-button').prop('disabled', true); } showHelp(current_step + 1); } @@ -388,25 +388,31 @@ angular.module('Utilities', ['RestServices', 'Utilities']) // Make the buttons look like TB and add FA icons $('.ui-dialog-buttonset button').each(function () { - var c, h, l; + var c, h, i, l; l = $(this).text(); if (l === 'Close') { h = "fa-times"; c = "btn btn-default"; + i = "help-close-button"; $(this).attr({ - 'class': c + 'class': c, + 'id': i }).html(" Close"); } else if (l === 'Prev') { h = "fa-chevron-left"; c = "btn btn-primary"; + i = "help-prev-button"; $(this).attr({ - 'class': c + 'class': c, + 'id': i }).html(" Prev"); } else { h = "fa-chevron-right"; c = "btn btn-primary"; + i = "help-next-button"; $(this).attr({ - 'class': c + 'class': c, + 'id': i }).html("Next ").css({ 'margin-right': '20px' });