##// END OF EJS Templates
global settings: add a new template for flash filtering
ergo -
r953:228787c1 default
parent child Browse files
Show More
@@ -1,247 +1,266 b''
1 ${h.secure_form(url('admin_settings_global'), method='post')}
1 ${h.secure_form(url('admin_settings_global'), method='post')}
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading" id="branding-options">
4 <div class="panel-heading" id="branding-options">
5 <h3 class="panel-title">${_('Branding')} <a class="permalink" href="#branding-options"> ΒΆ</a></h3>
5 <h3 class="panel-title">${_('Branding')} <a class="permalink" href="#branding-options"> ΒΆ</a></h3>
6 </div>
6 </div>
7 <div class="panel-body">
7 <div class="panel-body">
8 <div class="label">
8 <div class="label">
9 <label for="rhodecode_title">${_('Title')}</label>
9 <label for="rhodecode_title">${_('Title')}</label>
10 </div>
10 </div>
11 <div class="field input">
11 <div class="field input">
12 ${h.text('rhodecode_title',size=60)}
12 ${h.text('rhodecode_title',size=60)}
13 </div>
13 </div>
14 <div class="field">
14 <div class="field">
15 <span class="help-block">
15 <span class="help-block">
16 ${_('Set a custom title for your RhodeCode instance (limited to 40 characters).')}
16 ${_('Set a custom title for your RhodeCode instance (limited to 40 characters).')}
17 </span>
17 </span>
18 </div>
18 </div>
19 <div class="label">
19 <div class="label">
20 <label for="rhodecode_realm">${_('HTTP[S] authentication realm')}</label>
20 <label for="rhodecode_realm">${_('HTTP[S] authentication realm')}</label>
21 </div>
21 </div>
22 <div class="field input">
22 <div class="field input">
23 ${h.text('rhodecode_realm',size=60)}
23 ${h.text('rhodecode_realm',size=60)}
24 </div>
24 </div>
25 <div class="field">
25 <div class="field">
26 <span class="help-block">
26 <span class="help-block">
27 ${_('Set a custom text that is shown as authentication message to clients trying to connect.')}
27 ${_('Set a custom text that is shown as authentication message to clients trying to connect.')}
28 </span>
28 </span>
29 </div>
29 </div>
30 </div>
30 </div>
31 </div>
31 </div>
32
32
33 <div class="panel panel-default">
33 <div class="panel panel-default">
34 <div class="panel-heading" id="captcha-options">
34 <div class="panel-heading" id="captcha-options">
35 <h3 class="panel-title">${_('Registration Captcha')} <a class="permalink" href="#captcha-options"> ΒΆ</a></h3>
35 <h3 class="panel-title">${_('Registration Captcha')} <a class="permalink" href="#captcha-options"> ΒΆ</a></h3>
36 </div>
36 </div>
37 <div class="panel-body">
37 <div class="panel-body">
38 <div class="label">
38 <div class="label">
39 <label for="rhodecode_captcha_public_key">${_('Google ReCaptcha public key')}</label>
39 <label for="rhodecode_captcha_public_key">${_('Google ReCaptcha public key')}</label>
40 </div>
40 </div>
41 <div class="field input">
41 <div class="field input">
42 ${h.text('rhodecode_captcha_public_key',size=60)}
42 ${h.text('rhodecode_captcha_public_key',size=60)}
43 </div>
43 </div>
44 <div class="field">
44 <div class="field">
45 <span class="help-block">
45 <span class="help-block">
46 ${_('Public key for reCaptcha system.')}
46 ${_('Public key for reCaptcha system.')}
47 </span>
47 </span>
48 </div>
48 </div>
49
49
50 <div class="label">
50 <div class="label">
51 <label for="rhodecode_captcha_private_key">${_('Google ReCaptcha private key')}</label>
51 <label for="rhodecode_captcha_private_key">${_('Google ReCaptcha private key')}</label>
52 </div>
52 </div>
53 <div class="field input">
53 <div class="field input">
54 ${h.text('rhodecode_captcha_private_key',size=60)}
54 ${h.text('rhodecode_captcha_private_key',size=60)}
55 </div>
55 </div>
56 <div class="field">
56 <div class="field">
57 <span class="help-block">
57 <span class="help-block">
58 ${_('Private key for reCaptcha system. Setting this value will enable captcha on registration')}
58 ${_('Private key for reCaptcha system. Setting this value will enable captcha on registration')}
59 </span>
59 </span>
60 </div>
60 </div>
61 </div>
61 </div>
62 </div>
62 </div>
63
63
64 <div class="panel panel-default">
64 <div class="panel panel-default">
65 <div class="panel-heading" id="header-code-options">
65 <div class="panel-heading" id="header-code-options">
66 <h3 class="panel-title">${_('Custom Header Code')} <a class="permalink" href="#header-code-options"> ΒΆ</a></h3>
66 <h3 class="panel-title">${_('Custom Header Code')} <a class="permalink" href="#header-code-options"> ΒΆ</a></h3>
67 </div>
67 </div>
68 <div class="panel-body">
68 <div class="panel-body">
69 <div class="select">
69 <div class="select">
70 <select id="pre_template" >
70 <select id="pre_template" >
71 <option value="#">${_('Templates...')}</option>
71 <option value="#">${_('Templates...')}</option>
72 <option value="ga">Google Analytics</option>
72 <option value="ga">Google Analytics</option>
73 <option value="clicky">Clicky</option>
73 <option value="clicky">Clicky</option>
74 <option value="server_announce">${_('Server Announcement')}</option>
74 <option value="server_announce">${_('Server Announcement')}</option>
75 <option value="flash_filtering">${_('Example flash message filtering')}</option>
75 </select>
76 </select>
76 </div>
77 </div>
77 <div style="padding: 10px 0px"></div>
78 <div style="padding: 10px 0px"></div>
78 <div class="textarea text-area">
79 <div class="textarea text-area">
79 ${h.textarea('rhodecode_pre_code',cols=23,rows=5,class_="medium")}
80 ${h.textarea('rhodecode_pre_code',cols=23,rows=5,class_="medium")}
80 <span class="help-block">${_('Custom js/css code added at the end of the <header/> tag.')}
81 <span class="help-block">${_('Custom js/css code added at the end of the <header/> tag.')}
81 ${_('Use <script/> or <css/> tags to define custom styling or scripting')}</span>
82 ${_('Use <script/> or <css/> tags to define custom styling or scripting')}</span>
82 </div>
83 </div>
83 </div>
84 </div>
84 </div>
85 </div>
85
86
86 <div class="panel panel-default">
87 <div class="panel panel-default">
87 <div class="panel-heading" id="footer-code-options">
88 <div class="panel-heading" id="footer-code-options">
88 <h3 class="panel-title">${_('Custom Footer Code')} <a class="permalink" href="#footer-code-options"> ΒΆ</a></h3>
89 <h3 class="panel-title">${_('Custom Footer Code')} <a class="permalink" href="#footer-code-options"> ΒΆ</a></h3>
89 </div>
90 </div>
90 <div class="panel-body">
91 <div class="panel-body">
91 <div class="select">
92 <div class="select">
92 <select id="post_template" >
93 <select id="post_template" >
93 <option value="#">${_('Templates...')}</option>
94 <option value="#">${_('Templates...')}</option>
94 <option value="ga">Google Analytics</option>
95 <option value="ga">Google Analytics</option>
95 <option value="clicky">Clicky</option>
96 <option value="clicky">Clicky</option>
96 <option value="server_announce">${_('Server Announcement')}</option>
97 <option value="server_announce">${_('Server Announcement')}</option>
97 </select>
98 </select>
98 </div>
99 </div>
99 <div style="padding: 10px 0px"></div>
100 <div style="padding: 10px 0px"></div>
100 <div class="textarea text-area">
101 <div class="textarea text-area">
101 ${h.textarea('rhodecode_post_code',cols=23,rows=5, class_="medium")}
102 ${h.textarea('rhodecode_post_code',cols=23,rows=5, class_="medium")}
102 <span class="help-block">${_('Custom js/css code added at the end of the <body> tag.')}
103 <span class="help-block">${_('Custom js/css code added at the end of the <body> tag.')}
103 ${_('Use <script> or <css> tags to define custom styling or scripting')}</span>
104 ${_('Use <script> or <css> tags to define custom styling or scripting')}</span>
104 </div>
105 </div>
105 </div>
106 </div>
106 </div>
107 </div>
107
108
108 <div class="buttons">
109 <div class="buttons">
109 ${h.submit('save',_('Save settings'),class_="btn")}
110 ${h.submit('save',_('Save settings'),class_="btn")}
110 ${h.reset('reset',_('Reset'),class_="btn")}
111 ${h.reset('reset',_('Reset'),class_="btn")}
111 </div>
112 </div>
112 ${h.end_form()}
113 ${h.end_form()}
113
114
114
115
115
116
116 ## TEMPLATES ##
117 ## TEMPLATES ##
117 ###############
118 ###############
118
119
119 <script id="ga_tmpl" type="text/x-template">
120 <script id="ga_tmpl" type="text/x-template">
120 <%text filter="h">
121 <%text filter="h">
121 <script>
122 <script>
122 // Google Analytics
123 // Google Analytics
123 // Put your Google Analytics code instead of _GACODE_
124 // Put your Google Analytics code instead of _GACODE_
124 var _gaq_code = '_GACODE_';
125 var _gaq_code = '_GACODE_';
125 var _gaq = _gaq || [];
126 var _gaq = _gaq || [];
126 _gaq.push(['_setAccount', _gaq_code]);
127 _gaq.push(['_setAccount', _gaq_code]);
127 _gaq.push(['_trackPageview']);
128 _gaq.push(['_trackPageview']);
128
129
129 (function() {
130 (function() {
130 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
131 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
131 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
132 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
132 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
133 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
133 })();
134 })();
134
135
135 rhodecode_statechange_callback = function(url, data){
136 rhodecode_statechange_callback = function(url, data){
136 // ANALYTICS callback on html5 history state changed
137 // ANALYTICS callback on html5 history state changed
137 // triggered by file browser, url is the new url,
138 // triggered by file browser, url is the new url,
138 // data is extra info passed from the State object
139 // data is extra info passed from the State object
139 if (typeof window._gaq !== 'undefined') {
140 if (typeof window._gaq !== 'undefined') {
140 _gaq.push(['_trackPageview', url]);
141 _gaq.push(['_trackPageview', url]);
141 }
142 }
142 };
143 };
143 </script>
144 </script>
144 </%text>
145 </%text>
145 </script>
146 </script>
146
147
147
148
148
149
149 <script id="clicky_tmpl" type="text/x-template">
150 <script id="clicky_tmpl" type="text/x-template">
150 <%text filter="h">
151 <%text filter="h">
151 <script src="//static.getclicky.com/js" type="text/javascript"></script>
152 <script src="//static.getclicky.com/js" type="text/javascript"></script>
152 <script type="text/javascript">
153 <script type="text/javascript">
153 // Clicky Analytics - should be used in the footer code section.
154 // Clicky Analytics - should be used in the footer code section.
154 // Put your Clicky code instead of _CLICKYCODE_ here,
155 // Put your Clicky code instead of _CLICKYCODE_ here,
155 // and below in the <img> tag.
156 // and below in the <img> tag.
156 var _cl_code = _CLICKYCODE_;
157 var _cl_code = _CLICKYCODE_;
157 try{clicky.init(_cl_code);}catch(e){}
158 try{clicky.init(_cl_code);}catch(e){}
158
159
159 rhodecode_statechange_callback = function(url, data){
160 rhodecode_statechange_callback = function(url, data){
160 // ANALYTICS callback on html5 history state changed
161 // ANALYTICS callback on html5 history state changed
161 // triggered by file browser, url is the new url,
162 // triggered by file browser, url is the new url,
162 // data is extra info passed from the State object
163 // data is extra info passed from the State object
163 if (typeof window.clicky !== 'undefined') {
164 if (typeof window.clicky !== 'undefined') {
164 clicky.log(url);
165 clicky.log(url);
165 }
166 }
166 }
167 }
167 </script>
168 </script>
168 <noscript>
169 <noscript>
169 // Put your clicky code in the src file.
170 // Put your clicky code in the src file.
170 <p><img alt="Clicky" width="1" height="1"
171 <p><img alt="Clicky" width="1" height="1"
171 src="//in.getclicky.com/_CLICKYCODE_ns.gif" /></p>
172 src="//in.getclicky.com/_CLICKYCODE_ns.gif" /></p>
172 </noscript>
173 </noscript>
173 </%text>
174 </%text>
174 </script>
175 </script>
175
176
176
177
177
178
178 <script id="server_announce_tmpl" type='text/x-template'>
179 <script id="server_announce_tmpl" type='text/x-template'>
179 <%text filter="h">
180 <%text filter="h">
180 <script>
181 <script>
181 // Server announcement displayed on the top of the page.
182 // Server announcement displayed on the top of the page.
182 // This can be used to send a global maintainance messages or other
183 // This can be used to send a global maintainance messages or other
183 // important messages to all users of the RhodeCode Enterprise system.
184 // important messages to all users of the RhodeCode Enterprise system.
184
185
185 $(document).ready(function(e){
186 $(document).ready(function(e){
186
187
187 // EDIT - put your message below
188 // EDIT - put your message below
188 var message = "TYPE YOUR MESSAGE HERE";
189 var message = "TYPE YOUR MESSAGE HERE";
189
190
190 // EDIT - choose "info"/"warning"/"error"/"success"/"neutral" as appropriate
191 // EDIT - choose "info"/"warning"/"error"/"success"/"neutral" as appropriate
191 var alert_level = "info";
192 var alert_level = "info";
192
193
193 $("#body").prepend(
194 $("#body").prepend(
194 ("<div id='server-announcement' class='"+alert_level+"'>_MSG_"+"</div>").replace("_MSG_", message)
195 ("<div id='server-announcement' class='"+alert_level+"'>_MSG_"+"</div>").replace("_MSG_", message)
195 )
196 )
196 })
197 })
197 </script>
198 </script>
198 </%text>
199 </%text>
199 </script>
200 </script>
200
201
202 <script id="flash_filtering_tmpl" type='text/x-template'>
203 <%text filter="h">
204 <script>
205 // This filters out some flash messages before they are presented to user
206 // based on their contents
201
207
208 var filteredMessages = [];
209 for(var i =0; i< alertMessagePayloads.length; i++){
210 if (typeof alertMessagePayloads[i].message.subdata.subtype !== 'undefined' &&
211 alertMessagePayloads[i].message.subdata.subtype.indexOf('rc_license') !== -1){
212 continue
213 }
214 filteredMessages.push(alertMessagePayloads[i]);
215 }
216 alertMessagePayloads = filteredMessages;
217 </script>
218 </%text>
219 </script>
202
220
203 <script>
221 <script>
204 var pre_cm = initCodeMirror('rhodecode_pre_code', '', false);
222 var pre_cm = initCodeMirror('rhodecode_pre_code', '', false);
205 var pre_old = pre_cm.getValue();
223 var pre_old = pre_cm.getValue();
206
224
207 var post_cm = initCodeMirror('rhodecode_post_code', '', false);
225 var post_cm = initCodeMirror('rhodecode_post_code', '', false);
208 var post_old = post_cm.getValue();
226 var post_old = post_cm.getValue();
209
227
210 var get_data = function(type, old){
228 var get_data = function(type, old){
211 var get_tmpl = function(tmpl_name){
229 var get_tmpl = function(tmpl_name){
212 // unescape some stuff
230 // unescape some stuff
213 var html = htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
231 var html = htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
214 return html;
232 return html;
215 };
233 };
216 return {
234 return {
217 '#': old,
235 '#': old,
218 'ga': get_tmpl('ga'),
236 'ga': get_tmpl('ga'),
219 'clicky': get_tmpl('clicky'),
237 'clicky': get_tmpl('clicky'),
220 'server_announce': get_tmpl('server_announce')
238 'server_announce': get_tmpl('server_announce'),
239 'flash_filtering': get_tmpl('flash_filtering')
221 }[type]
240 }[type]
222 };
241 };
223
242
224 $('#pre_template').select2({
243 $('#pre_template').select2({
225 containerCssClass: 'drop-menu',
244 containerCssClass: 'drop-menu',
226 dropdownCssClass: 'drop-menu-dropdown',
245 dropdownCssClass: 'drop-menu-dropdown',
227 dropdownAutoWidth: true,
246 dropdownAutoWidth: true,
228 minimumResultsForSearch: -1
247 minimumResultsForSearch: -1
229 });
248 });
230
249
231 $('#post_template').select2({
250 $('#post_template').select2({
232 containerCssClass: 'drop-menu',
251 containerCssClass: 'drop-menu',
233 dropdownCssClass: 'drop-menu-dropdown',
252 dropdownCssClass: 'drop-menu-dropdown',
234 dropdownAutoWidth: true,
253 dropdownAutoWidth: true,
235 minimumResultsForSearch: -1
254 minimumResultsForSearch: -1
236 });
255 });
237
256
238 $('#post_template').on('change', function(e){
257 $('#post_template').on('change', function(e){
239 var sel = this.value;
258 var sel = this.value;
240 post_cm.setValue(get_data(sel, post_old))
259 post_cm.setValue(get_data(sel, post_old))
241 });
260 });
242
261
243 $('#pre_template').on('change', function(e){
262 $('#pre_template').on('change', function(e){
244 var sel = this.value;
263 var sel = this.value;
245 pre_cm.setValue(get_data(sel, pre_old))
264 pre_cm.setValue(get_data(sel, pre_old))
246 })
265 })
247 </script>
266 </script>
General Comments 0
You need to be logged in to leave comments. Login now