Improve quota input field
- Added tooltip with examples - The quota value returned by the server is now displayed after update - Fixes #5346
This commit is contained in:
parent
ca4a1ee5f7
commit
9d230bcc75
|
@ -1,8 +1,15 @@
|
||||||
(function ($) {
|
(function ($) {
|
||||||
$.fn.singleSelect = function () {
|
$.fn.singleSelect = function () {
|
||||||
return this.each(function (i, select) {
|
return this.each(function (i, select) {
|
||||||
var input = $('<input/>');
|
var input = $('<input/>'),
|
||||||
|
inputTooltip = $(select).attr('data-inputtitle');
|
||||||
|
if (inputTooltip){
|
||||||
|
input.attr('title', inputTooltip);
|
||||||
|
}
|
||||||
select = $(select);
|
select = $(select);
|
||||||
|
if ($.fn.tipsy){
|
||||||
|
input.tipsy({gravity: 'n', trigger: 'manual'});
|
||||||
|
}
|
||||||
input.css('position', 'absolute');
|
input.css('position', 'absolute');
|
||||||
input.css(select.offset());
|
input.css(select.offset());
|
||||||
input.css({
|
input.css({
|
||||||
|
@ -29,6 +36,9 @@
|
||||||
} else {
|
} else {
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
input.show();
|
input.show();
|
||||||
|
if ($.fn.tipsy){
|
||||||
|
input.tipsy('show');
|
||||||
|
}
|
||||||
select.css('background-color', 'white');
|
select.css('background-color', 'white');
|
||||||
input.focus();
|
input.focus();
|
||||||
}
|
}
|
||||||
|
@ -70,6 +80,9 @@
|
||||||
|
|
||||||
input.on('blur', function () {
|
input.on('blur', function () {
|
||||||
$(this).change();
|
$(this).change();
|
||||||
|
if ($.fn.tipsy){
|
||||||
|
$(this).tipsy('hide');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,11 @@ var UserList = {
|
||||||
quotaSelect.on('change', function () {
|
quotaSelect.on('change', function () {
|
||||||
var uid = $(this).parent().parent().attr('data-uid');
|
var uid = $(this).parent().parent().attr('data-uid');
|
||||||
var quota = $(this).val();
|
var quota = $(this).val();
|
||||||
setQuota(uid, quota);
|
setQuota(uid, quota, function(returnedQuota){
|
||||||
|
if (quota !== returnedQuota) {
|
||||||
|
$(quotaSelect).find(':selected').text(returnedQuota);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// From http://my.opera.com/GreyWyvern/blog/show.dml/1671288
|
// From http://my.opera.com/GreyWyvern/blog/show.dml/1671288
|
||||||
|
@ -428,9 +432,14 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('select.quota, select.quota-user').singleSelect().on('change', function () {
|
$('select.quota, select.quota-user').singleSelect().on('change', function () {
|
||||||
|
var select = $(this);
|
||||||
var uid = $(this).parent().parent().attr('data-uid');
|
var uid = $(this).parent().parent().attr('data-uid');
|
||||||
var quota = $(this).val();
|
var quota = $(this).val();
|
||||||
setQuota(uid, quota);
|
setQuota(uid, quota, function(returnedQuota){
|
||||||
|
if (quota !== returnedQuota) {
|
||||||
|
select.find(':selected').text(returnedQuota);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#newuser').submit(function (event) {
|
$('#newuser').submit(function (event) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ $_['subadmingroups'] = array_flip($items);
|
||||||
<div class="quota">
|
<div class="quota">
|
||||||
<span><?php p($l->t('Default Storage'));?></span>
|
<span><?php p($l->t('Default Storage'));?></span>
|
||||||
<?php if((bool) $_['isadmin']): ?>
|
<?php if((bool) $_['isadmin']): ?>
|
||||||
<select class='quota'>
|
<select class='quota' data-inputtitle="<?php p($l->t('Please enter storage quota (ex: "512 MB" or "12 GB"')) ?>">
|
||||||
<option
|
<option
|
||||||
<?php if($_['default_quota'] === 'none') print_unescaped('selected="selected"');?>
|
<?php if($_['default_quota'] === 'none') print_unescaped('selected="selected"');?>
|
||||||
value='none'>
|
value='none'>
|
||||||
|
@ -136,7 +136,7 @@ $_['subadmingroups'] = array_flip($items);
|
||||||
</td>
|
</td>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
<td class="quota">
|
<td class="quota">
|
||||||
<select class='quota-user'>
|
<select class='quota-user' data-inputtitle="<?php p($l->t('Please enter storage quota (ex: "512 MB" or "12 GB"')) ?>">
|
||||||
<option
|
<option
|
||||||
<?php if($user['quota'] === 'default') print_unescaped('selected="selected"');?>
|
<?php if($user['quota'] === 'default') print_unescaped('selected="selected"');?>
|
||||||
value='default'>
|
value='default'>
|
||||||
|
|
Loading…
Reference in New Issue