##// END OF EJS Templates
files: restructure the files views for easier restyling
marcink -
r3648:4b120ff6 new-ui
parent child Browse files
Show More
@@ -1,42 +1,31 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 <div class="summary-detail-header">
4 <h4 class="item">
5 % if c.file_author:
6 ${_('Last Author')}
7 % else:
8 ${h.literal(_ungettext(u'File Author (%s)',u'File Authors (%s)',len(c.authors)) % ('<b>%s</b>' % len(c.authors))) }
9 % endif
10 </h4>
11 <a href="#" id="show_authors" class="action_link">${_('Show All')}</a>
12 </div>
13
14 3 % if c.authors:
15 4 <ul class="sidebar-right-content">
16 5 % for email, user, commits in sorted(c.authors, key=lambda e: c.file_last_commit.author_email!=e[0]):
17 6 <li class="file_author">
18 7 <div class="tooltip" title="${h.tooltip(h.author_string(email))}">
19 8 ${base.gravatar(email, 16)}
20 9 <div class="user">${h.link_to_user(user)}</div>
21 10
22 11 % if c.file_author:
23 12 <span>- ${h.age_component(c.file_last_commit.date)}</span>
24 13 % elif c.file_last_commit.author_email==email:
25 14 <span> (${_('last author')})</span>
26 15 % endif
27 16
28 17 % if not c.file_author:
29 18 <span>
30 19 % if commits == 1:
31 20 ${commits} ${_('Commit')}
32 21 % else:
33 22 ${commits} ${_('Commits')}
34 23 % endif
35 24 </span>
36 25 % endif
37 26
38 27 </div>
39 28 </li>
40 29 % endfor
41 30 </ul>
42 31 % endif
@@ -1,320 +1,321 b''
1 1 <%inherit file="/base/base.mako"/>
2 2
3 3 <%def name="title(*args)">
4 4 ${_('%s Files') % c.repo_name}
5 5 %if hasattr(c,'file'):
6 6 &middot; ${h.safe_unicode(c.file.path) or '\\'}
7 7 %endif
8 8
9 9 %if c.rhodecode_name:
10 10 &middot; ${h.branding(c.rhodecode_name)}
11 11 %endif
12 12 </%def>
13 13
14 14 <%def name="breadcrumbs_links()">
15 15 ${_('Files')}
16 16 %if c.file:
17 17 @ ${h.show_id(c.commit)}
18 18 %endif
19 19 </%def>
20 20
21 21 <%def name="menu_bar_nav()">
22 22 ${self.menu_items(active='repositories')}
23 23 </%def>
24 24
25 25 <%def name="menu_bar_subnav()">
26 26 ${self.repo_menu(active='files')}
27 27 </%def>
28 28
29 29 <%def name="main()">
30 30 <div id="pjax-container" class="summary">
31 31 <div id="files_data">
32 32 <%include file='files_pjax.mako'/>
33 33 </div>
34 34 </div>
35 35 <script>
36 36 var curState = {
37 37 commit_id: "${c.commit.raw_id}"
38 38 };
39 39
40 40 var getState = function(context) {
41 41 var url = $(location).attr('href');
42 42 var _base_url = '${h.route_path("repo_files",repo_name=c.repo_name,commit_id='',f_path='')}';
43 43 var _annotate_url = '${h.route_path("repo_files:annotated",repo_name=c.repo_name,commit_id='',f_path='')}';
44 44 _base_url = _base_url.replace('//', '/');
45 45 _annotate_url = _annotate_url.replace('//', '/');
46 46
47 47 //extract f_path from url.
48 48 var parts = url.split(_base_url);
49 49 if (parts.length != 2) {
50 50 parts = url.split(_annotate_url);
51 51 if (parts.length != 2) {
52 52 var rev = "tip";
53 53 var f_path = "";
54 54 } else {
55 55 var parts2 = parts[1].split('/');
56 56 var rev = parts2.shift(); // pop the first element which is the revision
57 57 var f_path = parts2.join('/');
58 58 }
59 59
60 60 } else {
61 61 var parts2 = parts[1].split('/');
62 62 var rev = parts2.shift(); // pop the first element which is the revision
63 63 var f_path = parts2.join('/');
64 64 }
65 65
66 66 var _node_list_url = pyroutes.url('repo_files_nodelist',
67 67 {repo_name: templateContext.repo_name,
68 68 commit_id: rev, f_path: f_path});
69 69 var _url_base = pyroutes.url('repo_files',
70 70 {repo_name: templateContext.repo_name,
71 71 commit_id: rev, f_path:'__FPATH__'});
72 72 return {
73 73 url: url,
74 74 f_path: f_path,
75 75 rev: rev,
76 76 commit_id: curState.commit_id,
77 77 node_list_url: _node_list_url,
78 78 url_base: _url_base
79 79 };
80 80 };
81 81
82 82 var metadataRequest = null;
83 83 var getFilesMetadata = function() {
84 84 if (metadataRequest && metadataRequest.readyState != 4) {
85 85 metadataRequest.abort();
86 86 }
87 87 if (fileSourcePage) {
88 88 return false;
89 89 }
90 90
91 91 if ($('#file-tree-wrapper').hasClass('full-load')) {
92 92 // in case our HTML wrapper has full-load class we don't
93 93 // trigger the async load of metadata
94 94 return false;
95 95 }
96 96
97 97 var state = getState('metadata');
98 98 var url_data = {
99 99 'repo_name': templateContext.repo_name,
100 100 'commit_id': state.commit_id,
101 101 'f_path': state.f_path
102 102 };
103 103
104 104 var url = pyroutes.url('repo_nodetree_full', url_data);
105 105
106 106 metadataRequest = $.ajax({url: url});
107 107
108 108 metadataRequest.done(function(data) {
109 109 $('#file-tree').html(data);
110 110 timeagoActivate();
111 111 });
112 112 metadataRequest.fail(function (data, textStatus, errorThrown) {
113 113 console.log(data);
114 114 if (data.status != 0) {
115 115 alert("Error while fetching metadata.\nError code {0} ({1}).Please consider reloading the page".format(data.status,data.statusText));
116 116 }
117 117 });
118 118 };
119 119
120 120 var callbacks = function() {
121 121 var state = getState('callbacks');
122 122 timeagoActivate();
123 123
124 124 // used for history, and switch to
125 125 var initialCommitData = {
126 126 id: null,
127 127 text: '${_("Pick Commit")}',
128 128 type: 'sha',
129 129 raw_id: null,
130 130 files_url: null
131 131 };
132 132
133 133 if ($('#trimmed_message_box').height() < 50) {
134 134 $('#message_expand').hide();
135 135 }
136 136
137 137 $('#message_expand').on('click', function(e) {
138 138 $('#trimmed_message_box').css('max-height', 'none');
139 139 $(this).hide();
140 140 });
141 141
142 142 if (fileSourcePage) {
143 143 // variants for with source code, not tree view
144 144
145 145 // select code link event
146 146 $("#hlcode").mouseup(getSelectionLink);
147 147
148 148 // file history select2
149 149 select2FileHistorySwitcher('#diff1', initialCommitData, state);
150 150
151 151 // show at, diff to actions handlers
152 152 $('#diff1').on('change', function(e) {
153 153 $('#diff_to_commit').removeClass('disabled').removeAttr("disabled");
154 154 $('#diff_to_commit').val(_gettext('Diff to Commit ') + e.val.truncateAfter(8, '...'));
155 155
156 156 $('#show_at_commit').removeClass('disabled').removeAttr("disabled");
157 157 $('#show_at_commit').val(_gettext('Show at Commit ') + e.val.truncateAfter(8, '...'));
158 158 });
159 159
160 160 $('#diff_to_commit').on('click', function(e) {
161 161 var diff1 = $('#diff1').val();
162 162 var diff2 = $('#diff2').val();
163 163
164 164 var url_data = {
165 165 repo_name: templateContext.repo_name,
166 166 source_ref: diff1,
167 167 source_ref_type: 'rev',
168 168 target_ref: diff2,
169 169 target_ref_type: 'rev',
170 170 merge: 1,
171 171 f_path: state.f_path
172 172 };
173 173 window.location = pyroutes.url('repo_compare', url_data);
174 174 });
175 175
176 176 $('#show_at_commit').on('click', function(e) {
177 177 var diff1 = $('#diff1').val();
178 178
179 179 var annotate = $('#annotate').val();
180 180 if (annotate === "True") {
181 181 var url = pyroutes.url('repo_files:annotated',
182 182 {'repo_name': templateContext.repo_name,
183 183 'commit_id': diff1, 'f_path': state.f_path});
184 184 } else {
185 185 var url = pyroutes.url('repo_files',
186 186 {'repo_name': templateContext.repo_name,
187 187 'commit_id': diff1, 'f_path': state.f_path});
188 188 }
189 189 window.location = url;
190 190
191 191 });
192 192
193 193 // show more authors
194 194 $('#show_authors').on('click', function(e) {
195 195 e.preventDefault();
196 196 var url = pyroutes.url('repo_file_authors',
197 197 {'repo_name': templateContext.repo_name,
198 198 'commit_id': state.rev, 'f_path': state.f_path});
199 199
200 200 $.pjax({
201 201 url: url,
202 202 data: 'annotate=${"1" if c.annotate else "0"}',
203 203 container: '#file_authors',
204 204 push: false,
205 205 timeout: pjaxTimeout
206 206 }).complete(function(){
207 207 $('#show_authors').hide();
208 $('#file_authors_title').html(_gettext('All Authors'))
208 209 })
209 210 });
210 211
211 212 // load file short history
212 213 $('#file_history_overview').on('click', function(e) {
213 214 e.preventDefault();
214 215 path = state.f_path;
215 216 if (path.indexOf("#") >= 0) {
216 217 path = path.slice(0, path.indexOf("#"));
217 218 }
218 219 var url = pyroutes.url('repo_changelog_file',
219 220 {'repo_name': templateContext.repo_name,
220 221 'commit_id': state.rev, 'f_path': path, 'limit': 6});
221 222 $('#file_history_container').show();
222 223 $('#file_history_container').html('<div class="file-history-inner">{0}</div>'.format(_gettext('Loading ...')));
223 224
224 225 $.pjax({
225 226 url: url,
226 227 container: '#file_history_container',
227 228 push: false,
228 229 timeout: pjaxTimeout
229 230 })
230 231 });
231 232
232 233 }
233 234 else {
234 235 getFilesMetadata();
235 236
236 237 // fuzzy file filter
237 238 fileBrowserListeners(state.node_list_url, state.url_base);
238 239
239 240 // switch to widget
240 241 select2RefSwitcher('#refs_filter', initialCommitData);
241 242 $('#refs_filter').on('change', function(e) {
242 243 var data = $('#refs_filter').select2('data');
243 244 curState.commit_id = data.raw_id;
244 245 $.pjax({url: data.files_url, container: '#pjax-container', timeout: pjaxTimeout});
245 246 });
246 247
247 248 $("#prev_commit_link").on('click', function(e) {
248 249 var data = $(this).data();
249 250 curState.commit_id = data.commitId;
250 251 });
251 252
252 253 $("#next_commit_link").on('click', function(e) {
253 254 var data = $(this).data();
254 255 curState.commit_id = data.commitId;
255 256 });
256 257
257 258 $('#at_rev').on("keypress", function(e) {
258 259 /* ENTER PRESSED */
259 260 if (e.keyCode === 13) {
260 261 var rev = $('#at_rev').val();
261 262 // explicit reload page here. with pjax entering bad input
262 263 // produces not so nice results
263 264 window.location = pyroutes.url('repo_files',
264 265 {'repo_name': templateContext.repo_name,
265 266 'commit_id': rev, 'f_path': state.f_path});
266 267 }
267 268 });
268 269 }
269 270 };
270 271
271 272 var pjaxTimeout = 5000;
272 273
273 274 $(document).pjax(".pjax-link", "#pjax-container", {
274 275 "fragment": "#pjax-content",
275 276 "maxCacheLength": 1000,
276 277 "timeout": pjaxTimeout
277 278 });
278 279
279 280 // define global back/forward states
280 281 var isPjaxPopState = false;
281 282 $(document).on('pjax:popstate', function() {
282 283 isPjaxPopState = true;
283 284 });
284 285
285 286 $(document).on('pjax:end', function(xhr, options) {
286 287 if (isPjaxPopState) {
287 288 isPjaxPopState = false;
288 289 callbacks();
289 290 _NODEFILTER.resetFilter();
290 291 }
291 292
292 293 // run callback for tracking if defined for google analytics etc.
293 294 // this is used to trigger tracking on pjax
294 295 if (typeof window.rhodecode_statechange_callback !== 'undefined') {
295 296 var state = getState('statechange');
296 297 rhodecode_statechange_callback(state.url, null)
297 298 }
298 299 });
299 300
300 301 $(document).on('pjax:success', function(event, xhr, options) {
301 302 if (event.target.id == "file_history_container") {
302 303 $('#file_history_overview').hide();
303 304 $('#file_history_overview_full').show();
304 305 timeagoActivate();
305 306 } else {
306 307 callbacks();
307 308 }
308 309 });
309 310
310 311 $(document).ready(function() {
311 312 callbacks();
312 313 var search_GET = "${request.GET.get('search','')}";
313 314 if (search_GET === "1") {
314 315 _NODEFILTER.initFilter();
315 316 }
316 317 });
317 318
318 319 </script>
319 320
320 321 </%def>
@@ -1,55 +1,49 b''
1 1 <%def name="title(*args)">
2 ${_('%s Files') % c.repo_name}
2 ${_('{} Files').format(c.repo_name)}
3 3 %if hasattr(c,'file'):
4 &middot; ${h.safe_unicode(c.file.path) or '\\'}
4 &middot; ${(h.safe_unicode(c.file.path) or '\\')}
5 5 %endif
6 6
7 7 %if c.rhodecode_name:
8 8 &middot; ${h.branding(c.rhodecode_name)}
9 9 %endif
10 10 </%def>
11 11
12 12 <div id="pjax-content" data-title="${self.title()}">
13 <script>
14 // set the pageSource variable
15 var fileSourcePage = ${c.file_source_page};
16 </script>
17
13 18 <div class="summary-detail">
14 19 <div class="summary-detail-header">
15 20 <div class="breadcrumbs files_location">
16 21 <h4>
17 22 ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.file.path)}
18 23 %if c.annotate:
19 24 - ${_('annotation')}
20 25 %endif
21 26 </h4>
22 27 </div>
23 28 <div class="btn-collapse" data-toggle="summary-details">
24 29 ${_('Show More')}
25 30 </div>
26 31 </div><!--end summary-detail-header-->
27 32
28 33 % if c.file.is_submodule():
29 34 <span class="submodule-dir">Submodule ${h.escape(c.file.name)}</span>
30 35 % elif c.file.is_dir():
31 <%include file='file_tree_detail.mako'/>
36 <%include file='files_tree_header.mako'/>
32 37 % else:
33 <%include file='files_detail.mako'/>
38 <%include file='files_source_header.mako'/>
34 39 % endif
35 40
36 41 </div> <!--end summary-detail-->
37 <script>
38 // set the pageSource variable
39 var fileSourcePage = ${c.file_source_page};
40 </script>
42
41 43 % if c.file.is_dir():
42 <div id="commit-stats" class="sidebar-right">
43 <%include file='file_tree_author_box.mako'/>
44 </div>
45
46 44 <%include file='files_browser.mako'/>
47 45 % else:
48 <div id="file_authors" class="sidebar-right">
49 <%include file='file_authors_box.mako'/>
50 </div>
51
52 46 <%include file='files_source.mako'/>
53 47 % endif
54 48
55 </div> No newline at end of file
49 </div>
@@ -1,69 +1,85 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 2 <%namespace name="file_base" file="/files/base.mako"/>
2 3
3 4 <div class="fieldset collapsable-content no-hide" data-toggle="summary-details">
4 5 <div class="left-label">
5 6 ${_('Commit Description')}:
6 7 </div>
7 8 <div class="commit right-content truncate-wrap">${h.urlify_commit_message(h.chop_at_smart(c.commit.message, '\n', suffix_if_chopped='...'), c.repo_name)}</div>
8 9 </div>
9 10
10 11 <div class="fieldset collapsable-content" data-toggle="summary-details">
11 12 <div class="left-label">
12 13 ${_('Commit Description')}:
13 14 </div>
14 15 <div class="commit right-content">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
15 16 </div>
16 17
17 18
18 19 <div class="fieldset " data-toggle="summary-details">
19 20 <div class="left-label">
20 21 ${_('References')}:
21 22 </div>
22 23 <div class="right-content">
23 24 <div class="tags tags-main">
24 25 <code><a href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.commit.raw_id)}">${h.show_id(c.commit)}</a></code>
25 26 ${file_base.refs(c.commit)}
26 27 </div>
27 28 </div>
28 29 </div>
29 30
30 31 <div class="fieldset collapsable-content" data-toggle="summary-details">
31 32 <div class="left-label">
32 33 ${_('File last commit')}:
33 34 </div>
34 35 <div class="right-content">
35 36 <div class="tags">
36 37 <code><a href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.file_last_commit.raw_id)}">${h.show_id(c.file_last_commit)}</a></code>
37 38
38 39 ${file_base.refs(c.file_last_commit)}
39 40 </div>
40 41 </div>
41 42 </div>
42 43
43 44
44 45 <div class="fieldset collapsable-content" data-toggle="summary-details">
45 46 <div class="left-label">
46 47 ${_('Show/Diff file')}:
47 48 </div>
48 49 <div class="right-content">
49 50 ${h.hidden('diff1')}
50 51 ${h.hidden('diff2',c.commit.raw_id)}
51 52 ${h.hidden('annotate', c.annotate)}
52 53 </div>
53 54 </div>
54 55
55 56
56 57 <div class="fieldset collapsable-content" data-toggle="summary-details">
57 58 <div class="left-label">
58 59 ${_('Action')}:
59 60 </div>
60 61 <div class="right-content">
61 62 ${h.submit('diff_to_commit',_('Diff to Commit'),class_="btn disabled",disabled="true")}
62 63 ${h.submit('show_at_commit',_('Show at Commit'),class_="btn disabled",disabled="true")}
63 64 </div>
64 65 </div>
65 66
67 <div class="fieldset collapsable-content" data-toggle="summary-details">
68 <div class="left-label" id="file_authors_title">
69 % if c.file_author:
70 ${_('Last Author')}
71 % else:
72 ${h.literal(_ungettext(u'File Author (%s)',u'File Authors (%s)',len(c.authors)) % ('<b>%s</b>' % len(c.authors))) }
73 % endif
74 <a href="#" id="show_authors" class="action_link">${_('Show All')}</a>
75 </div>
76 <div class="right-content" id="file_authors">
77 ## loads single author, or ALL
78 <%include file='file_authors_box.mako'/>
79 </div>
80 </div>
81
66 82
67 83 <script>
68 84 collapsableContent();
69 </script> No newline at end of file
85 </script>
@@ -1,37 +1,45 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 2 <%namespace name="file_base" file="/files/base.mako"/>
2 3
3 4 <div class="fieldset collapsable-content no-hide" data-toggle="summary-details">
4 5 <div class="left-label">
5 6 ${_('Description')}:
6 7 </div>
7 8 <div class="commit right-content truncate-wrap">${h.urlify_commit_message(h.chop_at_smart(c.commit.message, '\n', suffix_if_chopped='...'), c.repo_name)}</div>
8 9 </div>
9 10
10 11 <div class="fieldset collapsable-content" data-toggle="summary-details">
11 12 <div class="left-label">
12 13 ${_('Description')}:
13 14 </div>
14 15 <div class="commit right-content">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
15 16 </div>
16 17
17
18
19 18 <div class="fieldset">
20 19 <div class="left-label">
21 20 ${_('References')}:
22 21 </div>
23 22 <div class="right-content">
24 23 <div class="tags">
25 24 <code>
26 25 <a href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.commit.raw_id)}">${h.show_id(c.commit)}</a>
27 26 </code>
28 27
29 28 ${file_base.refs(c.commit)}
30 29 </div>
31 30 </div>
32 31 </div>
33 32
33 <div class="fieldset">
34 <div class="left-label">
35 ${_('Commit Author')}:
36 </div>
37 <div class="right-content">
38 ${base.gravatar_with_user(c.commit.author)}
39 <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div>
40 </div>
41 </div>
34 42
35 43 <script>
36 44 collapsableContent();
37 45 </script>
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now