diff --git a/rhodecode/templates/changeset/changeset_file_comment.html b/rhodecode/templates/changeset/changeset_file_comment.html --- a/rhodecode/templates/changeset/changeset_file_comment.html +++ b/rhodecode/templates/changeset/changeset_file_comment.html @@ -12,7 +12,7 @@ ${co.author.username}
- ${h.age(co.modified_at)} + ${h.age(co.modified_at)}
%if co.status_change:
@@ -22,7 +22,7 @@
%endif -
+
%if co.pull_request: @@ -35,11 +35,9 @@ %endif
- + %if h.HasPermissionAny('hg.admin', 'repository.admin')() or co.author.user_id == c.rhodecode_user.user_id: -
- ${_('Delete')} -
+
${_('Delete')}
%endif
@@ -56,7 +54,7 @@ %if c.rhodecode_user.username != 'default':
${_('Submitting...')}
${h.form('#', class_='inline-form')} -
+
${_('Commenting on line {1}.')} ${(_('Comments parsed using %s syntax with %s support.') % ( ('RST' % h.url('rst_help')), @@ -64,9 +62,17 @@ ) )|n } +
${_('preview')}
- + +
+
@@ -134,7 +140,7 @@ %if c.rhodecode_user.username != 'default':
${h.form(post_url)} -
+
${(_('Comments parsed using %s syntax with %s support.') % (('RST' % h.url('rst_help')), '@mention' % @@ -143,6 +149,7 @@ | ${_('Change status')} %endif +
${_('preview')}
%if change_status: %endif
- ${h.textarea('text')} + ${h.textarea('text', class_="comment-block-ta")}
+ + +
${h.submit('save', _('Comment'), class_="ui-btn large")} %if close_btn and change_status: @@ -185,6 +201,27 @@ YUE.onDOMReady(function () { YUD.addClass('save_close', 'hidden'); } }) + 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'); + }) });