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