Giter Club home page Giter Club logo

Comments (50)

michelhabib avatar michelhabib commented on June 15, 2024

Phong, is the tree parameter in pw_get_comments working? i am only getting flat set of comments currently without children.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Yes it is currently working. I will find a good example of a post with hierarchical comments and an input / output for that...

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Try post_id : 166220 -- this has lots of comments and several which are hierarchical.
I'm testing locally now.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Perhaps if you try this:

echo json_encode(pw_get_comments(array("post_id"=>166220)));

You will see that some posts contain an object called 'children' which contains an array of child posts. This goes on recursively to however many levels deep the comments go.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

i was trying post 40519, which i know it has many comments, but i only get the first level.
i tried 166220, same thing.
i am trying to trace it in php, it gets way too many comments, but when the tree is created, it seem to return first level only. i already set the tree parameter to true.
i will give it more troubleshooting, maybe i can find something..

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

this is my code

    $query = array(
            'post_id' => 166220,            
        );
    $results = pw_get_comments ($query,'all',true);

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

i also noticed something strange, and i asked Ashraf to look into it, that comment_parent is usually a small number, that doesnt seem like a real comment_id, and mostly it is a number between 1 and 10, which would make it almost impossible to find a parent for any of these 5 digit comment_ids. would it be a script thing? maybe i should get a fresh copy of the migrated database from you?

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Oh yes I know this issue - we fixed it a while ago.
You need to run the most recent migration script on it. We fixed this at least a week ago, whereby the comment parent IDs weren't migrating, although Ashraf has already fixed this. The most recent migration script needs to be run.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

confirmed and fixed.
one more thing, user ids in wp_comments are not migrated, since they do not have associated roles.
I discovered these as they were throwing warnings when getting comments. i will log that separately, but this is just a heads up, i guess it would need to revisit our migration script logic.
this is not stopping me anyway, low priority for my work, but not sure of its priority in the db migration.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

The user_id field in my wp_comments table has been migrated. When you ran
the most recent migration script, did it not migrate the user_id?

On Wed, Oct 23, 2013 at 11:31 AM, michelhabib [email protected]:

confirmed and fixed.
one more thing, user ids in wp_comments are not migrated, since they do
not have associated roles.
I discovered these as they were throwing warnings when getting comments. i
will log that separately, but this is just a heads up, i guess it would
need to revisit our migration script logic.
this is not stopping me anyway, low priority for my work, but not sure of
its priority in the db migration.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-26931510
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

I guess i described it wrong. Yes, The user ids are migrated in wp comments and yes, i ran the most recent script.
The problem is that there are user ids in wp comments that do not have records in wp users, and the reason is that they do not have any roles associated to them. I will send you an example when i am on a computer.

Best Regards,
Michel.

On Oct 23, 2013, at 11:51 PM, phong [email protected] wrote:

The user_id field in my wp_comments table has been migrated. When you ran
the most recent migration script, did it not migrate the user_id?

On Wed, Oct 23, 2013 at 11:31 AM, michelhabib [email protected]:

confirmed and fixed.
one more thing, user ids in wp_comments are not migrated, since they do
not have associated roles.
I discovered these as they were throwing warnings when getting comments. i
will log that separately, but this is just a heads up, i guess it would
need to revisit our migration script logic.
this is not stopping me anyway, low priority for my work, but not sure of
its priority in the db migration.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-26931510
.


Reply to this email directly or view it on GitHub.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

ok thanks...

On Wed, Oct 23, 2013 at 3:15 PM, michelhabib [email protected]:

I guess i described it wrong. Yes, The user ids are migrated in wp
comments and yes, i ran the most recent script.
The problem is that there are user ids in wp comments that do not have
records in wp users, and the reason is that they do not have any roles
associated to them. I will send you an example when i am on a computer.

Best Regards,
Michel.

On Oct 23, 2013, at 11:51 PM, phong [email protected] wrote:

The user_id field in my wp_comments table has been migrated. When you
ran
the most recent migration script, did it not migrate the user_id?

On Wed, Oct 23, 2013 at 11:31 AM, michelhabib [email protected]:

confirmed and fixed.
one more thing, user ids in wp_comments are not migrated, since they
do
not have associated roles.
I discovered these as they were throwing warnings when getting
comments. i
will log that separately, but this is just a heads up, i guess it
would
need to revisit our migration script logic.
this is not stopping me anyway, low priority for my work, but not sure
of
its priority in the db migration.


Reply to this email directly or view it on GitHub<
https://github.com/phongmedia/postworld/issues/41#issuecomment-26931510>
.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-26950922
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

user id 21314 appears in wp comments, however it doesn't appear in wp users.
if you check back in drupal, user 21314 exists, however it is not tied to any role, hence not migrated.
Can you please check this one and let us know if that scenario is acceptable?
no rush from my side anyways.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Interesting, I will look into that.
That's a very good observation, I'm glad you noticed that. I will look into
that as far as data migration is concerned.

On Wed, Oct 23, 2013 at 4:34 PM, michelhabib [email protected]:

user id 21314 appears in wp comments, however it doesn't appear in wp
users.
if you check back in drupal, user 21314 exists, however it is not tied to
any role, hence not migrated.
Can you please check this one and let us know if that scenario is
acceptable?
no rush from my side anyways.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-26955445
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

Phong, if i should use edit-field with comment editing and sorting, is it ready for such use? and would you recommend using it in this case, or use regular fields for this special case?

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Hi Michel
I have archived and disabled the edit-field directive, as I found the
built-in Angular directives and controllers to be sufficient. You can use
ng-options for dropdown select items, and regular fields with ng-model.

On Thursday, October 24, 2013, michelhabib wrote:

Phong, if i should use edit-field with comment editing and sorting, is it
ready for such use? and would you recommend using it in this case, or use
regular fields for this special case?


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-26995462
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

oh that's ok, i am about to finish and publish most of the load-comments component.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

the wordpress comments do not have the option to flag a comment by a regular user, as far as i understand. i see the flagging option in your mockup above, is that something in scope?

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

you're right, comment flagging isn't in scope. Although the ability to
delete a comment should be.

On Thu, Oct 24, 2013 at 2:53 PM, michelhabib [email protected]:

the wordpress comments do not have the option to flag a comment by a
regular user, as far as i understand. i see the flagging option in your
mockup above, is that something in scope?


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-27034543
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

Phong, now load-comments directive is ready and committed into github.
Here are my comments inline in the js file, showing what is completed and the leftovers/questions that i am finalizing now. i am expecting that you will work on the UI, but at the same time i made an effort to make it look as clean as possible - there is still some ui work to be done that i listed below.

/*
 * Tasks
 * Get Comments Service [OK]
 * Create Recursive Comment Structure [OK]
 *  - with Maximimze/minimize [OK] 
 *  - +/- Karma Points [OK - just add ajax Functions]
 * Create Comment Tempalte [OK]
 * Add Comment/Reply [OK]
 * Edit Comment [OK]
 * Delete Comment [OK]
 * Toggle Reply/Delete/Edit [OK]
 * Flag comment [Doesn't exist]
 * Remove ngAnimate to enhance performance! [OK]
 * Bind HTML/Sanitize Content/Format Content [OK]
 * NOTE: Karma points are always zero, even if updated in the wp_comments table, it seems they need to be updated somewhere else
 *  - Maximize/Minimize based on Points [OK] = Note that we are currently using a random function to generate points - for testing purposes
 * performance Tuning of initial loading time [OK] [using chrome timeline - less than 1 second to render - after loading data from server]
 * Create a Comment on the Top Level [OK]
 * OrderBy is moved to query field and underscore is removed, just to match the arguments format of the get_comments function
 * Sort Options and refresh based on sorting [OK]
 * Show as Tree or linear [OK]
 * Show Loading Icon while loading data [OK]
 * Permissions, you can only edit and delete your own comments [OK]
 * 
 *  - show control bar on hover only
 *  - show icons for control bar
 *  - highlight selected function of the control bar [reply, edit, delete, etc...]
 *  
 *  - Show More [in progress]
 * add Timezone to date
 * encapsulate in a simple directive
 * 
 * when adding new comments they should be open by default?
 * Can we use the html returned directly?

 * Cleanup UI
 * Refactor a bit
 * Cleanup CSS
 * Animation? Performance Limitations
 * If we can show the comments with tree=false, what happens when users reply? it will become a tree? no?
*/

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

Here are some screenshots, illustrating the different functions, loading, viewing nested comments, edit comment, delete comment, reply to comment

loading
nestedcomments
editcomment
delete
reply

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Great, that looks good. I'll have a look at it today.

On Sat, Oct 26, 2013 at 6:37 AM, michelhabib [email protected]:

Here are some screenshots, illustrating the different functions, loading,
viewing nested comments, edit comment, delete comment, reply to comment

[image: loading]https://f.cloud.github.com/assets/296637/1413638/9fb33462-3e43-11e3-9625-b03029e3d4e8.jpg
[image: nestedcomments]https://f.cloud.github.com/assets/296637/1413637/9fae93f8-3e43-11e3-9113-605f9931e964.jpg
[image: editcomment]https://f.cloud.github.com/assets/296637/1413634/9ee8d55a-3e43-11e3-983f-ae911b6a2446.jpg
[image: delete]https://f.cloud.github.com/assets/296637/1413635/9f683098-3e43-11e3-8577-ff25b5612dbb.jpg
[image: reply]https://f.cloud.github.com/assets/296637/1413636/9fa63cf8-3e43-11e3-9a40-04323f187331.jpg


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-27146386
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

thanks, i made a bit of refactoring and cleaning, and hiding part of long comments [show more], the css is a bit messy. just let me know where to stop. i am just investigating a small issue related to the comment date and user timezone, they are not quire aligned.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

ok good idea ---
I have found working with dates, to stick with reading and writing _date_gmt, and then convert to the user display, and the back to GMT/UTC when writing to the DB. This way it doesn't matter if they've set their Wordpress timezone settings, it will use the offset of their current computer.

This is helpful:
http://docs.angularjs.org/api/ng.filter:date

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

i am using the same way that wordpress is writing it to the database and that is exactly as you suggested, thanks for the tip.
my problem was related to the AngularJS interpretation, it does not use the standard date format, which adds a Z to indicate that the date needs to be converted to local time. so , i just added the Z and it works now. the reason i could reproduce the issue is that i am using a server with a different timezone settings that the client.
as for the date filters, i am using a custom filter called TimeAgo, which gives the relative time, and it looks good so far.

Thanks

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Yes understood - the date often ends up taking longer than I expect, due to the various object formatting and time zone conversion.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

By first testing, the load-comments system appears to be working very effectively. It's by far the most sophisticated rendering of comments I've seen done for Wordpress before. Good thing the system is open source.

I have a question - you may tell me if it's very easy to implement or outside of our current budget scope.
What would it take to make a polling function with the following parameters?

load-comments [ directive ]

  live_poll: 60,  // in seconds
  live_poll_while_writing: false,  // boolean

live_poll : integer

  • Default : 0 (No Polling)
  • Updates the comment feed on time set in the directive setting
  • Integer defines the number of seconds between polls

live_poll_while_writing : boolean

  • Default : false (no polling while writing a comment)
  • Whether to poll while user is currently editing a comment (which might disturb the commenting process)

Usage

load_comments['post_single'] = {

   // LIVE POLL PARAMETERS //
   live_poll: 60,
   live_poll_while_writing: false,

    query : {
        post_id : 133925, // 21853, // 133925, // 166220, // 21853, // 166220,
        status: 'approve',
        orderby : 'comment_date',
        },
    fields : 'all',
    tree : true,
    order_options : {
        'comment_points' : 'Points',
        'comment_date' : 'Date'
        },
    min_points : 0,
};

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

I can give it a try. The way it is designed, it might make this implementation fairly simple.
The way i understand it is that every x seconds, the client will ping the server with the same get_comments function, retrieve all the results again, extract the difference and update its tree structure. unless you have a magical function that will return to the client all the adds, edits and deletes during the past period.

Theoritically, to do this, i need to:-

  • run a timer to get results again [easy]
  • walk the old comments tree to find deleted comments [moderate] and remove them [easy]
  • walk the new comments tree to find new comments/edits [moderate] and add/update them [moderate]
  • re-render the elements [this might be the tricky part, from performance perspective, not from implementation perspective]
    Let me know if the above is what you have in mind and i can make a simple trial.

about live poll while writing, do you mean preventing the poll when the user is writing a comment?

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

and Thanks, it is all your idea, i just hope my implementation is close enough :)

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

Just a note here, AngularJS gets slower as we add new comments.
I ran my test with the largest amount of comments available on the old site, that is 250 comments in a tree with 150 comments on the first level. and i guess the loading time is not that bad.
However, if you do thousands of comments, this approach might not be the best. it would be crazy to have thousands of dynamic elements, because of all the checks that Angular needs to run.

Let me know if that would be a concern, as it is the only limitation i can find so far with our design.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

I can understand about the possible performance issues with polling. The approach you suggested is good, by walking the comments tree twice, once to remove and once to add new comments, then re-render seamlessly.

You can give that a test and see how it goes. If it becomes overly complex or very slow on performance, then we can remove it from current scope.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

Ok then.
If i understand correctly, i will just give it lower priority than the rest of the remaining directives, i think we're very close - at least from my perspective here.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Yes, that polling can be lower priority.
As you said that, I just noticed that GitHub did a polling an updated our comments in real-time, which was interesting. I was also writing a post while that happened and my post writing was not interrupted, so perhaps there would be no need to prevent polling while writing a comment.

I have 2 other questions which you may be able to help with.

Question 1

I tried a number of things, and wasn't able to get it to work - it seems like it would be straightforward.

So I'm using load-comments inside another template, where I have the ID of the post in scope as post.ID.

So I want to load the directive into this template, referencing the post.ID like this:

load_comments['post_single'] = {
    query : {
        post_id : post.ID, // This doesn't seem to work. Any ideas?
        status: 'approve',
     orderby : 'comment_date',
        },
    min_points : 20,
};

Question 2

The parameter min_points : 20 doesn't seem to be working. I'd expect it would only have posts 'expanded' which have minimum of 20 karma points. This could also help improve performance and usability, since the user would have to 'dig' if they want to keep reading down a thread, so we would only have to render the header of the comment, and not the comment body.

Was this min_points parameter implemented yet, or am I missing something?

I'm generally quite happy with how load-comments is working. Bravo.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

Thanks Phong,
I will get back to polling comments when i start with my trial, the test will help reveal more about the usability.

for Question 1, let me help troubleshoot it, if you replace post.ID with a number does it work?
if no, then it is something with the template, it should be compared against the running environment in postworld-theme.
if yes, then when exactly do you set post.ID value? is it before load_comments['post_single'] is defined or after?
if before, then try to console.log('check',load_comments['post_single'].query.post_id)
if after, this is not possible, the array must be fully defined before calling the directive. At least we have to think of how this should be addressed, not a big deal though.

for Question 2,
Re-reading this, i guess i might have misinterpreted the requirement.
The way i implemented it, is,

  • i receive all comments from wordpress,
  • i render all comments,
  • i minimize the comments that have less than min_points [as if you clicked the minimize button on the left of the comment],
  • and it will minimize the content of this comment [but will leave the author, points, date] and all of the comments below it [regardless of their points]
    i added the following line to line 150 of loadComments.js, to help me simulate points, but you may comment it if you have real data.
    child.karmaPoints = child.comment_karma = Math.floor(Math.random() * 100) + 1;

i was thinking that you want the user to have all comments but have important ones only visible, the invisible ones can be seen if the selects to do so.

now, i guess you mean that you need

  • The comments to be all received [min_points doesn't affect the wordpress query as far as i understand]
  • Render all comments on the first level
  • For first level comments that have less than min_points, they will only have the header rendered with an expand button [the regular + button]
  • upon pushing + [maximizing], the rest of the comment hierarchy will be grabbed and rendered [grabbed from the object tree, not from the database]

Sorry i am getting into tiny details, but that will help me better understand the requirements. and sorry if there is a misunderstanding here, i am sure i can cover it up quickly with the current design.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Question 1 : Loading post.ID into load_comments[]

  • Yes, if I put a number there it works and loads comments fine. Works well.
  • When I do console.log, it gives a JS error : ReferenceError: post is not defined
  • Though when I put a number there, the console log returns the post ID fine.
  • The issue here is how to reference a scope model in local <script>

Question 2

Yes you understand exactly what is implied in the min_points parameter.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

To clarify Question 1 : I can print out post.ID and it works in HTML. Like {{post.ID}} since that post object is present with ID as a value. What I'm trying to do is essentially this :

load_comments['post_single'] = {
    query : {
        post_id : {{post.ID}}, // << How to get the literal value of post.ID
        status: 'approve',
     orderby : 'comment_date',
        },
    min_points : 20,
};

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

If there's no obvious solution to #1 then I'll try and setup an environment where you can see what's happening.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

if you can setup some environment that would be good, i think the mystery here is all about when/where is post.ID defined?

but i guess i know what the problem is, i think it is all about the order of execution - it's the major thing i keep learning about in angular. so here is my thought about it.
first the browser reads your html page and runs the script that defines the array, even before it gets to the controller that defines post.ID, and then it saves the load_commets array with empty value.
then at the point where you define post.ID, whether it is in a controller or anywhere else, it is not linked in any way to load_comments array.
if that is really the problem, the solution is easy, it's one of 2 things.
either you modify load_comments array in the same area that defines post.ID
or we can set a dynamic field in the load-comments directive like this:

<div load-comments="post_single" post-id={{post.ID}}></div>

this is not implemented yet, but can be easily added, it could be only a couple of lines of code. and it will override whatever post_id is defined in load-comments.
however, you still need to make sure that post.ID is defined before load-comments is executed,
let me know if that solution maybe feasible, i can send you a quick update to use it.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

and for Q2, when you say i understand it exactly, you mean the way i implemented it or the way i described it now in the second paragraph?

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Question 1

Yes, that may help to implement that attribute into load-comments. I'll try and illustrate the context first.

Question 2

Now that I re-read your paragraphs on question 2, I can't tell a difference between the methods. They both seem correct, and the same.

Both of these seem like the same solution, and both seem correct:

for Question 2,
Re-reading this, i guess i might have misinterpreted the requirement.
The way i implemented it, is,

i receive all comments from wordpress,
i render all comments,
i minimize the comments that have less than min_points [as if you clicked the minimize button on the left of the comment],
and it will minimize the content of this comment [but will leave the author, points, date] and all of the comments below it [regardless of their points] i added the following line to line 150 of loadComments.js, to help me simulate points, but you may comment it if you have real data. js child.karmaPoints = child.comment_karma = Math.floor(Math.random() * 100) + 1; i was thinking that you want the user to have all comments but have important ones only visible, the invisible ones can be seen if the selects to do so.
now, i guess you mean that you need

The comments to be all received [min_points doesn't affect the wordpress query as far as i understand]
Render all comments on the first level
For first level comments that have less than min_points, they will only have the header rendered with an expand button [the regular + button]
upon pushing + [maximizing], the rest of the comment hierarchy will be grabbed and rendered [grabbed from the object tree, not from the database]

What was the difference between the two methods? When I read them they're both the same and correct.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

for Q2.
Option 1 [implemented already] - all comments are retrieved from server and rendered in the UI, only the comments less than min_points are just collapsed [they are rendered by collapsted], you have to expand them to see them. Isn't that the behavior you are seeing right now?

It would be easier if we restart the conversation from here, can you tell me how isn't min_points working right now?
the image below [default from my template sample], shows some comments are expanded, and some are collapsed, depending on the number of points set in sample [50 i guess]
min_points

Also, note the random function i used for setting random values for points for each comment, these might be confusing you - as i mentioned in my earlier comment.
Let me know if we need to skype for this one.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Got it - YES this is the correct method. this is how it is meant to work.

On Mon, Oct 28, 2013 at 9:56 AM, michelhabib [email protected]:

for Q2.
Option 1 [implemented already] - all comments are retrieved from server
and rendered in the UI, only the comments less than min_points are just
collapsed [they are rendered by collapsted], you have to expand them to see
them. Isn't that the behavior you are seeing right now?

It would be easier if we restart the conversation from here, can you tell
me how isn't min_points working right now?
the image below [default from my template sample], shows some comments are
expanded, and some are collapsed, depending on the number of points set in
sample [50 i guess]
[image: min_points]https://f.cloud.github.com/assets/296637/1421746/4568d098-3ff1-11e3-8b62-9d8f50ca5b20.png

Also, note the random function i used for setting random values for points
for each comment, these might be confusing you - as i mentioned in my
earlier comment.
Let me know if we need to skype for this one.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-27230873
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

ok great

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Hi Michel, so I have created an environment for you to see how the load-comments directive is being used in a modal window.

Steps:

  1. Pull the latest /themes/postworld-theme
  2. New template is /themes/postworld-theme/sandbox.php You can create a new page with this as the template to see the demo, it's called "Sandbox".
    • image
    • NOTE : I tried adding the Media Modal to the main Postworl Dev menu and adding the route, which worked fine, although I tried troubleshooting for 30 minutes why it's throwing an error when launching the modal in the routing context, so I gave up and created a new template. You can see for yourself: /#/media-modal
  3. Click the second button "Launch Media Modal"
    image
  4. Here you will get an Angular-UI Bootstrap Modal window : http://angular-ui.github.io/bootstrap/

    image
  5. By inspecting /themes/postworld-theme/sandbox.php , you will see a working-example of how the data is being passed to the modal window in which the load-comments directive is located. This is a demo example - it's actually being passed by launching it with the post object attributed by the ng-repeat in the feed, though this is a functional example of the method. The real-world method looks like : ng-click="openMediaModal(post)" which works fine, except for allowing load-comments to use post.ID
  6. Pull the latest /plugins/postworld/ and look at /templates/panels/media_modal.html. You will see the reason the comments are working in the modal window, is because the post.ID is hard-wired to it. Here you can experiment with getting it to work by using the post.ID passed to it through the media modal launch.

Example Media Modal Invocation:

<div ng-controller="mediaModalCtrl">
    <button ng-click="openMediaModal({ID:'133925',post_title:'Post Title',post_format:'video',link_url:'http://www.youtube.com/watch?v=38peWm76l-U'})">Launch Media Modal</button>
</div>

Real-World Media Modal Invocation (from in feed post template):

<div ng-controller="mediaModalCtrl">
    <button ng-click="openMediaModal(post)">Launch Media Modal</button>
</div>

Goals (in order or priority)

  1. Our primary goal here is to get the load-comments to take the post.ID value (passed when opening the modal) to query and load the right comments.
  2. Secondary goal, is to get the modal window to actually also work in the Postworld Dev theme routing environment. ie. /#/media-modal/ without having to use a separate sandbox.php

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

i will try to be brief, since i have few minutes left on my laptop battery [forgot charger at work]
get the latest, and check the sandbox, it is working now.
use this for load-comments.

<div streeview load-comments="post_single" post="post"></div>

whenever a post object exists in scope, the load-comments will try to retrieve the post id from that post object post.ID instead of whatever value you put in the <script>
You cannot use the script tag to set values equal to scope objects, check the answer on stackoverflow here
http://stackoverflow.com/questions/13836765/angular-scope-inside-script
hope that helps for now. will check the modal window later on.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

great thanks, I'll give it a spin.

On Mon, Oct 28, 2013 at 3:17 PM, michelhabib [email protected]:

i will try to be brief, since i have few minutes left on my laptop battery
[forgot charger at work]
get the latest, and check the sandbox, it is working now.
use this for load-comments.

whenever a post object exists in scope, the load-comments will try to
retrieve the post id from that post object post.ID instead of whatever
value you put in the


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-27262346
.

from postworld.

michelhabib avatar michelhabib commented on June 15, 2024

my fix addresses goal 1, but using a little different change to load-comments directive.
please also note that now you need to use an ng-include attribute.

        <div streeview load-comments="post_single" ng-include="templateUrl"></div>

and if you want to use a post object, then add it like this:

        <div streeview load-comments="post_single" ng-include="templateUrl" post=post></div>

goal 2 requires a bit of investigation, i can see the errors now, and it says:

Template for directive 'modalWindow' must have exactly one root element. template/modal/window.html
Template for directive 'modalBackdrop' must have exactly one root element. template/modal/backdrop.html

This is kind of strange, these are angular-bootstrap-ui templates, i dont see them in our repository, they might be missing, i need to read about angular-bootstrap first.
This library is also conflicting with using bootstrap alone, it was preventing the menu from showing dropdowns. but i fixed that one [dropdown issue]
so, i will look into that.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Those Angular-UI Bootstrap templates are embedded in the minified code in *
/lib/angular/ui-bootstrap-tpls-0.6.0.min.js*

On Tue, Oct 29, 2013 at 8:31 AM, michelhabib [email protected]:

my fix address goal 1, but using a little different change to
load-comments directive.
please also note that now you need to use an ng-include attribute.

    <div streeview load-comments="post_single" ng-include="templateUrl"></div>

and if you want to use a post object, then add it like this:

    <div streeview load-comments="post_single" ng-include="templateUrl" post=post></div>

goal 2 requires a bit of investigation, i can see the errors now, and it
says:

Template for directive 'modalWindow' must have exactly one root element. template/modal/window.html
Template for directive 'modalBackdrop' must have exactly one root element. template/modal/backdrop.html

This is kind of strange, these are angular-bootstrap-ui templates, i dont
see them in our repository, they might be missing, i need to read about
angular-bootstrap first.
This library is also conflicting with using bootstrap alone, it was
preventing the menu from showing dropdowns. but i fixed that one [dropdown
issue]
so, i will look into that.


Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-27313178
.

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

Hi Michel,
I'm trying to implement the load-comments, and I'm still unclear about using the post object. When I inject the post like post="post" then somehow it's not working at all.

Am I doing this right?

    <script type="text/javascript" charset="utf-8">
    var load_comments = [];
    load_comments['post_single'] = {
        query : {
            status: 'approve',
         orderby : 'comment_date',
            },
        fields : 'all',
        tree : true,
        order_options : {
            'comment_points' : 'Points',
            'comment_date' : 'Date'
            },
        min_points : 0,
        view: 'default', // Optional, default value is default
    };
    </script>
    <div streeview load-comments="post_single" ng-include="templateUrl" post="post"></div>

from postworld.

ansonphong avatar ansonphong commented on June 15, 2024

I think it's working at least in the context of a single post view ---... I'll let you know if anything comes up. You can skip the last question.

from postworld.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.