refactoring alert message in views