Picture of Robert Willis
closing drawer
by Robert Willis - Monday, 7 November 2016, 4:45 PM
 

I have modified the "resources" extension to link to articles on a page but after selecting the article, the drawer remains open and one still has to click on the X at the top to close it.

 

I believe I am I need to add some code in the "adapt-contrib-resourcesView.js" file, probably after the window.open(href, target); call. 

 

onResourceClicked: function(event) {

var data = $(event.currentTarget).data("href"),
href = "",
target = "_self";

if(data.indexOf(",") >= 0){
href = data.split(",")[0];
target = data.split(",")[1];
}else{
href = data;
}

window.open(href, target);
// window.open($(event.currentTarget).data("href"), "_self");
}
});

return ResourcesView;
})

 

Would anyone know what I need to do close have the resource (article) selected and then close the drawer?

Picture of Matt Leathes
Re: closing drawer
by Matt Leathes - Tuesday, 8 November 2016, 8:08 PM
 

Hi Robert

Apologies for the slow response.

Adapt.trigger('drawer:closeDrawer');

Should do what you need. You can see this used in the pageLevelProgress plugin here.

Picture of Robert Willis
Re: closing drawer
by Robert Willis - Wednesday, 9 November 2016, 3:34 PM
 

Works like a charm! Thank you so much.