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

General refactoring #284

Open
7 tasks done
klemens-st opened this issue Jan 4, 2018 · 5 comments
Open
7 tasks done

General refactoring #284

klemens-st opened this issue Jan 4, 2018 · 5 comments
Labels

Comments

@klemens-st
Copy link
Collaborator

klemens-st commented Jan 4, 2018

Hi @picandocodigo , hope all is well in the new year 😉 Following what you said over two weeks ago:

I've been meaning to refactor stuff for a while, as I did with the paginator, so it's easier to test.

I'd like to focus on refactoring and writing tests before I send any other enhancements I've been thinking about. I'm opening this thread so that we can agree on what to do and how: I know you are refactoring stuff yourself so I don't wont to unnecessarily double your work.

To start, I'm planning to:

  • write tests for LcpUtils once you have reviewed Refactor pagination check #283
  • refactor LcpCatListDisplayer so that all the wrapping in [whatever]_tag and [whatever]_class is done in a speparate class, write a test suit for this
  • write tests for LcpCategory
  • make sure all functionality of LcpCategory works as intended
  • Use templates instead of default build method
  • write tests for get_post_title()
  • Refactor HTML generation

(this list is meant to be edited as things are done or new ideas appear)

@picandocodigo
Copy link
Owner

Hi @zymeth25, happy new year! 🎉
I'll review the new PR after work today but it looks good so far. As you already saw, I started using static functions for LcpUtils but I was too lazy to change the older functions 😝

That class in particular should be rather easy to test compared to others. LcpCatListDisplayer needs lots of refactoring, moving the tag and class functionality to a separate class is a great start. I'll start adding tests myself too.

Thanks for all the hard work you've been doing for the plugin!

@klemens-st
Copy link
Collaborator Author

Yes, I think using static functions in LcpUtils works much better 👍

@klemens-st
Copy link
Collaborator Author

klemens-st commented Jan 5, 2018

Looking at tags and classes now, the code is a bit inconsistent with what's written in the wiki, for instatnce the default tag for customfield_display is div not span. I guess I shouldn't try to unify it becuase it would break backward compatibility. But I'll edit the docs so that all exceptions are documented.

@klemens-st
Copy link
Collaborator Author

klemens-st commented Jan 7, 2018

@picandocodigo I'm working on CatListDisplayer, refactoring and moving tag/class wrapping to a separate class. I noticed something I'd like to discuss with you because it requires a decision to be made to solve inconsistencies.

So when we are not using templates everything is fine, but when using templates we have 3 different
scenarios regarding handling something_tag and something_class shortcode parameters:

  • shortcode parameters are ignored and only $tag and $css_class arguments passed to template functions are considered
  • shortcode parameters take precedence over template function arguments
  • function arguments take precedence over shortcode parameters

Different methods of this class have different behavior, one of those 3. I think this really should be unified. My suggestion is the second option, shortcode params take precedence over function arguments.

Once this is decided I'll finish my work and submit a PR.

@picandocodigo
Copy link
Owner

for instatnce the default tag for customfield_display is div not span. I guess I shouldn't try to unify it becuase it would break backward compatibility. But I'll edit the docs so that all exceptions are documented.

Yes, my intention in general was to have divs as default, but I might have missed a few. If there's any specific inconsistency that's too different from the rest, we could fix it and just add a message on the changelog and readme.

I agree with the different scenarios for the template too, parameters should take precedence. We should just document it and go that way. Thanks for all your work!

@stale stale bot added wontfix and removed wontfix labels Jun 18, 2020
@stale stale bot added the wontfix label Sep 17, 2020
Repository owner deleted a comment from stale bot Sep 17, 2020
@stale stale bot removed the wontfix label Sep 17, 2020
Repository owner deleted a comment from stale bot Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants