1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Fixed buttons on inventory help dialog. The Prev button never enabled and Next button never disabled.

This commit is contained in:
Chris Houseknecht 2014-03-06 11:22:35 -05:00
parent a63b9e661b
commit bb67020c30

View File

@ -338,10 +338,10 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
text: "Prev", text: "Prev",
click: function (e) { click: function (e) {
if (current_step - 1 === 0) { if (current_step - 1 === 0) {
$(e.target).button('disable'); $('#help-prev-button').prop('disabled', true);
} }
if (current_step - 1 < defn.story.steps.length - 1) { if (current_step - 1 < defn.story.steps.length - 1) {
$(e.target).next().button('enable'); $('#help-next-button').prop('disabled', false);
} }
showHelp(current_step - 1); showHelp(current_step - 1);
}, },
@ -349,12 +349,12 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
}); });
btns.push({ btns.push({
text: "Next", text: "Next",
click: function (e) { click: function() {
if (current_step + 1 > 0) { 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) { if (current_step + 1 >= defn.story.steps.length - 1) {
$(e.target).button('disable'); $('#help-next-button').prop('disabled', true);
} }
showHelp(current_step + 1); showHelp(current_step + 1);
} }
@ -388,25 +388,31 @@ angular.module('Utilities', ['RestServices', 'Utilities'])
// Make the buttons look like TB and add FA icons // Make the buttons look like TB and add FA icons
$('.ui-dialog-buttonset button').each(function () { $('.ui-dialog-buttonset button').each(function () {
var c, h, l; var c, h, i, l;
l = $(this).text(); l = $(this).text();
if (l === 'Close') { if (l === 'Close') {
h = "fa-times"; h = "fa-times";
c = "btn btn-default"; c = "btn btn-default";
i = "help-close-button";
$(this).attr({ $(this).attr({
'class': c 'class': c,
'id': i
}).html("<i class=\"fa " + h + "\"></i> Close"); }).html("<i class=\"fa " + h + "\"></i> Close");
} else if (l === 'Prev') { } else if (l === 'Prev') {
h = "fa-chevron-left"; h = "fa-chevron-left";
c = "btn btn-primary"; c = "btn btn-primary";
i = "help-prev-button";
$(this).attr({ $(this).attr({
'class': c 'class': c,
'id': i
}).html("<i class=\"fa " + h + "\"></i> Prev"); }).html("<i class=\"fa " + h + "\"></i> Prev");
} else { } else {
h = "fa-chevron-right"; h = "fa-chevron-right";
c = "btn btn-primary"; c = "btn btn-primary";
i = "help-next-button";
$(this).attr({ $(this).attr({
'class': c 'class': c,
'id': i
}).html("Next <i class=\"fa " + h + "\"></i>").css({ }).html("Next <i class=\"fa " + h + "\"></i>").css({
'margin-right': '20px' 'margin-right': '20px'
}); });