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