converted to AMD and moved widget template to separate file