Merge pull request #25023 from owncloud/fix-22127-trusted-servers

Fixed problem about removing trusted servers accidentally
This commit is contained in:
Vincent Petry 2016-06-08 17:41:16 +02:00
commit 6de406ae51
3 changed files with 16 additions and 11 deletions

View File

@ -17,10 +17,13 @@
cursor: pointer;
}
#listOfTrustedServers li:hover {
cursor: pointer;
}
#listOfTrustedServers .status {
margin-right: 10px;
}
#listOfTrustedServers .icon {
cursor: pointer;
display: inline-block;
vertical-align: middle;
margin-left: 10px;
}

View File

@ -42,8 +42,9 @@ $(document).ready(function () {
$('ul#listOfTrustedServers').prepend(
$('<li>')
.attr('id', data.id)
.attr('class', 'icon-delete')
.html('<span class="status indeterminate"></span>' + data.url)
.html('<span class="status indeterminate"></span>' +
data.url +
'<span class="icon icon-delete"></span>')
);
OC.msg.finishedSuccess('#ocFederationAddServer .msg', data.message);
})
@ -56,10 +57,10 @@ $(document).ready(function () {
}
});
// remove trusted server from list
$( "#listOfTrustedServers" ).on('click', 'li', function() {
var id = $(this).attr('id');
var $this = $(this);
// remove trusted server from list
$( "#listOfTrustedServers" ).on('click', 'li > .icon-delete', function() {
var $this = $(this).parent();
id = $this.attr('id');
$.ajax({
url: OC.generateUrl('/apps/federation/trusted-servers/' + id),
type: 'DELETE',

View File

@ -23,7 +23,7 @@ style('federation', 'settings-admin')
</p>
<ul id="listOfTrustedServers">
<?php foreach($_['trustedServers'] as $trustedServer) { ?>
<li id="<?php p($trustedServer['id']); ?>" class="icon-delete">
<li id="<?php p($trustedServer['id']); ?>">
<?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?>
<span class="status success"></span>
<?php
@ -36,6 +36,7 @@ style('federation', 'settings-admin')
<span class="status error"></span>
<?php } ?>
<?php p($trustedServer['url']); ?>
<span class="icon icon-delete"></span>
</li>
<?php } ?>
</ul>