forked from GNUsocial/gnu-social
Make add/remove item buttons work the same way they do on the extended profile form
This commit is contained in:
parent
607fa56449
commit
4a04291c16
@ -2,12 +2,16 @@
|
|||||||
var SN_WHITELIST = SN_WHITELIST || {};
|
var SN_WHITELIST = SN_WHITELIST || {};
|
||||||
|
|
||||||
SN_WHITELIST.updateButtons = function() {
|
SN_WHITELIST.updateButtons = function() {
|
||||||
|
$("ul > li > a.remove_row").show();
|
||||||
|
$("ul > li > a.add_row").hide();
|
||||||
|
|
||||||
var lis = $('ul > li > input[name^="username[]"]');
|
var lis = $('ul > li > input[name^="username[]"]');
|
||||||
if (lis.length === 1) {
|
if (lis.length === 1) {
|
||||||
$("ul > li > a.remove_row").hide();
|
$("ul > li > a.remove_row").hide();
|
||||||
} else {
|
} else {
|
||||||
$("ul > li > a.remove_row:first").show();
|
$("ul > li > a.remove_row:first").show();
|
||||||
}
|
}
|
||||||
|
$("ul > li > a.add_row:last").show();
|
||||||
};
|
};
|
||||||
|
|
||||||
SN_WHITELIST.resetRow = function(row) {
|
SN_WHITELIST.resetRow = function(row) {
|
||||||
@ -27,7 +31,6 @@ SN_WHITELIST.addRow = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SN_WHITELIST.removeRow = function() {
|
SN_WHITELIST.removeRow = function() {
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
$("#confirm-dialog").dialog({
|
$("#confirm-dialog").dialog({
|
||||||
@ -56,7 +59,6 @@ SN_WHITELIST.removeRow = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$("#confirm-dialog").dialog({
|
$("#confirm-dialog").dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
modal: true
|
modal: true
|
||||||
@ -64,4 +66,6 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
$('.add_row').live('click', SN_WHITELIST.addRow);
|
$('.add_row').live('click', SN_WHITELIST.addRow);
|
||||||
$('.remove_row').live('click', SN_WHITELIST.removeRow);
|
$('.remove_row').live('click', SN_WHITELIST.removeRow);
|
||||||
|
|
||||||
|
SN_WHITELIST.updateButtons();
|
||||||
});
|
});
|
||||||
|
@ -142,6 +142,7 @@ class WhitelistInviteForm extends Form
|
|||||||
array(
|
array(
|
||||||
'class' => 'remove_row',
|
'class' => 'remove_row',
|
||||||
'href' => 'javascript://',
|
'href' => 'javascript://',
|
||||||
|
'style' => 'display: none;'
|
||||||
),
|
),
|
||||||
'-'
|
'-'
|
||||||
);
|
);
|
||||||
@ -151,6 +152,7 @@ class WhitelistInviteForm extends Form
|
|||||||
array(
|
array(
|
||||||
'class' => 'add_row',
|
'class' => 'add_row',
|
||||||
'href' => 'javascript://',
|
'href' => 'javascript://',
|
||||||
|
'style' => 'display: none;'
|
||||||
),
|
),
|
||||||
_m('Add another item')
|
_m('Add another item')
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user