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