clipbucket/upload/styles/cb_27/layout/blocks/comments/add_comment.html

156 lines
5 KiB
HTML
Raw Normal View History

2014-09-19 09:58:54 +00:00
{if $userquery->login_check('',true) || $Cbucket->configs.anonym_comments == 'yes'}
2014-09-19 09:58:54 +00:00
<div class="add_comment_box" id="add_comment"> </div>
2014-02-04 13:16:11 +00:00
<div class="">
<div id="comment-add-err"></div>
2014-09-19 09:58:54 +00:00
2014-02-04 13:16:11 +00:00
<form class="" id="comment_form" >
<input type="hidden" name="reply_to" id="reply_to" value="0">
<input type="hidden" name="obj_id" id="obj_id" value="{$id}">
{if !$userquery->login_check('',true) && $Cbucket->configs.anonym_comments == 'yes'}
2014-02-13 11:29:11 +00:00
<div class="form-group">
<label for="comment_name">
{lang code='name'}
</label>
<input type="text" name="name" id="comment_name" class="form-control">
</div>
2014-02-13 11:29:11 +00:00
<div class="form-group">
<label for="comment_email">
{lang code='email_wont_display'}
</label>
<input type="email" name="email" id="comment_email" class="form-control">
</div>
{else}
<strong>{sprintf(lang('Comment as %s'),$userquery->username)}</strong>
{/if}
{ANCHOR place='before_compose_box'}
{if config('comments_captcha')=='all' || ( config('comments_captcha')=='guests' && !$userquery->login_check('',true) )}
2014-02-13 11:29:11 +00:00
<div class="form-group">
{assign var=captcha value=get_captcha()}
{if $captcha}
{if $captcha.show_field}
<label class="label" for="captcha">Verification Code</label>
{load_captcha captcha=$captcha load=field field_params = ' id="captcha" class="input" '}
{/if}
{load_captcha captcha=$captcha load=function}
{/if}
</div>
{/if}
2014-02-04 13:16:11 +00:00
<div class="form-group">
{if !$userquery->login_check('',true) && $Cbucket->configs.anonym_comments == 'yes'}
<label for="comment_text">
{lang code='Your comment'}
</label>
2014-09-19 09:58:54 +00:00
{/if}
<textarea name="comment" id="comment_text" class="form-control clearfix comment_text_new"></textarea>
2014-09-19 09:58:54 +00:00
<div id="reply_to_img"><i class="glyphicon glyphicon-share-alt" style="color:#428BCA;"></i></div>
2014-02-04 13:16:11 +00:00
</div>
<div class="form-group clearfix">
<button data-loading-text="Loading..." type="button" class="hidden-xs hidden-sm btn btn-primary pull-right" id="addCommentButton">{lang('Comment')}</button>
</div>
<script>
2014-09-19 09:58:54 +00:00
function blink(selector){
$(selector).fadeOut('slow', function(){
$(this).fadeIn('slow', function(){
blink(this);
});
});
}
var ajaxPage = baseurl+'/ajax.php';
$('#addCommentButton').on('click',function(e){
e.preventDefault();
var btn =$(this);
btn.button('loading');
$('#comment-add-err').hide();
var data = $(this).parents("form").serialize() + "&type={$type}&mode=add_comment";
$.ajax({
url: ajaxPage,
type: "post",
data: data,
dataType : 'json',
}).success(function(response){
//var response = $.parseJSON(response);
var cid = parseInt(response.cid);
if(cid > 1){
$.ajax({
url: ajaxPage,
type: "post",
data: {
mode: "get_comment",
cid: cid
},
}).success(function(comment){
$("#comment_text").val('');
//comments = $("#userCommentsList").html();
$("#userCommentsList").prepend(comment);
});
}else{
if(response.msg){
$('#comment-add-err').show().html(response.msg);
}
else if(response.err)
{
$('#comment-add-err').show().html(response.err);
}
}
btn.button('reset');
});
});
</script>
2014-09-23 13:47:24 +00:00
<div class="hidden-lg hidden-md mbxl">
2014-02-04 13:16:11 +00:00
<button type="submit" class="btn btn-primary" onclick="add_comment_js('comment_form','{$type}'){ANCHOR place='onClickAddComment'}">{lang('Comment')}</button>
</div>
</form>
2014-09-19 09:58:54 +00:00
<div id="add_comment_result" class="add_comment_result mtm mbm" style="display:none"></div>
{else}
{lang code='please_login_to_comment'}
{/if}
</div>
2014-09-19 09:58:54 +00:00
<style>
#reply_to_img{
position:absolute;
margin-left:686px;
margin-top:-65px;
display:none;
}
</style>