mirror of
https://github.com/e107inc/e107.git
synced 2025-07-29 19:00:26 +02:00
Issue #1944 (Partial fix) Comments use unique IDs.
This commit is contained in:
@@ -166,6 +166,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
ajaxOptions.url = $element.attr('data-src');
|
||||
// Set Ajax type to "GET".
|
||||
ajaxOptions.type = 'GET';
|
||||
|
||||
}
|
||||
|
||||
if(ajaxOptions.wait != null)
|
||||
@@ -428,6 +429,7 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
var val = src.match(/from=(\d+)/);
|
||||
var amt = parseInt(val[1]);
|
||||
|
||||
|
||||
var oldVal = 'from=' + amt;
|
||||
var newVal = null;
|
||||
|
||||
@@ -456,6 +458,11 @@ var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
newVal = 'from=' + add;
|
||||
}
|
||||
|
||||
if($(e).attr("data-nav-id"))
|
||||
{
|
||||
navid = '.' + $(e).attr("data-nav-id");
|
||||
}
|
||||
|
||||
if(newVal)
|
||||
{
|
||||
src = src.replace(oldVal, newVal);
|
||||
|
@@ -155,9 +155,13 @@ $(document).ready(function()
|
||||
var sort = $(this).attr("data-sort");
|
||||
var pid = parseInt($(this).attr("data-pid"));
|
||||
var formid = (pid != '0') ? "#e-comment-form-reply" : "#e-comment-form";
|
||||
var data = $('form'+formid).serialize() ;
|
||||
var total = parseInt($("#e-comment-total").text());
|
||||
|
||||
var data = $('form'+formid).serializeArray() ;
|
||||
var total = parseInt($("#e-comment-total").text());
|
||||
var container = '#' + $(this).attr("data-container");
|
||||
var input = '#' + $(this).attr("data-input");
|
||||
|
||||
//TODO replace _POST['comment'] with $(input).val() so we can rename 'comment' in the form to something unique.
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url + '?ajax_used=1&mode=submit',
|
||||
@@ -167,14 +171,8 @@ $(document).ready(function()
|
||||
// alert(data);
|
||||
// console.log(data);
|
||||
var a = $.parseJSON(data);
|
||||
|
||||
$("#comment").val('');
|
||||
|
||||
if($('#comments-container').length){
|
||||
// alert('true');
|
||||
}else{
|
||||
// $("#e-comment-form").parent().prepend("<div id='comments-container'></div>");
|
||||
}
|
||||
|
||||
$(input).val('');
|
||||
|
||||
if(pid != 0)
|
||||
{
|
||||
@@ -182,17 +180,18 @@ $(document).ready(function()
|
||||
}
|
||||
else if(sort == 'desc')
|
||||
{
|
||||
$('#comments-container').prepend(a.html).hide().slideDown(800); // FIXME - works in jquery 1.7, not 1.8
|
||||
$(container).prepend(a.html).hide().slideDown(800); // FIXME - works in jquery 1.7, not 1.8
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#comments-container').append(a.html).hide().slideDown(800); // FIXME - works in jquery 1.7, not 1.8
|
||||
$(container).append(a.html).hide().slideDown(800); // FIXME - works in jquery 1.7, not 1.8
|
||||
alert('Thank you for commenting'); // possibly needed as the submission may go unoticed by the user
|
||||
}
|
||||
|
||||
if(!a.error)
|
||||
{
|
||||
$("#e-comment-total").text(total + 1);
|
||||
|
||||
if(pid != '0')
|
||||
{
|
||||
$(formid).hide();
|
||||
|
Reference in New Issue
Block a user