Approximately half of the views in my application contain a small gear icon that allows users to click and open a tools menu associated with that view. While the contents of each of these menus will likely be different, the act of clicking the gear to open the menu is always exactly the same.
What's the best way to go about storing and reusing the same function for opening/closing this menu that appears in many views?
MORE
Similarly, many of my views are collapsible (meaning you can click an arrow in the view to hide its contents). I have a single function that controls that and would like to easily be able to reuse that across the application.