Skip to content

Commit

Permalink
WIP: fix pull comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
xtao committed Nov 17, 2014
1 parent 74392e4 commit 3e6e893
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
1 change: 1 addition & 0 deletions vilya/frontend/templates/macros/comments/comment.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% macro render_pull_new_comment(project, pull, current_user) -%}
{% set issue = pull.issue %}
<div class="timeline-comment-wrapper timeline-new-comment js-comment-container ">
<a href="/{{current_user.name}}">
<img alt="{{current_user.name}}" class="timeline-comment-avatar" data-user="{{current_user.id}}" height="48" src="{{current_user.avatar_url}}" width="48">
Expand Down
57 changes: 57 additions & 0 deletions vilya/frontend/templates/macros/comments/pullrequest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% macro render_pullrequest_description(project, pullrequest) -%}
{% set issue = pullrequest.issue %}
<div class="timeline-comment-wrapper js-comment-container">
<a href="/{{issue.creator.name}}">
<img alt="{{issue.creator.name}}" class="timeline-comment-avatar"
data-user="{{issue.creator.id}}" height="48" src="{{issue.creator.avatar_url}}" width="48">
</a>
<div id="issue-40807214" class="comment timeline-comment js-comment js-task-list-container current-user is-task-list-enabled" data-body-version="97c6ff07df2110d5a216983dffba336c">
<div class="timeline-comment-header ">
<div class="timeline-comment-actions">
<a class="octicon octicon-pencil js-comment-edit-button" data-skip-pjax="" href="#" title="edit comment" aria-label="edit comment"></a>
</div>
<div class="timeline-comment-header-text">
<strong>
<a href="/{{issue.creator.name}}" class="author">{{issue.creator.name}}</a>
</strong>
commented
<a href="#issue-40807214" class="timestamp">
<time datetime="2014-08-21t14:01:15z" is="relative-time" title="aug 21, 2014 10:01 pm gmt+08:00">{{issue.updated_at}}</time>
</a>
</div>
</div>
<div class="comment-content">
<p class="comment-form-stale">
the content you are editing has changed. reload the page and try again.
</p>
<div class="edit-comment-hide">
<div class="comment-body markdown-body markdown-format js-comment-body">
{{issue.description}}
</div>
</div>
<div class="context-loader">sending request…</div>
<div class="form-content js-write-bucket js-suggester-container js-uploadable-container js-upload-markdown-image upload-enabled is-default" data-upload-policy-url="/upload/policies/assets">
<form accept-charset="utf-8" action="/{{project.full_name}}/issues/{{issue.number}}"
class="js-comment-update" data-remote="" data-type="json" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="">
<input name="_method" type="hidden" value="put">
<input name="authenticity_token" type="hidden" value="quvwgztylt0esgm9vv/71g0gpgvilf6ahohvxi4tigcnmdoof2gi4e2jhxkuob0hr15jvubu+j//r3w70xjbrw==">
</div>
<textarea class="comment-form-textarea js-comment-field js-quick-submit js-task-list-field js-size-to-fit js-suggester-field" id="issue-40807214-body" name="issue[body]" tabindex="1">
{{issue.description}}
</textarea>
<div class="form-actions">
<button type="submit" class="btn btn-sm btn-primary" tabindex="1" data-disable-with="">update comment</button>
<button type="button" tabindex="1" class="btn btn-sm btn-danger comment-cancel-button js-comment-cancel-button" data-confirm-text="are you sure you want to cancel? you have unsaved changes that will be reverted.">
cancel
</button>
</div>
</form>
</div>
<div class="comment-form-error comment-form-bottom js-comment-update-error"></div>
</div>
</div>
</div>
{%- endmacro %}

7 changes: 4 additions & 3 deletions vilya/frontend/templates/pullrequests/pull.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{% extends "projects/base.html" %}
{% from "macros/diffs/patch.html" import render_patch_file %}
{% from "macros/commits/commit.html" import render_commit_item %}
{% from "macros/comments/comment.html" import render_comment, render_new_pull_comment %}
{% from "macros/comments/comment.html" import render_pull_new_comment %}
{% from "macros/comments/pullrequest.html" import render_pullrequest_description %}

{% block sub_content %}
<div class="panel panel-default">
Expand All @@ -23,7 +24,7 @@
<div class="panel-body">
<p> {{pullrequest.description}} </p>
</div>
{{ render_comment(pullrequest.description, pullrequest.issue.creator, pullrequest.issue.created_at) }}
{{ render_pullrequest_description(project, pullrequest) }}
{{ render_discussion_actions() }}
</div>
</div>
Expand Down Expand Up @@ -130,7 +131,7 @@ <h3 class="merge-branch-heading">Merge attempt failed</h3>
</form>
</div>
</div>
{{ render_new_pull_comment(project, pull, current_user) }}
{{ render_pull_new_comment(project, pullrequest, current_user) }}
</div>
{%- endmacro %}
{% macro render_commits() -%}
Expand Down

0 comments on commit 3e6e893

Please sign in to comment.