##// END OF EJS Templates
fixed show inline comments, broken after some html refactoring
marcink -
r1845:a048d0c6 beta
parent child Browse files
Show More
@@ -1,205 +1,209 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%inherit file="/base/base.html"/>
3 <%inherit file="/base/base.html"/>
4
4
5 <%def name="title()">
5 <%def name="title()">
6 ${c.repo_name} ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} - ${c.rhodecode_name}
6 ${c.repo_name} ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} - ${c.rhodecode_name}
7 </%def>
7 </%def>
8
8
9 <%def name="breadcrumbs_links()">
9 <%def name="breadcrumbs_links()">
10 ${h.link_to(u'Home',h.url('/'))}
10 ${h.link_to(u'Home',h.url('/'))}
11 &raquo;
11 &raquo;
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
12 ${h.link_to(c.repo_name,h.url('summary_home',repo_name=c.repo_name))}
13 &raquo;
13 &raquo;
14 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
14 ${_('Changeset')} - r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
15 </%def>
15 </%def>
16
16
17 <%def name="page_nav()">
17 <%def name="page_nav()">
18 ${self.menu('changelog')}
18 ${self.menu('changelog')}
19 </%def>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
22 <div class="box">
22 <div class="box">
23 <!-- box / title -->
23 <!-- box / title -->
24 <div class="title">
24 <div class="title">
25 ${self.breadcrumbs()}
25 ${self.breadcrumbs()}
26 </div>
26 </div>
27 <div class="table">
27 <div class="table">
28 <div class="diffblock">
28 <div class="diffblock">
29 <div class="code-header">
29 <div class="code-header">
30 <div class="date">${_('commit')} ${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} ${c.changeset.date}</div>
30 <div class="date">${_('commit')} ${c.changeset.revision}:${h.short_id(c.changeset.raw_id)} ${c.changeset.date}</div>
31 <div class="diff-menu-wrapper">
31 <div class="diff-menu-wrapper">
32 <img class="diff-menu-activate" style="cursor: pointer" alt="diff-menu" src="${h.url('/images/icons/script_gear.png')}" />
32 <img class="diff-menu-activate" style="cursor: pointer" alt="diff-menu" src="${h.url('/images/icons/script_gear.png')}" />
33 <div class="diff-menu" style="display:none">
33 <div class="diff-menu" style="display:none">
34 <ul>
34 <ul>
35 <li>${h.link_to(_('raw diff'),h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</li>
35 <li>${h.link_to(_('raw diff'),h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='show'))}</li>
36 <li>${h.link_to(_('download diff'),h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</li>
36 <li>${h.link_to(_('download diff'),h.url('raw_changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id,diff='download'))}</li>
37 <li>${c.ignorews_url()}</li>
37 <li>${c.ignorews_url()}</li>
38 <li>${c.context_url()}</li>
38 <li>${c.context_url()}</li>
39 </ul>
39 </ul>
40 </div>
40 </div>
41 </div>
41 </div>
42 <div class="comments-number" style="float:right;padding-right:5px">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
42 <div class="comments-number" style="float:right;padding-right:5px">${len(c.comments)} comment(s) (${c.inline_cnt} ${_('inline')})</div>
43 </div>
43 </div>
44 </div>
44 </div>
45 <div id="changeset_content">
45 <div id="changeset_content">
46 <div class="container">
46 <div class="container">
47 <div class="left">
47 <div class="left">
48 <div class="author">
48 <div class="author">
49 <div class="gravatar">
49 <div class="gravatar">
50 <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/>
50 <img alt="gravatar" src="${h.gravatar_url(h.email(c.changeset.author),20)}"/>
51 </div>
51 </div>
52 <span>${h.person(c.changeset.author)}</span><br/>
52 <span>${h.person(c.changeset.author)}</span><br/>
53 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
53 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
54 </div>
54 </div>
55 <div class="message">${h.urlify_commit(h.wrap_paragraphs(c.changeset.message))}</div>
55 <div class="message">${h.urlify_commit(h.wrap_paragraphs(c.changeset.message))}</div>
56 </div>
56 </div>
57 <div class="right">
57 <div class="right">
58 <div class="changes">
58 <div class="changes">
59 % if len(c.changeset.affected_files) <= c.affected_files_cut_off:
59 % if len(c.changeset.affected_files) <= c.affected_files_cut_off:
60 <span class="removed" title="${_('removed')}">${len(c.changeset.removed)}</span>
60 <span class="removed" title="${_('removed')}">${len(c.changeset.removed)}</span>
61 <span class="changed" title="${_('changed')}">${len(c.changeset.changed)}</span>
61 <span class="changed" title="${_('changed')}">${len(c.changeset.changed)}</span>
62 <span class="added" title="${_('added')}">${len(c.changeset.added)}</span>
62 <span class="added" title="${_('added')}">${len(c.changeset.added)}</span>
63 % else:
63 % else:
64 <span class="removed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
64 <span class="removed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
65 <span class="changed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
65 <span class="changed" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
66 <span class="added" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
66 <span class="added" title="${_('affected %s files') % len(c.changeset.affected_files)}">!</span>
67 % endif
67 % endif
68 </div>
68 </div>
69 %if len(c.changeset.parents)>1:
69 %if len(c.changeset.parents)>1:
70 <div class="merge">
70 <div class="merge">
71 ${_('merge')}<img alt="merge" src="${h.url('/images/icons/arrow_join.png')}"/>
71 ${_('merge')}<img alt="merge" src="${h.url('/images/icons/arrow_join.png')}"/>
72 </div>
72 </div>
73 %endif
73 %endif
74
74
75 %if c.changeset.parents:
75 %if c.changeset.parents:
76 %for p_cs in reversed(c.changeset.parents):
76 %for p_cs in reversed(c.changeset.parents):
77 <div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(h.short_id(p_cs.raw_id),
77 <div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(h.short_id(p_cs.raw_id),
78 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
78 h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
79 </div>
79 </div>
80 %endfor
80 %endfor
81 %else:
81 %else:
82 <div class="parent">${_('No parents')}</div>
82 <div class="parent">${_('No parents')}</div>
83 %endif
83 %endif
84 <span class="logtags">
84 <span class="logtags">
85 <span class="branchtag" title="${'%s %s' % (_('branch'),c.changeset.branch)}">
85 <span class="branchtag" title="${'%s %s' % (_('branch'),c.changeset.branch)}">
86 ${h.link_to(c.changeset.branch,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
86 ${h.link_to(c.changeset.branch,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
87 %for tag in c.changeset.tags:
87 %for tag in c.changeset.tags:
88 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
88 <span class="tagtag" title="${'%s %s' % (_('tag'),tag)}">
89 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
89 ${h.link_to(tag,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</span>
90 %endfor
90 %endfor
91 </span>
91 </span>
92 </div>
92 </div>
93 </div>
93 </div>
94 <span style="font-size:1.1em;font-weight: bold">
94 <span style="font-size:1.1em;font-weight: bold">
95 ${_('%s files affected with %s additions and %s deletions.') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)}
95 ${_('%s files affected with %s additions and %s deletions.') % (len(c.changeset.affected_files),c.lines_added,c.lines_deleted)}
96 </span>
96 </span>
97 <div class="cs_files">
97 <div class="cs_files">
98 %for change,filenode,diff,cs1,cs2,stat in c.changes:
98 %for change,filenode,diff,cs1,cs2,stat in c.changes:
99 <div class="cs_${change}">
99 <div class="cs_${change}">
100 <div class="node">
100 <div class="node">
101 %if change != 'removed':
101 %if change != 'removed':
102 ${h.link_to(h.safe_unicode(filenode.path),c.anchor_url(filenode.changeset.raw_id,filenode.path))}
102 ${h.link_to(h.safe_unicode(filenode.path),c.anchor_url(filenode.changeset.raw_id,filenode.path)+"_target")}
103 %else:
103 %else:
104 ${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.FID('',filenode.path)))}
104 ${h.link_to(h.safe_unicode(filenode.path),h.url.current(anchor=h.FID('',filenode.path)))}
105 %endif
105 %endif
106 </div>
106 </div>
107 <div class="changes">${h.fancy_file_stats(stat)}</div>
107 <div class="changes">${h.fancy_file_stats(stat)}</div>
108 </div>
108 </div>
109 %endfor
109 %endfor
110 % if c.cut_off:
110 % if c.cut_off:
111 ${_('Changeset was too big and was cut off...')}
111 ${_('Changeset was too big and was cut off...')}
112 % endif
112 % endif
113 </div>
113 </div>
114 </div>
114 </div>
115
115
116 </div>
116 </div>
117
117
118 ## diff block
118 ## diff block
119 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
119 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
120 ${diff_block.diff_block(c.changes)}
120 ${diff_block.diff_block(c.changes)}
121
121
122 ## template for inline comment form
122 ## template for inline comment form
123 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
123 <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
124 ${comment.comment_inline_form(c.changeset)}
124 ${comment.comment_inline_form(c.changeset)}
125
125
126 ${comment.comments(c.changeset)}
126 ${comment.comments(c.changeset)}
127
127
128 <script type="text/javascript">
128 <script type="text/javascript">
129 var deleteComment = function(comment_id){
129 var deleteComment = function(comment_id){
130
130
131 var url = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}".replace('__COMMENT_ID__',comment_id);
131 var url = "${url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}".replace('__COMMENT_ID__',comment_id);
132 var postData = '_method=delete';
132 var postData = '_method=delete';
133 var success = function(o){
133 var success = function(o){
134 var n = YUD.get('comment-'+comment_id);
134 var n = YUD.get('comment-'+comment_id);
135 n.parentNode.removeChild(n);
135 n.parentNode.removeChild(n);
136 }
136 }
137 ajaxPOST(url,postData,success);
137 ajaxPOST(url,postData,success);
138 }
138 }
139
139
140 YUE.onDOMReady(function(){
140 YUE.onDOMReady(function(){
141
141
142 YUE.on(YUQ('.diff-menu-activate'),'click',function(e){
142 YUE.on(YUQ('.diff-menu-activate'),'click',function(e){
143 var act = e.currentTarget.nextElementSibling;
143 var act = e.currentTarget.nextElementSibling;
144
144
145 if(YUD.hasClass(act,'active')){
145 if(YUD.hasClass(act,'active')){
146 YUD.removeClass(act,'active');
146 YUD.removeClass(act,'active');
147 YUD.setStyle(act,'display','none');
147 YUD.setStyle(act,'display','none');
148 }else{
148 }else{
149 YUD.addClass(act,'active');
149 YUD.addClass(act,'active');
150 YUD.setStyle(act,'display','');
150 YUD.setStyle(act,'display','');
151 }
151 }
152 });
152 });
153
153
154 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
154 YUE.on(YUQ('.show-inline-comments'),'change',function(e){
155 var show = 'none';
155 var show = 'none';
156 var target = e.currentTarget;
156 var target = e.currentTarget;
157 console.log(target);
157 if(target.checked){
158 if(target.checked){
158 var show = ''
159 var show = ''
159 }
160 }
161 console.log('aa')
160 var boxid = YUD.getAttribute(target,'id_for');
162 var boxid = YUD.getAttribute(target,'id_for');
163 console.log(boxid);
161 var comments = YUQ('#{0} .inline-comments'.format(boxid));
164 var comments = YUQ('#{0} .inline-comments'.format(boxid));
165 console.log(comments)
162 for(c in comments){
166 for(c in comments){
163 YUD.setStyle(comments[c],'display',show);
167 YUD.setStyle(comments[c],'display',show);
164 }
168 }
165 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
169 var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
166 for(c in btns){
170 for(c in btns){
167 YUD.setStyle(btns[c],'display',show);
171 YUD.setStyle(btns[c],'display',show);
168 }
172 }
169 })
173 })
170
174
171 YUE.on(YUQ('.line'),'click',function(e){
175 YUE.on(YUQ('.line'),'click',function(e){
172 var tr = e.currentTarget;
176 var tr = e.currentTarget;
173 injectInlineForm(tr);
177 injectInlineForm(tr);
174 });
178 });
175
179
176 // inject comments into they proper positions
180 // inject comments into they proper positions
177 var file_comments = YUQ('.inline-comment-placeholder');
181 var file_comments = YUQ('.inline-comment-placeholder');
178
182
179 for (f in file_comments){
183 for (f in file_comments){
180 var box = file_comments[f];
184 var box = file_comments[f];
181 var inlines = box.children;
185 var inlines = box.children;
182 for(var i=0; i<inlines.length; i++){
186 for(var i=0; i<inlines.length; i++){
183 try{
187 try{
184
188
185 var inline = inlines[i];
189 var inline = inlines[i];
186 var lineno = YUD.getAttribute(inlines[i],'line');
190 var lineno = YUD.getAttribute(inlines[i],'line');
187 var lineid = "{0}_{1}".format(YUD.getAttribute(inline,'target_id'),lineno);
191 var lineid = "{0}_{1}".format(YUD.getAttribute(inline,'target_id'),lineno);
188 var target_line = YUD.get(lineid);
192 var target_line = YUD.get(lineid);
189
193
190 var add = createInlineAddButton(target_line.parentNode,'${_("add another comment")}');
194 var add = createInlineAddButton(target_line.parentNode,'${_("add another comment")}');
191 YUD.insertAfter(add,target_line.parentNode);
195 YUD.insertAfter(add,target_line.parentNode);
192
196
193 var comment = new YAHOO.util.Element(tableTr('inline-comments',inline.innerHTML))
197 var comment = new YAHOO.util.Element(tableTr('inline-comments',inline.innerHTML))
194 YUD.insertAfter(comment,target_line.parentNode);
198 YUD.insertAfter(comment,target_line.parentNode);
195 }catch(e){
199 }catch(e){
196 console.log(e);
200 console.log(e);
197 }
201 }
198 }
202 }
199 }
203 }
200 })
204 })
201
205
202 </script>
206 </script>
203
207
204 </div>
208 </div>
205 </%def>
209 </%def>
@@ -1,46 +1,46 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 ##usage:
2 ##usage:
3 ## <%namespace name="diff_block" file="/changeset/diff_block.html"/>
3 ## <%namespace name="diff_block" file="/changeset/diff_block.html"/>
4 ## ${diff_block.diff_block(changes)}
4 ## ${diff_block.diff_block(changes)}
5 ##
5 ##
6 <%def name="diff_block(changes)">
6 <%def name="diff_block(changes)">
7
7
8 %for change,filenode,diff,cs1,cs2,stat in changes:
8 %for change,filenode,diff,cs1,cs2,stat in changes:
9 %if change !='removed':
9 %if change !='removed':
10 <div id="${h.FID(filenode.changeset.raw_id,filenode.path)}" style="clear:both;height:90px;margin-top:-60px"></div>
10 <div id="${h.FID(filenode.changeset.raw_id,filenode.path)}_target" style="clear:both;height:90px;margin-top:-60px"></div>
11 <div class="diffblock margined comm">
11 <div id="${h.FID(filenode.changeset.raw_id,filenode.path)}" class="diffblock margined comm">
12 <div class="code-header">
12 <div class="code-header">
13 <div class="changeset_header">
13 <div class="changeset_header">
14 <div class="changeset_file">
14 <div class="changeset_file">
15 ${h.link_to_if(change!='removed',h.safe_unicode(filenode.path),h.url('files_home',repo_name=c.repo_name,
15 ${h.link_to_if(change!='removed',h.safe_unicode(filenode.path),h.url('files_home',repo_name=c.repo_name,
16 revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))}
16 revision=filenode.changeset.raw_id,f_path=h.safe_unicode(filenode.path)))}
17 </div>
17 </div>
18 <div class="diff-menu-wrapper">
18 <div class="diff-menu-wrapper">
19 <img class="diff-menu-activate" style="margin-bottom:-6px;cursor: pointer" alt="diff-menu" src="${h.url('/images/icons/script_gear.png')}" />
19 <img class="diff-menu-activate" style="margin-bottom:-6px;cursor: pointer" alt="diff-menu" src="${h.url('/images/icons/script_gear.png')}" />
20 <div class="diff-menu" style="display:none">
20 <div class="diff-menu" style="display:none">
21 <ul>
21 <ul>
22 <li>${h.link_to(_('diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff',fulldiff=1))}</li>
22 <li>${h.link_to(_('diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='diff',fulldiff=1))}</li>
23 <li>${h.link_to(_('raw diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</li>
23 <li>${h.link_to(_('raw diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='raw'))}</li>
24 <li>${h.link_to(_('download diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</li>
24 <li>${h.link_to(_('download diff'),h.url('files_diff_home',repo_name=c.repo_name,f_path=h.safe_unicode(filenode.path),diff2=cs2,diff1=cs1,diff='download'))}</li>
25 <li>${c.ignorews_url(h.FID(filenode.changeset.raw_id,filenode.path))}</li>
25 <li>${c.ignorews_url(h.FID(filenode.changeset.raw_id,filenode.path))}</li>
26 <li>${c.context_url(h.FID(filenode.changeset.raw_id,filenode.path))}</li>
26 <li>${c.context_url(h.FID(filenode.changeset.raw_id,filenode.path))}</li>
27 </ul>
27 </ul>
28 </div>
28 </div>
29 </div>
29 </div>
30 <span style="float:right;margin-top:-3px">
30 <span style="float:right;margin-top:-3px">
31 <label>
31 <label>
32 ${_('show inline comments')}
32 ${_('show inline comments')}
33 ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=h.FID(filenode.changeset.raw_id,filenode.path))}
33 ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=h.FID(filenode.changeset.raw_id,filenode.path))}
34 </label>
34 </label>
35 </span>
35 </span>
36 </div>
36 </div>
37 </div>
37 </div>
38 <div class="code-body">
38 <div class="code-body">
39 <div class="full_f_path" path="${h.safe_unicode(filenode.path)}"></div>
39 <div class="full_f_path" path="${h.safe_unicode(filenode.path)}"></div>
40 ${diff|n}
40 ${diff|n}
41 </div>
41 </div>
42 </div>
42 </div>
43 %endif
43 %endif
44 %endfor
44 %endfor
45
45
46 </%def> No newline at end of file
46 </%def>
General Comments 0
You need to be logged in to leave comments. Login now