Changeset - 9265958e33bb
[Not reviewed]
codereview
0 5 0
Marcin Kuzminski - 14 years ago 2012-05-17 00:02:52
marcin@python-works.com
Show changes of status inside comments
- comments that change status are now associated with status object, and showed in comments blocks
5 files changed with 32 insertions and 13 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/changeset.py
Show inline comments
 
@@ -381,10 +381,11 @@ class ChangesetController(BaseRepoContro
 
        status = request.POST.get('changeset_status')
 
        if status and request.POST.get('change_changeset_status'):
 
            ChangesetStatusModel().set_status(
 
                c.rhodecode_db_repo.repo_id, 
 
                c.rhodecode_db_repo.repo_id,
 
                revision,
 
                status,
 
                c.rhodecode_user.user_id,
 
                comm,
 
            )
 

	
 
        Session.commit()
rhodecode/model/changeset_status.py
Show inline comments
 
@@ -65,7 +65,7 @@ class ChangesetStatusModel(BaseModel):
 
        st = status or ChangesetStatus.DEFAULT
 
        return str(st)
 

	
 
    def set_status(self, repo, revision, status, user):
 
    def set_status(self, repo, revision, status, user, comment):
 
        """
 
        Creates new status for changeset or updates the old one
 

	
 
@@ -77,6 +77,8 @@ class ChangesetStatusModel(BaseModel):
 
        :type status:
 
        :param user:
 
        :type user:
 
        :param comment:
 
        :type comment:
 
        """
 
        repo = self.__get_repo(repo)
 

	
 
@@ -89,6 +91,7 @@ class ChangesetStatusModel(BaseModel):
 
        new_status.repo = self.__get_repo(repo)
 
        new_status.status = status
 
        new_status.revision = revision
 
        new_status.comment = comment
 
        self.sa.add(new_status)
 
        return new_status
 

	
rhodecode/model/db.py
Show inline comments
 
@@ -1211,6 +1211,7 @@ class ChangesetComment(Base, BaseModel):
 

	
 
    author = relationship('User', lazy='joined')
 
    repo = relationship('Repository')
 
    status_change = relationship('ChangesetStatus', uselist=False)
 

	
 
    @classmethod
 
    def get_users(cls, revision):
 
@@ -1247,10 +1248,12 @@ class ChangesetStatus(Base, BaseModel):
 
    user_id = Column("user_id", Integer(), ForeignKey('users.user_id'), nullable=False, unique=None)
 
    revision = Column('revision', String(40), nullable=False)
 
    status = Column('status', String(128), nullable=False, default=DEFAULT)
 
    changeset_comment_id = Column('changeset_comment_id', Integer(), ForeignKey('changeset_comments.comment_id'))
 
    modified_at = Column('modified_at', DateTime(), nullable=False, default=datetime.datetime.now)
 

	
 
    author = relationship('User', lazy='joined')
 
    repo = relationship('Repository')
 
    comment = relationship('ChangesetComment', lazy='joined')
 

	
 
    @property
 
    def status_lbl(self):
rhodecode/public/css/style.css
Show inline comments
 
@@ -2447,7 +2447,7 @@ h3.files_location {
 
    font-weight: bold !important;
 
}
 
 
.right .changeset-status-container{
 
.changeset-status-container{
 
    padding-right: 5px;
 
    margin-top:1px;
 
    float:right;
 
@@ -2457,16 +2457,16 @@ h3.files_location {
 
	float:left;
 
	padding:2px 0px 0px 2px;
 
}
 
.right .changeset-status-container .changeset-status-lbl{
 
.changeset-status-container .changeset-status-lbl{
 
	color: rgb(136, 136, 136);
 
    float: left;
 
    padding: 0px 4px 0px 0px;	
 
    padding: 3px 4px 0px 0px
 
}
 
.code-header .changeset-status-container .changeset-status-lbl{
 
    float: left;
 
    padding: 0px 4px 0px 0px;   
 
}
 
.right .changeset-status-container .changeset-status-ico{
 
.changeset-status-container .changeset-status-ico{
 
    float: left;
 
}
 
.code-header .changeset-status-container .changeset-status-ico, .container .changeset-status-ico{
 
@@ -3916,6 +3916,7 @@ div.rst-block  pre {
 
    background: #f8f8f8;
 
    padding: 4px;
 
    border-bottom: 1px solid #ddd;
 
    height: 18px;
 
}
 
 
.comments .comment .meta img {
 
@@ -3924,9 +3925,13 @@ div.rst-block  pre {
 
 
.comments .comment .meta .user {
 
    font-weight: bold;
 
    float: left;
 
    padding: 4px 2px 2px 2px;
 
}
 
 
.comments .comment .meta .date {
 
	float: left;
 
	padding:4px 4px 0px 4px;
 
}
 
 
.comments .comment .text {
rhodecode/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -7,17 +7,24 @@
 
  <div class="comment" id="comment-${co.comment_id}" line="${co.line_no}">
 
    <div class="comment-wrapp">
 
  	<div class="meta">
 
  		<span class="user">
 
  			<img src="${h.gravatar_url(co.author.email, 20)}" />
 
        <div style="float:left"> <img src="${h.gravatar_url(co.author.email, 20)}" /> </div>
 
  		<div class="user">
 
  			${co.author.username}
 
  		</span>
 
  		<span class="date">
 
  		</div>
 
  		<div class="date">
 
  			${h.age(co.modified_at)}
 
  		</span>
 
  		</div>
 
        %if co.status_change:
 
           <div  style="float:left" class="changeset-status-container">
 
             <div style="float:left;padding:0px 2px 0px 2px"><span style="font-size: 18px;">&rsaquo;</span></div>
 
             <div title="${_('Changeset status')}" class="changeset-status-lbl"> ${co.status_change.status_lbl}</div>
 
             <div class="changeset-status-ico"><img src="${h.url(str('/images/icons/flag_status_%s.png' % co.status_change.status))}" /></div>             
 
           </div>
 
        %endif      
 
      %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id:
 
        <span class="buttons">
 
        <div class="buttons">
 
          <span onClick="deleteComment(${co.comment_id})" class="delete-comment ui-btn">${_('Delete')}</span>
 
        </span>
 
        </div>
 
      %endif
 
  	</div>
 
  	<div class="text">
0 comments (0 inline, 0 general)