Skip to content
Snippets Groups Projects
Commit 3716b053 authored by Chris Hallberg's avatar Chris Hallberg
Browse files

Fix usercomments to require login before posting comments. Avoids/Fixes a...

Fix usercomments to require login before posting comments. Avoids/Fixes a nasty Lightbox redirect bug.
parent 063ab206
No related merge requests found
......@@ -114,28 +114,12 @@ function registerAjaxCommentRecord() {
if (response.status == 'OK') {
refreshCommentList(id, recordSource);
$(form).find('textarea[name="comment"]').val('');
} else if (response.status == 'NEED_AUTH') {
Lightbox.addCloseAction(function() {
$.ajax({
type: 'POST',
url: url,
data: data,
dataType: 'json',
success:function() {
refreshCommentList(id, recordSource);
$(form).find('textarea[name="comment"]').val('');
}
});
});
return Lightbox.get('Record', 'AddComment', data, data);
$(form).find('input[type="submit"]').button('loading');
} else {
$('#modal').find('.modal-body').html(response.data+'!');
$('#modal').find('.modal-header h3').html('Error!');
$('#modal').modal('show');
Lightbox.displayError(response.data);
}
}
});
$(form).find('input[type="submit"]').button('loading');
return false;
});
// Delete links
......
......@@ -13,7 +13,13 @@
<strong><?=$this->transEsc("Your Comment")?></strong>
</div>
<div class="col-sm-9">
<textarea id="comment" name="comment" class="form-control" rows="3" required></textarea><br/>
<input class="btn btn-primary" data-loading-text="<?=$this->transEsc('Submitting') ?>..." type="submit" value="<?=$this->transEsc("Add your comment")?>"/>
<? $user = $this->auth()->isLoggedIn() ?>
<? if($user): ?>
<textarea id="comment" name="comment" class="form-control" rows="3" required></textarea><br/>
<input class="btn btn-primary" data-loading-text="<?=$this->transEsc('Submitting') ?>..." type="submit" value="<?=$this->transEsc("Add your comment")?>"/>
<? else: ?>
<textarea id="comment" name="comment" class="form-control" rows="3" disabled></textarea><br/>
<input class="btn btn-primary" type="submit" value="<?=$this->transEsc("You must be logged in first")?>" disabled/>
<? endif; ?>
</div>
</form>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment