changeset 2286:9265958e33bb codereview

Show changes of status inside comments - comments that change status are now associated with status object, and showed in comments blocks
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 17 May 2012 00:02:52 +0200
parents 393c53cbd0d8
children 8447d35b674e
files rhodecode/controllers/changeset.py rhodecode/model/changeset_status.py rhodecode/model/db.py rhodecode/public/css/style.css rhodecode/templates/changeset/changeset_file_comment.html
diffstat 5 files changed, 32 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/changeset.py	Wed May 16 23:17:13 2012 +0200
+++ b/rhodecode/controllers/changeset.py	Thu May 17 00:02:52 2012 +0200
@@ -381,10 +381,11 @@
         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()
--- a/rhodecode/model/changeset_status.py	Wed May 16 23:17:13 2012 +0200
+++ b/rhodecode/model/changeset_status.py	Thu May 17 00:02:52 2012 +0200
@@ -65,7 +65,7 @@
         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 @@
         :type status:
         :param user:
         :type user:
+        :param comment:
+        :type comment:
         """
         repo = self.__get_repo(repo)
 
@@ -89,6 +91,7 @@
         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
 
--- a/rhodecode/model/db.py	Wed May 16 23:17:13 2012 +0200
+++ b/rhodecode/model/db.py	Thu May 17 00:02:52 2012 +0200
@@ -1211,6 +1211,7 @@
 
     author = relationship('User', lazy='joined')
     repo = relationship('Repository')
+    status_change = relationship('ChangesetStatus', uselist=False)
 
     @classmethod
     def get_users(cls, revision):
@@ -1247,10 +1248,12 @@
     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):
--- a/rhodecode/public/css/style.css	Wed May 16 23:17:13 2012 +0200
+++ b/rhodecode/public/css/style.css	Thu May 17 00:02:52 2012 +0200
@@ -2447,7 +2447,7 @@
     font-weight: bold !important;
 }
 
-.right .changeset-status-container{
+.changeset-status-container{
     padding-right: 5px;
     margin-top:1px;
     float:right;
@@ -2457,16 +2457,16 @@
 	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 @@
     background: #f8f8f8;
     padding: 4px;
     border-bottom: 1px solid #ddd;
+    height: 18px;
 }
 
 .comments .comment .meta img {
@@ -3924,9 +3925,13 @@
 
 .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 {
--- a/rhodecode/templates/changeset/changeset_file_comment.html	Wed May 16 23:17:13 2012 +0200
+++ b/rhodecode/templates/changeset/changeset_file_comment.html	Thu May 17 00:02:52 2012 +0200
@@ -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">