# HG changeset patch # User Mads Kiilerich # Date 1453250831 -3600 # Node ID 872d05f3d7cc46b9743fc17ec4a38db9f88d0c4a # Parent 4a91848040891e276cb336351a14497dd612edc3 comments: drop preview - no need for it without RST diff -r 4a9184804089 -r 872d05f3d7cc kallithea/config/routing.py --- a/kallithea/config/routing.py Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/config/routing.py Wed Jan 20 01:47:11 2016 +0100 @@ -653,11 +653,6 @@ controller='changeset', revision='tip', action='comment', conditions=dict(function=check_repo)) - rmap.connect('changeset_comment_preview', - '/{repo_name:.*?}/changeset-comment-preview', - controller='changeset', action='preview_comment', - conditions=dict(function=check_repo, method=["POST"])) - rmap.connect('changeset_comment_delete', '/{repo_name:.*?}/changeset-comment-delete/{comment_id}', controller='changeset', action='delete_comment', diff -r 4a9184804089 -r 872d05f3d7cc kallithea/controllers/changeset.py --- a/kallithea/controllers/changeset.py Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/controllers/changeset.py Wed Jan 20 01:47:11 2016 +0100 @@ -407,18 +407,6 @@ @NotAnonymous() @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', 'repository.admin') - def preview_comment(self): - if not request.environ.get('HTTP_X_PARTIAL_XHR'): - raise HTTPBadRequest() - text = request.POST.get('text') - if text: - return h.render_w_mentions(text) - return '' - - @LoginRequired() - @NotAnonymous() - @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', - 'repository.admin') @jsonify def delete_comment(self, repo_name, comment_id): co = ChangesetComment.get(comment_id) diff -r 4a9184804089 -r 872d05f3d7cc kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/lib/helpers.py Wed Jan 20 01:47:11 2016 +0100 @@ -1383,21 +1383,6 @@ return newtext -def rst(source): - return literal('
%s
' % - MarkupRenderer.rst(source)) - - -def rst_w_mentions(source): - """ - Wrapped rst renderer with @mention highlighting - - :param source: - """ - return literal('
%s
' % - MarkupRenderer.rst_with_mentions(source)) - - def _mentions_replace(match_obj): return '@%s' % match_obj.group(1) diff -r 4a9184804089 -r 872d05f3d7cc kallithea/public/css/style.css --- a/kallithea/public/css/style.css Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/public/css/style.css Wed Jan 20 01:47:11 2016 +0100 @@ -4188,19 +4188,6 @@ padding: 5px 5px 5px 5px; color: #666; } -.comment-form .comment-help .preview-btn, -.comment-form .comment-help .edit-btn { - float: right; - margin: -6px 0px 0px 0px; -} - -.comment-form .preview-box.unloaded, -.comment-inline-form .preview-box.unloaded { - height: 50px; - text-align: center; - padding: 20px; - background-color: #fafafa; -} .comment-form .comment-button { padding-top: 5px; @@ -4217,7 +4204,6 @@ margin: -1px 0px 0px 0px; } - .show-inline-comments { position: relative; top: 1px @@ -4277,12 +4263,6 @@ color: #666; } -.comment-inline-form .comment-help .preview-btn, -.comment-inline-form .comment-help .edit-btn { - float: right; - margin: -6px 0px 0px 0px; -} - .comment-inline-form .comment-button { padding-top: 5px; } diff -r 4a9184804089 -r 872d05f3d7cc kallithea/public/js/base.js --- a/kallithea/public/js/base.js Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/public/js/base.js Wed Jan 20 01:47:11 2016 +0100 @@ -711,32 +711,6 @@ ajaxPOST(AJAX_COMMENT_URL, postData, success); }); - $('#preview-btn_'+line_no).click(function(e){ - var text = $('#text_'+line_no).val(); - if(!text){ - return - } - $('#preview-box_'+line_no).addClass('unloaded'); - $('#preview-box_'+line_no).html(_TM['Loading ...']); - $('#edit-container_'+line_no).hide(); - $('#edit-btn_'+line_no).show(); - $('#preview-container_'+line_no).show(); - $('#preview-btn_'+line_no).hide(); - - var url = pyroutes.url('changeset_comment_preview', {'repo_name': REPO_NAME}); - var post_data = {'text': text}; - ajaxPOST(url, post_data, function(html) { - $('#preview-box_'+line_no).html(html); - $('#preview-box_'+line_no).removeClass('unloaded'); - }) - }) - $('#edit-btn_'+line_no).click(function(e) { - $('#edit-container_'+line_no).show(); - $('#edit-btn_'+line_no).hide(); - $('#preview-container_'+line_no).hide(); - $('#preview-btn_'+line_no).show(); - }) - // create event for hide button $form.find('.hide-inline-form').click(function(e) { comment_div_state($comment_div, f_path, line_no, false); diff -r 4a9184804089 -r 872d05f3d7cc kallithea/templates/base/root.html --- a/kallithea/templates/base/root.html Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/templates/base/root.html Wed Jan 20 01:47:11 2016 +0100 @@ -97,7 +97,6 @@ pyroutes.register('toggle_following', "${h.url('toggle_following')}"); pyroutes.register('changeset_info', "${h.url('changeset_info', repo_name='%(repo_name)s', revision='%(revision)s')}", ['repo_name', 'revision']); pyroutes.register('repo_size', "${h.url('repo_size', repo_name='%(repo_name)s')}", ['repo_name']); - pyroutes.register('changeset_comment_preview', "${h.url('changeset_comment_preview', repo_name='%(repo_name)s')}", ['repo_name']); pyroutes.register('repo_refs_data', "${h.url('repo_refs_data', repo_name='%(repo_name)s')}", ['repo_name']); }); diff -r 4a9184804089 -r 872d05f3d7cc kallithea/templates/changeset/changeset_file_comment.html --- a/kallithea/templates/changeset/changeset_file_comment.html Fri Jul 04 14:12:07 2014 +0200 +++ b/kallithea/templates/changeset/changeset_file_comment.html Wed Jan 20 01:47:11 2016 +0100 @@ -55,27 +55,19 @@
%if c.authuser.username != 'default': ${h.form('#', class_='inline-form')} -
+
${_('Commenting on line {1}.')} ${_('Comments are in plain text. Use @username inside this text to notify another user.')|n}
-
${_('Submitting ...')}
${h.submit('save', _('Comment'), class_='btn btn-small save-inline-form')} ${h.reset('hide-inline-form', _('Cancel'), class_='btn btn-small hide-inline-form')} -
${_('Preview')}
-
${h.end_form()} %else: @@ -172,17 +164,8 @@ %endif
- -
${h.submit('save', _('Comment'), class_="btn")} -
${_('Preview')}
-
${h.end_form()}
@@ -211,32 +194,6 @@ } }); - $('#preview-btn').click(function(){ - var _text = $('#text').val(); - if(!_text){ - return; - } - var post_data = {'text': _text}; - $('#preview-box').addClass('unloaded'); - $('#preview-box').html(_TM['Loading ...']); - $('#edit-container').hide(); - $('#edit-btn').show(); - $('#preview-container').show(); - $('#preview-btn').hide(); - - var url = pyroutes.url('changeset_comment_preview', {'repo_name': '${c.repo_name}'}); - ajaxPOST(url,post_data,function(html){ - $('#preview-box').html(html); - $('#preview-box').removeClass('unloaded'); - }); - }); - $('#edit-btn').click(function(){ - $('#edit-container').show(); - $('#edit-btn').hide(); - $('#preview-container').hide(); - $('#preview-btn').show(); - }); - });