Skip to content

Commit

Permalink
UI:Add Template button should be disable but not hide before input th…
Browse files Browse the repository at this point in the history
…e iSO

Change the initial state of the template create button from 'hide' to 'disabled', make the button enabled when inputting.

Signed-off-by: Xin Ding <xinding@linux.vnet.ibm.com>
  • Loading branch information
xinding authored and Adam Litke committed Jul 16, 2013
1 parent 7c4c1b5 commit 130d98b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions ui/css/theme-default/button.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@
font-size: 13px;
}

.btn-normal[disabled="disabled"] {
background-color: silver;
}

.btn-group {
float: right;
padding: 0 10px;
Expand Down
16 changes: 8 additions & 8 deletions ui/js/src/burnet.template_add_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@ burnet.template_add_main = function() {
function init_iso_file_box() {
$('#iso_file_box').hide();
$('#iso_file').val('');
$('#btn-template-iso-create').hide();
$('#btn-template-iso-create').attr('disabled', 'disabled');
}
function init_iso_url_box() {
$('#iso_url_box').hide();
$('#iso_url').val('');
$('#btn-template-url-create').hide();
$('#btn-template-url-create').attr('disabled', 'disabled');
}

$('#iso_file').change(function() {
$('#iso_file').on('input', function() {
if ($('#iso_file').val()) {
$('#btn-template-iso-create').slideDown();
$('#btn-template-iso-create').removeAttr('disabled');
} else {
$('#btn-template-iso-create').hide();
$('#btn-template-iso-create').attr('disabled', 'disabled');
}
});
$('#iso_url').change(function() {
$('#iso_url').on('input', function() {
if ($('#iso_url').val()) {
$('#btn-template-url-create').slideDown();
$('#btn-template-url-create').removeAttr('disabled');
} else {
$('#btn-template-url-create').hide();
$('#btn-template-url-create').attr('disabled', 'disabled');
}
});

Expand Down
4 changes: 2 additions & 2 deletions ui/pages/template-add.html.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<div>
<input type="text" class="text" style="width: 92%" id="iso_file" name="iso_file" value="">
<div class="btn-group">
<button class="btn-normal" id="btn-template-iso-create" style="display: none;"><span class="text">$_("Create")</span></button>
<button class="btn-normal" id="btn-template-iso-create" disabled="disabled"><span class="text">$_("Create")</span></button>
</div>
</div>
</div>
Expand All @@ -86,7 +86,7 @@
<div>
<input type="text" class="text" style="width: 92%" id="iso_url" name="iso_url" value="">
<div class="btn-group">
<button class="btn-normal" id="btn-template-url-create" style="display: none;"><span class="text">$_("Create")</span></button>
<button class="btn-normal" id="btn-template-url-create" disabled="disabled"><span class="text">$_("Create")</span></button>
</div>
</div>
</div>
Expand Down

0 comments on commit 130d98b

Please sign in to comment.