##// 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 # TODO(marcink): with group voting, how does rejected work,
212 # TODO(marcink): with group voting, how does rejected work,
213 # do we ever get rejected state ?
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 return ChangesetStatus.STATUS_APPROVED
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 return ChangesetStatus.STATUS_REJECTED
219 return ChangesetStatus.STATUS_REJECTED
220
220
221 return ChangesetStatus.STATUS_UNDER_REVIEW
221 return ChangesetStatus.STATUS_UNDER_REVIEW
@@ -3866,7 +3866,9 b' class ChangesetComment(Base, BaseModel):'
3866
3866
3867 @property
3867 @property
3868 def is_inline(self):
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 @property
3873 @property
3872 def last_version(self):
3874 def last_version(self):
@@ -299,13 +299,22 b' var tooltipActivate = function () {'
299 var altHovercard =$origin.data('hovercardAlt');
299 var altHovercard = $origin.data('hovercardAlt');
300
300
301 if (hovercardUrl !== undefined && hovercardUrl !== "") {
301 if (hovercardUrl !== undefined && hovercardUrl !== "") {
302 var urlLoad = true;
302 if (hovercardUrl.substr(0,12) === 'pyroutes.url'){
303 if (hovercardUrl.substr(0, 12) === 'pyroutes.url') {
303 hovercardUrl = eval(hovercardUrl)
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
312 if (urlLoad) {
306 var loaded = loadHoverCard(hovercardUrl, altHovercard, function (data) {
313 var loaded = loadHoverCard(hovercardUrl, altHovercard, function (data) {
307 instance.content(data);
314 instance.content(data);
308 })
315 })
316 }
317
309 } else {
318 } else {
310 if ($origin.data('hovercardAltHtml')) {
319 if ($origin.data('hovercardAltHtml')) {
311 var data = atob($origin.data('hovercardAltHtml'));
320 var data = atob($origin.data('hovercardAltHtml'));
@@ -84,34 +84,35 b''
84
84
85 <tr class="${_cls}" style="display: ${display};" data-sidebar-comment-id="${comment_obj.comment_id}">
85 <tr class="${_cls}" style="display: ${display};" data-sidebar-comment-id="${comment_obj.comment_id}">
86 <td class="td-todo-number">
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 version_info = ''
88 version_info = ''
94 if is_pr:
89 if is_pr:
95 version_info = (' made in older version (v{})'.format(comment_ver_index) if is_from_old_ver == 'true' else ' made in this version')
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:
108 % if comment_obj.outdated:
99 % if comment_obj.is_inline:
109 <i class="icon-comment-toggle tooltip-hovercard" data-hovercard-url="javascript:sidebarComment${comment_obj.comment_id}()"></i>
100 <i class="tooltip icon-code" title="Inline TODO comment${version_info}."></i>
110 % elif comment_obj.is_inline:
101 % else:
111 <i class="icon-code tooltip-hovercard" data-hovercard-url="javascript:sidebarComment${comment_obj.comment_id}()"></i>
102 <i class="tooltip icon-comment" title="General TODO comment${version_info}."></i>
103 % endif
104 % else:
112 % else:
105 % if comment_obj.outdated:
113 <i class="icon-comment tooltip-hovercard" data-hovercard-url="javascript:sidebarComment${comment_obj.comment_id}()"></i>
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
112 % endif
114 % endif
113
115
114 </a>
115 ## NEW, since refresh
116 ## NEW, since refresh
116 % if existing_ids and comment_obj.comment_id not in existing_ids:
117 % if existing_ids and comment_obj.comment_id not in existing_ids:
117 <span class="tag">NEW</span>
118 <span class="tag">NEW</span>
@@ -122,8 +123,13 b''
122 ${base.gravatar(comment_obj.author.email, 16, user=comment_obj.author, tooltip=True, extra_class=['no-margin'])}
123 ${base.gravatar(comment_obj.author.email, 16, user=comment_obj.author, tooltip=True, extra_class=['no-margin'])}
123 </td>
124 </td>
124 <td class="todo-comment-text-wrapper">
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 <div class="todo-comment-text ${('todo-resolved' if comment_obj.resolved else '')}">
126 <code>${h.chop_at_smart(comment_obj.text, '\n', suffix_if_chopped='...')}</code>
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 </div>
133 </div>
128 </td>
134 </td>
129 </tr>
135 </tr>
@@ -183,8 +183,51 b' if (show_disabled) {'
183
183
184 </script>
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 </div>
223 </div>
187
224
225 </script>
226
227 ##// END OF EJS Templates
228 </div>
229
230
188 <script>
231 <script>
189 // registers the templates into global cache
232 // registers the templates into global cache
190 registerTemplates();
233 registerTemplates();
General Comments 0
You need to be logged in to leave comments. Login now