##// END OF EJS Templates
sidebar: changed new comment color indicator.
marcink -
r4502:c14cbcd9 stable
parent child Browse files
Show More
@@ -1,147 +1,147 b''
1 1 ## snippet for sidebar elements
2 2 ## usage:
3 3 ## <%namespace name="sidebar" file="/base/sidebar.mako"/>
4 4 ## ${sidebar.comments_table()}
5 5 <%namespace name="base" file="/base/base.mako"/>
6 6
7 7 <%def name="comments_table(comments, counter_num, todo_comments=False, existing_ids=None, is_pr=True)">
8 8 <%
9 9 if todo_comments:
10 10 cls_ = 'todos-content-table'
11 11 def sorter(entry):
12 12 user_id = entry.author.user_id
13 13 resolved = '1' if entry.resolved else '0'
14 14 if user_id == c.rhodecode_user.user_id:
15 15 # own comments first
16 16 user_id = 0
17 17 return '{}'.format(str(entry.comment_id).zfill(10000))
18 18 else:
19 19 cls_ = 'comments-content-table'
20 20 def sorter(entry):
21 21 user_id = entry.author.user_id
22 22 return '{}'.format(str(entry.comment_id).zfill(10000))
23 23
24 24 existing_ids = existing_ids or []
25 25
26 26 %>
27 27
28 28 <table class="todo-table ${cls_}" data-total-count="${len(comments)}" data-counter="${counter_num}">
29 29
30 30 % for loop_obj, comment_obj in h.looper(reversed(sorted(comments, key=sorter))):
31 31 <%
32 32 display = ''
33 33 _cls = ''
34 34 %>
35 35
36 36 <%
37 37 comment_ver_index = comment_obj.get_index_version(getattr(c, 'versions', []))
38 38 prev_comment_ver_index = 0
39 39 if loop_obj.previous:
40 40 prev_comment_ver_index = loop_obj.previous.get_index_version(getattr(c, 'versions', []))
41 41
42 42 ver_info = None
43 43 if getattr(c, 'versions', []):
44 44 ver_info = c.versions[comment_ver_index-1] if comment_ver_index else None
45 45 %>
46 46 <% hidden_at_ver = comment_obj.outdated_at_version_js(c.at_version_num) %>
47 47 <% is_from_old_ver = comment_obj.older_than_version_js(c.at_version_num) %>
48 48 <%
49 49 if (prev_comment_ver_index > comment_ver_index):
50 50 comments_ver_divider = comment_ver_index
51 51 else:
52 52 comments_ver_divider = None
53 53 %>
54 54
55 55 % if todo_comments:
56 56 % if comment_obj.resolved:
57 57 <% _cls = 'resolved-todo' %>
58 58 <% display = 'none' %>
59 59 % endif
60 60 % else:
61 61 ## SKIP TODOs we display them in other area
62 62 % if comment_obj.is_todo:
63 63 <% display = 'none' %>
64 64 % endif
65 65 ## Skip outdated comments
66 66 % if comment_obj.outdated:
67 67 <% display = 'none' %>
68 68 <% _cls = 'hidden-comment' %>
69 69 % endif
70 70 % endif
71 71
72 72 % if not todo_comments and comments_ver_divider:
73 73 <tr class="old-comments-marker">
74 74 <td colspan="3">
75 75 % if ver_info:
76 76 <code>v${comments_ver_divider} ${h.age_component(ver_info.created_on, time_is_local=True, tooltip=False)}</code>
77 77 % else:
78 78 <code>v${comments_ver_divider}</code>
79 79 % endif
80 80 </td>
81 81 </tr>
82 82
83 83 % endif
84 84
85 85 <tr class="${_cls}" style="display: ${display};" data-sidebar-comment-id="${comment_obj.comment_id}">
86 86 <td class="td-todo-number">
87 87 <%
88 88 version_info = ''
89 89 if is_pr:
90 90 version_info = (' made in older version (v{})'.format(comment_ver_index) if is_from_old_ver == 'true' else ' made in this version')
91 91 %>
92 ## NEW, since refresh
92 ## new comments, since refresh
93 93 % if existing_ids and comment_obj.comment_id not in existing_ids:
94 <div class="tooltip" style="position: absolute; left: 8px" title="New comment">
94 <div class="tooltip" style="position: absolute; left: 8px; color: #682668" title="New comment">
95 95 !
96 96 </div>
97 97 % endif
98 98
99 99 <%
100 100 data = h.json.dumps({
101 101 'comment_id': comment_obj.comment_id,
102 102 'version_info': version_info,
103 103 'file_name': comment_obj.f_path,
104 104 'line_no': comment_obj.line_no,
105 105 'outdated': comment_obj.outdated,
106 106 'inline': comment_obj.is_inline,
107 107 'is_todo': comment_obj.is_todo,
108 108 'created_on': h.format_date(comment_obj.created_on),
109 109 'datetime': '{}{}'.format(comment_obj.created_on, h.get_timezone(comment_obj.created_on, time_is_local=True)),
110 110 'review_status': (comment_obj.review_status or '')
111 111 })
112 112
113 113 if comment_obj.outdated:
114 114 icon = 'icon-comment-toggle'
115 115 elif comment_obj.is_inline:
116 116 icon = 'icon-code'
117 117 else:
118 118 icon = 'icon-comment'
119 119 %>
120 120
121 121 <i id="commentHovercard${comment_obj.comment_id}"
122 122 class="${icon} tooltip-hovercard"
123 123 data-hovercard-url="javascript:sidebarComment(${comment_obj.comment_id})"
124 124 data-comment-json-b64='${h.b64(data)}'>
125 125 </i>
126 126
127 127 </td>
128 128
129 129 <td class="td-todo-gravatar">
130 130 ${base.gravatar(comment_obj.author.email, 16, user=comment_obj.author, tooltip=True, extra_class=['no-margin'])}
131 131 </td>
132 132 <td class="todo-comment-text-wrapper">
133 133 <div class="todo-comment-text ${('todo-resolved' if comment_obj.resolved else '')}">
134 134 <a class="${('todo-resolved' if comment_obj.resolved else '')} permalink"
135 135 href="#comment-${comment_obj.comment_id}"
136 136 onclick="return Rhodecode.comments.scrollToComment($('#comment-${comment_obj.comment_id}'), 0, ${hidden_at_ver})">
137 137
138 138 ${h.chop_at_smart(comment_obj.text, '\n', suffix_if_chopped='...')}
139 139 </a>
140 140 </div>
141 141 </td>
142 142 </tr>
143 143 % endfor
144 144
145 145 </table>
146 146
147 147 </%def> No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now