add media gallery active class and data attribute to template