+ def set_shared_template_vars
+ @root_url = root_url(:host => SERVER_URL)
+ end
+
+ def attach_project_logo
+ attachments.inline["logo.png"] = File.read(Rails.root.join("app", "assets", "images", "osm_logo_30.png"))
+ end
+
+ def attach_user_avatar(user)
+ attachments.inline["avatar.png"] = File.read(user_avatar_file_path(user))
+ end
+
+ def user_avatar_file_path(user)
+ image = user && user.image
+ if image && image.file?
+ return image.path(:small)
+ else
+ return Rails.root.join("app", "assets", "images", "users", "images", "small.png")
+ end
+ end
+