# HG changeset patch # User Marcin Kuzminski # Date 2018-11-09 13:35:43 # Node ID 4c4b71815a1b908bea3e0088850b3300bc4b3f9a # Parent 5fbf95d06ea310bc81798192d211963b363d70b4 rcextensions: added example how to change integration templates. diff --git a/rhodecode/config/rcextensions/examples/custom_email_integration_template.py b/rhodecode/config/rcextensions/examples/custom_email_integration_template.py new file mode 100644 --- /dev/null +++ b/rhodecode/config/rcextensions/examples/custom_email_integration_template.py @@ -0,0 +1,175 @@ +# This code allows override the integrations templates. Put this into the __init__.py +# file of rcextensions + + +# EMAIL +from rhodecode.integrations import email +email.REPO_PUSH_TEMPLATE_HTML = email.Template(''' + + + + + + ${subject} + + + + + + + + + + + + + +
+ + + + + +
+ + ${'RhodeCode'} + +
+ % if data['push']['commits']: + % for commit in data['push']['commits']: + ${commit['short_id']} by ${commit['author']} at ${commit['date']}
+ ${commit['message_html']}
+
+ % endfor + % else: + No commit data + % endif +
+
+ +

+ ${'This is a notification from RhodeCode. %(instance_url)s' % {'instance_url': instance_url}} +

+ + +''') + + +# JIRA (EE ONLY) +from rc_integrations import jira_tracker + +jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template(''' +${action} by ${author} (status: ${status}). \n +pull-request: ${url} +''') + + +jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template(''' +Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n +${url}\n + +## MODIFICATION add custom COMMIT message to the comment +${commit['message']} +''') + + +jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template(''' +Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n +'{url}\n + +## MODIFICATION add custom COMMIT message to the comment +${commit['message']} +''') + + +# REDMINE (EE ONLY) +from rc_integrations import redmine_tracker + +redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template(''' +Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n +commit: ${url}\n + +## MODIFICATION add custom COMMIT message to the comment +message: +``` +${commit['message']} +``` + +''') + +redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template(''' +Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n +commit: ${url}\n + +## MODIFICATION add custom COMMIT message to the comment +message: +``` +${commit['message']} +``` + +''') + +redmine_tracker.COMMENT_TEMPLATE_PULL_REQUEST = redmine_tracker.Template(''' +${action} by ${author} (status: ${status}). \n' +${url}\n + +## MODIFICATION add custom COMMIT message to the comment +message: +``` +${commit['message']} +``` + +''')