##// END OF EJS Templates
template: use mako block for root.html extra sections
Mads Kiilerich -
r4810:6a825018 default
parent child Browse files
Show More
@@ -1,177 +1,177 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
5 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
6 %if c.site_name:
6 %if c.site_name:
7 &middot; ${c.site_name}
7 &middot; ${c.site_name}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="js_extra()">
11 <%block name="js_extra">
12 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
12 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
13 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
13 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
14 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
14 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
15 </%def>
15 </%block>
16 <%def name="css_extra()">
16 <%block name="css_extra">
17 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
17 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
18 </%def>
18 </%block>
19
19
20 <%def name="breadcrumbs_links()">
20 <%def name="breadcrumbs_links()">
21 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
21 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
22 </%def>
22 </%def>
23
23
24 <%block name="header_menu">
24 <%block name="header_menu">
25 ${self.menu('gists')}
25 ${self.menu('gists')}
26 </%block>
26 </%block>
27
27
28 <%def name="main()">
28 <%def name="main()">
29 <div class="box">
29 <div class="box">
30 <!-- box / title -->
30 <!-- box / title -->
31 <div class="title">
31 <div class="title">
32 ${self.breadcrumbs()}
32 ${self.breadcrumbs()}
33 </div>
33 </div>
34
34
35 <div class="table">
35 <div class="table">
36 <div id="edit_error" style="display: none" class="flash_msg">
36 <div id="edit_error" style="display: none" class="flash_msg">
37 <div class="alert alert-dismissable alert-warning">
37 <div class="alert alert-dismissable alert-warning">
38 <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="icon-cancel-circled"></i></button>
38 <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><i class="icon-cancel-circled"></i></button>
39 ${h.literal(_('Gist was update since you started editing. Copy your changes and click %(here)s to reload new version.')
39 ${h.literal(_('Gist was update since you started editing. Copy your changes and click %(here)s to reload new version.')
40 % {'here': h.link_to('here',h.url('edit_gist', gist_id=c.gist.gist_access_id))})}
40 % {'here': h.link_to('here',h.url('edit_gist', gist_id=c.gist.gist_access_id))})}
41 </div>
41 </div>
42 <script>
42 <script>
43 if (typeof jQuery != 'undefined') {
43 if (typeof jQuery != 'undefined') {
44 $(".alert").alert();
44 $(".alert").alert();
45 }
45 }
46 </script>
46 </script>
47 </div>
47 </div>
48
48
49 <div id="files_data">
49 <div id="files_data">
50 ${h.form(h.url('edit_gist', gist_id=c.gist.gist_access_id), method='post', id='eform')}
50 ${h.form(h.url('edit_gist', gist_id=c.gist.gist_access_id), method='post', id='eform')}
51 <div>
51 <div>
52 <div class="gravatar">
52 <div class="gravatar">
53 ${h.gravatar(c.authuser.email, size=32)}
53 ${h.gravatar(c.authuser.email, size=32)}
54 </div>
54 </div>
55 <input type="hidden" value="${c.file_changeset.raw_id}" name="parent_hash">
55 <input type="hidden" value="${c.file_changeset.raw_id}" name="parent_hash">
56 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;"
56 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;"
57 id="description" name="description"
57 id="description" name="description"
58 placeholder="${_('Gist description ...')}">${c.gist.gist_description}</textarea>
58 placeholder="${_('Gist description ...')}">${c.gist.gist_description}</textarea>
59 <div style="padding:0px 0px 0px 42px">
59 <div style="padding:0px 0px 0px 42px">
60 <label for='lifetime'>${_('Gist lifetime')}</label>
60 <label for='lifetime'>${_('Gist lifetime')}</label>
61 ${h.select('lifetime', '0', c.lifetime_options)}
61 ${h.select('lifetime', '0', c.lifetime_options)}
62 <span class="" style="color: #AAA">
62 <span class="" style="color: #AAA">
63 %if c.gist.gist_expires == -1:
63 %if c.gist.gist_expires == -1:
64 ${_('Expires')}: ${_('never')}
64 ${_('Expires')}: ${_('never')}
65 %else:
65 %else:
66 ${_('Expires')}: ${h.age(h.time_to_datetime(c.gist.gist_expires))}
66 ${_('Expires')}: ${h.age(h.time_to_datetime(c.gist.gist_expires))}
67 %endif
67 %endif
68 </span>
68 </span>
69 </div>
69 </div>
70 </div>
70 </div>
71
71
72 % for cnt, file in enumerate(c.files):
72 % for cnt, file in enumerate(c.files):
73 <div id="body" class="codeblock" style="margin-bottom: 4px">
73 <div id="body" class="codeblock" style="margin-bottom: 4px">
74 <div style="padding: 10px 10px 10px 26px;color:#666666">
74 <div style="padding: 10px 10px 10px 26px;color:#666666">
75 <input type="hidden" value="${file.path}" name="org_files">
75 <input type="hidden" value="${file.path}" name="org_files">
76 <input id="filename_${h.FID('f',file.path)}" name="files" size="30" type="text" value="${file.path}">
76 <input id="filename_${h.FID('f',file.path)}" name="files" size="30" type="text" value="${file.path}">
77 <select id="mimetype_${h.FID('f',file.path)}" name="mimetypes"/>
77 <select id="mimetype_${h.FID('f',file.path)}" name="mimetypes"/>
78 </div>
78 </div>
79 <div class="editor_container">
79 <div class="editor_container">
80 <pre id="editor_pre"></pre>
80 <pre id="editor_pre"></pre>
81 <textarea id="editor_${h.FID('f',file.path)}" name="contents" style="display:none">${file.content}</textarea>
81 <textarea id="editor_${h.FID('f',file.path)}" name="contents" style="display:none">${file.content}</textarea>
82 </div>
82 </div>
83 </div>
83 </div>
84
84
85 ## dynamic edit box.
85 ## dynamic edit box.
86 <script type="text/javascript">
86 <script type="text/javascript">
87 var myCodeMirror = initCodeMirror("editor_${h.FID('f',file.path)}", '');
87 var myCodeMirror = initCodeMirror("editor_${h.FID('f',file.path)}", '');
88
88
89 //inject new modes
89 //inject new modes
90 var $modes_select = $('#mimetype_${h.FID('f',file.path)}');
90 var $modes_select = $('#mimetype_${h.FID('f',file.path)}');
91 $modes_select.each(function(){
91 $modes_select.each(function(){
92 var modes_select = this;
92 var modes_select = this;
93 var index = 1;
93 var index = 1;
94 for(var i=0;i<CodeMirror.modeInfo.length;i++) {
94 for(var i=0;i<CodeMirror.modeInfo.length;i++) {
95 var m = CodeMirror.modeInfo[i];
95 var m = CodeMirror.modeInfo[i];
96 var opt = new Option(m.name, m.mime);
96 var opt = new Option(m.name, m.mime);
97 $(opt).attr('mode', m.mode);
97 $(opt).attr('mode', m.mode);
98 if (m.mime == 'text/plain') {
98 if (m.mime == 'text/plain') {
99 // default plain text
99 // default plain text
100 $(opt).attr('selected', 'selected');
100 $(opt).attr('selected', 'selected');
101 modes_select.options[0] = opt;
101 modes_select.options[0] = opt;
102 } else {
102 } else {
103 modes_select.options[index++] = opt;
103 modes_select.options[index++] = opt;
104 }
104 }
105 }
105 }
106 });
106 });
107
107
108 var $filename = $('#filename_${h.FID('f',file.path)}');
108 var $filename = $('#filename_${h.FID('f',file.path)}');
109 // on select change set new mode
109 // on select change set new mode
110 $modes_select.change(function(e){
110 $modes_select.change(function(e){
111 var selected = e.currentTarget;
111 var selected = e.currentTarget;
112 var node = selected.options[selected.selectedIndex];
112 var node = selected.options[selected.selectedIndex];
113 var detected_mode = CodeMirror.findModeByMIME(node.value);
113 var detected_mode = CodeMirror.findModeByMIME(node.value);
114 setCodeMirrorMode(myCodeMirror, detected_mode);
114 setCodeMirrorMode(myCodeMirror, detected_mode);
115
115
116 var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
116 var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
117 var file_data = CodeMirror.getFilenameAndExt($filename.val());
117 var file_data = CodeMirror.getFilenameAndExt($filename.val());
118 var filename = file_data['filename'] || 'filename1';
118 var filename = file_data['filename'] || 'filename1';
119 $filename.val(filename + '.' + proposed_ext);
119 $filename.val(filename + '.' + proposed_ext);
120 });
120 });
121
121
122 // on type the new filename set mode
122 // on type the new filename set mode
123 $filename.keyup(function(e){
123 $filename.keyup(function(e){
124 var file_data = CodeMirror.getFilenameAndExt(this.value);
124 var file_data = CodeMirror.getFilenameAndExt(this.value);
125 if(file_data['ext'] != null){
125 if(file_data['ext'] != null){
126 var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
126 var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
127
127
128 if (detected_mode){
128 if (detected_mode){
129 setCodeMirrorMode(myCodeMirror, detected_mode);
129 setCodeMirrorMode(myCodeMirror, detected_mode);
130 $modes_select.val(detected_mode.mime);
130 $modes_select.val(detected_mode.mime);
131 }
131 }
132 }
132 }
133 });
133 });
134
134
135 // set mode on page load
135 // set mode on page load
136 var detected_mode = CodeMirror.findModeByExtension("${file.extension}");
136 var detected_mode = CodeMirror.findModeByExtension("${file.extension}");
137
137
138 if (detected_mode){
138 if (detected_mode){
139 setCodeMirrorMode(myCodeMirror, detected_mode);
139 setCodeMirrorMode(myCodeMirror, detected_mode);
140 $modes_select.val(detected_mode.mime);
140 $modes_select.val(detected_mode.mime);
141 }
141 }
142
142
143 </script>
143 </script>
144
144
145 %endfor
145 %endfor
146
146
147 <div style="padding-top: 5px">
147 <div style="padding-top: 5px">
148 ${h.submit('update',_('Update Gist'),class_="btn btn-mini btn-success")}
148 ${h.submit('update',_('Update Gist'),class_="btn btn-mini btn-success")}
149 <a class="btn btn-mini" href="${h.url('gist', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
149 <a class="btn btn-mini" href="${h.url('gist', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
150 </div>
150 </div>
151 ${h.end_form()}
151 ${h.end_form()}
152 <script>
152 <script>
153 $('#update').on('click', function(e){
153 $('#update').on('click', function(e){
154 e.preventDefault();
154 e.preventDefault();
155
155
156 // check for newer version.
156 // check for newer version.
157 $.ajax({
157 $.ajax({
158 url: "${h.url('edit_gist_check_revision', gist_id=c.gist.gist_access_id)}",
158 url: "${h.url('edit_gist_check_revision', gist_id=c.gist.gist_access_id)}",
159 data: {'revision': '${c.file_changeset.raw_id}'},
159 data: {'revision': '${c.file_changeset.raw_id}'},
160 dataType: 'json',
160 dataType: 'json',
161 type: 'POST',
161 type: 'POST',
162 success: function(data) {
162 success: function(data) {
163 if(data.success == false){
163 if(data.success == false){
164 $('#edit_error').show();
164 $('#edit_error').show();
165 }
165 }
166 else{
166 else{
167 $('#eform').submit();
167 $('#eform').submit();
168 }
168 }
169 }
169 }
170 })
170 })
171 });
171 });
172 </script>
172 </script>
173 </div>
173 </div>
174 </div>
174 </div>
175
175
176 </div>
176 </div>
177 </%def>
177 </%def>
@@ -1,116 +1,116 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('New Gist')}
5 ${_('New Gist')}
6 %if c.site_name:
6 %if c.site_name:
7 &middot; ${c.site_name}
7 &middot; ${c.site_name}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="js_extra()">
11 <%block name="js_extra">
12 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
12 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
13 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
13 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
14 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
14 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
15 </%def>
15 </%block>
16 <%def name="css_extra()">
16 <%block name="css_extra">
17 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
17 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
18 </%def>
18 </%block>
19
19
20 <%def name="breadcrumbs_links()">
20 <%def name="breadcrumbs_links()">
21 ${_('New Gist')}
21 ${_('New Gist')}
22 </%def>
22 </%def>
23
23
24 <%block name="header_menu">
24 <%block name="header_menu">
25 ${self.menu('gists')}
25 ${self.menu('gists')}
26 </%block>
26 </%block>
27
27
28 <%def name="main()">
28 <%def name="main()">
29 <div class="box">
29 <div class="box">
30 <!-- box / title -->
30 <!-- box / title -->
31 <div class="title">
31 <div class="title">
32 ${self.breadcrumbs()}
32 ${self.breadcrumbs()}
33 </div>
33 </div>
34
34
35 <div class="table">
35 <div class="table">
36 <div id="files_data">
36 <div id="files_data">
37 ${h.form(h.url('gists'), method='post',id='eform')}
37 ${h.form(h.url('gists'), method='post',id='eform')}
38 <div>
38 <div>
39 <div class="gravatar">
39 <div class="gravatar">
40 ${h.gravatar(c.authuser.email, size=32)}
40 ${h.gravatar(c.authuser.email, size=32)}
41 </div>
41 </div>
42 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
42 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
43 <div style="padding:0px 0px 0px 42px">
43 <div style="padding:0px 0px 0px 42px">
44 <label for='lifetime'>${_('Gist lifetime')}</label>
44 <label for='lifetime'>${_('Gist lifetime')}</label>
45 ${h.select('lifetime', '', c.lifetime_options)}
45 ${h.select('lifetime', '', c.lifetime_options)}
46 </div>
46 </div>
47 </div>
47 </div>
48 <div id="body" class="codeblock">
48 <div id="body" class="codeblock">
49 <div style="padding: 10px 10px 10px 26px;color:#666666">
49 <div style="padding: 10px 10px 10px 26px;color:#666666">
50 ${h.text('filename', size=30, placeholder=_('name this file...'))}
50 ${h.text('filename', size=30, placeholder=_('name this file...'))}
51 <select id="mimetype" name="mimetype"/>
51 <select id="mimetype" name="mimetype"/>
52 </div>
52 </div>
53 <div id="editor_container">
53 <div id="editor_container">
54 <pre id="editor_pre"></pre>
54 <pre id="editor_pre"></pre>
55 <textarea id="editor" name="content" style="display:none"></textarea>
55 <textarea id="editor" name="content" style="display:none"></textarea>
56 </div>
56 </div>
57 </div>
57 </div>
58 <div style="padding-top: 5px">
58 <div style="padding-top: 5px">
59 ${h.submit('private',_('Create Private Gist'),class_="btn btn-mini btn-success")}
59 ${h.submit('private',_('Create Private Gist'),class_="btn btn-mini btn-success")}
60 ${h.submit('public',_('Create Public Gist'),class_="btn btn-mini")}
60 ${h.submit('public',_('Create Public Gist'),class_="btn btn-mini")}
61 ${h.reset('reset',_('Reset'),class_="btn btn-mini")}
61 ${h.reset('reset',_('Reset'),class_="btn btn-mini")}
62 </div>
62 </div>
63 ${h.end_form()}
63 ${h.end_form()}
64 <script type="text/javascript">
64 <script type="text/javascript">
65 var myCodeMirror = initCodeMirror('editor', '');
65 var myCodeMirror = initCodeMirror('editor', '');
66
66
67 //inject new modes
67 //inject new modes
68 var $modes_select = $('#mimetype');
68 var $modes_select = $('#mimetype');
69 $modes_select.each(function(){
69 $modes_select.each(function(){
70 var modes_select = this;
70 var modes_select = this;
71 var index = 1;
71 var index = 1;
72 for(var i=0;i<CodeMirror.modeInfo.length;i++) {
72 for(var i=0;i<CodeMirror.modeInfo.length;i++) {
73 var m = CodeMirror.modeInfo[i];
73 var m = CodeMirror.modeInfo[i];
74 var opt = new Option(m.name, m.mime);
74 var opt = new Option(m.name, m.mime);
75 $(opt).attr('mode', m.mode);
75 $(opt).attr('mode', m.mode);
76 if (m.mime == 'text/plain') {
76 if (m.mime == 'text/plain') {
77 // default plain text
77 // default plain text
78 $(opt).attr('selected', 'selected');
78 $(opt).attr('selected', 'selected');
79 modes_select.options[0] = opt;
79 modes_select.options[0] = opt;
80 } else {
80 } else {
81 modes_select.options[index++] = opt;
81 modes_select.options[index++] = opt;
82 }
82 }
83 }
83 }
84 });
84 });
85
85
86 var $filename = $('#filename');
86 var $filename = $('#filename');
87 // on select change set new mode
87 // on select change set new mode
88 $modes_select.change(function(e){
88 $modes_select.change(function(e){
89 var selected = e.currentTarget;
89 var selected = e.currentTarget;
90 var node = selected.options[selected.selectedIndex];
90 var node = selected.options[selected.selectedIndex];
91 var detected_mode = CodeMirror.findModeByMIME(node.value);
91 var detected_mode = CodeMirror.findModeByMIME(node.value);
92 setCodeMirrorMode(myCodeMirror, detected_mode);
92 setCodeMirrorMode(myCodeMirror, detected_mode);
93
93
94 var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
94 var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
95 var file_data = CodeMirror.getFilenameAndExt($filename.val());
95 var file_data = CodeMirror.getFilenameAndExt($filename.val());
96 var filename = file_data['filename'] || 'filename1';
96 var filename = file_data['filename'] || 'filename1';
97 $filename.val(filename + '.' + proposed_ext);
97 $filename.val(filename + '.' + proposed_ext);
98 });
98 });
99
99
100 // on type the new filename set mode
100 // on type the new filename set mode
101 $filename.keyup(function(e){
101 $filename.keyup(function(e){
102 var file_data = CodeMirror.getFilenameAndExt(this.value);
102 var file_data = CodeMirror.getFilenameAndExt(this.value);
103 if(file_data['ext'] != null){
103 if(file_data['ext'] != null){
104 var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
104 var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
105 if (detected_mode){
105 if (detected_mode){
106 setCodeMirrorMode(myCodeMirror, detected_mode);
106 setCodeMirrorMode(myCodeMirror, detected_mode);
107 $modes_select.val(detected_mode.mime);
107 $modes_select.val(detected_mode.mime);
108 }
108 }
109 }
109 }
110 });
110 });
111 </script>
111 </script>
112 </div>
112 </div>
113 </div>
113 </div>
114
114
115 </div>
115 </div>
116 </%def>
116 </%def>
@@ -1,147 +1,144 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html>
2 <!DOCTYPE html>
3 <html xmlns="http://www.w3.org/1999/xhtml">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
4 <head>
5 <title>${self.title()}</title>
5 <title>${self.title()}</title>
6 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
6 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7 <meta name="robots" content="index, nofollow"/>
7 <meta name="robots" content="index, nofollow"/>
8 <link rel="icon" href="${h.url('/images/favicon.ico')}" type="image/png" />
8 <link rel="icon" href="${h.url('/images/favicon.ico')}" type="image/png" />
9
9
10 ## CSS ###
10 ## CSS ###
11 <link rel="stylesheet" type="text/css" href="${h.url('/js/select2/select2.css', ver=c.kallithea_version)}"/>
11 <link rel="stylesheet" type="text/css" href="${h.url('/js/select2/select2.css', ver=c.kallithea_version)}"/>
12 <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css', ver=c.kallithea_version)}"/>
12 <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css', ver=c.kallithea_version)}"/>
13 <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.kallithea_version)}" media="screen"/>
13 <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css', ver=c.kallithea_version)}" media="screen"/>
14 <link rel="stylesheet" type="text/css" href="${h.url('/css/contextbar.css', ver=c.kallithea_version)}" media="screen"/>
14 <link rel="stylesheet" type="text/css" href="${h.url('/css/contextbar.css', ver=c.kallithea_version)}" media="screen"/>
15 <link rel="stylesheet" type="text/css" href="${h.url('/fontello/css/kallithea.css', ver=c.kallithea_version)}">
15 <link rel="stylesheet" type="text/css" href="${h.url('/fontello/css/kallithea.css', ver=c.kallithea_version)}">
16 <%def name="css_extra()"></%def>
16 <%block name="css_extra"/>
17 ${self.css_extra()}
18
17
19 ## JAVASCRIPT ##
18 ## JAVASCRIPT ##
20 <script type="text/javascript">
19 <script type="text/javascript">
21 ## JS translations map
20 ## JS translations map
22 var TRANSLATION_MAP = {
21 var TRANSLATION_MAP = {
23 'Add Another Comment':'${_("Add Another Comment")}',
22 'Add Another Comment':'${_("Add Another Comment")}',
24 'Stop following this repository':"${_('Stop following this repository')}",
23 'Stop following this repository':"${_('Stop following this repository')}",
25 'Start following this repository':"${_('Start following this repository')}",
24 'Start following this repository':"${_('Start following this repository')}",
26 'Group':"${_('Group')}",
25 'Group':"${_('Group')}",
27 'members':"${_('members')}",
26 'members':"${_('members')}",
28 'Loading ...':"${_('Loading ...')}",
27 'Loading ...':"${_('Loading ...')}",
29 'loading ...':"${_('loading ...')}",
28 'loading ...':"${_('loading ...')}",
30 'Search truncated': "${_('Search truncated')}",
29 'Search truncated': "${_('Search truncated')}",
31 'No matching files': "${_('No matching files')}",
30 'No matching files': "${_('No matching files')}",
32 'Open New Pull Request': "${_('Open New Pull Request')}",
31 'Open New Pull Request': "${_('Open New Pull Request')}",
33 'Open New Pull Request for Selected Changesets': "${_('Open New Pull Request for Selected Changesets')}",
32 'Open New Pull Request for Selected Changesets': "${_('Open New Pull Request for Selected Changesets')}",
34 'Show Selected Changesets __S &rarr; __E': "${h.literal(_('Show Selected Changesets __S &rarr; __E'))}",
33 'Show Selected Changesets __S &rarr; __E': "${h.literal(_('Show Selected Changesets __S &rarr; __E'))}",
35 'Show Selected Changeset __S': "${_('Show Selected Changeset __S')}",
34 'Show Selected Changeset __S': "${_('Show Selected Changeset __S')}",
36 'Selection Link': "${_('Selection Link')}",
35 'Selection Link': "${_('Selection Link')}",
37 'Collapse Diff': "${_('Collapse Diff')}",
36 'Collapse Diff': "${_('Collapse Diff')}",
38 'Expand Diff': "${_('Expand Diff')}",
37 'Expand Diff': "${_('Expand Diff')}",
39 'Failed to revoke permission': "${_('Failed to revoke permission')}",
38 'Failed to revoke permission': "${_('Failed to revoke permission')}",
40 'Confirm to revoke permission for {0}: {1} ?': "${_('Confirm to revoke permission for {0}: {1} ?')}",
39 'Confirm to revoke permission for {0}: {1} ?': "${_('Confirm to revoke permission for {0}: {1} ?')}",
41 'enabled': "${_('enabled')}",
40 'enabled': "${_('enabled')}",
42 'disabled': "${_('disabled')}",
41 'disabled': "${_('disabled')}",
43 'Select changeset': "${_('Select changeset')}",
42 'Select changeset': "${_('Select changeset')}",
44 'Specify changeset': "${_('Specify changeset')}",
43 'Specify changeset': "${_('Specify changeset')}",
45 'MSG_SORTASC': "${_('Click to sort ascending')}",
44 'MSG_SORTASC': "${_('Click to sort ascending')}",
46 'MSG_SORTDESC': "${_('Click to sort descending')}",
45 'MSG_SORTDESC': "${_('Click to sort descending')}",
47 'MSG_EMPTY': "${_('No records found.')}",
46 'MSG_EMPTY': "${_('No records found.')}",
48 'MSG_ERROR': "${_('Data error.')}",
47 'MSG_ERROR': "${_('Data error.')}",
49 'MSG_LOADING': "${_('Loading...')}"
48 'MSG_LOADING': "${_('Loading...')}"
50 };
49 };
51 var _TM = TRANSLATION_MAP;
50 var _TM = TRANSLATION_MAP;
52
51
53 var TOGGLE_FOLLOW_URL = "${h.url('toggle_following')}";
52 var TOGGLE_FOLLOW_URL = "${h.url('toggle_following')}";
54
53
55 var REPO_NAME = "";
54 var REPO_NAME = "";
56 %if hasattr(c, 'repo_name'):
55 %if hasattr(c, 'repo_name'):
57 var REPO_NAME = "${c.repo_name}";
56 var REPO_NAME = "${c.repo_name}";
58 %endif
57 %endif
59 </script>
58 </script>
60 <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.kallithea_version)}"></script>
59 <script type="text/javascript" src="${h.url('/js/yui.2.9.js', ver=c.kallithea_version)}"></script>
61 <script type="text/javascript" src="${h.url('/js/jquery-1.11.1.min.js', ver=c.kallithea_version)}"></script>
60 <script type="text/javascript" src="${h.url('/js/jquery-1.11.1.min.js', ver=c.kallithea_version)}"></script>
62 <script type="text/javascript" src="${h.url('/js/bootstrap.js', ver=c.kallithea_version)}"></script>
61 <script type="text/javascript" src="${h.url('/js/bootstrap.js', ver=c.kallithea_version)}"></script>
63 <script type="text/javascript" src="${h.url('/js/select2/select2.js', ver=c.kallithea_version)}"></script>
62 <script type="text/javascript" src="${h.url('/js/select2/select2.js', ver=c.kallithea_version)}"></script>
64 <script type="text/javascript" src="${h.url('/js/mousetrap.js', ver=c.kallithea_version)}"></script>
63 <script type="text/javascript" src="${h.url('/js/mousetrap.js', ver=c.kallithea_version)}"></script>
65 <!--[if lt IE 9]>
64 <!--[if lt IE 9]>
66 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
65 <script language="javascript" type="text/javascript" src="${h.url('/js/excanvas.min.js')}"></script>
67 <![endif]-->
66 <![endif]-->
68 <script type="text/javascript" src="${h.url('/js/yui.flot.js', ver=c.kallithea_version)}"></script>
67 <script type="text/javascript" src="${h.url('/js/yui.flot.js', ver=c.kallithea_version)}"></script>
69 <script type="text/javascript" src="${h.url('/js/native.history.js', ver=c.kallithea_version)}"></script>
68 <script type="text/javascript" src="${h.url('/js/native.history.js', ver=c.kallithea_version)}"></script>
70 <script type="text/javascript" src="${h.url('/js/pyroutes_map.js', ver=c.kallithea_version)}"></script>
69 <script type="text/javascript" src="${h.url('/js/pyroutes_map.js', ver=c.kallithea_version)}"></script>
71 <script type="text/javascript" src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
70 <script type="text/javascript" src="${h.url('/js/base.js', ver=c.kallithea_version)}"></script>
72 ## EXTRA FOR JS
71 ## EXTRA FOR JS
73 <%def name="js_extra()"></%def>
72 <%block name="js_extra"/>
74 ${self.js_extra()}
75 <script type="text/javascript">
73 <script type="text/javascript">
76 (function(window,undefined){
74 (function(window,undefined){
77 var History = window.History; // Note: We are using a capital H instead of a lower h
75 var History = window.History; // Note: We are using a capital H instead of a lower h
78 if ( !History.enabled ) {
76 if ( !History.enabled ) {
79 // History.js is disabled for this browser.
77 // History.js is disabled for this browser.
80 // This is because we can optionally choose to support HTML4 browsers or not.
78 // This is because we can optionally choose to support HTML4 browsers or not.
81 return false;
79 return false;
82 }
80 }
83 })(window);
81 })(window);
84
82
85 $(document).ready(function(){
83 $(document).ready(function(){
86 tooltip_activate();
84 tooltip_activate();
87 show_more_event();
85 show_more_event();
88 show_changeset_tooltip();
86 show_changeset_tooltip();
89 // routes registration
87 // routes registration
90 pyroutes.register('home', "${h.url('home')}", []);
88 pyroutes.register('home', "${h.url('home')}", []);
91 pyroutes.register('new_gist', "${h.url('new_gist')}", []);
89 pyroutes.register('new_gist', "${h.url('new_gist')}", []);
92 pyroutes.register('gists', "${h.url('gists')}", []);
90 pyroutes.register('gists', "${h.url('gists')}", []);
93 pyroutes.register('new_repo', "${h.url('new_repo')}", []);
91 pyroutes.register('new_repo', "${h.url('new_repo')}", []);
94
92
95 pyroutes.register('summary_home', "${h.url('summary_home', repo_name='%(repo_name)s')}", ['repo_name']);
93 pyroutes.register('summary_home', "${h.url('summary_home', repo_name='%(repo_name)s')}", ['repo_name']);
96 pyroutes.register('changelog_home', "${h.url('changelog_home', repo_name='%(repo_name)s')}", ['repo_name']);
94 pyroutes.register('changelog_home', "${h.url('changelog_home', repo_name='%(repo_name)s')}", ['repo_name']);
97 pyroutes.register('files_home', "${h.url('files_home', repo_name='%(repo_name)s',revision='%(revision)s',f_path='%(f_path)s')}", ['repo_name', 'revision', 'f_path']);
95 pyroutes.register('files_home', "${h.url('files_home', repo_name='%(repo_name)s',revision='%(revision)s',f_path='%(f_path)s')}", ['repo_name', 'revision', 'f_path']);
98 pyroutes.register('edit_repo', "${h.url('edit_repo', repo_name='%(repo_name)s')}", ['repo_name']);
96 pyroutes.register('edit_repo', "${h.url('edit_repo', repo_name='%(repo_name)s')}", ['repo_name']);
99 pyroutes.register('edit_repo_perms', "${h.url('edit_repo_perms', repo_name='%(repo_name)s')}", ['repo_name']);
97 pyroutes.register('edit_repo_perms', "${h.url('edit_repo_perms', repo_name='%(repo_name)s')}", ['repo_name']);
100 pyroutes.register('pullrequest_home', "${h.url('pullrequest_home', repo_name='%(repo_name)s')}", ['repo_name']);
98 pyroutes.register('pullrequest_home', "${h.url('pullrequest_home', repo_name='%(repo_name)s')}", ['repo_name']);
101
99
102 pyroutes.register('toggle_following', "${h.url('toggle_following')}");
100 pyroutes.register('toggle_following', "${h.url('toggle_following')}");
103 pyroutes.register('changeset_info', "${h.url('changeset_info', repo_name='%(repo_name)s', revision='%(revision)s')}", ['repo_name', 'revision']);
101 pyroutes.register('changeset_info', "${h.url('changeset_info', repo_name='%(repo_name)s', revision='%(revision)s')}", ['repo_name', 'revision']);
104 pyroutes.register('repo_size', "${h.url('repo_size', repo_name='%(repo_name)s')}", ['repo_name']);
102 pyroutes.register('repo_size', "${h.url('repo_size', repo_name='%(repo_name)s')}", ['repo_name']);
105 pyroutes.register('changeset_comment_preview', "${h.url('changeset_comment_preview', repo_name='%(repo_name)s')}", ['repo_name']);
103 pyroutes.register('changeset_comment_preview', "${h.url('changeset_comment_preview', repo_name='%(repo_name)s')}", ['repo_name']);
106 pyroutes.register('repo_refs_data', "${h.url('repo_refs_data', repo_name='%(repo_name)s')}", ['repo_name']);
104 pyroutes.register('repo_refs_data', "${h.url('repo_refs_data', repo_name='%(repo_name)s')}", ['repo_name']);
107 });
105 });
108 </script>
106 </script>
109
107
110 <%def name="head_extra()"></%def>
108 <%block name="head_extra"/>
111 ${self.head_extra()}
112 </head>
109 </head>
113 <body id="body">
110 <body id="body">
114 ## IE hacks
111 ## IE hacks
115 <!--[if IE 7]>
112 <!--[if IE 7]>
116 <script>$(document.body).addClass('ie7')</script>
113 <script>$(document.body).addClass('ie7')</script>
117 <![endif]-->
114 <![endif]-->
118 <!--[if IE 8]>
115 <!--[if IE 8]>
119 <script>$(document.body).addClass('ie8')</script>
116 <script>$(document.body).addClass('ie8')</script>
120 <![endif]-->
117 <![endif]-->
121 <!--[if IE 9]>
118 <!--[if IE 9]>
122 <script>$(document.body).addClass('ie9')</script>
119 <script>$(document.body).addClass('ie9')</script>
123 <![endif]-->
120 <![endif]-->
124
121
125 <div id="header">
122 <div id="header">
126 <div id="header-inner" class="title">
123 <div id="header-inner" class="title">
127 <div id="logo">
124 <div id="logo">
128 <a href="${h.url('home')}" style="display: block;">
125 <a href="${h.url('home')}" style="display: block;">
129 <div class="header">
126 <div class="header">
130 <img src="${h.url('/images/kallithea-logo.svg')}" onerror="this.onerror='';this.src='${h.url('/images/kallithea-logo.png')}'" alt="Kallithea"/>
127 <img src="${h.url('/images/kallithea-logo.svg')}" onerror="this.onerror='';this.src='${h.url('/images/kallithea-logo.png')}'" alt="Kallithea"/>
131 </div>
128 </div>
132 %if c.site_name:
129 %if c.site_name:
133 <div class="branding">${c.site_name}</div>
130 <div class="branding">${c.site_name}</div>
134 %endif
131 %endif
135 </a>
132 </a>
136 </div>
133 </div>
137 <%block name="header_menu"/>
134 <%block name="header_menu"/>
138 </div>
135 </div>
139 </div>
136 </div>
140
137
141 ${next.body()}
138 ${next.body()}
142
139
143 %if c.ga_code:
140 %if c.ga_code:
144 ${h.literal(c.ga_code)}
141 ${h.literal(c.ga_code)}
145 %endif
142 %endif
146 </body>
143 </body>
147 </html>
144 </html>
@@ -1,112 +1,112 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%inherit file="/base/base.html"/>
3 <%inherit file="/base/base.html"/>
4
4
5 <%def name="js_extra()">
5 <%block name="js_extra">
6 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
6 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
7 <script type="text/javascript" src="${h.url('/js/mergely.js')}"></script>
7 <script type="text/javascript" src="${h.url('/js/mergely.js')}"></script>
8 </%def>
8 </%block>
9 <%def name="css_extra()">
9 <%block name="css_extra">
10 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
10 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
11 <link rel="stylesheet" type="text/css" href="${h.url('/css/mergely.css')}"/>
11 <link rel="stylesheet" type="text/css" href="${h.url('/css/mergely.css')}"/>
12 </%def>
12 </%block>
13
13
14 <%def name="title()">
14 <%def name="title()">
15 ${_('%s File side-by-side diff') % c.repo_name}
15 ${_('%s File side-by-side diff') % c.repo_name}
16 %if c.site_name:
16 %if c.site_name:
17 &middot; ${c.site_name}
17 &middot; ${c.site_name}
18 %endif
18 %endif
19 </%def>
19 </%def>
20
20
21 <%def name="breadcrumbs_links()">
21 <%def name="breadcrumbs_links()">
22 ${_('File diff')} ${h.show_id(c.changeset_1)} &rarr; ${h.show_id(c.changeset_2)}
22 ${_('File diff')} ${h.show_id(c.changeset_1)} &rarr; ${h.show_id(c.changeset_2)}
23 </%def>
23 </%def>
24
24
25 <%block name="header_menu">
25 <%block name="header_menu">
26 ${self.menu('repositories')}
26 ${self.menu('repositories')}
27 </%block>
27 </%block>
28
28
29 <%def name="main()">
29 <%def name="main()">
30 ${self.repo_context_bar('changelog')}
30 ${self.repo_context_bar('changelog')}
31 <div class="box">
31 <div class="box">
32 <!-- box / title -->
32 <!-- box / title -->
33 <div class="title">
33 <div class="title">
34 ${self.breadcrumbs()}
34 ${self.breadcrumbs()}
35 </div>
35 </div>
36
36
37 <div class="diff-container" style="overflow-x: hidden">
37 <div class="diff-container" style="overflow-x: hidden">
38 <div class="diffblock comm" style="margin:3px; padding:1px">
38 <div class="diffblock comm" style="margin:3px; padding:1px">
39 <div class="code-header">
39 <div class="code-header">
40 <div class="changeset_header">
40 <div class="changeset_header">
41 <div class="changeset_file">
41 <div class="changeset_file">
42 ${h.link_to(h.safe_unicode(c.node1.path),h.url('files_home',repo_name=c.repo_name,
42 ${h.link_to(h.safe_unicode(c.node1.path),h.url('files_home',repo_name=c.repo_name,
43 revision=c.cs2.raw_id,f_path=h.safe_unicode(c.node1.path)))}
43 revision=c.cs2.raw_id,f_path=h.safe_unicode(c.node1.path)))}
44 </div>
44 </div>
45 <div class="diff-actions">
45 <div class="diff-actions">
46 <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('Show full diff for this file'))}">
46 <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('Show full diff for this file'))}">
47 <i class="icon-file-code"></i>
47 <i class="icon-file-code"></i>
48 </a>
48 </a>
49 <a href="${h.url('files_diff_2way_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('Show full side-by-side diff for this file'))}">
49 <a href="${h.url('files_diff_2way_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='diff',fulldiff=1)}" class="tooltip" title="${h.tooltip(_('Show full side-by-side diff for this file'))}">
50 <i class="icon-docs"></i>
50 <i class="icon-docs"></i>
51 </a>
51 </a>
52 <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='raw')}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
52 <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='raw')}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
53 <i class="icon-diff"></i>
53 <i class="icon-diff"></i>
54 </a>
54 </a>
55 <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
55 <a href="${h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),diff2=c.cs2.raw_id,diff1=c.cs1.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
56 <i class="icon-floppy"></i>
56 <i class="icon-floppy"></i>
57 </a>
57 </a>
58 ${h.checkbox('ignorews', label=_('Ignore whitespace'))}
58 ${h.checkbox('ignorews', label=_('Ignore whitespace'))}
59 ${h.checkbox('edit_mode', label=_('Edit'))}
59 ${h.checkbox('edit_mode', label=_('Edit'))}
60 </div>
60 </div>
61 </div>
61 </div>
62 </div>
62 </div>
63 <div id="compare"></div>
63 <div id="compare"></div>
64 </div>
64 </div>
65 </div>
65 </div>
66
66
67 <script>
67 <script>
68 var orig1_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),revision=c.cs1.raw_id)}';
68 var orig1_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node1.path),revision=c.cs1.raw_id)}';
69 var orig2_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node2.path),revision=c.cs2.raw_id)}';
69 var orig2_url = '${h.url('files_raw_home',repo_name=c.repo_name,f_path=h.safe_unicode(c.node2.path),revision=c.cs2.raw_id)}';
70
70
71 $(document).ready(function () {
71 $(document).ready(function () {
72 $('#compare').mergely({
72 $('#compare').mergely({
73 width: 'auto',
73 width: 'auto',
74 height: '600',
74 height: '600',
75 fgcolor: {a:'#ddffdd',c:'#cccccc',d:'#ffdddd'},
75 fgcolor: {a:'#ddffdd',c:'#cccccc',d:'#ffdddd'},
76 bgcolor: '#fff',
76 bgcolor: '#fff',
77 viewport: true,
77 viewport: true,
78 cmsettings: {mode: 'text/plain', readOnly: true, lineWrapping: false, lineNumbers: true},
78 cmsettings: {mode: 'text/plain', readOnly: true, lineWrapping: false, lineNumbers: true},
79 lhs: function(setValue) {
79 lhs: function(setValue) {
80 if("${c.node1.is_binary}" == "True"){
80 if("${c.node1.is_binary}" == "True"){
81 setValue('Binary file')
81 setValue('Binary file')
82 }
82 }
83 else{
83 else{
84 $.ajax(orig1_url, {dataType: 'text', success: setValue});
84 $.ajax(orig1_url, {dataType: 'text', success: setValue});
85 }
85 }
86
86
87 },
87 },
88 rhs: function(setValue) {
88 rhs: function(setValue) {
89 if("${c.node2.is_binary}" == "True"){
89 if("${c.node2.is_binary}" == "True"){
90 setValue('Binary file')
90 setValue('Binary file')
91 }
91 }
92 else{
92 else{
93 $.ajax(orig2_url, {dataType: 'text', success: setValue});
93 $.ajax(orig2_url, {dataType: 'text', success: setValue});
94 }
94 }
95 }
95 }
96 });
96 });
97 $('#ignorews').change(function(e){
97 $('#ignorews').change(function(e){
98 var val = e.currentTarget.checked;
98 var val = e.currentTarget.checked;
99 $('#compare').mergely('options', {ignorews: val});
99 $('#compare').mergely('options', {ignorews: val});
100 $('#compare').mergely('update');
100 $('#compare').mergely('update');
101 })
101 })
102 $('#edit_mode').change(function(e){
102 $('#edit_mode').change(function(e){
103 var val = !e.currentTarget.checked;
103 var val = !e.currentTarget.checked;
104 $('#compare').mergely('cm', 'lhs').setOption('readOnly', val);
104 $('#compare').mergely('cm', 'lhs').setOption('readOnly', val);
105 $('#compare').mergely('cm', 'rhs').setOption('readOnly', val);
105 $('#compare').mergely('cm', 'rhs').setOption('readOnly', val);
106 $('#compare').mergely('update');
106 $('#compare').mergely('update');
107 })
107 })
108 });
108 });
109 </script>
109 </script>
110
110
111 </div>
111 </div>
112 </%def>
112 </%def>
@@ -1,120 +1,120 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Files Add') % c.repo_name}
4 ${_('%s Files Add') % c.repo_name}
5 %if c.site_name:
5 %if c.site_name:
6 &middot; ${c.site_name}
6 &middot; ${c.site_name}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="js_extra()">
10 <%block name="js_extra">
11 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
11 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
12 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
12 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
13 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
13 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
14 </%def>
14 </%block>
15 <%def name="css_extra()">
15 <%block name="css_extra">
16 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
16 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
17 </%def>
17 </%block>
18
18
19 <%block name="header_menu">
19 <%block name="header_menu">
20 ${self.menu('repositories')}
20 ${self.menu('repositories')}
21 </%block>
21 </%block>
22
22
23 <%def name="breadcrumbs_links()">
23 <%def name="breadcrumbs_links()">
24 ${_('Add New File')} @ ${h.show_id(c.cs)}
24 ${_('Add New File')} @ ${h.show_id(c.cs)}
25 </%def>
25 </%def>
26
26
27 <%def name="main()">
27 <%def name="main()">
28 ${self.repo_context_bar('files')}
28 ${self.repo_context_bar('files')}
29 <div class="box">
29 <div class="box">
30 <!-- box / title -->
30 <!-- box / title -->
31 <div class="title">
31 <div class="title">
32 ${self.breadcrumbs()}
32 ${self.breadcrumbs()}
33 <ul class="links">
33 <ul class="links">
34 <li>
34 <li>
35 <span><a href="#">${_('Branch')}: ${c.cs.branch}</a></span>
35 <span><a href="#">${_('Branch')}: ${c.cs.branch}</a></span>
36 </li>
36 </li>
37 </ul>
37 </ul>
38 </div>
38 </div>
39 <div class="table" id="edit">
39 <div class="table" id="edit">
40 <div id="files_data">
40 <div id="files_data">
41 ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data", class_="form-horizontal")}
41 ${h.form(h.url.current(),method='post',id='eform',enctype="multipart/form-data", class_="form-horizontal")}
42 <h3 class="files_location">
42 <h3 class="files_location">
43 ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.raw_id,c.f_path)} /
43 ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.raw_id,c.f_path)} /
44 <span id="filename_container" class="file reviewer_ac">
44 <span id="filename_container" class="file reviewer_ac">
45 <input class="input-small" type="text" value="" size="30" name="filename" id="filename" placeholder="${_('Enter filename...')}">
45 <input class="input-small" type="text" value="" size="30" name="filename" id="filename" placeholder="${_('Enter filename...')}">
46 <input type="hidden" value="${c.f_path}" size="30" name="location" id="location">
46 <input type="hidden" value="${c.f_path}" size="30" name="location" id="location">
47 ${_('or')} <div class="btn btn-small" id="upload_file_enable">${_('Upload File')}</div>
47 ${_('or')} <div class="btn btn-small" id="upload_file_enable">${_('Upload File')}</div>
48 </span>
48 </span>
49 <span id="upload_file_container" class="reviewer_ac" style="display:none">
49 <span id="upload_file_container" class="reviewer_ac" style="display:none">
50 <input type="file" size="20" name="upload_file" id="upload_file">
50 <input type="file" size="20" name="upload_file" id="upload_file">
51 ${_('or')} <div class="btn btn-small" id="file_enable">${_('Create New File')}</div>
51 ${_('or')} <div class="btn btn-small" id="file_enable">${_('Create New File')}</div>
52 </span>
52 </span>
53 </h3>
53 </h3>
54 <div id="body" class="codeblock">
54 <div id="body" class="codeblock">
55 <div class="code-header" id="set_mode_header">
55 <div class="code-header" id="set_mode_header">
56 <label class="commit" for="set_mode">${_('New file mode')}</label>
56 <label class="commit" for="set_mode">${_('New file mode')}</label>
57 <select id="set_mode" name="set_mode"/>
57 <select id="set_mode" name="set_mode"/>
58 </div>
58 </div>
59 <div id="editor_container">
59 <div id="editor_container">
60 <pre id="editor_pre"></pre>
60 <pre id="editor_pre"></pre>
61 <textarea id="editor" name="content" style="display:none"></textarea>
61 <textarea id="editor" name="content" style="display:none"></textarea>
62 </div>
62 </div>
63 <div style="padding: 10px;color:#666666">${_('Commit Message')}</div>
63 <div style="padding: 10px;color:#666666">${_('Commit Message')}</div>
64 <textarea id="commit" name="message" style="height: 100px;width: 99%;margin-left:4px" placeholder="${c.default_message}"></textarea>
64 <textarea id="commit" name="message" style="height: 100px;width: 99%;margin-left:4px" placeholder="${c.default_message}"></textarea>
65 </div>
65 </div>
66 <div style="text-align: left;padding-top: 5px">
66 <div style="text-align: left;padding-top: 5px">
67 ${h.submit('commit',_('Commit Changes'),class_="btn btn-small btn-success")}
67 ${h.submit('commit',_('Commit Changes'),class_="btn btn-small btn-success")}
68 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
68 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
69 </div>
69 </div>
70 ${h.end_form()}
70 ${h.end_form()}
71 <script type="text/javascript">
71 <script type="text/javascript">
72 var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path)}";
72 var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path)}";
73 var myCodeMirror = initCodeMirror('editor',reset_url);
73 var myCodeMirror = initCodeMirror('editor',reset_url);
74
74
75 //inject new modes, based on codeMirrors modeInfo object
75 //inject new modes, based on codeMirrors modeInfo object
76 $('#set_mode').each(function(){
76 $('#set_mode').each(function(){
77 var modes_select = this;
77 var modes_select = this;
78 var index = 1;
78 var index = 1;
79 for(var i=0;i<CodeMirror.modeInfo.length;i++){
79 for(var i=0;i<CodeMirror.modeInfo.length;i++){
80 var m = CodeMirror.modeInfo[i];
80 var m = CodeMirror.modeInfo[i];
81 var opt = new Option(m.name, m.mime);
81 var opt = new Option(m.name, m.mime);
82 $(opt).attr('mode', m.mode);
82 $(opt).attr('mode', m.mode);
83 if (m.mime == 'text/plain') {
83 if (m.mime == 'text/plain') {
84 // default plain text
84 // default plain text
85 $(opt).attr('selected', 'selected');
85 $(opt).attr('selected', 'selected');
86 modes_select.options[0] = opt;
86 modes_select.options[0] = opt;
87 } else {
87 } else {
88 modes_select.options[index++] = opt;
88 modes_select.options[index++] = opt;
89 }
89 }
90 }
90 }
91 });
91 });
92 $('#set_mode').change(function(e){
92 $('#set_mode').change(function(e){
93 var selected = e.currentTarget;
93 var selected = e.currentTarget;
94 var node = selected.options[selected.selectedIndex];
94 var node = selected.options[selected.selectedIndex];
95 var detected_mode = CodeMirror.findModeByMIME(node.value);
95 var detected_mode = CodeMirror.findModeByMIME(node.value);
96 setCodeMirrorMode(myCodeMirror, detected_mode);
96 setCodeMirrorMode(myCodeMirror, detected_mode);
97
97
98 var filenameInput = $('#filename');
98 var filenameInput = $('#filename');
99 var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
99 var proposed_ext = CodeMirror.findExtensionByMode(detected_mode);
100 var file_data = CodeMirror.getFilenameAndExt(filenameInput.val());
100 var file_data = CodeMirror.getFilenameAndExt(filenameInput.val());
101 var filename = file_data['filename'] || 'filename1';
101 var filename = file_data['filename'] || 'filename1';
102 filenameInput.val(filename + '.' + proposed_ext);
102 filenameInput.val(filename + '.' + proposed_ext);
103 });
103 });
104
104
105 // on type the new filename set mode
105 // on type the new filename set mode
106 $('#filename').keyup(function(e){
106 $('#filename').keyup(function(e){
107 var file_data = CodeMirror.getFilenameAndExt(this.value);
107 var file_data = CodeMirror.getFilenameAndExt(this.value);
108 if(file_data['ext'] != null){
108 if(file_data['ext'] != null){
109 var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
109 var detected_mode = CodeMirror.findModeByExtension(file_data['ext']) || CodeMirror.findModeByMIME('text/plain');
110 if (detected_mode){
110 if (detected_mode){
111 setCodeMirrorMode(myCodeMirror, detected_mode);
111 setCodeMirrorMode(myCodeMirror, detected_mode);
112 $('#set_mode').val(detected_mode.mime);
112 $('#set_mode').val(detected_mode.mime);
113 }
113 }
114 }
114 }
115 });
115 });
116 </script>
116 </script>
117 </div>
117 </div>
118 </div>
118 </div>
119 </div>
119 </div>
120 </%def>
120 </%def>
@@ -1,115 +1,115 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s File Edit') % c.repo_name}
4 ${_('%s File Edit') % c.repo_name}
5 %if c.site_name:
5 %if c.site_name:
6 &middot; ${c.site_name}
6 &middot; ${c.site_name}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="js_extra()">
10 <%block name="js_extra">
11 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
11 <script type="text/javascript" src="${h.url('/codemirror/lib/codemirror.js')}"></script>
12 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
12 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
13 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
13 <script type="text/javascript" src="${h.url('/codemirror/mode/meta.js')}"></script>
14 </%def>
14 </%block>
15 <%def name="css_extra()">
15 <%block name="css_extra">
16 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
16 <link rel="stylesheet" type="text/css" href="${h.url('/codemirror/lib/codemirror.css')}"/>
17 </%def>
17 </%block>
18
18
19 <%block name="header_menu">
19 <%block name="header_menu">
20 ${self.menu('repositories')}
20 ${self.menu('repositories')}
21 </%block>
21 </%block>
22
22
23 <%def name="breadcrumbs_links()">
23 <%def name="breadcrumbs_links()">
24 ${_('Edit file')} @ ${h.show_id(c.cs)}
24 ${_('Edit file')} @ ${h.show_id(c.cs)}
25 </%def>
25 </%def>
26
26
27 <%def name="main()">
27 <%def name="main()">
28 ${self.repo_context_bar('files')}
28 ${self.repo_context_bar('files')}
29 <div class="box">
29 <div class="box">
30 <!-- box / title -->
30 <!-- box / title -->
31 <div class="title">
31 <div class="title">
32 ${self.breadcrumbs()}
32 ${self.breadcrumbs()}
33 <ul class="links">
33 <ul class="links">
34 <li>
34 <li>
35 <span><a href="#">${_('Branch')}: ${c.cs.branch}</a></span>
35 <span><a href="#">${_('Branch')}: ${c.cs.branch}</a></span>
36 </li>
36 </li>
37 </ul>
37 </ul>
38 </div>
38 </div>
39 <div class="table" id="edit">
39 <div class="table" id="edit">
40 <div id="files_data">
40 <div id="files_data">
41 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.revision,c.file.path)}</h3>
41 <h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cs.revision,c.file.path)}</h3>
42 ${h.form(h.url.current(),method='post',id='eform')}
42 ${h.form(h.url.current(),method='post',id='eform')}
43 <div id="body" class="codeblock">
43 <div id="body" class="codeblock">
44 <div class="code-header">
44 <div class="code-header">
45 <div class="stats">
45 <div class="stats">
46 <div class="left"><i class="icon-doc-inv"></i></div>
46 <div class="left"><i class="icon-doc-inv"></i></div>
47 <div class="left item">${h.link_to(h.show_id(c.file.changeset),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</div>
47 <div class="left item">${h.link_to(h.show_id(c.file.changeset),h.url('changeset_home',repo_name=c.repo_name,revision=c.file.changeset.raw_id))}</div>
48 <div class="left item">${h.format_byte_size(c.file.size,binary=True)}</div>
48 <div class="left item">${h.format_byte_size(c.file.size,binary=True)}</div>
49 <div class="left item last">${c.file.mimetype}</div>
49 <div class="left item last">${c.file.mimetype}</div>
50 <div class="buttons">
50 <div class="buttons">
51 ${h.link_to(_('Show Annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
51 ${h.link_to(_('Show Annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
52 ${h.link_to(_('Show as Raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
52 ${h.link_to(_('Show as Raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
53 ${h.link_to(_('Download as Raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
53 ${h.link_to(_('Download as Raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
54 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
54 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
55 % if not c.file.is_binary:
55 % if not c.file.is_binary:
56 ${h.link_to(_('Source'),h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
56 ${h.link_to(_('Source'),h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.f_path),class_="btn btn-mini")}
57 % endif
57 % endif
58 % endif
58 % endif
59 </div>
59 </div>
60 </div>
60 </div>
61 <label class="commit" for="set_mode">${_('Editing file')}: ${c.file.unicode_path}</label>
61 <label class="commit" for="set_mode">${_('Editing file')}: ${c.file.unicode_path}</label>
62 <select id="set_mode" name="set_mode"/>
62 <select id="set_mode" name="set_mode"/>
63 </div>
63 </div>
64 <pre id="editor_pre"></pre>
64 <pre id="editor_pre"></pre>
65 <textarea id="editor" name="content" style="display:none">${h.escape(c.file.content)|n}</textarea>
65 <textarea id="editor" name="content" style="display:none">${h.escape(c.file.content)|n}</textarea>
66 <div style="padding: 10px;color:#666666">${_('Commit Message')}</div>
66 <div style="padding: 10px;color:#666666">${_('Commit Message')}</div>
67 <textarea id="commit" name="message" style="height: 60px;width: 99%;margin-left:4px" placeholder="${c.default_message}"></textarea>
67 <textarea id="commit" name="message" style="height: 60px;width: 99%;margin-left:4px" placeholder="${c.default_message}"></textarea>
68 </div>
68 </div>
69 <div style="text-align: left;padding-top: 5px">
69 <div style="text-align: left;padding-top: 5px">
70 ${h.submit('commit',_('Commit Changes'),class_="btn btn-small btn-success")}
70 ${h.submit('commit',_('Commit Changes'),class_="btn btn-small btn-success")}
71 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
71 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
72 </div>
72 </div>
73 ${h.end_form()}
73 ${h.end_form()}
74 </div>
74 </div>
75 </div>
75 </div>
76 </div>
76 </div>
77
77
78 <script type="text/javascript">
78 <script type="text/javascript">
79 $(document).ready(function(){
79 $(document).ready(function(){
80 var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path)}";
80 var reset_url = "${h.url('files_home',repo_name=c.repo_name,revision=c.cs.raw_id,f_path=c.file.path)}";
81 var myCodeMirror = initCodeMirror('editor',reset_url);
81 var myCodeMirror = initCodeMirror('editor',reset_url);
82
82
83 //inject new modes, based on codeMirrors modeInfo object
83 //inject new modes, based on codeMirrors modeInfo object
84 $('#set_mode').each(function(){
84 $('#set_mode').each(function(){
85 var modes_select = this;
85 var modes_select = this;
86 var index = 1;
86 var index = 1;
87 for(var i=0;i<CodeMirror.modeInfo.length;i++){
87 for(var i=0;i<CodeMirror.modeInfo.length;i++){
88 var m = CodeMirror.modeInfo[i];
88 var m = CodeMirror.modeInfo[i];
89 var opt = new Option(m.name, m.mime);
89 var opt = new Option(m.name, m.mime);
90 $(opt).attr('mode', m.mode);
90 $(opt).attr('mode', m.mode);
91 if (m.mime == 'text/plain') {
91 if (m.mime == 'text/plain') {
92 // default plain text
92 // default plain text
93 $(opt).attr('selected', 'selected');
93 $(opt).attr('selected', 'selected');
94 modes_select.options[0] = opt;
94 modes_select.options[0] = opt;
95 } else {
95 } else {
96 modes_select.options[index++] = opt;
96 modes_select.options[index++] = opt;
97 }
97 }
98 }
98 }
99 });
99 });
100 // try to detect the mode based on the file we edit
100 // try to detect the mode based on the file we edit
101 var detected_mode = CodeMirror.findModeByExtension("${c.file.extension}");
101 var detected_mode = CodeMirror.findModeByExtension("${c.file.extension}");
102 if(detected_mode){
102 if(detected_mode){
103 setCodeMirrorMode(myCodeMirror, detected_mode);
103 setCodeMirrorMode(myCodeMirror, detected_mode);
104 $($('#set_mode option[value="'+detected_mode.mime+'"]')[0]).attr("selected", "selected")
104 $($('#set_mode option[value="'+detected_mode.mime+'"]')[0]).attr("selected", "selected")
105 }
105 }
106
106
107 $('#set_mode').on('change', function(e){
107 $('#set_mode').on('change', function(e){
108 var selected = e.currentTarget;
108 var selected = e.currentTarget;
109 var node = selected.options[selected.selectedIndex];
109 var node = selected.options[selected.selectedIndex];
110 var detected_mode = CodeMirror.findModeByMIME(node.value);
110 var detected_mode = CodeMirror.findModeByMIME(node.value);
111 setCodeMirrorMode(myCodeMirror, detected_mode);
111 setCodeMirrorMode(myCodeMirror, detected_mode);
112 });
112 });
113 })
113 })
114 </script>
114 </script>
115 </%def>
115 </%def>
@@ -1,339 +1,339 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3 <%def name="title()">
3 <%def name="title()">
4 ${_('Journal')}
4 ${_('Journal')}
5 %if c.site_name:
5 %if c.site_name:
6 &middot; ${c.site_name}
6 &middot; ${c.site_name}
7 %endif
7 %endif
8 </%def>
8 </%def>
9 <%def name="breadcrumbs()">
9 <%def name="breadcrumbs()">
10 <h5>
10 <h5>
11 <form id="filter_form">
11 <form id="filter_form">
12 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('quick filter...')}"/>
12 <input class="q_filter_box ${'' if c.search_term else 'initial'}" id="j_filter" size="15" type="text" name="filter" value="${c.search_term or _('quick filter...')}"/>
13 <span class="tooltip" title="${h.tooltip(h.journal_filter_help())}">?</span>
13 <span class="tooltip" title="${h.tooltip(h.journal_filter_help())}">?</span>
14 <input type='submit' value="${_('Filter')}" class="btn btn-small" style="padding:0px 2px 0px 2px;margin:0px"/>
14 <input type='submit' value="${_('Filter')}" class="btn btn-small" style="padding:0px 2px 0px 2px;margin:0px"/>
15 ${_('Journal')} - ${ungettext('%s Entry', '%s Entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
15 ${_('Journal')} - ${ungettext('%s Entry', '%s Entries', c.journal_pager.item_count) % (c.journal_pager.item_count)}
16 </form>
16 </form>
17 ${h.end_form()}
17 ${h.end_form()}
18 </h5>
18 </h5>
19 </%def>
19 </%def>
20 <%block name="header_menu">
20 <%block name="header_menu">
21 ${self.menu('journal')}
21 ${self.menu('journal')}
22 </%block>
22 </%block>
23 <%def name="head_extra()">
23 <%block name="head_extra">
24 <link href="${h.url('journal_atom', api_key=c.authuser.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
24 <link href="${h.url('journal_atom', api_key=c.authuser.api_key)}" rel="alternate" title="${_('ATOM journal feed')}" type="application/atom+xml" />
25 <link href="${h.url('journal_rss', api_key=c.authuser.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
25 <link href="${h.url('journal_rss', api_key=c.authuser.api_key)}" rel="alternate" title="${_('RSS journal feed')}" type="application/rss+xml" />
26 </%def>
26 </%block>
27
27 <%def name="main()">
28 <%def name="main()">
28
29 <div class="box box-left">
29 <div class="box box-left">
30 <!-- box / title -->
30 <!-- box / title -->
31 <div class="title">
31 <div class="title">
32 ${self.breadcrumbs()}
32 ${self.breadcrumbs()}
33 <ul class="links icon-only-links">
33 <ul class="links icon-only-links">
34 <li>
34 <li>
35 <span><a id="refresh" href="${h.url('journal')}"><i class="icon-arrows-cw"></i></a></span>
35 <span><a id="refresh" href="${h.url('journal')}"><i class="icon-arrows-cw"></i></a></span>
36 </li>
36 </li>
37 <li>
37 <li>
38 <span><a href="${h.url('journal_atom', api_key=c.authuser.api_key)}"><i class="icon-rss-squared"></i></a></span>
38 <span><a href="${h.url('journal_atom', api_key=c.authuser.api_key)}"><i class="icon-rss-squared"></i></a></span>
39 </li>
39 </li>
40 </ul>
40 </ul>
41 </div>
41 </div>
42 <div id="journal">${c.journal_data}</div>
42 <div id="journal">${c.journal_data}</div>
43 </div>
43 </div>
44 <div class="box box-right">
44 <div class="box box-right">
45 <!-- box / title -->
45 <!-- box / title -->
46
46
47 <div class="title">
47 <div class="title">
48 <h5>
48 <h5>
49 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/>
49 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/>
50 <input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/>
50 <input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value="" style="display: none"/>
51 </h5>
51 </h5>
52 <ul class="links nav nav-tabs">
52 <ul class="links nav nav-tabs">
53 <li class="active" id="show_watched_li">
53 <li class="active" id="show_watched_li">
54 <a id="show_watched" href="#watched"><i class="icon-eye"></i> ${_('Watched')}</a>
54 <a id="show_watched" href="#watched"><i class="icon-eye"></i> ${_('Watched')}</a>
55 </li>
55 </li>
56 <li id="show_my_li">
56 <li id="show_my_li">
57 <a id="show_my" href="#my"><i class="icon-database"></i> ${_('My Repos')}</a>
57 <a id="show_my" href="#my"><i class="icon-database"></i> ${_('My Repos')}</a>
58 </li>
58 </li>
59 </ul>
59 </ul>
60 </div>
60 </div>
61
61
62 <!-- end box / title -->
62 <!-- end box / title -->
63 <div id="my_container" style="display:none">
63 <div id="my_container" style="display:none">
64 <div class="table-grid table yui-skin-sam" id="repos_list_wrap"></div>
64 <div class="table-grid table yui-skin-sam" id="repos_list_wrap"></div>
65 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
65 <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
66 </div>
66 </div>
67
67
68 <div id="watched_container">
68 <div id="watched_container">
69 <div class="table-grid table yui-skin-sam" id="watched_repos_list_wrap"></div>
69 <div class="table-grid table yui-skin-sam" id="watched_repos_list_wrap"></div>
70 <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div>
70 <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div>
71 </div>
71 </div>
72 </div>
72 </div>
73
73
74 <script type="text/javascript">
74 <script type="text/javascript">
75
75
76 $('#j_filter').click(function(){
76 $('#j_filter').click(function(){
77 var $jfilter = $('#j_filter');
77 var $jfilter = $('#j_filter');
78 if($jfilter.hasClass('initial')){
78 if($jfilter.hasClass('initial')){
79 $jfilter.val('');
79 $jfilter.val('');
80 }
80 }
81 });
81 });
82 var fix_j_filter_width = function(len){
82 var fix_j_filter_width = function(len){
83 $('#j_filter').css('width', Math.max(80, len*6.50)+'px');
83 $('#j_filter').css('width', Math.max(80, len*6.50)+'px');
84 };
84 };
85 $('#j_filter').keyup(function(){
85 $('#j_filter').keyup(function(){
86 fix_j_filter_width($('#j_filter').val().length);
86 fix_j_filter_width($('#j_filter').val().length);
87 });
87 });
88 $('#filter_form').submit(function(e){
88 $('#filter_form').submit(function(e){
89 e.preventDefault();
89 e.preventDefault();
90 var val = $('#j_filter').val();
90 var val = $('#j_filter').val();
91 window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val);
91 window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val);
92 });
92 });
93 fix_j_filter_width($('#j_filter').val().length);
93 fix_j_filter_width($('#j_filter').val().length);
94
94
95 $('#refresh').click(function(e){
95 $('#refresh').click(function(e){
96 asynchtml("${h.url.current(filter=c.search_term)}", $("#journal"), function(){
96 asynchtml("${h.url.current(filter=c.search_term)}", $("#journal"), function(){
97 show_more_event();
97 show_more_event();
98 tooltip_activate();
98 tooltip_activate();
99 show_changeset_tooltip();
99 show_changeset_tooltip();
100 });
100 });
101 e.preventDefault();
101 e.preventDefault();
102 });
102 });
103
103
104 var show_my = function(e){
104 var show_my = function(e){
105 $('#watched_container').hide();
105 $('#watched_container').hide();
106 $('#my_container').show();
106 $('#my_container').show();
107 $('#q_filter').show();
107 $('#q_filter').show();
108 $('#q_filter_watched').hide();
108 $('#q_filter_watched').hide();
109
109
110 $('#show_my_li').addClass('active');
110 $('#show_my_li').addClass('active');
111 $('#show_watched_li').removeClass('active');
111 $('#show_watched_li').removeClass('active');
112 if(!$('#show_my').hasClass('loaded')){
112 if(!$('#show_my').hasClass('loaded')){
113 table_renderer(${c.data |n});
113 table_renderer(${c.data |n});
114 $('#show_my').addClass('loaded');
114 $('#show_my').addClass('loaded');
115 }
115 }
116 };
116 };
117 $('#show_my').click(function(){
117 $('#show_my').click(function(){
118 show_my();
118 show_my();
119 });
119 });
120 var show_watched = function(){
120 var show_watched = function(){
121 $('#my_container').hide();
121 $('#my_container').hide();
122 $('#watched_container').show();
122 $('#watched_container').show();
123 $('#q_filter_watched').show();
123 $('#q_filter_watched').show();
124 $('#q_filter').hide();
124 $('#q_filter').hide();
125
125
126 $('#show_watched_li').addClass('active');
126 $('#show_watched_li').addClass('active');
127 $('#show_my_li').removeClass('active');
127 $('#show_my_li').removeClass('active');
128 if(!$('#show_watched').hasClass('loaded')){
128 if(!$('#show_watched').hasClass('loaded')){
129 watched_renderer(${c.watched_data |n});
129 watched_renderer(${c.watched_data |n});
130 $('#show_watched').addClass('loaded');
130 $('#show_watched').addClass('loaded');
131 }
131 }
132 };
132 };
133 $('#show_watched').click(function(){
133 $('#show_watched').click(function(){
134 show_watched();
134 show_watched();
135 });
135 });
136 //init watched
136 //init watched
137 show_watched();
137 show_watched();
138
138
139 var tabs = {
139 var tabs = {
140 'watched': show_watched,
140 'watched': show_watched,
141 'my': show_my
141 'my': show_my
142 }
142 }
143 var url = location.href.split('#');
143 var url = location.href.split('#');
144 if (url[1]) {
144 if (url[1]) {
145 //We have a hash
145 //We have a hash
146 var tabHash = url[1];
146 var tabHash = url[1];
147 var func = tabs[tabHash]
147 var func = tabs[tabHash]
148 if (func){
148 if (func){
149 func();
149 func();
150 }
150 }
151 }
151 }
152 function watched_renderer(data){
152 function watched_renderer(data){
153 var myDataSource = new YAHOO.util.DataSource(data);
153 var myDataSource = new YAHOO.util.DataSource(data);
154 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
154 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
155
155
156 myDataSource.responseSchema = {
156 myDataSource.responseSchema = {
157 resultsList: "records",
157 resultsList: "records",
158 fields: [
158 fields: [
159 {key:"menu"},
159 {key:"menu"},
160 {key:"raw_name"},
160 {key:"raw_name"},
161 {key:"name"},
161 {key:"name"},
162 {key:"last_changeset"},
162 {key:"last_changeset"},
163 {key:"last_rev_raw"},
163 {key:"last_rev_raw"},
164 {key:"action"}
164 {key:"action"}
165 ]
165 ]
166 };
166 };
167 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
167 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
168 // This is the filter function
168 // This is the filter function
169 var data = res.results || [],
169 var data = res.results || [],
170 filtered = [],
170 filtered = [],
171 i,l;
171 i,l;
172
172
173 if (req) {
173 if (req) {
174 req = req.toLowerCase();
174 req = req.toLowerCase();
175 for (i = 0; i<data.length; i++) {
175 for (i = 0; i<data.length; i++) {
176 var pos = data[i].raw_name.toLowerCase().indexOf(req)
176 var pos = data[i].raw_name.toLowerCase().indexOf(req)
177 if (pos != -1) {
177 if (pos != -1) {
178 filtered.push(data[i]);
178 filtered.push(data[i]);
179 }
179 }
180 }
180 }
181 res.results = filtered;
181 res.results = filtered;
182 }
182 }
183 return res;
183 return res;
184 }
184 }
185 // main table sorting
185 // main table sorting
186 var myColumnDefs = [
186 var myColumnDefs = [
187 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
187 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
188 {key:"name",label:"${_('Name')}",sortable:true,
188 {key:"name",label:"${_('Name')}",sortable:true,
189 sortOptions: { sortFunction: nameSort }},
189 sortOptions: { sortFunction: nameSort }},
190 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
190 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
191 sortOptions: { sortFunction: revisionSort }},
191 sortOptions: { sortFunction: revisionSort }},
192 {key:"action",label:"${_('Action')}",sortable:false}
192 {key:"action",label:"${_('Action')}",sortable:false}
193 ];
193 ];
194
194
195 var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{
195 var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{
196 sortedBy:{key:"name",dir:"asc"},
196 sortedBy:{key:"name",dir:"asc"},
197 paginator: YUI_paginator(25, ['watched-user-paginator']),
197 paginator: YUI_paginator(25, ['watched-user-paginator']),
198
198
199 MSG_SORTASC:"${_('Click to sort ascending')}",
199 MSG_SORTASC:"${_('Click to sort ascending')}",
200 MSG_SORTDESC:"${_('Click to sort descending')}",
200 MSG_SORTDESC:"${_('Click to sort descending')}",
201 MSG_EMPTY:"${_('No records found.')}",
201 MSG_EMPTY:"${_('No records found.')}",
202 MSG_ERROR:"${_('Data error.')}",
202 MSG_ERROR:"${_('Data error.')}",
203 MSG_LOADING:"${_('Loading...')}"
203 MSG_LOADING:"${_('Loading...')}"
204 }
204 }
205 );
205 );
206 myDataTable.subscribe('postRenderEvent',function(oArgs) {
206 myDataTable.subscribe('postRenderEvent',function(oArgs) {
207 tooltip_activate();
207 tooltip_activate();
208 quick_repo_menu();
208 quick_repo_menu();
209 });
209 });
210
210
211 var filterTimeout = null;
211 var filterTimeout = null;
212
212
213 updateFilter = function () {
213 updateFilter = function () {
214 // Reset timeout
214 // Reset timeout
215 filterTimeout = null;
215 filterTimeout = null;
216
216
217 // Reset sort
217 // Reset sort
218 var state = myDataTable.getState();
218 var state = myDataTable.getState();
219 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
219 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
220
220
221 // Get filtered data
221 // Get filtered data
222 myDataSource.sendRequest(YUD.get('q_filter_watched').value,{
222 myDataSource.sendRequest(YUD.get('q_filter_watched').value,{
223 success : myDataTable.onDataReturnInitializeTable,
223 success : myDataTable.onDataReturnInitializeTable,
224 failure : myDataTable.onDataReturnInitializeTable,
224 failure : myDataTable.onDataReturnInitializeTable,
225 scope : myDataTable,
225 scope : myDataTable,
226 argument: state
226 argument: state
227 });
227 });
228
228
229 };
229 };
230 $('#q_filter_watched').click(function(){
230 $('#q_filter_watched').click(function(){
231 if(!$('#q_filter_watched').hasClass('loaded')) {
231 if(!$('#q_filter_watched').hasClass('loaded')) {
232 //TODO: load here full list later to do search within groups
232 //TODO: load here full list later to do search within groups
233 $('#q_filter_watched').css('loaded');
233 $('#q_filter_watched').css('loaded');
234 }
234 }
235 });
235 });
236
236
237 $('#q_filter_watched').keyup(function(){
237 $('#q_filter_watched').keyup(function(){
238 clearTimeout(filterTimeout);
238 clearTimeout(filterTimeout);
239 filterTimeout = setTimeout(updateFilter,600);
239 filterTimeout = setTimeout(updateFilter,600);
240 });
240 });
241 }
241 }
242
242
243 function table_renderer(data){
243 function table_renderer(data){
244 var myDataSource = new YAHOO.util.DataSource(data);
244 var myDataSource = new YAHOO.util.DataSource(data);
245 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
245 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
246
246
247 myDataSource.responseSchema = {
247 myDataSource.responseSchema = {
248 resultsList: "records",
248 resultsList: "records",
249 fields: [
249 fields: [
250 {key:"menu"},
250 {key:"menu"},
251 {key:"raw_name"},
251 {key:"raw_name"},
252 {key:"name"},
252 {key:"name"},
253 {key:"last_changeset"},
253 {key:"last_changeset"},
254 {key:"last_rev_raw"},
254 {key:"last_rev_raw"},
255 {key:"action"}
255 {key:"action"}
256 ]
256 ]
257 };
257 };
258 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
258 myDataSource.doBeforeCallback = function(req,raw,res,cb) {
259 // This is the filter function
259 // This is the filter function
260 var data = res.results || [],
260 var data = res.results || [],
261 filtered = [],
261 filtered = [],
262 i,l;
262 i,l;
263
263
264 if (req) {
264 if (req) {
265 req = req.toLowerCase();
265 req = req.toLowerCase();
266 for (i = 0; i<data.length; i++) {
266 for (i = 0; i<data.length; i++) {
267 var pos = data[i].raw_name.toLowerCase().indexOf(req)
267 var pos = data[i].raw_name.toLowerCase().indexOf(req)
268 if (pos != -1) {
268 if (pos != -1) {
269 filtered.push(data[i]);
269 filtered.push(data[i]);
270 }
270 }
271 }
271 }
272 res.results = filtered;
272 res.results = filtered;
273 }
273 }
274 return res;
274 return res;
275 }
275 }
276 // main table sorting
276 // main table sorting
277 var myColumnDefs = [
277 var myColumnDefs = [
278 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
278 {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
279 {key:"name",label:"${_('Name')}",sortable:true,
279 {key:"name",label:"${_('Name')}",sortable:true,
280 sortOptions: { sortFunction: nameSort }},
280 sortOptions: { sortFunction: nameSort }},
281 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
281 {key:"last_changeset",label:"${_('Tip')}",sortable:true,
282 sortOptions: { sortFunction: revisionSort }},
282 sortOptions: { sortFunction: revisionSort }},
283 {key:"action",label:"${_('Action')}",sortable:false}
283 {key:"action",label:"${_('Action')}",sortable:false}
284 ];
284 ];
285
285
286 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
286 var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
287 sortedBy:{key:"name",dir:"asc"},
287 sortedBy:{key:"name",dir:"asc"},
288 paginator: YUI_paginator(25, ['user-paginator']),
288 paginator: YUI_paginator(25, ['user-paginator']),
289
289
290 MSG_SORTASC:"${_('Click to sort ascending')}",
290 MSG_SORTASC:"${_('Click to sort ascending')}",
291 MSG_SORTDESC:"${_('Click to sort descending')}",
291 MSG_SORTDESC:"${_('Click to sort descending')}",
292 MSG_EMPTY:"${_('No records found.')}",
292 MSG_EMPTY:"${_('No records found.')}",
293 MSG_ERROR:"${_('Data error.')}",
293 MSG_ERROR:"${_('Data error.')}",
294 MSG_LOADING:"${_('Loading...')}"
294 MSG_LOADING:"${_('Loading...')}"
295 }
295 }
296 );
296 );
297 myDataTable.subscribe('postRenderEvent',function(oArgs) {
297 myDataTable.subscribe('postRenderEvent',function(oArgs) {
298 tooltip_activate();
298 tooltip_activate();
299 quick_repo_menu();
299 quick_repo_menu();
300 });
300 });
301
301
302 var filterTimeout = null;
302 var filterTimeout = null;
303
303
304 updateFilter = function () {
304 updateFilter = function () {
305 // Reset timeout
305 // Reset timeout
306 filterTimeout = null;
306 filterTimeout = null;
307
307
308 // Reset sort
308 // Reset sort
309 var state = myDataTable.getState();
309 var state = myDataTable.getState();
310 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
310 state.sortedBy = {key:'name', dir:YAHOO.widget.DataTable.CLASS_ASC};
311
311
312 // Get filtered data
312 // Get filtered data
313 myDataSource.sendRequest(YUD.get('q_filter').value,{
313 myDataSource.sendRequest(YUD.get('q_filter').value,{
314 success : myDataTable.onDataReturnInitializeTable,
314 success : myDataTable.onDataReturnInitializeTable,
315 failure : myDataTable.onDataReturnInitializeTable,
315 failure : myDataTable.onDataReturnInitializeTable,
316 scope : myDataTable,
316 scope : myDataTable,
317 argument: state
317 argument: state
318 });
318 });
319
319
320 };
320 };
321 $('#q_filter').click(function(){
321 $('#q_filter').click(function(){
322 if(!$('#q_filter').hasClass('loaded')){
322 if(!$('#q_filter').hasClass('loaded')){
323 //TODO: load here full list later to do search within groups
323 //TODO: load here full list later to do search within groups
324 $('#q_filter').addClass('loaded');
324 $('#q_filter').addClass('loaded');
325 }
325 }
326 });
326 });
327
327
328 $('#q_filter').keyup(function(){
328 $('#q_filter').keyup(function(){
329 clearTimeout(filterTimeout);
329 clearTimeout(filterTimeout);
330 filterTimeout = setTimeout(updateFilter,600);
330 filterTimeout = setTimeout(updateFilter,600);
331 });
331 });
332
332
333 if($('#q_filter').val()) {
333 if($('#q_filter').val()) {
334 updateFilter();
334 updateFilter();
335 }
335 }
336 }
336 }
337
337
338 </script>
338 </script>
339 </%def>
339 </%def>
@@ -1,37 +1,37 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/>
2 <%inherit file="/base/base.html"/>
3 <%def name="title()">
3 <%def name="title()">
4 ${_('Public Journal')}
4 ${_('Public Journal')}
5 %if c.site_name:
5 %if c.site_name:
6 &middot; ${c.site_name}
6 &middot; ${c.site_name}
7 %endif
7 %endif
8 </%def>
8 </%def>
9 <%def name="breadcrumbs()">
9 <%def name="breadcrumbs()">
10 ${c.site_name}
10 ${c.site_name}
11 </%def>
11 </%def>
12 <%block name="header_menu">
12 <%block name="header_menu">
13 ${self.menu('journal')}
13 ${self.menu('journal')}
14 </%block>
14 </%block>
15 <%def name="head_extra()">
15 <%block name="head_extra">
16 <link href="${h.url('public_journal_atom')}" rel="alternate" title="${_('ATOM public journal feed')}" type="application/atom+xml" />
16 <link href="${h.url('public_journal_atom')}" rel="alternate" title="${_('ATOM public journal feed')}" type="application/atom+xml" />
17 <link href="${h.url('public_journal_rss')}" rel="alternate" title="${_('RSS public journal feed')}" type="application/rss+xml" />
17 <link href="${h.url('public_journal_rss')}" rel="alternate" title="${_('RSS public journal feed')}" type="application/rss+xml" />
18 </%def>
18 </%block>
19 <%def name="main()">
19 <%def name="main()">
20
20
21 <div class="box">
21 <div class="box">
22 <!-- box / title -->
22 <!-- box / title -->
23 <div class="title">
23 <div class="title">
24 <h5>${_('Public Journal')}</h5>
24 <h5>${_('Public Journal')}</h5>
25 <ul class="links">
25 <ul class="links">
26 <li>
26 <li>
27 <span>
27 <span>
28 <a href="${h.url('public_journal_atom')}"> <i class="icon-rss-squared" style="color: #fa9b39"></i></a>
28 <a href="${h.url('public_journal_atom')}"> <i class="icon-rss-squared" style="color: #fa9b39"></i></a>
29 </span>
29 </span>
30 </li>
30 </li>
31 </ul>
31 </ul>
32 </div>
32 </div>
33
33
34 <div id="journal">${c.journal_data}</div>
34 <div id="journal">${c.journal_data}</div>
35 </div>
35 </div>
36
36
37 </%def>
37 </%def>
@@ -1,450 +1,450 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Statistics') % c.repo_name}
4 ${_('%s Statistics') % c.repo_name}
5 %if c.site_name:
5 %if c.site_name:
6 &middot; ${c.site_name}
6 &middot; ${c.site_name}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="breadcrumbs_links()">
10 <%def name="breadcrumbs_links()">
11 ${_('Statistics')}
11 ${_('Statistics')}
12 </%def>
12 </%def>
13
13
14 <%block name="header_menu">
14 <%block name="header_menu">
15 ${self.menu('repositories')}
15 ${self.menu('repositories')}
16 </%block>
16 </%block>
17
17
18 <%def name="head_extra()">
18 <%block name="head_extra">
19 <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
19 <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
20 <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
20 <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
21 </%def>
21 </%block>
22
22
23 <%def name="main()">
23 <%def name="main()">
24 ${self.repo_context_bar('summary')}
24 ${self.repo_context_bar('summary')}
25 <%
25 <%
26 summary = lambda n:{False:'summary-short'}.get(n)
26 summary = lambda n:{False:'summary-short'}.get(n)
27 %>
27 %>
28 <div class="box">
28 <div class="box">
29 <!-- box / title -->
29 <!-- box / title -->
30 <div class="title">
30 <div class="title">
31 ${self.breadcrumbs()}
31 ${self.breadcrumbs()}
32 </div>
32 </div>
33
33
34 <div class="graph">
34 <div class="graph">
35 <div style="padding:0 10px 10px 17px;">
35 <div style="padding:0 10px 10px 17px;">
36 %if c.no_data:
36 %if c.no_data:
37 ${c.no_data_msg}
37 ${c.no_data_msg}
38 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
38 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
39 ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name),class_="btn btn-mini")}
39 ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name),class_="btn btn-mini")}
40 %endif
40 %endif
41 %else:
41 %else:
42 ${_('Stats gathered: ')} ${c.stats_percentage}%
42 ${_('Stats gathered: ')} ${c.stats_percentage}%
43 %endif
43 %endif
44 </div>
44 </div>
45 <div id="commit_history" style="width:450px;height:300px;float:left"></div>
45 <div id="commit_history" style="width:450px;height:300px;float:left"></div>
46 <div style="clear: both;height: 10px"></div>
46 <div style="clear: both;height: 10px"></div>
47 <div id="overview" style="width:450px;height:100px;float:left"></div>
47 <div id="overview" style="width:450px;height:100px;float:left"></div>
48
48
49 <div id="legend_data" style="clear:both;margin-top:10px;">
49 <div id="legend_data" style="clear:both;margin-top:10px;">
50 <div id="legend_container"></div>
50 <div id="legend_container"></div>
51 <div id="legend_choices">
51 <div id="legend_choices">
52 <table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table>
52 <table id="legend_choices_tables" class="noborder" style="font-size:smaller;color:#545454"></table>
53 </div>
53 </div>
54 </div>
54 </div>
55 </div>
55 </div>
56 </div>
56 </div>
57
57
58 <script type="text/javascript">
58 <script type="text/javascript">
59 var data = ${c.trending_languages|n};
59 var data = ${c.trending_languages|n};
60 var total = 0;
60 var total = 0;
61 var no_data = true;
61 var no_data = true;
62 var tbl = document.createElement('table');
62 var tbl = document.createElement('table');
63 tbl.setAttribute('class','trending_language_tbl');
63 tbl.setAttribute('class','trending_language_tbl');
64 var cnt = 0;
64 var cnt = 0;
65 for (var i=0;i<data.length;i++){
65 for (var i=0;i<data.length;i++){
66 total+= data[i][1].count;
66 total+= data[i][1].count;
67 }
67 }
68 for (var i=0;i<data.length;i++){
68 for (var i=0;i<data.length;i++){
69 cnt += 1;
69 cnt += 1;
70 no_data = false;
70 no_data = false;
71
71
72 var hide = cnt>2;
72 var hide = cnt>2;
73 var tr = document.createElement('tr');
73 var tr = document.createElement('tr');
74 if (hide){
74 if (hide){
75 tr.setAttribute('style','display:none');
75 tr.setAttribute('style','display:none');
76 tr.setAttribute('class','stats_hidden');
76 tr.setAttribute('class','stats_hidden');
77 }
77 }
78 var k = data[i][0];
78 var k = data[i][0];
79 var obj = data[i][1];
79 var obj = data[i][1];
80 var percentage = Math.round((obj.count/total*100),2);
80 var percentage = Math.round((obj.count/total*100),2);
81
81
82 var td1 = document.createElement('td');
82 var td1 = document.createElement('td');
83 td1.width = 150;
83 td1.width = 150;
84 var trending_language_label = document.createElement('div');
84 var trending_language_label = document.createElement('div');
85 trending_language_label.innerHTML = obj.desc+" ("+k+")";
85 trending_language_label.innerHTML = obj.desc+" ("+k+")";
86 td1.appendChild(trending_language_label);
86 td1.appendChild(trending_language_label);
87
87
88 var td2 = document.createElement('td');
88 var td2 = document.createElement('td');
89 td2.setAttribute('style','padding-right:14px !important');
89 td2.setAttribute('style','padding-right:14px !important');
90 var trending_language = document.createElement('div');
90 var trending_language = document.createElement('div');
91 var nr_files = obj.count+" ${_('files')}";
91 var nr_files = obj.count+" ${_('files')}";
92
92
93 trending_language.title = k+" "+nr_files;
93 trending_language.title = k+" "+nr_files;
94
94
95 if (percentage>22){
95 if (percentage>22){
96 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
96 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
97 }
97 }
98 else{
98 else{
99 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
99 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
100 }
100 }
101
101
102 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
102 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
103 trending_language.style.width=percentage+"%";
103 trending_language.style.width=percentage+"%";
104 td2.appendChild(trending_language);
104 td2.appendChild(trending_language);
105
105
106 tr.appendChild(td1);
106 tr.appendChild(td1);
107 tr.appendChild(td2);
107 tr.appendChild(td2);
108 tbl.appendChild(tr);
108 tbl.appendChild(tr);
109 if(cnt == 3){
109 if(cnt == 3){
110 var show_more = document.createElement('tr');
110 var show_more = document.createElement('tr');
111 var td = document.createElement('td');
111 var td = document.createElement('td');
112 lnk = document.createElement('a');
112 lnk = document.createElement('a');
113
113
114 lnk.href='#';
114 lnk.href='#';
115 lnk.innerHTML = "${_('Show more')}";
115 lnk.innerHTML = "${_('Show more')}";
116 lnk.id='code_stats_show_more';
116 lnk.id='code_stats_show_more';
117 td.appendChild(lnk);
117 td.appendChild(lnk);
118
118
119 show_more.appendChild(td);
119 show_more.appendChild(td);
120 show_more.appendChild(document.createElement('td'));
120 show_more.appendChild(document.createElement('td'));
121 tbl.appendChild(show_more);
121 tbl.appendChild(show_more);
122 }
122 }
123
123
124 }
124 }
125
125
126 </script>
126 </script>
127 <script type="text/javascript">
127 <script type="text/javascript">
128 /**
128 /**
129 * Plots summary graph
129 * Plots summary graph
130 *
130 *
131 * @class SummaryPlot
131 * @class SummaryPlot
132 * @param {from} initial from for detailed graph
132 * @param {from} initial from for detailed graph
133 * @param {to} initial to for detailed graph
133 * @param {to} initial to for detailed graph
134 * @param {dataset}
134 * @param {dataset}
135 * @param {overview_dataset}
135 * @param {overview_dataset}
136 */
136 */
137 function SummaryPlot(from,to,dataset,overview_dataset) {
137 function SummaryPlot(from,to,dataset,overview_dataset) {
138 var initial_ranges = {
138 var initial_ranges = {
139 "xaxis":{
139 "xaxis":{
140 "from":from,
140 "from":from,
141 "to":to
141 "to":to
142 }
142 }
143 };
143 };
144 var dataset = dataset;
144 var dataset = dataset;
145 var overview_dataset = [overview_dataset];
145 var overview_dataset = [overview_dataset];
146 var choiceContainer = YUD.get("legend_choices");
146 var choiceContainer = YUD.get("legend_choices");
147 var choiceContainerTable = YUD.get("legend_choices_tables");
147 var choiceContainerTable = YUD.get("legend_choices_tables");
148 var plotContainer = YUD.get('commit_history');
148 var plotContainer = YUD.get('commit_history');
149 var overviewContainer = YUD.get('overview');
149 var overviewContainer = YUD.get('overview');
150
150
151 var plot_options = {
151 var plot_options = {
152 bars: {show:true, align: 'center', lineWidth: 4},
152 bars: {show:true, align: 'center', lineWidth: 4},
153 legend: {show:true, container: "legend_container"},
153 legend: {show:true, container: "legend_container"},
154 points: {show:true, radius: 0, fill: false},
154 points: {show:true, radius: 0, fill: false},
155 yaxis: {tickDecimals: 0},
155 yaxis: {tickDecimals: 0},
156 xaxis: {
156 xaxis: {
157 mode: "time",
157 mode: "time",
158 timeformat: "%d/%m",
158 timeformat: "%d/%m",
159 min: from,
159 min: from,
160 max: to
160 max: to
161 },
161 },
162 grid: {
162 grid: {
163 hoverable: true,
163 hoverable: true,
164 clickable: true,
164 clickable: true,
165 autoHighlight: true,
165 autoHighlight: true,
166 color: "#999"
166 color: "#999"
167 },
167 },
168 //selection: {mode: "x"}
168 //selection: {mode: "x"}
169 };
169 };
170 var overview_options = {
170 var overview_options = {
171 legend:{show:false},
171 legend:{show:false},
172 bars: {show:true, barWidth: 2},
172 bars: {show:true, barWidth: 2},
173 shadowSize: 0,
173 shadowSize: 0,
174 xaxis: {mode: "time", timeformat: "%d/%m/%y"},
174 xaxis: {mode: "time", timeformat: "%d/%m/%y"},
175 yaxis: {ticks: 3, min: 0, tickDecimals:0},
175 yaxis: {ticks: 3, min: 0, tickDecimals:0},
176 grid: {color: "#999"},
176 grid: {color: "#999"},
177 selection: {mode: "x"}
177 selection: {mode: "x"}
178 };
178 };
179
179
180 /**
180 /**
181 *get dummy data needed in few places
181 *get dummy data needed in few places
182 */
182 */
183 function getDummyData(label){
183 function getDummyData(label){
184 return {"label":label,
184 return {"label":label,
185 "data":[{"time":0,
185 "data":[{"time":0,
186 "commits":0,
186 "commits":0,
187 "added":0,
187 "added":0,
188 "changed":0,
188 "changed":0,
189 "removed":0
189 "removed":0
190 }],
190 }],
191 "schema":["commits"],
191 "schema":["commits"],
192 "color":'#ffffff'
192 "color":'#ffffff'
193 }
193 }
194 }
194 }
195
195
196 /**
196 /**
197 * generate checkboxes accordindly to data
197 * generate checkboxes accordindly to data
198 * @param keys
198 * @param keys
199 * @returns
199 * @returns
200 */
200 */
201 function generateCheckboxes(data) {
201 function generateCheckboxes(data) {
202 //append checkboxes
202 //append checkboxes
203 var i = 0;
203 var i = 0;
204 choiceContainerTable.innerHTML = '';
204 choiceContainerTable.innerHTML = '';
205 for(var pos in data) {
205 for(var pos in data) {
206
206
207 data[pos].color = i;
207 data[pos].color = i;
208 i++;
208 i++;
209 if(data[pos].label != ''){
209 if(data[pos].label != ''){
210 choiceContainerTable.innerHTML +=
210 choiceContainerTable.innerHTML +=
211 '<tr><td><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
211 '<tr><td><input type="checkbox" id="id_user_{0}" name="{0}" checked="checked" /> \
212 <label for="id_user_{0}">{0}</label></td></tr>'.format(data[pos].label);
212 <label for="id_user_{0}">{0}</label></td></tr>'.format(data[pos].label);
213 }
213 }
214 }
214 }
215 }
215 }
216
216
217 /**
217 /**
218 * ToolTip show
218 * ToolTip show
219 */
219 */
220 function showTooltip(x, y, contents) {
220 function showTooltip(x, y, contents) {
221 var div=document.getElementById('tooltip');
221 var div=document.getElementById('tooltip');
222 if(!div) {
222 if(!div) {
223 div = document.createElement('div');
223 div = document.createElement('div');
224 div.id="tooltip";
224 div.id="tooltip";
225 div.style.position="absolute";
225 div.style.position="absolute";
226 div.style.border='1px solid #fdd';
226 div.style.border='1px solid #fdd';
227 div.style.padding='2px';
227 div.style.padding='2px';
228 div.style.backgroundColor='#fee';
228 div.style.backgroundColor='#fee';
229 document.body.appendChild(div);
229 document.body.appendChild(div);
230 }
230 }
231 YUD.setStyle(div, 'opacity', 0);
231 YUD.setStyle(div, 'opacity', 0);
232 div.innerHTML = contents;
232 div.innerHTML = contents;
233 div.style.top=(y + 5) + "px";
233 div.style.top=(y + 5) + "px";
234 div.style.left=(x + 5) + "px";
234 div.style.left=(x + 5) + "px";
235
235
236 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
236 var anim = new YAHOO.util.Anim(div, {opacity: {to: 0.8}}, 0.2);
237 anim.animate();
237 anim.animate();
238 }
238 }
239
239
240 /**
240 /**
241 * This function will detect if selected period has some changesets
241 * This function will detect if selected period has some changesets
242 for this user if it does this data is then pushed for displaying
242 for this user if it does this data is then pushed for displaying
243 Additionally it will only display users that are selected by the checkbox
243 Additionally it will only display users that are selected by the checkbox
244 */
244 */
245 function getDataAccordingToRanges(ranges) {
245 function getDataAccordingToRanges(ranges) {
246
246
247 var data = [];
247 var data = [];
248 var new_dataset = {};
248 var new_dataset = {};
249 var keys = [];
249 var keys = [];
250 var max_commits = 0;
250 var max_commits = 0;
251 for(var key in dataset){
251 for(var key in dataset){
252
252
253 for(var ds in dataset[key].data){
253 for(var ds in dataset[key].data){
254 commit_data = dataset[key].data[ds];
254 commit_data = dataset[key].data[ds];
255 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
255 if (commit_data.time >= ranges.xaxis.from && commit_data.time <= ranges.xaxis.to){
256
256
257 if(new_dataset[key] === undefined){
257 if(new_dataset[key] === undefined){
258 new_dataset[key] = {data:[],schema:["commits"],label:key};
258 new_dataset[key] = {data:[],schema:["commits"],label:key};
259 }
259 }
260 new_dataset[key].data.push(commit_data);
260 new_dataset[key].data.push(commit_data);
261 }
261 }
262 }
262 }
263 if (new_dataset[key] !== undefined){
263 if (new_dataset[key] !== undefined){
264 data.push(new_dataset[key]);
264 data.push(new_dataset[key]);
265 }
265 }
266 }
266 }
267
267
268 if (data.length > 0){
268 if (data.length > 0){
269 return data;
269 return data;
270 }
270 }
271 else{
271 else{
272 //just return dummy data for graph to plot itself
272 //just return dummy data for graph to plot itself
273 return [getDummyData('')];
273 return [getDummyData('')];
274 }
274 }
275 }
275 }
276
276
277 /**
277 /**
278 * redraw using new checkbox data
278 * redraw using new checkbox data
279 */
279 */
280 function plotchoiced(e,args){
280 function plotchoiced(e,args){
281 var cur_data = args[0];
281 var cur_data = args[0];
282 var cur_ranges = args[1];
282 var cur_ranges = args[1];
283
283
284 var new_data = [];
284 var new_data = [];
285 var inputs = choiceContainer.getElementsByTagName("input");
285 var inputs = choiceContainer.getElementsByTagName("input");
286
286
287 //show only checked labels
287 //show only checked labels
288 for(var i=0; i<inputs.length; i++) {
288 for(var i=0; i<inputs.length; i++) {
289 var checkbox_key = inputs[i].name;
289 var checkbox_key = inputs[i].name;
290
290
291 if(inputs[i].checked){
291 if(inputs[i].checked){
292 for(var d in cur_data){
292 for(var d in cur_data){
293 if(cur_data[d].label == checkbox_key){
293 if(cur_data[d].label == checkbox_key){
294 new_data.push(cur_data[d]);
294 new_data.push(cur_data[d]);
295 }
295 }
296 }
296 }
297 }
297 }
298 else{
298 else{
299 //push dummy data to not hide the label
299 //push dummy data to not hide the label
300 new_data.push(getDummyData(checkbox_key));
300 new_data.push(getDummyData(checkbox_key));
301 }
301 }
302 }
302 }
303
303
304 var new_options = YAHOO.lang.merge(plot_options, {
304 var new_options = YAHOO.lang.merge(plot_options, {
305 xaxis: {
305 xaxis: {
306 min: cur_ranges.xaxis.from,
306 min: cur_ranges.xaxis.from,
307 max: cur_ranges.xaxis.to,
307 max: cur_ranges.xaxis.to,
308 mode: "time",
308 mode: "time",
309 timeformat: "%d/%m"
309 timeformat: "%d/%m"
310 }
310 }
311 });
311 });
312 if (!new_data){
312 if (!new_data){
313 new_data = [[0,1]];
313 new_data = [[0,1]];
314 }
314 }
315 // do the zooming
315 // do the zooming
316 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
316 plot = YAHOO.widget.Flot(plotContainer, new_data, new_options);
317
317
318 plot.subscribe("plotselected", plotselected);
318 plot.subscribe("plotselected", plotselected);
319
319
320 //resubscribe plothover
320 //resubscribe plothover
321 plot.subscribe("plothover", plothover);
321 plot.subscribe("plothover", plothover);
322
322
323 // don't fire event on the overview to prevent eternal loop
323 // don't fire event on the overview to prevent eternal loop
324 overview.setSelection(cur_ranges, true);
324 overview.setSelection(cur_ranges, true);
325
325
326 }
326 }
327
327
328 /**
328 /**
329 * plot only selected items from overview
329 * plot only selected items from overview
330 * @param ranges
330 * @param ranges
331 * @returns
331 * @returns
332 */
332 */
333 function plotselected(ranges,cur_data) {
333 function plotselected(ranges,cur_data) {
334 //updates the data for new plot
334 //updates the data for new plot
335 var data = getDataAccordingToRanges(ranges);
335 var data = getDataAccordingToRanges(ranges);
336 generateCheckboxes(data);
336 generateCheckboxes(data);
337
337
338 var new_options = YAHOO.lang.merge(plot_options, {
338 var new_options = YAHOO.lang.merge(plot_options, {
339 xaxis: {
339 xaxis: {
340 min: ranges.xaxis.from,
340 min: ranges.xaxis.from,
341 max: ranges.xaxis.to,
341 max: ranges.xaxis.to,
342 mode:"time",
342 mode:"time",
343 timeformat: "%d/%m"
343 timeformat: "%d/%m"
344 }
344 }
345 });
345 });
346 // do the zooming
346 // do the zooming
347 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
347 plot = YAHOO.widget.Flot(plotContainer, data, new_options);
348
348
349 plot.subscribe("plotselected", plotselected);
349 plot.subscribe("plotselected", plotselected);
350
350
351 //resubscribe plothover
351 //resubscribe plothover
352 plot.subscribe("plothover", plothover);
352 plot.subscribe("plothover", plothover);
353
353
354 // don't fire event on the overview to prevent eternal loop
354 // don't fire event on the overview to prevent eternal loop
355 overview.setSelection(ranges, true);
355 overview.setSelection(ranges, true);
356
356
357 //resubscribe choiced
357 //resubscribe choiced
358 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
358 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, ranges]);
359 }
359 }
360
360
361 var previousPoint = null;
361 var previousPoint = null;
362
362
363 function plothover(o) {
363 function plothover(o) {
364 var pos = o.pos;
364 var pos = o.pos;
365 var item = o.item;
365 var item = o.item;
366
366
367 //YUD.get("x").innerHTML = pos.x.toFixed(2);
367 //YUD.get("x").innerHTML = pos.x.toFixed(2);
368 //YUD.get("y").innerHTML = pos.y.toFixed(2);
368 //YUD.get("y").innerHTML = pos.y.toFixed(2);
369 if (item) {
369 if (item) {
370 if (previousPoint != item.datapoint) {
370 if (previousPoint != item.datapoint) {
371 previousPoint = item.datapoint;
371 previousPoint = item.datapoint;
372
372
373 var tooltip = YUD.get("tooltip");
373 var tooltip = YUD.get("tooltip");
374 if(tooltip) {
374 if(tooltip) {
375 tooltip.parentNode.removeChild(tooltip);
375 tooltip.parentNode.removeChild(tooltip);
376 }
376 }
377 var x = item.datapoint.x.toFixed(2);
377 var x = item.datapoint.x.toFixed(2);
378 var y = item.datapoint.y.toFixed(2);
378 var y = item.datapoint.y.toFixed(2);
379
379
380 if (!item.series.label){
380 if (!item.series.label){
381 item.series.label = 'commits';
381 item.series.label = 'commits';
382 }
382 }
383 var d = new Date(x*1000);
383 var d = new Date(x*1000);
384 var fd = d.toDateString()
384 var fd = d.toDateString()
385 var nr_commits = parseInt(y);
385 var nr_commits = parseInt(y);
386
386
387 var cur_data = dataset[item.series.label].data[item.dataIndex];
387 var cur_data = dataset[item.series.label].data[item.dataIndex];
388 var added = cur_data.added;
388 var added = cur_data.added;
389 var changed = cur_data.changed;
389 var changed = cur_data.changed;
390 var removed = cur_data.removed;
390 var removed = cur_data.removed;
391
391
392 var nr_commits_suffix = " ${_('commits')} ";
392 var nr_commits_suffix = " ${_('commits')} ";
393 var added_suffix = " ${_('files added')} ";
393 var added_suffix = " ${_('files added')} ";
394 var changed_suffix = " ${_('files changed')} ";
394 var changed_suffix = " ${_('files changed')} ";
395 var removed_suffix = " ${_('files removed')} ";
395 var removed_suffix = " ${_('files removed')} ";
396
396
397 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
397 if(nr_commits == 1){nr_commits_suffix = " ${_('commit')} ";}
398 if(added==1){added_suffix=" ${_('file added')} ";}
398 if(added==1){added_suffix=" ${_('file added')} ";}
399 if(changed==1){changed_suffix=" ${_('file changed')} ";}
399 if(changed==1){changed_suffix=" ${_('file changed')} ";}
400 if(removed==1){removed_suffix=" ${_('file removed')} ";}
400 if(removed==1){removed_suffix=" ${_('file removed')} ";}
401
401
402 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
402 showTooltip(item.pageX, item.pageY, item.series.label + " on " + fd
403 +'<br/>'+
403 +'<br/>'+
404 nr_commits + nr_commits_suffix+'<br/>'+
404 nr_commits + nr_commits_suffix+'<br/>'+
405 added + added_suffix +'<br/>'+
405 added + added_suffix +'<br/>'+
406 changed + changed_suffix + '<br/>'+
406 changed + changed_suffix + '<br/>'+
407 removed + removed_suffix + '<br/>');
407 removed + removed_suffix + '<br/>');
408 }
408 }
409 }
409 }
410 else {
410 else {
411 var tooltip = YUD.get("tooltip");
411 var tooltip = YUD.get("tooltip");
412
412
413 if(tooltip) {
413 if(tooltip) {
414 tooltip.parentNode.removeChild(tooltip);
414 tooltip.parentNode.removeChild(tooltip);
415 }
415 }
416 previousPoint = null;
416 previousPoint = null;
417 }
417 }
418 }
418 }
419
419
420 /**
420 /**
421 * MAIN EXECUTION
421 * MAIN EXECUTION
422 */
422 */
423
423
424 var data = getDataAccordingToRanges(initial_ranges);
424 var data = getDataAccordingToRanges(initial_ranges);
425 generateCheckboxes(data);
425 generateCheckboxes(data);
426
426
427 //main plot
427 //main plot
428 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
428 var plot = YAHOO.widget.Flot(plotContainer,data,plot_options);
429
429
430 //overview
430 //overview
431 var overview = YAHOO.widget.Flot(overviewContainer,
431 var overview = YAHOO.widget.Flot(overviewContainer,
432 overview_dataset, overview_options);
432 overview_dataset, overview_options);
433
433
434 //show initial selection on overview
434 //show initial selection on overview
435 overview.setSelection(initial_ranges);
435 overview.setSelection(initial_ranges);
436
436
437 plot.subscribe("plotselected", plotselected);
437 plot.subscribe("plotselected", plotselected);
438 plot.subscribe("plothover", plothover)
438 plot.subscribe("plothover", plothover)
439
439
440 overview.subscribe("plotselected", function (ranges) {
440 overview.subscribe("plotselected", function (ranges) {
441 plot.setSelection(ranges);
441 plot.setSelection(ranges);
442 });
442 });
443
443
444 // user choices on overview
444 // user choices on overview
445 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
445 YUE.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]);
446 }
446 }
447 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
447 SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n});
448 </script>
448 </script>
449
449
450 </%def>
450 </%def>
@@ -1,400 +1,399 b''
1 <%inherit file="/base/base.html"/>
1 <%inherit file="/base/base.html"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Summary') % c.repo_name}
4 ${_('%s Summary') % c.repo_name}
5 %if c.site_name:
5 %if c.site_name:
6 &middot; ${c.site_name}
6 &middot; ${c.site_name}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="breadcrumbs_links()">
10 <%def name="breadcrumbs_links()">
11 ${_('Summary')}
11 ${_('Summary')}
12
12
13 ## locking icon
13 ## locking icon
14 %if c.db_repo.enable_locking:
14 %if c.db_repo.enable_locking:
15 %if c.db_repo.locked[0]:
15 %if c.db_repo.locked[0]:
16 <span class="locking_locked tooltip icon-block" title="${_('Repository locked by %s') % h.person_by_id(c.db_repo.locked[0])}"></span>
16 <span class="locking_locked tooltip icon-block" title="${_('Repository locked by %s') % h.person_by_id(c.db_repo.locked[0])}"></span>
17 %else:
17 %else:
18 <span class="locking_unlocked tooltip icon-ok" title="${_('Repository unlocked')}"></span>
18 <span class="locking_unlocked tooltip icon-ok" title="${_('Repository unlocked')}"></span>
19 %endif
19 %endif
20 %endif
20 %endif
21
21
22 ##FORK
22 ##FORK
23 %if c.db_repo.fork:
23 %if c.db_repo.fork:
24 <span>
24 <span>
25 - <i class="icon-fork"></i> ${_('Fork of')} "<a href="${h.url('summary_home',repo_name=c.db_repo.fork.repo_name)}">${c.db_repo.fork.repo_name}</a>"
25 - <i class="icon-fork"></i> ${_('Fork of')} "<a href="${h.url('summary_home',repo_name=c.db_repo.fork.repo_name)}">${c.db_repo.fork.repo_name}</a>"
26 </span>
26 </span>
27 %endif
27 %endif
28
28
29 ##REMOTE
29 ##REMOTE
30 %if c.db_repo.clone_uri:
30 %if c.db_repo.clone_uri:
31 <span>
31 <span>
32 - <i class="icon-fork"></i> ${_('Clone from')} "<a href="${h.url(str(h.hide_credentials(c.db_repo.clone_uri)))}">${h.hide_credentials(c.db_repo.clone_uri)}</a>"
32 - <i class="icon-fork"></i> ${_('Clone from')} "<a href="${h.url(str(h.hide_credentials(c.db_repo.clone_uri)))}">${h.hide_credentials(c.db_repo.clone_uri)}</a>"
33 <span>
33 <span>
34 %endif
34 %endif
35 </%def>
35 </%def>
36
36
37 <%block name="header_menu">
37 <%block name="header_menu">
38 ${self.menu('repositories')}
38 ${self.menu('repositories')}
39 </%block>
39 </%block>
40
40
41 <%def name="head_extra()">
41 <%block name="head_extra">
42 <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
42 <link href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
43 <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
43 <link href="${h.url('rss_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
44
44
45 <script>
45 <script>
46 redirect_hash_branch = function(){
46 redirect_hash_branch = function(){
47 var branch = window.location.hash.replace(/^#(.*)/, '$1');
47 var branch = window.location.hash.replace(/^#(.*)/, '$1');
48 if (branch){
48 if (branch){
49 window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"
49 window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"
50 .replace('__BRANCH__',branch);
50 .replace('__BRANCH__',branch);
51 }
51 }
52 }
52 }
53 redirect_hash_branch();
53 redirect_hash_branch();
54 window.onhashchange = function() {
54 window.onhashchange = function() {
55 redirect_hash_branch();
55 redirect_hash_branch();
56 };
56 };
57 </script>
57 </script>
58
58 </%block>
59 </%def>
60
59
61 <%def name="main()">
60 <%def name="main()">
62 ${self.repo_context_bar('summary')}
61 ${self.repo_context_bar('summary')}
63 <%
62 <%
64 summary = lambda n:{False:'summary-short'}.get(n)
63 summary = lambda n:{False:'summary-short'}.get(n)
65 %>
64 %>
66 <div class="box">
65 <div class="box">
67 <!-- box / title -->
66 <!-- box / title -->
68 <div class="title">
67 <div class="title">
69 ${self.breadcrumbs()}
68 ${self.breadcrumbs()}
70 </div>
69 </div>
71 <!-- end box / title -->
70 <!-- end box / title -->
72 <div class="form">
71 <div class="form">
73 <div id="summary" class="fields">
72 <div id="summary" class="fields">
74 <div class="field">
73 <div class="field">
75 <div class="label-summary">
74 <div class="label-summary">
76 <label>${_('Clone url')}:</label>
75 <label>${_('Clone url')}:</label>
77 </div>
76 </div>
78 <div class="input ${summary(c.show_stats)}">
77 <div class="input ${summary(c.show_stats)}">
79 <input style="width:80%" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
78 <input style="width:80%" type="text" id="clone_url" readonly="readonly" value="${c.clone_repo_url}"/>
80 <input style="display:none;width:80%" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/>
79 <input style="display:none;width:80%" type="text" id="clone_url_id" readonly="readonly" value="${c.clone_repo_url_id}"/>
81 <div style="display:none" id="clone_by_name" class="btn btn-small">${_('Show by Name')}</div>
80 <div style="display:none" id="clone_by_name" class="btn btn-small">${_('Show by Name')}</div>
82 <div id="clone_by_id" class="btn btn-small">${_('Show by ID')}</div>
81 <div id="clone_by_id" class="btn btn-small">${_('Show by ID')}</div>
83 </div>
82 </div>
84 </div>
83 </div>
85
84
86 <div class="field">
85 <div class="field">
87 <div class="label-summary">
86 <div class="label-summary">
88 <label>${_('Description')}:</label>
87 <label>${_('Description')}:</label>
89 </div>
88 </div>
90 %if c.visual.stylify_metatags:
89 %if c.visual.stylify_metatags:
91 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.db_repo.description))}</div>
90 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(h.desc_stylize(c.db_repo.description))}</div>
92 %else:
91 %else:
93 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.db_repo.description)}</div>
92 <div class="input ${summary(c.show_stats)} desc">${h.urlify_text(c.db_repo.description)}</div>
94 %endif
93 %endif
95 </div>
94 </div>
96
95
97 <div class="field">
96 <div class="field">
98 <div class="label-summary">
97 <div class="label-summary">
99 <label>${_('Trending files')}:</label>
98 <label>${_('Trending files')}:</label>
100 </div>
99 </div>
101 <div class="input ${summary(c.show_stats)}">
100 <div class="input ${summary(c.show_stats)}">
102 %if c.show_stats:
101 %if c.show_stats:
103 <div id="lang_stats"></div>
102 <div id="lang_stats"></div>
104 %else:
103 %else:
105 ${_('Statistics are disabled for this repository')}
104 ${_('Statistics are disabled for this repository')}
106 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
105 %if h.HasPermissionAll('hg.admin')('enable stats on from summary'):
107 ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_statistics'),class_="btn btn-mini")}
106 ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_statistics'),class_="btn btn-mini")}
108 %endif
107 %endif
109 %endif
108 %endif
110 </div>
109 </div>
111 </div>
110 </div>
112
111
113 <div class="field">
112 <div class="field">
114 <div class="label-summary">
113 <div class="label-summary">
115 <label>${_('Download')}:</label>
114 <label>${_('Download')}:</label>
116 </div>
115 </div>
117 <div class="input ${summary(c.show_stats)}">
116 <div class="input ${summary(c.show_stats)}">
118 %if len(c.db_repo_scm_instance.revisions) == 0:
117 %if len(c.db_repo_scm_instance.revisions) == 0:
119 ${_('There are no downloads yet')}
118 ${_('There are no downloads yet')}
120 %elif not c.enable_downloads:
119 %elif not c.enable_downloads:
121 ${_('Downloads are disabled for this repository')}
120 ${_('Downloads are disabled for this repository')}
122 %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
121 %if h.HasPermissionAll('hg.admin')('enable downloads on from summary'):
123 ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'),class_="btn btn-mini")}
122 ${h.link_to(_('Enable'),h.url('edit_repo',repo_name=c.repo_name, anchor='repo_enable_downloads'),class_="btn btn-mini")}
124 %endif
123 %endif
125 %else:
124 %else:
126 <span id="${'zip_link'}">
125 <span id="${'zip_link'}">
127 <a class="btn btn-small" href="${h.url('files_archive_home',repo_name=c.db_repo.repo_name,fname='tip.zip')}"><i class="icon-file-zip"></i> ${_('Download as zip')}</a>
126 <a class="btn btn-small" href="${h.url('files_archive_home',repo_name=c.db_repo.repo_name,fname='tip.zip')}"><i class="icon-file-zip"></i> ${_('Download as zip')}</a>
128 </span>
127 </span>
129 ${h.hidden('download_options')}
128 ${h.hidden('download_options')}
130 <span style="vertical-align: bottom">
129 <span style="vertical-align: bottom">
131 <input id="archive_subrepos" type="checkbox" name="subrepos" />
130 <input id="archive_subrepos" type="checkbox" name="subrepos" />
132 <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label>
131 <label for="archive_subrepos" class="tooltip" title="${h.tooltip(_('Check this to download archive with subrepos'))}" >${_('with subrepos')}</label>
133 </span>
132 </span>
134 %endif
133 %endif
135 </div>
134 </div>
136 </div>
135 </div>
137 </div>
136 </div>
138 <div id="summary-menu-stats">
137 <div id="summary-menu-stats">
139 <ul>
138 <ul>
140 <li>
139 <li>
141 <a title="${_('Owner')} ${c.db_repo.user.email}">
140 <a title="${_('Owner')} ${c.db_repo.user.email}">
142 <i class="icon-user"></i> ${c.db_repo.user.username}
141 <i class="icon-user"></i> ${c.db_repo.user.username}
143 <div class="gravatar" style="float: right; margin: 0px 0px 0px 0px" title="${c.db_repo.user.name} ${c.db_repo.user.lastname}">
142 <div class="gravatar" style="float: right; margin: 0px 0px 0px 0px" title="${c.db_repo.user.name} ${c.db_repo.user.lastname}">
144 ${h.gravatar(c.db_repo.user.email, size=18)}
143 ${h.gravatar(c.db_repo.user.email, size=18)}
145 </div>
144 </div>
146 </a>
145 </a>
147 </li>
146 </li>
148 <li>
147 <li>
149 <a title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
148 <a title="${_('Followers')}" href="${h.url('repo_followers_home',repo_name=c.repo_name)}">
150 <i class="icon-heart"></i> ${_('Followers')}
149 <i class="icon-heart"></i> ${_('Followers')}
151 <span class="stats-bullet" id="current_followers_count">${c.repository_followers}</span>
150 <span class="stats-bullet" id="current_followers_count">${c.repository_followers}</span>
152 </a>
151 </a>
153 </li>
152 </li>
154 <li>
153 <li>
155 <a title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
154 <a title="${_('Forks')}" href="${h.url('repo_forks_home',repo_name=c.repo_name)}">
156 <i class="icon-fork"></i> ${_('Forks')}
155 <i class="icon-fork"></i> ${_('Forks')}
157 <span class="stats-bullet">${c.repository_forks}</span>
156 <span class="stats-bullet">${c.repository_forks}</span>
158 </a>
157 </a>
159 </li>
158 </li>
160
159
161 %if c.authuser.username != 'default':
160 %if c.authuser.username != 'default':
162 <li class="repo_size">
161 <li class="repo_size">
163 <a href="#" onclick="javascript:showRepoSize('repo_size_2','${c.db_repo.repo_name}','${str(h.get_token())}')"><i class="icon-ruler"></i> ${_('Repository Size')}</a>
162 <a href="#" onclick="javascript:showRepoSize('repo_size_2','${c.db_repo.repo_name}','${str(h.get_token())}')"><i class="icon-ruler"></i> ${_('Repository Size')}</a>
164 <span class="stats-bullet" id="repo_size_2"></span>
163 <span class="stats-bullet" id="repo_size_2"></span>
165 </li>
164 </li>
166 %endif
165 %endif
167
166
168 <li>
167 <li>
169 %if c.authuser.username != 'default':
168 %if c.authuser.username != 'default':
170 <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}"><i class="icon-rss-squared"></i> ${_('Feed')}</a>
169 <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name,api_key=c.authuser.api_key)}"><i class="icon-rss-squared"></i> ${_('Feed')}</a>
171 %else:
170 %else:
172 <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name)}"><i class="icon-rss-squared"></i> ${_('Feed')}</a>
171 <a href="${h.url('atom_feed_home',repo_name=c.db_repo.repo_name)}"><i class="icon-rss-squared"></i> ${_('Feed')}</a>
173 %endif
172 %endif
174 </li>
173 </li>
175
174
176 %if c.show_stats:
175 %if c.show_stats:
177 <li>
176 <li>
178 <a title="${_('Statistics')}" href="${h.url('repo_stats_home',repo_name=c.repo_name)}">
177 <a title="${_('Statistics')}" href="${h.url('repo_stats_home',repo_name=c.repo_name)}">
179 <i class="icon-graph"></i> ${_('Statistics')}
178 <i class="icon-graph"></i> ${_('Statistics')}
180 </a>
179 </a>
181 </li>
180 </li>
182 %endif
181 %endif
183 </ul>
182 </ul>
184 </div>
183 </div>
185 </div>
184 </div>
186 </div>
185 </div>
187
186
188
187
189 <div class="box">
188 <div class="box">
190 <div class="title">
189 <div class="title">
191 <div class="breadcrumbs">
190 <div class="breadcrumbs">
192 %if c.repo_changesets:
191 %if c.repo_changesets:
193 ${h.link_to(_('Latest Changes'),h.url('changelog_home',repo_name=c.repo_name))}
192 ${h.link_to(_('Latest Changes'),h.url('changelog_home',repo_name=c.repo_name))}
194 %else:
193 %else:
195 ${_('Quick Start')}
194 ${_('Quick Start')}
196 %endif
195 %endif
197 </div>
196 </div>
198 </div>
197 </div>
199 <div class="table">
198 <div class="table">
200 <div id="shortlog_data">
199 <div id="shortlog_data">
201 <%include file='../changelog/changelog_summary_data.html'/>
200 <%include file='../changelog/changelog_summary_data.html'/>
202 </div>
201 </div>
203 </div>
202 </div>
204 </div>
203 </div>
205
204
206 %if c.readme_data:
205 %if c.readme_data:
207 <div id="readme" class="anchor">
206 <div id="readme" class="anchor">
208 <div class="box" style="background-color: #FAFAFA">
207 <div class="box" style="background-color: #FAFAFA">
209 <div class="title" title="${_('Readme file from revision %s:%s') % (c.db_repo.landing_rev[0], c.db_repo.landing_rev[1])}">
208 <div class="title" title="${_('Readme file from revision %s:%s') % (c.db_repo.landing_rev[0], c.db_repo.landing_rev[1])}">
210 <div class="breadcrumbs">
209 <div class="breadcrumbs">
211 <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a>
210 <a href="${h.url('files_home',repo_name=c.repo_name,revision='tip',f_path=c.readme_file)}">${c.readme_file}</a>
212 </div>
211 </div>
213 </div>
212 </div>
214 <div class="readme">
213 <div class="readme">
215 <div class="readme_box">
214 <div class="readme_box">
216 ${c.readme_data|n}
215 ${c.readme_data|n}
217 </div>
216 </div>
218 </div>
217 </div>
219 </div>
218 </div>
220 </div>
219 </div>
221 %endif
220 %endif
222
221
223 <script type="text/javascript">
222 <script type="text/javascript">
224 $(document).ready(function(){
223 $(document).ready(function(){
225 var $clone_url = $('#clone_url');
224 var $clone_url = $('#clone_url');
226 var $clone_url_id = $('#clone_url_id');
225 var $clone_url_id = $('#clone_url_id');
227 var $clone_by_name = $('#clone_by_name');
226 var $clone_by_name = $('#clone_by_name');
228 var $clone_by_id = $('#clone_by_id');
227 var $clone_by_id = $('#clone_by_id');
229 $clone_url.click(function(e){
228 $clone_url.click(function(e){
230 if($clone_url.hasClass('selected')){
229 if($clone_url.hasClass('selected')){
231 return ;
230 return ;
232 }else{
231 }else{
233 $clone_url.addClass('selected');
232 $clone_url.addClass('selected');
234 $clone_url.select();
233 $clone_url.select();
235 }
234 }
236 });
235 });
237
236
238 $clone_by_name.click(function(e){
237 $clone_by_name.click(function(e){
239 // show url by name and hide name button
238 // show url by name and hide name button
240 $clone_url.show();
239 $clone_url.show();
241 $clone_by_name.hide();
240 $clone_by_name.hide();
242
241
243 // hide url by id and show name button
242 // hide url by id and show name button
244 $clone_by_id.show();
243 $clone_by_id.show();
245 $clone_url_id.hide();
244 $clone_url_id.hide();
246 });
245 });
247
246
248 $clone_by_id.click(function(e){
247 $clone_by_id.click(function(e){
249 // show url by id and hide id button
248 // show url by id and hide id button
250 $clone_by_id.hide();
249 $clone_by_id.hide();
251 $clone_url_id.show();
250 $clone_url_id.show();
252
251
253 // hide url by name and show id button
252 // hide url by name and show id button
254 $clone_by_name.show();
253 $clone_by_name.show();
255 $clone_url.hide();
254 $clone_url.hide();
256 });
255 });
257
256
258 var cache = {}
257 var cache = {}
259 $("#download_options").select2({
258 $("#download_options").select2({
260 placeholder: _TM['Select changeset'],
259 placeholder: _TM['Select changeset'],
261 dropdownAutoWidth: true,
260 dropdownAutoWidth: true,
262 query: function(query){
261 query: function(query){
263 var key = 'cache';
262 var key = 'cache';
264 var cached = cache[key] ;
263 var cached = cache[key] ;
265 if(cached) {
264 if(cached) {
266 var data = {results: []};
265 var data = {results: []};
267 //filter results
266 //filter results
268 $.each(cached.results, function(){
267 $.each(cached.results, function(){
269 var section = this.text;
268 var section = this.text;
270 var children = [];
269 var children = [];
271 $.each(this.children, function(){
270 $.each(this.children, function(){
272 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
271 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
273 children.push({'id': this.id, 'text': this.text})
272 children.push({'id': this.id, 'text': this.text})
274 }
273 }
275 })
274 })
276 data.results.push({'text': section, 'children': children})
275 data.results.push({'text': section, 'children': children})
277 });
276 });
278 query.callback(data);
277 query.callback(data);
279 }else{
278 }else{
280 $.ajax({
279 $.ajax({
281 url: pyroutes.url('repo_refs_data', {'repo_name': '${c.repo_name}'}),
280 url: pyroutes.url('repo_refs_data', {'repo_name': '${c.repo_name}'}),
282 data: {},
281 data: {},
283 dataType: 'json',
282 dataType: 'json',
284 type: 'GET',
283 type: 'GET',
285 success: function(data) {
284 success: function(data) {
286 cache[key] = data;
285 cache[key] = data;
287 query.callback({results: data.results});
286 query.callback({results: data.results});
288 }
287 }
289 })
288 })
290 }
289 }
291 }
290 }
292 });
291 });
293 // on change of download options
292 // on change of download options
294 $('#download_options').change(function(e){
293 $('#download_options').change(function(e){
295 var new_cs = e.added
294 var new_cs = e.added
296
295
297 for(k in tmpl_links){
296 for(k in tmpl_links){
298 var s = $('#'+k+'_link');
297 var s = $('#'+k+'_link');
299 if(s){
298 if(s){
300 var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
299 var title_tmpl = "${_('Download %s as %s') % ('__CS_NAME__','__CS_EXT__')}";
301 title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text);
300 title_tmpl= title_tmpl.replace('__CS_NAME__',new_cs.text);
302 title_tmpl = title_tmpl.replace('__CS_EXT__',k);
301 title_tmpl = title_tmpl.replace('__CS_EXT__',k);
303 title_tmpl = '<i class="icon-file-zip"></i> '+ title_tmpl;
302 title_tmpl = '<i class="icon-file-zip"></i> '+ title_tmpl;
304 var url = tmpl_links[k].replace('__CS__',new_cs.id);
303 var url = tmpl_links[k].replace('__CS__',new_cs.id);
305 var subrepos = $('#archive_subrepos').is(':checked');
304 var subrepos = $('#archive_subrepos').is(':checked');
306 url = url.replace('__SUB__',subrepos);
305 url = url.replace('__SUB__',subrepos);
307 url = url.replace('__NAME__',title_tmpl);
306 url = url.replace('__NAME__',title_tmpl);
308
307
309 s.html(url)
308 s.html(url)
310 }
309 }
311 }
310 }
312 });
311 });
313
312
314 var tmpl_links = {};
313 var tmpl_links = {};
315 %for cnt,archive in enumerate(c.db_repo_scm_instance._get_archives()):
314 %for cnt,archive in enumerate(c.db_repo_scm_instance._get_archives()):
316 tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.db_repo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='btn btn-small')}';
315 tmpl_links["${archive['type']}"] = '${h.link_to('__NAME__', h.url('files_archive_home',repo_name=c.db_repo.repo_name, fname='__CS__'+archive['extension'],subrepos='__SUB__'),class_='btn btn-small')}';
317 %endfor
316 %endfor
318 })
317 })
319 </script>
318 </script>
320
319
321 %if c.show_stats:
320 %if c.show_stats:
322 <script type="text/javascript">
321 <script type="text/javascript">
323 $(document).ready(function(){
322 $(document).ready(function(){
324 var data = ${c.trending_languages|n};
323 var data = ${c.trending_languages|n};
325 var total = 0;
324 var total = 0;
326 var no_data = true;
325 var no_data = true;
327 var tbl = document.createElement('table');
326 var tbl = document.createElement('table');
328 tbl.setAttribute('class','trending_language_tbl');
327 tbl.setAttribute('class','trending_language_tbl');
329 var cnt = 0;
328 var cnt = 0;
330 for (var i=0;i<data.length;i++){
329 for (var i=0;i<data.length;i++){
331 total+= data[i][1].count;
330 total+= data[i][1].count;
332 }
331 }
333 for (var i=0;i<data.length;i++){
332 for (var i=0;i<data.length;i++){
334 cnt += 1;
333 cnt += 1;
335 no_data = false;
334 no_data = false;
336
335
337 var hide = cnt>2;
336 var hide = cnt>2;
338 var tr = document.createElement('tr');
337 var tr = document.createElement('tr');
339 if (hide){
338 if (hide){
340 tr.setAttribute('style','display:none');
339 tr.setAttribute('style','display:none');
341 tr.setAttribute('class','stats_hidden');
340 tr.setAttribute('class','stats_hidden');
342 }
341 }
343 var k = data[i][0];
342 var k = data[i][0];
344 var obj = data[i][1];
343 var obj = data[i][1];
345 var percentage = Math.round((obj.count/total*100),2);
344 var percentage = Math.round((obj.count/total*100),2);
346
345
347 var td1 = document.createElement('td');
346 var td1 = document.createElement('td');
348 td1.width = 150;
347 td1.width = 150;
349 var trending_language_label = document.createElement('div');
348 var trending_language_label = document.createElement('div');
350 trending_language_label.innerHTML = obj.desc+" ("+k+")";
349 trending_language_label.innerHTML = obj.desc+" ("+k+")";
351 td1.appendChild(trending_language_label);
350 td1.appendChild(trending_language_label);
352
351
353 var td2 = document.createElement('td');
352 var td2 = document.createElement('td');
354 td2.setAttribute('style','padding-right:14px !important');
353 td2.setAttribute('style','padding-right:14px !important');
355 var trending_language = document.createElement('div');
354 var trending_language = document.createElement('div');
356 var nr_files = obj.count+" ${_('files')}";
355 var nr_files = obj.count+" ${_('files')}";
357
356
358 trending_language.title = k+" "+nr_files;
357 trending_language.title = k+" "+nr_files;
359
358
360 if (percentage>22){
359 if (percentage>22){
361 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
360 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"% "+nr_files+ "</b>";
362 }
361 }
363 else{
362 else{
364 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
363 trending_language.innerHTML = "<b style='font-size:0.8em'>"+percentage+"%</b>";
365 }
364 }
366
365
367 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
366 trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
368 trending_language.style.width=percentage+"%";
367 trending_language.style.width=percentage+"%";
369 td2.appendChild(trending_language);
368 td2.appendChild(trending_language);
370
369
371 tr.appendChild(td1);
370 tr.appendChild(td1);
372 tr.appendChild(td2);
371 tr.appendChild(td2);
373 tbl.appendChild(tr);
372 tbl.appendChild(tr);
374 if(cnt == 3){
373 if(cnt == 3){
375 var show_more = document.createElement('tr');
374 var show_more = document.createElement('tr');
376 var td = document.createElement('td');
375 var td = document.createElement('td');
377 lnk = document.createElement('a');
376 lnk = document.createElement('a');
378
377
379 lnk.href='#';
378 lnk.href='#';
380 lnk.innerHTML = "${_('Show more')}";
379 lnk.innerHTML = "${_('Show more')}";
381 lnk.id='code_stats_show_more';
380 lnk.id='code_stats_show_more';
382 td.appendChild(lnk);
381 td.appendChild(lnk);
383
382
384 show_more.appendChild(td);
383 show_more.appendChild(td);
385 show_more.appendChild(document.createElement('td'));
384 show_more.appendChild(document.createElement('td'));
386 tbl.appendChild(show_more);
385 tbl.appendChild(show_more);
387 }
386 }
388
387
389 }
388 }
390
389
391 $('#lang_stats').appendChild(tbl);
390 $('#lang_stats').appendChild(tbl);
392 $('#code_status_show_more').click(function(){
391 $('#code_status_show_more').click(function(){
393 $('.stats_hidden').show();
392 $('.stats_hidden').show();
394 $('#code_status_show_more').hide();
393 $('#code_status_show_more').hide();
395 });
394 });
396 });
395 });
397 </script>
396 </script>
398 %endif
397 %endif
399
398
400 </%def>
399 </%def>
General Comments 0
You need to be logged in to leave comments. Login now