summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-07-05 15:12:17 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-07-05 15:12:17 -0400
commit96041641949c55abf2b432bc08ea493b40dec873 (patch)
tree6c177b89d19ef4a9f14acddf19697a8bdd951247 /js
parentfcd843bc0c2ef3163d1ecc6b036e46726a61239a (diff)
button to edit and delete feeds
Diffstat (limited to 'js')
-rw-r--r--js/news.js49
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