Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting started #8

Closed
paulsitebuildercorp1 opened this issue Sep 9, 2015 · 6 comments
Closed

Getting started #8

paulsitebuildercorp1 opened this issue Sep 9, 2015 · 6 comments

Comments

@paulsitebuildercorp1
Copy link

I downloaded and installed the package exactly as shown. Used the sample code for a starting point.
On both the demo, and on the start up I have going. It fires a jquery / javascript error when you make a change to the text, and then of course the send button does not un-disable and the script is dead.

The error I get is

TypeError: this.commentsById[commentId] is undefined
var contentChanged = content != this.commentsById[commentId].content;

At line 545. If you look at the source code its looking for an attribute data-comments that does not exist on the textarea or its surrounding wrappers. I found the area in the code that defines the dom of that object. Tried adding it.

I'm a newbie here. I've done a lot of jquery work, and tried to debug this on my own. After a couple of hours I figured I'd better simply ask someone. Either there is something left out of the setup instructions, or I've missed something.

@paulsitebuildercorp1
Copy link
Author

After reviewing one of the closed issues I realized this was supposed to be addressed. The bug is still there in the minified code (different but the same basic problem). Its not finding commentID and throwing errors. Also the use of a double assignment.
var contentChanged = content != this.commentsById[commentId].content; at line 542ish is odd.

@paulsitebuildercorp1
Copy link
Author

I pulled the version from the other branch gh-pages. This version does not throw the error. Although it still is using the double assignment methods which is not recommended. (Netbeans generates a warning here).

@CaiqueJhones
Copy link

@paulsitebuildercorp1
Copy link
Author

I pulled that version and tried it. If I format my data as standard json (being pulled in via the getComments: method via a php url I get an error.

TypeError: commentsArray.map is not a function
var commentModels = commentsArray.map(function(commentsJSON){

The format of the data returned is
{
"id": 1,
"parent": null,
"created": "2015-01-01",
"modified": "2015-01-01",
"content": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed posuere interdum sem. Quisque ligula eros ullamcorper quis, lacinia quis facilisis sed sapien. Mauris varius diam vitae arcu.",
"fullname": "Simon Powell",
"profile_picture_url": "https://app.viima.com/static/media/user_profiles/user-icon.png",
"created_by_admin": false,
"created_by_current_user": false,
"moderation_pending": false,
"upvote_count": 3,
"user_has_upvoted": false
},
{
"id": 2,
"parent": null,
"created": "2015-01-02",
"modified": "2015-01-02",
"content": "Sed posuere interdum sem. Quisque ligula eros ullamcorper quis, lacinia quis facilisis sed sapien. Mauris varius diam vitae arcu.",
"fullname": "Administrator",
"profile_picture_url": "https://app.viima.com/static/media/user_profiles/admin-user-icon.png",
"created_by_admin": true,
"created_by_current_user": false,
"moderation_pending": false,
"upvote_count": 2,
"user_has_upvoted": false
},

Direct copy of the sample data. I also tried converting to an array by enclosing it in [] both with an assignment to the var and not. (var commentsArray = [ etc). So there is some stupid simple thing I'm missing here. Do I need to json encode the return string? Or is there as this indicates a missing or renamed function or method in the script?

Any help here would be appreciated.

@jessenieminen
Copy link
Member

There was indeed a bug with the latest commits, a small change we made in #6 was the reason for this so we reverted the changes made there.

Now it should work again.

@danman1234
Copy link

danman1234 commented May 5, 2017

Really not working and not fixed, i have exactly the same problem

i give the comment back as one singe somment:

echo json_encode(array('upvote_count' => 2, 'created_by_current_user' => true, 'created_by_admin' => false, 'id' => 3 , 'parent' => null, 'created' => '2015-01-03' , 'modified' => '2015-01-03', 'content' => '@Hank Smith sed posuere interdum sem.\nQuisque ligula eros ullamcorper https://www.google.com/ q' , 'fullname' => 'test' , 'profile_picture_url' => 'https://app.viima.com/static/media/user_profiles/user-icon.png'));

How can i return more then 1 comment in one array?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants