Changeset - 91492a72b2dc
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-12-14 02:27:48
marcin@python-works.com
implements #677: Don't allow to close pull requests when they are under-review state
3 files changed with 23 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/pullrequests.py
Show inline comments
 
@@ -433,10 +433,15 @@ class PullrequestsController(BaseRepoCon
 
                      c.rhodecode_db_repo, self.ip_addr, self.sa)
 

	
 
        if request.POST.get('save_close'):
 
            PullRequestModel().close_pull_request(pull_request_id)
 
            action_logger(self.rhodecode_user,
 
                      'user_closed_pull_request:%s' % pull_request_id,
 
                      c.rhodecode_db_repo, self.ip_addr, self.sa)
 
            if status in ['rejected', 'approved']:
 
                PullRequestModel().close_pull_request(pull_request_id)
 
                action_logger(self.rhodecode_user,
 
                          'user_closed_pull_request:%s' % pull_request_id,
 
                          c.rhodecode_db_repo, self.ip_addr, self.sa)
 
            else:
 
                h.flash(_('Closing pull request on other statuses than '
 
                          'rejected or approved forbidden'),
 
                        category='warning')
 

	
 
        Session().commit()
 

	
rhodecode/public/css/style.css
Show inline comments
 
@@ -3619,6 +3619,10 @@ div.gravatar img {
 
  border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);	
 
}
 
 
.ui-btn.blue.hidden{
 
	display: none;
 
}
 
 
.ui-btn.active{
 
    font-weight: bold;
 
}
rhodecode/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -127,7 +127,7 @@
 
            <div id="status_block_container" class="status-block" style="display:none">
 
                %for status,lbl in c.changeset_statuses:
 
                    <div class="">
 
                        <img src="${h.url('/images/icons/flag_status_%s.png' % status)}" /> <input ${'checked="checked"' if status == cur_status else ''}" type="radio" name="changeset_status" id="${status}" value="${status}"> 
 
                        <img src="${h.url('/images/icons/flag_status_%s.png' % status)}" /> <input ${'checked="checked"' if status == cur_status else ''}" type="radio" class="status_change_radio" name="changeset_status" id="${status}" value="${status}"> 
 
                        <label for="${status}">${lbl}</label>
 
                    </div>
 
                %endfor
 
@@ -138,7 +138,7 @@
 
        <div class="comment-button">
 
        ${h.submit('save', _('Comment'), class_="ui-btn large")}
 
        %if close_btn:
 
           ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large')}
 
           ${h.submit('save_close', _('Comment and close'), class_='ui-btn blue large %s' % 'hidden' if cur_status in ['not_reviewd','under_review'] else '')}
 
        %endif
 
        </div>
 
        ${h.end_form()}
 
@@ -158,6 +158,14 @@ YUE.onDOMReady(function () {
 
           YUD.setStyle('status_block_container','display','none');
 
       }
 
   })
 
   YUE.on(YUQ('.status_change_radio'), 'change',function(e){
 
	   var val = e.currentTarget.value;
 
	   if (val == 'approved' || val == 'rejected') {
 
		   YUD.removeClass('save_close', 'hidden');
 
	   }else{
 
		   YUD.addClass('save_close', 'hidden');
 
	   }
 
   })
 

	
 
});
 
</script>
0 comments (0 inline, 0 general)