{{define "comment"}}
<div class="sep10"></div>
<div class="box_white page-comment">
	<input type="hidden" name="me-uid" value="{{.me.Uid}}"/>
	<div class="cell">添加一条新回复
	{{if not .me.Uid}}
	<span class="h2-tip">
	（您需要 <a class="c-log" href="javascript:openPop('#login-pop');">登录</a> 后才能回复 <a href="/user/register" class="c-reg"> 没有账号</a> ？）</span>
	{{end}}
	</div>
	<div class="cell">
		<div class="row clearfix md-toolbar">
			<ul class="col-md-10 list-inline comment-tab-menu" data-comment-group="default">
				<li class="comment-edit-tab cur"><a href="#" class="op">编辑</a></li>
				<li class="comment-preview-tab"><a href="#" class="op">预览</a></li>
				<li>
					<div class="nav reply-to dn" data-floor="" data-username="">
						<i class="fa fa-mail-reply" title=""></i>
						<a href="#reply" class="user" title=""></a>
						<a href="#" class="close"><i class="fa fa-close"></i></a>
					</div>
				</li>
			</ul>
			<div class="col-md-2 text-right">
				<i id="upload-img" class="glyphicon glyphicon-picture upload-img tool-tip" data-toggle="tooltip" data-placement="top" title="上传图片"></i>
			</div>
		</div>
		<div class="submit" id="commentForm">
			<div class="comment-content-text" data-comment-group="default">
				<textarea id="comment-content" name="content" class="comment-textarea main-textarea need-autogrow" rows="8"></textarea>
			</div>
			<div class="comment-content-preview cell" data-comment-group="default"></div>
			<div class="sub row">
				<ul class="help-block col-md-10">
					<li>请尽量让自己的回复能够对别人有帮助</li>
					<li class="markdown_tip">支持 Markdown 格式, <strong>**粗体**</strong>、~~删除线~~、<code>`单行代码`</code></li>
					<li>支持 @ 本站用户；支持表情（输入 : 提示），见 <a href="http://www.emoji-cheat-sheet.com/" target="_blank">Emoji cheat sheet</a></li>
					<li>图片支持拖拽、截图粘贴等方式上传</li>
				</ul>
				<div class="col-md-2 text-right"><button id="comment-submit" type="submit" title="提交" class="btn btn-default">提交</button></div>
			</div>
		</div>
	</div>
</div>

<script type="text/x-jsrender" id="one-comment">
<div class="reply [%if is_new%]light[%/if%]" id="reply-[%:comment.floor%]">
	<div data-floor="[%:comment.floor%]">
		<div class="avatar"><a title="[%:user.username%]" href="/user/[%:user.username%]"><img class="media-object avatar-48" src="[%:user.avatar%]" alt="[%:user.username%]"></a></div>
			<div class="infos">
				<div class="info">
					<span class="name">
						<a class="user-name" data-name="[%:user.name%]" href="/user/[%:user.username%]">[%:user.username%]</a>
					</span> ·
					<span class="floor">#[%:comment.floor%]</span> ·
					<abbr class="timeago" title="[%:comment.ctime%]">[%:comment.cmt_time%]</abbr>
					<span class="opts pull-right">
						<span class="op-reply hideable">
							[%if me.uid == user.uid %]
								<a data-floor="[%:comment.floor%]" title="编辑" class="btn-edit glyphicon glyphicon-edit"></a>
							[%/if%]
						  <a data-floor="[%:comment.floor%]" data-username="[%:user.username%]" title="回复此楼" class="btn-reply fa fa-mail-reply" href="#"></a>
						</span>
						<!-- <a title="赞" data-count="0" data-state="" data-type="Reply" data-id="323365" class="likeable " href="#"><i class="fa fa-heart"></i> <span></span></a> -->
					</span>
				</div>
				[%if comment.reply_floor > 0%]
				<div class="reply-to-block">
					<div class="info reply_user">
						对
						<a data-remote="true" href="/user/[%:comment.reply_user.username%]">
							<img class="media-object avatar-16" src="[%:comment.reply_user.avatar%]" alt="[%:comment.reply_user.username%]"><span class="user-name">[%:comment.reply_user.username%]</span>
						</a>
						<a href="#reply-[%:comment.reply_floor%]"><span class="reply-floor">#[%:comment.reply_floor%]</span></a> 回复
					</div>
					<div class="markdown dn">
						<p>[%:comment.reply_content%]</p>
					</div>
				</div>
				[%/if%]

			<div class="markdown" data-floor="[%:comment.floor%]">
				<div class="content">[%:comment.content%]</div>
				<div class="edit-wrapper">
					<div class="row clearfix md-toolbar">
						<ul class="col-md-10 list-inline comment-tab-menu" data-comment-group="[%:comment.floor%]">
								<li class="comment-edit-tab cur"><a href="#" class="op">编辑</a></li>
								<li class="comment-preview-tab"><a href="#" class="op">预览</a></li>
						</ul>
						<div class="col-md-2 text-right">
							<i data-floor="[%:comment.floor%]" class="glyphicon glyphicon-picture upload-img tool-tip" data-toggle="tooltip" data-placement="top" title="上传图片"></i>
						</div>
					</div>
					<div class="comment-content-text" data-comment-group="[%:comment.floor%]">
						<textarea data-raw-content="[%:comment.rawContent%]" name="content" class="comment-textarea" rows="8" style="width: 100%;">[%:comment.rawContent%]</textarea>
					</div>
					<div class="comment-content-preview cell" data-comment-group="[%:comment.floor%]"></div>
					<div class="text-right">
						<button type="submit" title="提交" data-cid="[%:comment.cid%]" data-floor="[%:comment.floor%]" class="submit btn btn-default">提交</button>
						<button title="取消" data-floor="[%:comment.floor%]" class="cancel btn btn-default">取消</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</script>
{{end}}
