Show More
@@ -266,8 +266,3 b' class FilesController(BaseController):' | |||
|
266 | 266 | |
|
267 | 267 | return hist_l |
|
268 | 268 | |
|
269 | # [ | |
|
270 | # ([("u1", "User1"), ("u2", "User2")], "Users"), | |
|
271 | # ([("g1", "Group1"), ("g2", "Group2")], "Groups") | |
|
272 | # ] | |
|
273 |
@@ -31,6 +31,8 b' from webhelpers.html.tags import _set_in' | |||
|
31 | 31 | convert_boolean_attrs, NotGiven |
|
32 | 32 | |
|
33 | 33 | def _reset(name, value=None, id=NotGiven, type="reset", **attrs): |
|
34 | """Reset button | |
|
35 | """ | |
|
34 | 36 | _set_input_attrs(attrs, type, name, value) |
|
35 | 37 | _set_id_attr(attrs, id, name) |
|
36 | 38 | convert_boolean_attrs(attrs, ["disabled"]) |
@@ -55,24 +57,13 b' def get_token():' | |||
|
55 | 57 | session.save() |
|
56 | 58 | return session[token_key] |
|
57 | 59 | |
|
58 | ||
|
59 | #Custom helpers here :) | |
|
60 | class _Link(object): | |
|
61 | ''' | |
|
62 | Make a url based on label and url with help of url_for | |
|
63 | :param label:name of link if not defined url is used | |
|
64 | :param url: the url for link | |
|
65 | ''' | |
|
66 | ||
|
67 | def __call__(self, label='', *url_, **urlargs): | |
|
68 | if label is None or '': | |
|
69 | label = url | |
|
70 | link_fn = link_to(label, url(*url_, **urlargs)) | |
|
71 | return link_fn | |
|
72 | ||
|
73 | link = _Link() | |
|
74 | ||
|
75 | 60 | class _GetError(object): |
|
61 | """Get error from form_errors, and represent it as span wrapped error | |
|
62 | message | |
|
63 | ||
|
64 | :param field_name: field to fetch errors for | |
|
65 | :param form_errors: form errors dict | |
|
66 | """ | |
|
76 | 67 | |
|
77 | 68 | def __call__(self, field_name, form_errors): |
|
78 | 69 | tmpl = """<span class="error_msg">%s</span>""" |
@@ -82,10 +73,10 b' class _GetError(object):' | |||
|
82 | 73 | get_error = _GetError() |
|
83 | 74 | |
|
84 | 75 | def recursive_replace(str, replace=' '): |
|
85 | """ | |
|
86 | Recursive replace of given sign to just one instance | |
|
76 | """Recursive replace of given sign to just one instance | |
|
77 | ||
|
87 | 78 | :param str: given string |
|
88 | :param replace:char to find and replace multiple instances | |
|
79 | :param replace: char to find and replace multiple instances | |
|
89 | 80 | |
|
90 | 81 | Examples:: |
|
91 | 82 | >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-') |
@@ -245,6 +236,7 b' class _FilesBreadCrumbs(object):' | |||
|
245 | 236 | return literal('/'.join(url_l)) |
|
246 | 237 | |
|
247 | 238 | files_breadcrumbs = _FilesBreadCrumbs() |
|
239 | ||
|
248 | 240 | class CodeHtmlFormatter(HtmlFormatter): |
|
249 | 241 | |
|
250 | 242 | def wrap(self, source, outfile): |
@@ -256,16 +248,17 b' class CodeHtmlFormatter(HtmlFormatter):' | |||
|
256 | 248 | t = '<div id="#S-%s">%s</div>' % (cnt + 1, t) |
|
257 | 249 | yield i, t |
|
258 | 250 | def pygmentize(filenode, **kwargs): |
|
259 | """ | |
|
260 | pygmentize function using pygments | |
|
251 | """pygmentize function using pygments | |
|
252 | ||
|
261 | 253 | :param filenode: |
|
262 | 254 | """ |
|
255 | ||
|
263 | 256 | return literal(code_highlight(filenode.content, |
|
264 | 257 | filenode.lexer, CodeHtmlFormatter(**kwargs))) |
|
265 | 258 | |
|
266 | 259 | def pygmentize_annotation(filenode, **kwargs): |
|
267 | """ | |
|
268 | pygmentize function for annotation | |
|
260 | """pygmentize function for annotation | |
|
261 | ||
|
269 | 262 | :param filenode: |
|
270 | 263 | """ |
|
271 | 264 | |
@@ -322,6 +315,7 b' def repo_name_slug(value):' | |||
|
322 | 315 | This function is called on each creation/modification |
|
323 | 316 | of repository to prevent bad names in repo |
|
324 | 317 | """ |
|
318 | ||
|
325 | 319 | slug = remove_formatting(value) |
|
326 | 320 | slug = strip_tags(slug) |
|
327 | 321 | |
@@ -355,8 +349,6 b' flash = _Flash()' | |||
|
355 | 349 | from mercurial import util |
|
356 | 350 | from mercurial.templatefilters import person as _person |
|
357 | 351 | |
|
358 | ||
|
359 | ||
|
360 | 352 | def _age(curdate): |
|
361 | 353 | """turns a datetime into an age string.""" |
|
362 | 354 | |
@@ -392,9 +384,9 b' short_id = lambda x: x[:12]' | |||
|
392 | 384 | |
|
393 | 385 | |
|
394 | 386 | def bool2icon(value): |
|
395 | """ | |
|
396 | Returns True/False values represented as small html image of true/false | |
|
387 | """Returns True/False values represented as small html image of true/false | |
|
397 | 388 | icons |
|
389 | ||
|
398 | 390 | :param value: bool value |
|
399 | 391 | """ |
|
400 | 392 | |
@@ -408,12 +400,12 b' def bool2icon(value):' | |||
|
408 | 400 | |
|
409 | 401 | |
|
410 | 402 | def action_parser(user_log): |
|
411 | """ | |
|
412 | This helper will map the specified string action into translated | |
|
403 | """This helper will map the specified string action into translated | |
|
413 | 404 | fancy names with icons and links |
|
414 | 405 | |
|
415 | @param action: | |
|
406 | :param user_log: user log instance | |
|
416 | 407 | """ |
|
408 | ||
|
417 | 409 | action = user_log.action |
|
418 | 410 | action_params = ' ' |
|
419 | 411 | |
@@ -424,12 +416,20 b' def action_parser(user_log):' | |||
|
424 | 416 | |
|
425 | 417 | def get_cs_links(): |
|
426 | 418 | if action == 'push': |
|
427 | revs_limit = 5 | |
|
419 | revs_limit = 5 #display this amount always | |
|
420 | revs_top_limit = 50 #show upto this amount of changesets hidden | |
|
428 | 421 | revs = action_params.split(',') |
|
429 | cs_links = " " + ', '.join ([link(rev, | |
|
422 | repo_name = user_log.repository.repo_name | |
|
423 | from rhodecode.model.scm import ScmModel | |
|
424 | ||
|
425 | message = lambda rev: get_changeset_safe(ScmModel().get(repo_name), | |
|
426 | rev).message | |
|
427 | ||
|
428 | cs_links = " " + ', '.join ([link_to(rev, | |
|
430 | 429 | url('changeset_home', |
|
431 |
repo_name= |
|
|
432 |
revision=rev)) |
|
|
430 | repo_name=repo_name, | |
|
431 | revision=rev), tooltip_title=message(rev), | |
|
432 | class_='tooltip') for rev in revs[:revs_limit] ]) | |
|
433 | 433 | if len(revs) > revs_limit: |
|
434 | 434 | uniq_id = revs[0] |
|
435 | 435 | html_tmpl = ('<span> %s ' |
@@ -440,10 +440,11 b' def action_parser(user_log):' | |||
|
440 | 440 | _('revisions')) |
|
441 | 441 | |
|
442 | 442 | html_tmpl = '<span id="%s" style="display:none"> %s </span>' |
|
443 | cs_links += html_tmpl % (uniq_id, ', '.join([link(rev, | |
|
443 | cs_links += html_tmpl % (uniq_id, ', '.join([link_to(rev, | |
|
444 | 444 | url('changeset_home', |
|
445 |
repo_name= |
|
|
446 | revision=rev)) for rev in revs[revs_limit:] ])) | |
|
445 | repo_name=repo_name, revision=rev), | |
|
446 | tooltip_title=message(rev), class_='tooltip') | |
|
447 | for rev in revs[revs_limit:revs_top_limit]])) | |
|
447 | 448 | |
|
448 | 449 | return cs_links |
|
449 | 450 | return '' |
@@ -491,7 +492,7 b' def action_parser_icon(user_log):' | |||
|
491 | 492 | 'user_forked_repo':'arrow_divide.png', |
|
492 | 493 | 'user_updated_repo':'database_edit.png', |
|
493 | 494 | 'admin_deleted_repo':'database_delete.png', |
|
494 |
'admin_created_repo':'database_ |
|
|
495 | 'admin_created_repo':'database_add.png', | |
|
495 | 496 | 'admin_forked_repo':'arrow_divide.png', |
|
496 | 497 | 'admin_updated_repo':'database_edit.png', |
|
497 | 498 | 'push':'script_add.png', |
General Comments 0
You need to be logged in to leave comments.
Login now