Changeset - c83d3d42ab92
[Not reviewed]
beta
1 6 0
Marcin Kuzminski - 14 years ago 2011-12-09 23:48:05
marcin@python-works.com
- diff.css merge to main style.css
- css fixes for diffs
- JS fixes for diff and inline comments
7 files changed with 155 insertions and 161 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/diffs.py
Show inline comments
 
@@ -405,26 +405,26 @@ class DiffProcessor(object):
 
                    # OLD LINE NUMBER
 
                    ###########################################################
 
                    _html.append('''\t<td %(a_id)s class="%(old_lineno_cls)s">''' \
 
                                    % {'a_id': anchor_old_id,
 
                                       'old_lineno_cls': old_lineno_class})
 

	
 
                    _html.append('''<pre>%(link)s</pre>''' \
 
                    _html.append('''%(link)s''' \
 
                        % {'link':
 
                        _link_to_if(cond_old, change['old_lineno'], '#%s' \
 
                                                                % anchor_old)})
 
                    _html.append('''</td>\n''')
 
                    ###########################################################
 
                    # NEW LINE NUMBER
 
                    ###########################################################
 

	
 
                    _html.append('''\t<td %(a_id)s class="%(new_lineno_cls)s">''' \
 
                                    % {'a_id': anchor_new_id,
 
                                       'new_lineno_cls': new_lineno_class})
 

	
 
                    _html.append('''<pre>%(link)s</pre>''' \
 
                    _html.append('''%(link)s''' \
 
                        % {'link':
 
                        _link_to_if(cond_new, change['new_lineno'], '#%s' \
 
                                                                % anchor_new)})
 
                    _html.append('''</td>\n''')
 
                    ###########################################################
 
                    # CODE
rhodecode/public/css/diff.css
Show inline comments
 
deleted file
rhodecode/public/css/style.css
Show inline comments
 
@@ -2739,13 +2739,12 @@ div.gravatar img {
 
    outline: none;
 
    margin: 0px 3px 3px 0px;
 
    -webkit-border-radius: 4px 4px 4px 4px !important;
 
    -khtml-border-radius: 4px 4px 4px 4px !important;
 
    -moz-border-radius: 4px 4px 4px 4px !important;
 
    border-radius: 4px 4px 4px 4px !important;
 
    box-shadow: 0 1px 0 #DADADA !important;
 
    cursor: pointer !important;
 
	padding: 3px 3px 3px 3px;	
 
 
}
 
.ui-btn.xsmall{
 
    padding: 1px 2px 1px 1px;
 
@@ -3554,14 +3553,17 @@ form.comment-inline-form {
 
.inline-comments .comment {
 
    border: 1px solid #ddd;
 
    -webkit-border-radius: 4px;
 
    -moz-border-radius: 4px;
 
    border-radius: 4px;
 
    margin: 3px 3px 5px 5px;
 
}
 
 
    background-color: #FAFAFA;
 
}
 
.inline-comments .comment-wrapp{
 
	padding:1px;
 
}
 
.inline-comments .comment .meta {
 
    background: #f8f8f8;
 
    padding: 6px;
 
    border-bottom: 1px solid #ddd;
 
}
 
 
@@ -3633,7 +3635,140 @@ form.comment-inline-form {
 
    cursor: pointer;
 
}
 
.notification-subject{
 
    clear:both;
 
    border-bottom: 1px solid #eee;
 
    padding:5px 0px 5px 38px;
 
}
 
 
 
/*****************************************************************************
 
                                  DIFFS CSS
 
******************************************************************************/
 
 
div.diffblock {
 
    overflow: auto;
 
    padding: 0px;
 
    border: 1px solid #ccc;
 
    background: #f8f8f8;
 
    font-size: 100%;
 
    line-height: 100%;
 
    /* new */
 
    line-height: 125%;
 
    -webkit-border-radius: 6px 6px 0px 0px;
 
    -moz-border-radius: 6px 6px 0px 0px;
 
    border-radius: 6px 6px 0px 0px;     
 
}
 
div.diffblock.margined{
 
    margin: 0px 20px 0px 20px;
 
}
 
div.diffblock .code-header{
 
    border-bottom: 1px solid #CCCCCC;
 
    background: #EEEEEE;
 
    padding:10px 0 10px 0;
 
}
 
div.diffblock .code-header div{
 
    margin-left:10px;
 
    font-weight: bold;
 
    font-size: 14px;
 
}
 
div.diffblock .code-body{
 
    background: #FFFFFF;
 
}
 
div.diffblock pre.raw{
 
    background: #FFFFFF;
 
    color:#000000;
 
}
 
table.code-difftable{
 
    border-collapse: collapse;
 
    width: 99%;
 
}
 
table.code-difftable td {
 
    padding: 0 !important; 
 
    background: none !important; 
 
    border:0 !important;
 
    vertical-align: none !important;
 
}
 
table.code-difftable .context{
 
    background:none repeat scroll 0 0 #DDE7EF;
 
}
 
table.code-difftable .add{
 
    background:none repeat scroll 0 0 #DDFFDD;
 
}
 
table.code-difftable .add ins{
 
    background:none repeat scroll 0 0 #AAFFAA;
 
    text-decoration:none;
 
}
 
table.code-difftable .del{
 
    background:none repeat scroll 0 0 #FFDDDD;
 
}
 
table.code-difftable .del del{
 
    background:none repeat scroll 0 0 #FFAAAA;
 
    text-decoration:none;
 
}
 
 
/** LINE NUMBERS **/
 
table.code-difftable .lineno{
 
    background:none repeat scroll 0 0 #EEEEEE !important;
 
    padding-left:2px;
 
    padding-right:2px;
 
    text-align:right;
 
    width:30px;
 
    -moz-user-select:none;
 
    -webkit-user-select: none;
 
    border-right: 1px solid #CCC !important;
 
    border-left: 0px solid #CCC !important;
 
    border-top: 0px solid #CCC !important;
 
    border-bottom: none !important;
 
    vertical-align: middle !important;
 
    
 
}
 
table.code-difftable .lineno.new {
 
}
 
table.code-difftable .lineno.old {
 
}
 
table.code-difftable .lineno a{
 
    color:#747474 !important;
 
    font:11px "Bitstream Vera Sans Mono",Monaco,"Courier New",Courier,monospace !important;
 
    letter-spacing:-1px;
 
    text-align:right;
 
    float:right;
 
    width:20px;
 
    padding-right: 2px;
 
    cursor: pointer;
 
}
 
 
table.code-difftable .lineno-inline{
 
    background:none repeat scroll 0 0 #FFF !important;
 
    padding-left:2px;
 
    padding-right:2px;
 
    text-align:right;
 
    width:30px;
 
    -moz-user-select:none;
 
    -webkit-user-select: none;
 
}
 
 
/** CODE **/
 
table.code-difftable .code { 
 
    display: block;
 
    width: 100%;
 
}
 
table.code-difftable .code td{
 
    margin:0;
 
    padding:0;
 
}
 
table.code-difftable .code pre{
 
    margin:0;
 
    padding:0;
 
    height: 17px;
 
    line-height: 17px;
 
}
 
 
 
.diffblock.margined.comm .line .code:hover{
 
    background-color:#FFFFCC !important;
 
    cursor: pointer !important;
 
    background-image:url("../images/icons/comment_add.png") !important;
 
    background-repeat:no-repeat !important;
 
    background-position: right !important;
 
    background-position: 0% 50% !important;
 
}
 
\ No newline at end of file
rhodecode/public/js/rhodecode.js
Show inline comments
 
@@ -353,13 +353,14 @@ var injectInlineForm = function(tr){
 
	  var form = createInlineForm(tr, f_path, lineno);
 
	  var target_tr = tr;
 
	  if(YUD.hasClass(YUD.getNextSibling(tr),'inline-comments')){
 
		  target_tr = YUD.getNextSibling(tr);
 
	  }
 
	  YUD.insertAfter(form,target_tr);
 
	  YUD.get('text_'+lineno).focus();	
 
	  YUD.get('text_'+lineno).focus();
 
	  tooltip_activate();
 
};
 

	
 
var createInlineAddButton = function(tr,label){
 
	var html = '<div class="add-comment"><span class="ui-btn">{0}</span></div>'.format(label);
 
        
 
	var add = new YAHOO.util.Element(tableTr('inline-comments-button',html));
rhodecode/templates/base/root.html
Show inline comments
 
@@ -8,13 +8,12 @@
 
        <link rel="icon" href="${h.url('/images/icons/database_gear.png')}" type="image/png" />
 

	
 
        ## CSS ###
 
        <%def name="css()">
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/style.css')}" media="screen"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/pygments.css')}"/>
 
            <link rel="stylesheet" type="text/css" href="${h.url('/css/diff.css')}"/>
 
            ## EXTRA FOR CSS
 
            ${self.css_extra()}
 
        </%def>
 
        <%def name="css_extra()">
 
        </%def>
 
                    
rhodecode/templates/changeset/changeset.html
Show inline comments
 
@@ -129,13 +129,13 @@
 
					&raquo; <span>${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'))}</span>
 
					&raquo; <span>${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'))}</span>
 
					&raquo; <span>${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'))}</span>
 
                    <span style="float:right">
 
                    <span style="float:right;margin-top:-3px">
 
                      <label>
 
                      ${_('show inline comments')}
 
                      ${h.checkbox('',checked="checked",class_="show-inline-comments",id_for=self.fid(filenode.changeset.raw_id,filenode.path))}
 
                      </label>
 
                    </span>
 
				</div>
 
@@ -178,12 +178,13 @@
 
        <div class="comment-form">
 
            ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=c.changeset.raw_id))}
 
            <strong>${_('Leave a comment')}</strong>
 
            <div class="clearfix">
 
                <div class="comment-help">
 
                    ${_('Comments parsed using')} <a href="${h.url('rst_help')}">RST</a> ${_('syntax')}
 
                    ${_('with')} <span style="color:#003367" class="tooltip" title="${_('Use @username inside this text to send notification to this RhodeCode user')}">@mention</span> ${_('support')}
 
                </div>
 
                    ${h.textarea('text')}
 
            </div>
 
            <div class="comment-button">
 
            ${h.submit('save', _('Comment'), class_='ui-button')}
 
            </div>
 
@@ -213,12 +214,16 @@
 
    		  }
 
    		  var boxid = YUD.getAttribute(target,'id_for');
 
    		  var comments = YUQ('#{0} .inline-comments'.format(boxid));
 
    		  for(c in comments){ 
 
    		     YUD.setStyle(comments[c],'display',show);
 
    		  }
 
    		  var btns = YUQ('#{0} .inline-comments-button'.format(boxid));
 
              for(c in btns){ 
 
                  YUD.setStyle(btns[c],'display',show);
 
               }    		  
 
    	  })
 
          
 
          YUE.on(YUQ('.line'),'click',function(e){
 
        	  var tr = e.currentTarget;
 
        	  injectInlineForm(tr);
 
          });
rhodecode/templates/changeset/changeset_file_comment.html
Show inline comments
 
##usage:
 
## <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>
 
## ${comment.comment_block(co)}
 
##
 
<%def name="comment_block(co)">
 
  <div class="comment" id="comment-${co.comment_id}">
 
    <div class="comment-wrapp">
 
  	<div class="meta">
 
  		<span class="user">
 
  			<img src="${h.gravatar_url(co.author.email, 20)}" />
 
  			${co.author.username}
 
  		</span>
 
  		<a href="${h.url.current(anchor='comment-%s' % co.comment_id)}"> ${_('commented on')} </a>
 
@@ -24,26 +25,29 @@
 
  			<div class="buttons">
 
  				<span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
 
  			</div>
 
  		%endif
 
  		${h.rst_w_mentions(co.text)|n}
 
  	</div>
 
    </div>
 
  </div>
 
</%def>
 
 
 
 
<%def name="comment_inline_form()">
 
<div id='comment-inline-form-template' style="display:none">
 
  <div class="comment-inline-form">
 
  %if c.rhodecode_user.username != 'default':
 
      ${h.form(h.url('changeset_comment', repo_name=c.repo_name, revision=c.changeset.raw_id))}
 
      <div class="clearfix">
 
          <div class="comment-help">${_('Commenting on line')} {1} ${_('comments parsed using')} 
 
          <a href="${h.url('rst_help')}">RST</a> ${_('syntax')}</div>
 
              <textarea id="text_{1}" name="text"></textarea>
 
          <div class="comment-help">${_('Commenting on line')} {1}. ${_('Comments parsed using')} 
 
          <a href="${h.url('rst_help')}">RST</a> ${_('syntax')} ${_('with')} 
 
          <span style="color:#003367" class="tooltip" title="${_('Use @username inside this text to send notification to this RhodeCode user')}">@mention</span> ${_('support')}
 
          </div>
 
          <textarea id="text_{1}" name="text"></textarea>
 
      </div>
 
      <div class="comment-button">
 
      <input type="hidden" name="f_path" value="{0}">
 
      <input type="hidden" name="line" value="{1}">            
 
      ${h.submit('save', _('Comment'), class_='ui-btn')}
 
      ${h.reset('hide-inline-form', _('Hide'), class_='ui-btn hide-inline-form')}
0 comments (0 inline, 0 general)