Template refactoring: extract ngdocForMethod

Extract the template of ngdoc comment for a resource method into
a function.

No changes of functionality.
WIP: hasAndBelongsToMany