web/static/ldt/js/projectscontents.js
changeset 66 8a7530e28185
parent 46 ba02faf089df
child 71 8a881c9593d0
equal deleted inserted replaced
65:e96c79ca2ebc 66:8a7530e28185
   225 
   225 
   226 
   226 
   227     $('.ldt_link_create',base_node).each(function(i){
   227     $('.ldt_link_create',base_node).each(function(i){
   228         $(this).attr("target","_iri");
   228         $(this).attr("target","_iri");
   229     });
   229     });
   230      $('.ldt_link_create',base_node).nyroModal({
   230     $('.ldt_link_create',base_node).nyroModal({
   231          
   231          
   232         filters: ['iriIframe'],
   232         filters: ['iriIframe'],
   233         sizes: {
   233         sizes: {
   234             minW: '600',
   234             minW: '600',
   235             minH: '500'
   235             minH: '500'
   268             close: testAndClose(nm.close)
   268             close: testAndClose(nm.close)
   269         }));
   269         }));
   270     });
   270     });
   271 
   271 
   272     
   272     
   273      $('.publishedproject', base_node).click(function(e) {
   273     $('.publishedproject', base_node).click(function(e) {
   274         e.preventDefault();
   274         e.preventDefault();
   275         var target = $(e.target);
   275         var target = $(e.target);
   276         var project_id = target.attr('id').replace('project_','');
   276         var project_id = target.attr('id').replace('project_','');
   277         var url = unpublishprojecturl.replace('__PROJECT_ID__', project_id);
   277         var url = unpublishprojecturl.replace('__PROJECT_ID__', project_id);
   278         $.ajax({
   278         $.ajax({
   279             url: url,
   279             url: url,
   280             type: 'POST',
   280             type: 'POST',
   281             dataType: 'json',
   281             data: {csrfmiddlewaretoken:global_csrf_token},
   282             success: function(json, textStatus, XMLHttpRequest){
   282             // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
       
   283             //dataType: 'json',
       
   284             success: function(json, textStatus, XMLHttpRequest) {
   283                 if(json.res) {
   285                 if(json.res) {
   284                     searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
   286                     searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
   285                 }
   287                 }
   286             }
   288             }
   287         });
   289         });
   288     });
   290     });
   289 
   291     
   290     $('.unpublishedproject', base_node).click(function(e) {
   292     $('.unpublishedproject', base_node).click(function(e) {
   291         e.preventDefault();
   293         e.preventDefault();
   292         var target = $(e.target);
   294         var target = $(e.target);
   293         var project_id = target.attr('id').replace('project_','');
   295         var project_id = target.attr('id').replace('project_','');
   294         var url = publishprojecturl.replace('__PROJECT_ID__', project_id);
   296         var url = publishprojecturl.replace('__PROJECT_ID__', project_id);
   295         $.ajax({
   297         $.ajax({
   296             url: url,
   298             url: url,
   297             type: 'POST',
   299             type: 'POST',
   298             dataType: 'json',
   300             data: {csrfmiddlewaretoken:global_csrf_token},
   299             success: function(json, textStatus, XMLHttpRequest){
   301             // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
       
   302             //dataType: 'json',
       
   303             success: function(json, textStatus, XMLHttpRequest) {
   300                 if(json.res) {
   304                 if(json.res) {
   301                     searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
   305                     searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0);
   302                 }
   306                 }
   303             }
   307             }
   304         });
   308         });
   332     });
   336     });
   333     
   337     
   334 }
   338 }
   335 
   339 
   336 function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
   340 function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
   337     
       
   338     init_events_base(base_node, embed_url);
   341     init_events_base(base_node, embed_url);
   339     init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl);
   342     init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl);
   340 }
   343 }
   341 
   344 
   342 function init_events_all(base_node, embed_url, searchcontentfilterurl, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {
   345 function init_events_all(base_node, embed_url, searchcontentfilterurl, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) {