##// END OF EJS Templates
rcextensions: updated example template override with more docs.
marcink -
r3393:8264f2fd default
parent child Browse files
Show More
@@ -1,175 +1,187 b''
1 # This code allows override the integrations templates. Put this into the __init__.py
1 # This code allows override the integrations templates.
2 # file of rcextensions
2 # Put this into the __init__.py file of rcextensions to override the templates
3
3
4
4
5 # EMAIL
5 # EMAIL Integration
6 from rhodecode.integrations import email
6 from rhodecode.integrations import email
7 email.REPO_PUSH_TEMPLATE_HTML = email.Template('''
7 email.REPO_PUSH_TEMPLATE_HTML = email.Template('''
8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
8 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9 <html xmlns="http://www.w3.org/1999/xhtml">
9 <html xmlns="http://www.w3.org/1999/xhtml">
10 <head>
10 <head>
11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
12 <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
12 <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
13 <title>${subject}</title>
13 <title>${subject}</title>
14 <style type="text/css">
14 <style type="text/css">
15 /* Based on The MailChimp Reset INLINE: Yes. */
15 /* Based on The MailChimp Reset INLINE: Yes. */
16 #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
16 #outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */
17 body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
17 body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;}
18 /* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
18 /* Prevent Webkit and Windows Mobile platforms from changing default font sizes.*/
19 .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
19 .ExternalClass {width:100%;} /* Force Hotmail to display emails at full width */
20 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
20 .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;}
21 /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
21 /* Forces Hotmail to display normal line spacing. More on that: http://www.emailonacid.com/forum/viewthread/43/ */
22 #backgroundTable {margin:0; padding:0; line-height: 100% !important;}
22 #backgroundTable {margin:0; padding:0; line-height: 100% !important;}
23 /* End reset */
23 /* End reset */
24
24
25 /* defaults for images*/
25 /* defaults for images*/
26 img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
26 img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;}
27 a img {border:none;}
27 a img {border:none;}
28 .image_fix {display:block;}
28 .image_fix {display:block;}
29
29
30 body {line-height:1.2em;}
30 body {line-height:1.2em;}
31 p {margin: 0 0 20px;}
31 p {margin: 0 0 20px;}
32 h1, h2, h3, h4, h5, h6 {color:#323232!important;}
32 h1, h2, h3, h4, h5, h6 {color:#323232!important;}
33 a {color:#427cc9;text-decoration:none;outline:none;cursor:pointer;}
33 a {color:#427cc9;text-decoration:none;outline:none;cursor:pointer;}
34 a:focus {outline:none;}
34 a:focus {outline:none;}
35 a:hover {color: #305b91;}
35 a:hover {color: #305b91;}
36 h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color:#427cc9!important;text-decoration:none!important;}
36 h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color:#427cc9!important;text-decoration:none!important;}
37 h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {color: #305b91!important;}
37 h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active {color: #305b91!important;}
38 h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {color: #305b91!important;}
38 h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited {color: #305b91!important;}
39 table {font-size:13px;border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;}
39 table {font-size:13px;border-collapse:collapse;mso-table-lspace:0pt;mso-table-rspace:0pt;}
40 table td {padding:.65em 1em .65em 0;border-collapse:collapse;vertical-align:top;text-align:left;}
40 table td {padding:.65em 1em .65em 0;border-collapse:collapse;vertical-align:top;text-align:left;}
41 input {display:inline;border-radius:2px;border-style:solid;border: 1px solid #dbd9da;padding:.5em;}
41 input {display:inline;border-radius:2px;border-style:solid;border: 1px solid #dbd9da;padding:.5em;}
42 input:focus {outline: 1px solid #979797}
42 input:focus {outline: 1px solid #979797}
43 @media only screen and (-webkit-min-device-pixel-ratio: 2) {
43 @media only screen and (-webkit-min-device-pixel-ratio: 2) {
44 /* Put your iPhone 4g styles in here */
44 /* Put your iPhone 4g styles in here */
45 }
45 }
46
46
47 /* Android targeting */
47 /* Android targeting */
48 @media only screen and (-webkit-device-pixel-ratio:.75){
48 @media only screen and (-webkit-device-pixel-ratio:.75){
49 /* Put CSS for low density (ldpi) Android layouts in here */
49 /* Put CSS for low density (ldpi) Android layouts in here */
50 }
50 }
51 @media only screen and (-webkit-device-pixel-ratio:1){
51 @media only screen and (-webkit-device-pixel-ratio:1){
52 /* Put CSS for medium density (mdpi) Android layouts in here */
52 /* Put CSS for medium density (mdpi) Android layouts in here */
53 }
53 }
54 @media only screen and (-webkit-device-pixel-ratio:1.5){
54 @media only screen and (-webkit-device-pixel-ratio:1.5){
55 /* Put CSS for high density (hdpi) Android layouts in here */
55 /* Put CSS for high density (hdpi) Android layouts in here */
56 }
56 }
57 /* end Android targeting */
57 /* end Android targeting */
58
58
59 </style>
59 </style>
60
60
61 <!-- Targeting Windows Mobile -->
61 <!-- Targeting Windows Mobile -->
62 <!--[if IEMobile 7]>
62 <!--[if IEMobile 7]>
63 <style type="text/css">
63 <style type="text/css">
64
64
65 </style>
65 </style>
66 <![endif]-->
66 <![endif]-->
67
67
68 <!--[if gte mso 9]>
68 <!--[if gte mso 9]>
69 <style>
69 <style>
70 /* Target Outlook 2007 and 2010 */
70 /* Target Outlook 2007 and 2010 */
71 </style>
71 </style>
72 <![endif]-->
72 <![endif]-->
73 </head>
73 </head>
74 <body>
74 <body>
75 <!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
75 <!-- Wrapper/Container Table: Use a wrapper table to control the width and the background color consistently of your email. Use this approach instead of setting attributes on the body tag. -->
76 <table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" align="left" style="margin:1%;width:97%;padding:0;font-family:sans-serif;font-weight:100;border:1px solid #dbd9da">
76 <table cellpadding="0" cellspacing="0" border="0" id="backgroundTable" align="left" style="margin:1%;width:97%;padding:0;font-family:sans-serif;font-weight:100;border:1px solid #dbd9da">
77 <tr>
77 <tr>
78 <td valign="top" style="padding:0;">
78 <td valign="top" style="padding:0;">
79 <table cellpadding="0" cellspacing="0" border="0" align="left" width="100%">
79 <table cellpadding="0" cellspacing="0" border="0" align="left" width="100%">
80 <tr><td style="width:100%;padding:7px;background-color:#202020" valign="top">
80 <tr><td style="width:100%;padding:7px;background-color:#202020" valign="top">
81 <a style="color:#eeeeee;text-decoration:none;" href="${instance_url}">
81 <a style="color:#eeeeee;text-decoration:none;" href="${instance_url}">
82 ${'RhodeCode'}
82 ${'RhodeCode'}
83 </a>
83 </a>
84 </td></tr>
84 </td></tr>
85 <tr>
85 <tr>
86 <td style="padding:15px;" valign="top">
86 <td style="padding:15px;" valign="top">
87 % if data['push']['commits']:
87 % if data['push']['commits']:
88 % for commit in data['push']['commits']:
88 % for commit in data['push']['commits']:
89 <a href="${commit['url']}">${commit['short_id']}</a> by ${commit['author']} at ${commit['date']} <br/>
89 <a href="${commit['url']}">${commit['short_id']}</a> by ${commit['author']} at ${commit['date']} <br/>
90 ${commit['message_html']} <br/>
90 ${commit['message_html']} <br/>
91 <br/>
91 <br/>
92 % endfor
92 % endfor
93 % else:
93 % else:
94 No commit data
94 No commit data
95 % endif
95 % endif
96 </td>
96 </td>
97 </tr>
97 </tr>
98 </table>
98 </table>
99 </td>
99 </td>
100 </tr>
100 </tr>
101 </table>
101 </table>
102 <!-- End of wrapper table -->
102 <!-- End of wrapper table -->
103 <p><a style="margin-top:15px;margin-left:1%;font-family:sans-serif;font-weight:100;font-size:11px;color:#666666;text-decoration:none;" href="${instance_url}">
103 <p><a style="margin-top:15px;margin-left:1%;font-family:sans-serif;font-weight:100;font-size:11px;color:#666666;text-decoration:none;" href="${instance_url}">
104 ${'This is a notification from RhodeCode. %(instance_url)s' % {'instance_url': instance_url}}
104 ${'This is a notification from RhodeCode. %(instance_url)s' % {'instance_url': instance_url}}
105 </a></p>
105 </a></p>
106 </body>
106 </body>
107 </html>
107 </html>
108 ''')
108 ''')
109
109
110
110
111 # JIRA (EE ONLY)
111 # JIRA Integration (EE ONLY)
112 # available variables:
113 # url, short_id ,author
114 # branch, commit_message
115 # commit (dict data for commit)
112 from rc_integrations import jira_tracker
116 from rc_integrations import jira_tracker
113
117
114 jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template('''
118 # used for references issues without transition, e.g `This ticket references PROJ-123`
115 ${action} by ${author} (status: ${status}). \n
116 pull-request: ${url}
117 ''')
118
119
120 jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template('''
119 jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template('''
121 Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n
120 Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n
122 ${url}\n
121 ${url}\n
123
122
124 ## MODIFICATION add custom COMMIT message to the comment
123 ## MODIFICATION add custom COMMIT message to the comment
125 ${commit['message']}
124 ${commit['message']}
126 ''')
125 ''')
127
126
128
127 # used when there's a transition, e.g referenced issues status goes from
128 # open to resolved this is used in correlation with something like `closes PROJ-123`
129 jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template('''
129 jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template('''
130 Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n
130 Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n
131 '{url}\n
131 '{url}\n
132
132
133 ## MODIFICATION add custom COMMIT message to the comment
133 ## MODIFICATION add custom COMMIT message to the comment
134 ${commit['message']}
134 ${commit['message']}
135 ''')
135 ''')
136
136
137 jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template('''
138 ${action} by ${author} (status: ${status}). \n
139 pull-request: ${url}
140 ''')
141
137
142
138 # REDMINE (EE ONLY)
143 # REDMINE (EE ONLY)
144 # available variables:
145 # url, short_id ,author
146 # branch, commit_message
147 # commit (dict data for commit)
139 from rc_integrations import redmine_tracker
148 from rc_integrations import redmine_tracker
140
149
150 # used for references issues without transition, e.g `This ticket references #123`
141 redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template('''
151 redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template('''
142 Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n
152 Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n
143 commit: ${url}\n
153 commit: ${url}\n
144
154
145 ## MODIFICATION add custom COMMIT message to the comment
155 ## MODIFICATION add custom COMMIT message to the comment
146 message:
156 message:
147 ```
157 ```
148 ${commit['message']}
158 ${commit['message']}
149 ```
159 ```
150
160
151 ''')
161 ''')
152
162
163 # used when there's a transition, e.g referenced issues status goes from
164 # open to resolved this is used in correlation with something like `closes #123`
153 redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template('''
165 redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template('''
154 Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n
166 Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n
155 commit: ${url}\n
167 commit: ${url}\n
156
168
157 ## MODIFICATION add custom COMMIT message to the comment
169 ## MODIFICATION add custom COMMIT message to the comment
158 message:
170 message:
159 ```
171 ```
160 ${commit['message']}
172 ${commit['message']}
161 ```
173 ```
162
174
163 ''')
175 ''')
164
176
165 redmine_tracker.COMMENT_TEMPLATE_PULL_REQUEST = redmine_tracker.Template('''
177 redmine_tracker.COMMENT_TEMPLATE_PULL_REQUEST = redmine_tracker.Template('''
166 ${action} by ${author} (status: ${status}). \n'
178 ${action} by ${author} (status: ${status}). \n'
167 ${url}\n
179 ${url}\n
168
180
169 ## MODIFICATION add custom COMMIT message to the comment
181 ## MODIFICATION add custom COMMIT message to the comment
170 message:
182 message:
171 ```
183 ```
172 ${commit['message']}
184 ${commit['message']}
173 ```
185 ```
174
186
175 ''')
187 ''')
General Comments 0
You need to be logged in to leave comments. Login now