ansonphong / postworld

Wordpress Theme Development Framework
GNU General Public License v2.0
7 stars 0 forks source link

live-feed feedQuery // Route Parameters #71

Closed ansonphong closed 8 years ago

ansonphong commented 11 years ago

Hi Michel, It should be so that the live-feed search functionality takes routing parameters which sets the feedQuery object. I have some basic abilities with the $route methods, and so I could implement this if you like.

Or if you would like to do it, then I welcome you. As you know, we will soon have reached the budget ceiling, so I don't want to put any pressure on you to do it if it's not something you have time for in the next 7 days. If so, I can share the latest RSV2 theme repo, and you can see exactly how it's being used in-context of the actual site which might make it faster.

Or if you prefer me to implement it, do you have any advice on how it's structured before undertaking?

I noticed that it's in filterFeed.js in the pwFilterFeedController where the $route parameters would be implemented.

michelhabib commented 11 years ago

Phong, my pleasure, just let me know what needs to be done. I can at least put the initial structure and take it from there.

The filterFeed Controller is a controller i created to allow you to put multiple search forms with the live feed. all filterFeed directives use the local feedQuery scope variable and will ultimately feed back the args.feed_query variable of liveFeed.

Depending on the context, i can either continue working on this structure, or implement it differently to match your needs, it's already very flexible, we just need to know how it will ultimately look like.

ansonphong commented 11 years ago

Great, yes I quite like how you have it setup. Very flexible.

I'll give more specifications if you like, although the basic structure would be that values are pre-populated by the route, and the route updates when the values update.

Like this: /search/#/s=earth&post_type=blog&post_class=author...

On 2013-11-03, at 3:00 AM, michelhabib notifications@github.com wrote:

Phong, my pleasure, just let me know what needs to be done. I can at least put the initial structure and take it from there.

The filterFeed Controller is a controller i created to allow you to put multiple search forms with the live feed. all filterFeed directives use the local feedQuery scope variable and will ultimately feed back the args.feed_query variable of liveFeed.

Depending on the context, i can either continue working on this structure, or implement it differently to match your needs, it's already very flexible, we just need to know how it will ultimately look like.

— Reply to this email directly or view it on GitHub.

michelhabib commented 11 years ago

the sample above should be working already, let me know if anything is needed here.

ansonphong commented 11 years ago

great, I'll have a look at it.

On Wed, Nov 6, 2013 at 2:14 AM, michelhabib notifications@github.comwrote:

the sample above should be working already, let me know if anything is needed here.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-27859638 .

ansonphong commented 11 years ago

Hi Michel, Using the default configuration, although the search results itself works great, I don't know how to set it up so the routing you implemented works.

image

For instance, I setup the page at /s/, which works well, and then add the route params in the URL string, although it doesn't update the view. Also, the URL isn't updated when I change the search terms.

Is this already implimented? Is there anything special I need to add to the embed process?

michelhabib commented 11 years ago

how do you trigger the route change from the UI? do you click a link that submits to the new url? the search is triggered on url load, and url load is triggered when you refresh the page with the updated route, or click a link with the new route [not actually refreshing the page, but will only simulate the action of navigating to a new url]

ansonphong commented 11 years ago

I think every time the local submit() function is called, we update the route to match the feedQuery params. Theoretically, the user should be able to copy/paste the search route right out of the URL.

This would include any tax queries, containing single query terms : ie.

/#/s=earth&post_type=blog&tax-topic=eco&tax-section=videos

ansonphong commented 11 years ago

Basically, at the time of submit, you can parse all the feedQuery values as a new route and set that in the URL.

michelhabib commented 11 years ago

Sorry for being late here, i missed this one. The way i implemented it was to take the parameters from the route and execute the query, also if you change the route url and refresh - post - the page - it will execute the query. but not the other way around, if you make changes to the feedQuery, it is not updating the route. Let me see how i can get that to work.

ansonphong commented 11 years ago

ok - I suppose there would be a circular watch between the form model and the route.

$routeUpdate and $watch

then filter services could be affixed to the data going in both directions.

On Sun, Nov 10, 2013 at 6:38 AM, michelhabib notifications@github.comwrote:

Sorry for being late here, i missed this one. The way i implemented it was to take the parameters from the route and execute the query, also if you change the route url and refresh - post - the page - it will execute the query. but not the other way around, if you make changes to the feedQuery, it is not updating the route. Let me see how i can get that to work.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-28151758 .

ansonphong commented 11 years ago

Hi Michel, Do you have time to get to this in the next several days? If you're busy, tell me and I'll try and make time to get it done. Otherwise it would be great to have your help with this. Either way, let me know what your time allows. Thanks.

michelhabib commented 11 years ago

sorry it might be taking longer than expected, it's a bit tricky to handle as we are changing the flow of arguments and submission. i got my hands on the process and will send you an update today.

ansonphong commented 11 years ago

yes timing is ok right now - I'm busy implementing some other things currently so I'm not waiting on you for this.

as long as I can get my hands on the new search query vars mechanism in the next 48 hours and start to implement into the current system, we will be fine for time.

On Tue, Nov 19, 2013 at 2:38 AM, michelhabib notifications@github.comwrote:

sorry it might be taking longer than expected, it's a bit tricky to handle as we are changing the flow of arguments and submission. i got my hands on the process and will send you an update today.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-28780091 .

michelhabib commented 11 years ago

ok good, i will need your feedback once done because it might need some updates depending on your usage. But at least we will have it organized in a way that is easy to extend.

ansonphong commented 11 years ago

great to hear.

On Tue, Nov 19, 2013 at 3:11 AM, michelhabib notifications@github.comwrote:

ok good, i will need your feedback once done because it might need some updates depending on your usage. But at least we will have it organized in a way that is easy to extend.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-28781879 .

michelhabib commented 11 years ago

Updated in latest commit. You may try it here, go to http://localhost/wordpress/search/#/live-feed-2/ and change the filter parameters and click go, check the url for url change. note that empty values are omitted, special characters are encoded, back button is working. values that are arrays and objects are not handled, how do you want the query parameter to look like in that case?

michelhabib commented 11 years ago

i want to add that the flow is as follows [flow A]:- open a page with live-feed, where the live-feed is served in an ng-view with hash url parameters. 1- live-feed will read query args from feed-settings. 2- live-feed will read query args from query string and override/merge with the ones from the previous step. 3- filter-feed panels will read query args from the previous step and populates the input controls accordingly.

if you click submit on any filter-feed panel. 1- by default, any input in filter-feed panel is already populated to feed query args automatically. 2- all feed query args [accumulated] will be converted to a query string. 3- the url changes to the new query string and restarts the process as if it is a new page loaded, and goes to the flow A above.

ansonphong commented 11 years ago

Great - that is a perfect circular process that takes all the factors into account. Very happy with how you structured this.

I plan to have a look at this tonight.

On Tue, Nov 19, 2013 at 3:02 PM, michelhabib notifications@github.comwrote:

i want to add that the flow is as follows [flow A]:- open a page with live-feed, where the live-feed is served in an ng-view with hash url parameters. 1- live-feed will read query args from feed-settings. 2- live-feed will read query args from query string and override/merge with the ones from the previous step. 3- filter-feed panels will read query args from the previous step and populates the input controls accordingly.

if you click submit on any filter-feed panel. 1- by default, any input in filter-feed panel is already populated to feed query args automatically. 2- all feed query args [accumulated] will be converted to a query string. 3- the url changes to the new query string and restarts the process as if it is a new page loaded, and goes to the flow A above.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-28847782 .

ansonphong commented 11 years ago

Hi Michel, I managed to get this partially working on the PW template - were there any required changes to the /postworld-theme which haven't been pushed, or is the past commit 13 days ago working?

I tried on that demo, and it seemed to be partially working but not fully at #/live-feed-params/

Also I noticed that on the live-feeds now that #/home/ gets appended to the URL by the routing mechanism, although I can't get the search query vars to work

image

Are all live-feeds automatically connected to the query vars, or is that something needs to be added to the feed settings?

ansonphong commented 11 years ago

I noticed that this /#/home is now showing up on other pages as well:

image

I think we should have a way to disable - or optionally enable, the query vars functionality so that we can limit the routing mechanism to only operating when it's enabled.

ansonphong commented 11 years ago

Hi Michel, Can you send me some instructions on how to implement this in a real-world example? This would be very helpful, as I'm having difficulty figuring out how to configure the implementation.

michelhabib commented 11 years ago

i saw your comments only now, i am checking.,,

michelhabib commented 11 years ago

with just postworld and postworld theme, when you go to http://localhost/wordpress/search/#/live-feed-2/ does it work? when you change the year field and submit, what happens?

michelhabib commented 11 years ago

i initially found an issue, i found this on line 78 of liveFeed.js, i hardcoded a path while testing the route

            $location.path('live-feed-2/').search(queryString);
ansonphong commented 11 years ago

yea that makes sense, because for my the live-feed-2 was something else - the one that seemed like it was the one was the #/live-feed-params/ sample.

On Thu, Nov 21, 2013 at 2:14 PM, michelhabib notifications@github.comwrote:

i initially found an issue, i found this on line 78 of liveFeed.js, i hardcoded a path while testing the route

        $location.path('live-feed-2/').search(queryString);

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-29029961 .

michelhabib commented 11 years ago

ok, updated and commited, only changed 2 lines in liveFeed.js to get the path dynamically from the url. can you please try again and let me know.

ansonphong commented 11 years ago

ok, I'll give that a run.

On Thu, Nov 21, 2013 at 2:27 PM, michelhabib notifications@github.comwrote:

ok, updated and commited, only changed 2 lines in liveFeed.js to get the path dynamically from the url. can you please try again and let me know.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-29031004 .

ansonphong commented 11 years ago

OK so now I've deployed the latest version to the staging server and here are some bug reports with the current way I have implemented.

Example : http://staging.realitysandwich.com/s/#/?s=dream

Going directly to the URL works normally as expected the first time.

1 • If the URL is changed in the URL input, and then you hit enter in the URL box, then it doesn't update. Updating only happens if you press browser reload. New changes to the URL are not being substantiated.

Example:

Additionally, this can be re-created by changing the parameters in any way in the URL and pressing enter. First enter nothing happens, second enter it returns to the original state.

2 • Tax_query is not working - shows up as which ends up returning no results tax_query=%5Bobject%20Object%5D

3 • By default the author_name is showing up as 'undefined', thus returning no results &author_name=undefined

We will want to condition the author_name field so that it doesn't appear if == undefined

Generally, it seems to be working well.

michelhabib commented 11 years ago

i am looking at these, but it seems that the search page in staging environment is not working, it shows a console error with nothing on the page but the header.

ansonphong commented 11 years ago

try to reload, perhaps it's a cached JS file.

On Sun, Nov 24, 2013 at 12:59 AM, michelhabib notifications@github.comwrote:

i am looking at these, but it seems that the search page in staging environment is not working, it shows a console error with nothing on the page but the header.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-29151498 .

michelhabib commented 11 years ago

i cleared cache, the problem is i get this error :-

TypeError: Cannot read property '0' of undefined
    at Object.pwGetPostStatusOptions (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:7:6000)
    at new <anonymous> (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:7:11119)
    at d (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:13875)
    at Object.instantiate (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:14012)
    at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:28202
    at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:22347
    at q (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:2553)
    at l (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:22238)
    at f (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:19770)
    at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:19340 ```
ansonphong commented 11 years ago

alright good to know - I'm going to re-deploy in development mode and hopefully that will solve it.

On Sun, Nov 24, 2013 at 2:36 AM, michelhabib notifications@github.comwrote:

i cleared cache, the problem is i get this error :-

TypeError: Cannot read property '0' of undefined at Object.pwGetPostStatusOptions (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:7:6000) at new (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:7:11119) at d (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:13875) at Object.instantiate (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:14012) at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:28202 at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:22347 at q (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:2553) at l (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:22238) at f (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:19770) at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:19340 ```

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-29152751 .

ansonphong commented 11 years ago

ok I just re-deployed in development mode - it's working for me still : http://staging.realitysandwich.com/s/

On Sun, Nov 24, 2013 at 3:42 AM, phong asun@phong.com wrote:

alright good to know - I'm going to re-deploy in development mode and hopefully that will solve it.

On Sun, Nov 24, 2013 at 2:36 AM, michelhabib notifications@github.comwrote:

i cleared cache, the problem is i get this error :-

TypeError: Cannot read property '0' of undefined at Object.pwGetPostStatusOptions (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:7:6000) at new (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:7:11119) at d (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:13875) at Object.instantiate (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:14012) at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:28202 at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:22347 at q (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:2553) at l (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:22238) at f (http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:19770) at http://staging.realitysandwich.com/wp-content/plugins/postworld/deploy/postworld.min.js?ver=3.7.1:1:19340 ```

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-29152751 .

michelhabib commented 11 years ago

i never thought of that, its an issue for anonymous user, try logging out and you will get the same error :) its not blocking me now anyway, i logged in and i can see the page, and working on it.

michelhabib commented 11 years ago

i have the RSV2 environment locally now, so i will be able to fix this, hopefully today. if i use the deployment php script, that should push the postworld updates? or you prefer to do this yourself? let me know, thanks.

ansonphong commented 11 years ago

You can deploy is need be. I generally prefer to do it myself, though if you need to deploy for test purposes than go for it.

Make sure to commit and add the latest version of postworld before pushin RSV2 though, otherwise RSV2 git repo refers to non-existant work tree for Postworld sub-module and the deploy won't work, and it can take 15 minutes to fix in git.

Very important.

If you need to deploy for testing feel free.

Additioy, were you able to look into the tax_query and author issues?

On 2013-11-24, at 9:23 AM, michelhabib notifications@github.com wrote:

i have the RSV2 environment locally now, so i will be able to fix this, hopefully today. if i use the deployment php script, that should push the postworld updates? or you prefer to do this yourself? let me know, thanks.

— Reply to this email directly or view it on GitHub.

michelhabib commented 11 years ago

Phong, i am already working on a number of issues here. but, mainly there are some feed_query values that are set somewhere that i cannot find, can you help? for example, what sets the s to empty value? what sets the post_class and post_type drop downs to null? they are supposed to be empty values, but not null. i can work around all these issues and force them to empty values but that would be just an override.

anyways, still working on it and will keep you updated.

michelhabib commented 11 years ago

i fixed some of the issues in postworld, tested them locally on RSV2, but didn't push them to RSV2 or deploy to staging yet:-

I am still working on:-

ansonphong commented 11 years ago

Ok thanks for the update. I think the null values are a result of the Angular Model system - those dropdowns which have a default selected item which is empty / description, such as "Any" register a null value, if I understand correctly.

On 2013-11-25, at 8:28 AM, michelhabib notifications@github.com wrote:

i fixed some of the issues in postworld, tested them locally on RSV2, but didn't push them to RSV2 or deploy to staging yet:-

the /home/ route, was the default route defined in app.js, i removed that, since it is only needed for postworld theme. empty values, null values are not added to the url neither added to the query arguments sent to the server. fixed author name, by changing the default to empty string instead of undefined. post class and post type, when "any" is selected, they no longer show null in the url. when making changes to the parameters, they are reflected in the url correctly. I am still working on:-

handle object and array parameters url edit and enter - works on second enter only year and month drop downs are not picking the year,month parameter from the route url. — Reply to this email directly or view it on GitHub.

michelhabib commented 11 years ago

You are correct, and that is handled anyway in latest build, will get you updated for the rest, this will be fully completed today.

ansonphong commented 11 years ago

great. I'm still preparing for public release, we're about 23 hours away.

On Tue, Nov 26, 2013 at 1:00 AM, michelhabib notifications@github.comwrote:

You are correct, and that is handled anyway in latest build, will get you updated for the rest, this will be fully completed today.

— Reply to this email directly or view it on GitHubhttps://github.com/phongmedia/postworld/issues/71#issuecomment-29276313 .

michelhabib commented 11 years ago

http://staging.realitysandwich.com/s/

I guess i covered all points, except for:-

the deploy script is not working for me, so i copied the postworld files directly, they are committed to postworld repo. i had to commit a couple of files in RSV2, just search templates in the RSV2 theme.

I had to make some changes to get different drop downs to work, like year and month, these had to be changed a bit in order to pick up the values from the url and vice versa.

Note that link_format, i changed it in the search template - it should work but it is still pending on #74 to be completed.

Tax Query is now generated as a json string. Changing that to a more user friendly format would require changing the current logic you implemented for tax_query in filterfeed.js and also it would be very limiting in adding future search fields.

The home page link to search page looks strange, do you want me to work on that? it is redirecting to: http://staging.realitysandwich.com/s/#/home/?s=undefined But i don't know how this link is generated. if you set s to empty string, it will work fine now. all undefined and null parameters are handled correctly in the search page, also the #/home/ is removed from the url in the search page.

ansonphong commented 11 years ago

I agree about putting json string for tax query - I didn't know that was possible! Good to hear I'll try it out.

Phong

On 2013-11-26, at 9:26 AM, michelhabib notifications@github.com wrote:

http://staging.realitysandwich.com/s/

I guess i covered all points, except for:-

url editing and double enter the deploy script is not working for me, so i copied the postworld files directly, they are committed to postworld repo. i had to commit a couple of files in RSV2, just search templates in the RSV2 theme. I had to make some changes to get different drop downs to work, like year and month, these had to be changed a bit in order to pick up the values from the url and vice versa.

Note that link_format, i changed it in the search template - it should work but it is still pending on #74 to be completed.

Tax Query is now generated as a json string. Changing that to a more user friendly format would require changing the current logic you implemented for tax_query in filterfeed.js and also it would be very limiting in adding future search fields.

The home page link to search page looks strange, do you want me to work on that? it is redirecting to: http://staging.realitysandwich.com/s/#/home/?s=undefined But i don't know how this link is generated. if you set s to empty string, it will work fine now. all undefined and null parameters are handled correctly in the search page, also the #/home/ is removed from the url in the search page.

— Reply to this email directly or view it on GitHub.