diff options
Diffstat (limited to 'js/news.js')
-rw-r--r-- | js/news.js | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/js/news.js b/js/news.js index 699b8ce2f..3675fb0db 100644 --- a/js/news.js +++ b/js/news.js @@ -64,6 +64,50 @@ News={ OC.dialogs.alert(jsondata.data.message, t('news', 'Error')); } }); + }, + doDelete:function() { + $('#feeds_delete').tipsy('hide'); + OC.dialogs.confirm(t('news', 'Are you sure you want to delete this feed?'), t('news', 'Warning'), function(answer) { + if(answer == true) { + $.post(OC.filePath('contacts', 'ajax', 'deletefeed.php'),{'id':Contacts.UI.Card.id},function(jsondata){ + if(jsondata.status == 'success'){ + var newid = ''; + var curlistitem = $('#leftcontent [data-id="'+jsondata.data.id+'"]'); + var newlistitem = curlistitem.prev(); + if(newlistitem == undefined) { + newlistitem = curlistitem.next(); + } + curlistitem.remove(); + if(newlistitem != undefined) { + newid = newlistitem.data('id'); + } + $('#rightcontent').data('id',newid); + this.id = this.fn = this.fullname = this.shortname = this.famname = this.givname = this.addname = this.honpre = this.honsuf = ''; + this.data = undefined; + + if($('#contacts li').length > 0) { // Load first in list. + Contacts.UI.Card.update(newid); + } else { + // load intro page + $.getJSON(OC.filePath('contacts', 'ajax', 'loadintro.php'),{},function(jsondata){ + if(jsondata.status == 'success'){ + id = ''; + $('#rightcontent').data('id',''); + $('#rightcontent').html(jsondata.data.page); + } + else{ + OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); + } + }); + } + } + else{ + OC.dialogs.alert(jsondata.data.message, t('contacts', 'Error')); + } + }); + } + }); + return false; } } } @@ -71,7 +115,6 @@ News={ $(document).ready(function(){ $('#addfeedfolder').click(News.UI.overview); - $('#addfeedfolder').keydown(News.UI.overview); $('.collapsable').click(function(){ $(this).parent().children().toggle(); @@ -82,5 +125,7 @@ $(document).ready(function(){ $(this).next().toggle(); return false; }).next().hide(); - + + $('#feeds_delete').click( function() { News.Feed.doDelete(); return false;} ); + });
\ No newline at end of file |