##// END OF EJS Templates
sidebar: fixes to comment links, and new hovercard info about a comment.
marcink -
r4488:e79c19d1 default
parent child Browse files
Show More
@@ -212,10 +212,10 b' class ChangesetStatusModel(BaseModel):'
212 212 # TODO(marcink): with group voting, how does rejected work,
213 213 # do we ever get rejected state ?
214 214
215 if approved_votes_count == reviewers_number:
215 if approved_votes_count and (approved_votes_count == reviewers_number):
216 216 return ChangesetStatus.STATUS_APPROVED
217 217
218 if rejected_votes_count == reviewers_number:
218 if rejected_votes_count and (rejected_votes_count == reviewers_number):
219 219 return ChangesetStatus.STATUS_REJECTED
220 220
221 221 return ChangesetStatus.STATUS_UNDER_REVIEW
@@ -3866,7 +3866,9 b' class ChangesetComment(Base, BaseModel):'
3866 3866
3867 3867 @property
3868 3868 def is_inline(self):
3869 return self.line_no and self.f_path
3869 if self.line_no and self.f_path:
3870 return True
3871 return False
3870 3872
3871 3873 @property
3872 3874 def last_version(self):
@@ -296,16 +296,25 b' var tooltipActivate = function () {'
296 296 // we set a variable so the data is only loaded once via Ajax, not every time the tooltip opens
297 297 if ($origin.data('loaded') !== true) {
298 298 var hovercardUrl = $origin.data('hovercardUrl');
299 var altHovercard =$origin.data('hovercardAlt');
299 var altHovercard = $origin.data('hovercardAlt');
300 300
301 301 if (hovercardUrl !== undefined && hovercardUrl !== "") {
302 if (hovercardUrl.substr(0,12) === 'pyroutes.url'){
302 var urlLoad = true;
303 if (hovercardUrl.substr(0, 12) === 'pyroutes.url') {
303 304 hovercardUrl = eval(hovercardUrl)
305 } else if (hovercardUrl.substr(0, 11) === 'javascript:') {
306 var jsFunc = hovercardUrl.substr(11);
307 urlLoad = false;
308 loaded = true;
309 instance.content(eval(jsFunc))
304 310 }
305 311
306 var loaded = loadHoverCard(hovercardUrl, altHovercard, function (data) {
307 instance.content(data);
308 })
312 if (urlLoad) {
313 var loaded = loadHoverCard(hovercardUrl, altHovercard, function (data) {
314 instance.content(data);
315 })
316 }
317
309 318 } else {
310 319 if ($origin.data('hovercardAltHtml')) {
311 320 var data = atob($origin.data('hovercardAltHtml'));
@@ -84,34 +84,35 b''
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
88 <a class="${('todo-resolved' if comment_obj.resolved else '')} permalink"
89 href="#comment-${comment_obj.comment_id}"
90 onclick="return Rhodecode.comments.scrollToComment($('#comment-${comment_obj.comment_id}'), 0, ${hidden_at_ver})">
91
92 87 <%
93 88 version_info = ''
94 89 if is_pr:
95 90 version_info = (' made in older version (v{})'.format(comment_ver_index) if is_from_old_ver == 'true' else ' made in this version')
96 91 %>
92 <script type="text/javascript">
93 // closure function helper
94 var sidebarComment${comment_obj.comment_id} = function() {
95 return renderTemplate('sideBarCommentHovercard', {
96 version_info: "${version_info}",
97 file_name: "${comment_obj.f_path}",
98 line_no: "${comment_obj.line_no}",
99 outdated: ${h.json.dumps(comment_obj.outdated)},
100 inline: ${h.json.dumps(comment_obj.is_inline)},
101 is_todo: ${h.json.dumps(comment_obj.is_todo)},
102 created_on: "${h.format_date(comment_obj.created_on)}",
103 datetime: "${comment_obj.created_on}${h.get_timezone(comment_obj.created_on, time_is_local=True)}",
104 })
105 }
106 </script>
97 107
98 % if todo_comments:
99 % if comment_obj.is_inline:
100 <i class="tooltip icon-code" title="Inline TODO comment${version_info}."></i>
101 % else:
102 <i class="tooltip icon-comment" title="General TODO comment${version_info}."></i>
103 % endif
108 % if comment_obj.outdated:
109 <i class="icon-comment-toggle tooltip-hovercard" data-hovercard-url="javascript:sidebarComment${comment_obj.comment_id}()"></i>
110 % elif comment_obj.is_inline:
111 <i class="icon-code tooltip-hovercard" data-hovercard-url="javascript:sidebarComment${comment_obj.comment_id}()"></i>
104 112 % else:
105 % if comment_obj.outdated:
106 <i class="tooltip icon-comment-toggle" title="Inline Outdated made in v${comment_ver_index}."></i>
107 % elif comment_obj.is_inline:
108 <i class="tooltip icon-code" title="Inline comment${version_info}."></i>
109 % else:
110 <i class="tooltip icon-comment" title="General comment${version_info}."></i>
111 % endif
113 <i class="icon-comment tooltip-hovercard" data-hovercard-url="javascript:sidebarComment${comment_obj.comment_id}()"></i>
112 114 % endif
113 115
114 </a>
115 116 ## NEW, since refresh
116 117 % if existing_ids and comment_obj.comment_id not in existing_ids:
117 118 <span class="tag">NEW</span>
@@ -122,8 +123,13 b''
122 123 ${base.gravatar(comment_obj.author.email, 16, user=comment_obj.author, tooltip=True, extra_class=['no-margin'])}
123 124 </td>
124 125 <td class="todo-comment-text-wrapper">
125 <div class="tooltip todo-comment-text timeago ${('todo-resolved' if comment_obj.resolved else '')} " title="${h.format_date(comment_obj.created_on)}" datetime="${comment_obj.created_on}${h.get_timezone(comment_obj.created_on, time_is_local=True)}">
126 <code>${h.chop_at_smart(comment_obj.text, '\n', suffix_if_chopped='...')}</code>
126 <div class="todo-comment-text ${('todo-resolved' if comment_obj.resolved else '')}">
127 <a class="${('todo-resolved' if comment_obj.resolved else '')} permalink"
128 href="#comment-${comment_obj.comment_id}"
129 onclick="return Rhodecode.comments.scrollToComment($('#comment-${comment_obj.comment_id}'), 0, ${hidden_at_ver})">
130
131 ${h.chop_at_smart(comment_obj.text, '\n', suffix_if_chopped='...')}
132 </a>
127 133 </div>
128 134 </td>
129 135 </tr>
@@ -183,8 +183,51 b' if (show_disabled) {'
183 183
184 184 </script>
185 185
186
187 <script id="ejs_sideBarCommentHovercard" type="text/template" class="ejsTemplate">
188
189 <div>
190 <% if (is_todo) { %>
191 <% if (inline) { %>
192 <strong>Inline</strong> TODO on line: <%= line_no %>
193 <% if (version_info) { %>
194 <%= version_info %>
195 <% } %>
196 <br/>
197 File: <code><%- file_name -%></code>
198 <% } else { %>
199 <strong>General</strong> TODO
200 <% if (version_info) { %>
201 <%= version_info %>
202 <% } %>
203 <% } %>
204 <% } else { %>
205 <% if (inline) { %>
206 <strong>Inline</strong> comment on line: <%= line_no %>
207 <% if (version_info) { %>
208 <%= version_info %>
209 <% } %>
210 <br/>
211 File: <code><%- file_name -%></code>
212 <% } else { %>
213 <strong>General</strong> comment
214 <% if (version_info) { %>
215 <%= version_info %>
216 <% } %>
217 <% } %>
218 <% } %>
219 <br/>
220 Created:
221 <time class="timeago" title="<%= created_on %>" datetime="<%= datetime %>"><%= $.timeago(datetime) %></time>
222
186 223 </div>
187 224
225 </script>
226
227 ##// END OF EJS Templates
228 </div>
229
230
188 231 <script>
189 232 // registers the templates into global cache
190 233 registerTemplates();
General Comments 0
You need to be logged in to leave comments. Login now