A variational approach for boundary value problems for impulsive fractional differential equations