Changeset - eac6c70e63e8
[Not reviewed]
default
0 2 0
Mads Kiilerich - 12 years ago 2013-12-10 19:30:37
madski@unity3d.com
comments: always show vote controls, use 'No change' as default instead of current review status
2 files changed with 25 insertions and 25 deletions:
0 comments (0 inline, 0 general)
kallithea/public/css/style.css
Show inline comments
 
@@ -4439,49 +4439,49 @@ div.rst-block  pre {
 
}
 

	
 
.comments .comment .meta .date {
 
    float: left;
 
    padding: 4px 4px 0px 4px;
 
}
 

	
 
.comments .comment .text {
 
    background-color: #FAFAFA;
 
}
 
.comment .text div.rst-block p {
 
    margin: 0.5em 0px !important;
 
}
 

	
 
.comments .comments-number {
 
    padding: 0px 0px 10px 0px;
 
    font-weight: bold;
 
    color: #666;
 
    font-size: 16px;
 
}
 

	
 
/** comment form **/
 

	
 
.status-block {
 
    min-height: 80px;
 
    margin: 5px;
 
    clear: both
 
}
 

	
 

	
 
div.comment-form {
 
    margin-top: 20px;
 
}
 

	
 
.comment-form strong {
 
    display: block;
 
    margin-bottom: 15px;
 
}
 

	
 
.comment-form textarea {
 
    width: 100%;
 
    height: 100px;
 
    font-family: Consolas, Monaco, Inconsolata, Liberation Mono, monospace;
 
}
 

	
 
form.comment-form {
 
    margin-top: 10px;
 
    margin-left: 10px;
 
}
 

	
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -128,120 +128,120 @@
 
    ## generate inlines for this changeset
 
     ${inlines()}
 
    </div>
 

	
 
    %for co in c.comments:
 
        <div id="comment-tr-${co.comment_id}">
 
          ${comment_block(co)}
 
        </div>
 
    %endfor
 
</div>
 
</%def>
 

	
 
## MAIN COMMENT FORM
 
<%def name="comments(post_url, cur_status, is_pr=False, change_status=True)">
 

	
 
<div class="comments">
 
    %if c.authuser.username != 'default':
 
    <div class="comment-form ac">
 
        ${h.form(post_url)}
 
        <div id="edit-container" class="clearfix">
 
            <div class="comment-help">
 
                ${(_('Comments parsed using %s syntax with %s support.') % (('<a href="%s">RST</a>' % h.url('rst_help')),
 
                  '<span style="color:#577632" class="tooltip" title="%s">@mention</span>' %
 
                  _('Use @username inside this text to send notification to this Kallithea user')))|n}
 
              %if change_status:
 
                | <a id="show_changeset_link" onClick="change_status_show();">
 
                  %if is_pr:
 
                    ${_('Vote for pull request status')}
 
                  %else:
 
                    ${_('Change changeset status')}
 
                  %endif
 
                  </a>
 
                  <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" />
 
              %endif
 
              <div id="preview-btn" class="preview-btn btn btn-mini">${_('Preview')}</div>
 
            </div>
 
            <div class="mentions-container" id="mentions_container"></div>
 
            ${h.textarea('text', class_="comment-block-ta")}
 
            %if change_status:
 
            <div id="status_block_container" class="status-block" style="display:none">
 
              <div id="status_block_container" class="status-block">
 
                %if is_pr:
 
                  ${_('Vote for pull request status')}:
 
                %else:
 
                  ${_('Set changeset status')}:
 
                %endif
 
                <input id="show_changeset_status_box" type="checkbox" name="change_changeset_status" style="display: none;" />
 
                <input type="radio" class="status_change_radio" name="changeset_status" id="changeset_status_unchanged" value="" checked="checked" />
 
                <label for="changeset_status_unchanged">
 
                  ${_('No change')}
 
                </label>
 
                %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" class="status_change_radio" name="changeset_status" id="${status}" value="${status}">
 
                        <label for="${status}">${lbl}</label>
 
                    </div>
 
                    <span style="margin-left: 15px;">
 
                        <input type="radio" class="status_change_radio" name="changeset_status" id="${status}" value="${status}">
 
                        <label for="${status}"><img src="${h.url('/images/icons/flag_status_%s.png' % status)}" />${lbl}</label>
 
                    </span>
 
                %endfor
 
                %if is_pr and change_status:
 
                <input id="save_close" type="checkbox" name="save_close" disabled="${'1' if cur_status in ['not_reviewed','under_review'] else ''}">
 
                <label id="save_close_label" for="save_close" class="${'disabled' if cur_status in ['not_reviewed','under_review'] else ''}">${_("Close (when approved or rejected)")}</label>
 
                %endif
 
            </div>
 
            %endif
 
            <div class="mentions-container" id="mentions_container"></div>
 
             ${h.textarea('text', class_="comment-block-ta")}
 
        </div>
 

	
 
        <div id="preview-container" class="clearfix" style="display:none">
 
           <div class="comment-help">
 
                ${_('Comment preview')}
 
              <div id="edit-btn" class="edit-btn btn btn-mini">${_('Edit')}</div>
 
            </div>
 
            <div id="preview-box" class="preview-box"></div>
 
        </div>
 

	
 
        <div class="comment-button">
 
        ${h.submit('save', _('Comment'), class_="btn")}
 
        </div>
 
        ${h.end_form()}
 
    </div>
 
    %endif
 
</div>
 

	
 
<script>
 
var change_status_show = function(){
 
    var show = ! YUD.get('show_changeset_status_box').checked;
 
    YUD.get('show_changeset_status_box').checked = show;
 
    YUD.setStyle('status_block_container', 'display', show?'':'none');
 
};
 

	
 
YUE.onDOMReady(function () {
 
   MentionsAutoComplete('text', 'mentions_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
 

	
 
   var set_close_button_state = function(cur_val){
 
     YUD.get('show_changeset_status_box').checked = (cur_val != '');
 
     %if is_pr and change_status:
 
       if (cur_val == 'approved' || cur_val == 'rejected') {
 
           YUD.removeClass('save_close_label', 'disabled');
 
           YUD.get('save_close').disabled = false;
 
       }else{
 
           YUD.addClass('save_close_label', 'disabled');
 
           YUD.get('save_close').disabled = true;
 
           YUD.get('save_close').checked = false;
 
       }
 
     %endif
 
   }
 
   YUE.on(YUQ('.status_change_radio'), 'change',function(e){
 
       var val = e.currentTarget.value;
 
       set_close_button_state(val)
 
       set_close_button_state(val);
 
   })
 
   // if currect checked status is approved or rejected we should unlock the close button
 
   var cur_val = YUQ('.status_change_radio[checked]')[0].value;
 
   set_close_button_state(cur_val)
 

	
 
   YUE.on('preview-btn', 'click', function(e){
 
       var _text = YUD.get('text').value;
 
       if(!_text){
 
           return
 
       }
 
       var post_data = {'text': _text};
 
       YUD.addClass('preview-box', 'unloaded');
 
       YUD.get('preview-box').innerHTML = _TM['Loading ...'];
 
       YUD.setStyle('edit-container', 'display', 'none');
 
       YUD.setStyle('preview-container', 'display', '');
 

	
 
       var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'});
 
       ajaxPOST(url,post_data,function(o){
 
           YUD.get('preview-box').innerHTML = o.responseText;
 
           YUD.removeClass('preview-box', 'unloaded');
 
       })
 
   })
 
   YUE.on('edit-btn', 'click', function(e){
 
       YUD.setStyle('edit-container', 'display', '');
 
       YUD.setStyle('preview-container', 'display', 'none');
 
   })
 

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