Make context menu component more self-contained

Widget-type directives should have replace:true in their config. They also should as self-contained as possible.