Added posts controller and logic in view templates