joedolson / my-calendar

My Calendar WordPress Plugin
https://www.joedolson.com/my-calendar/
GNU General Public License v3.0
21 stars 16 forks source link

Clicking "Generate Shortcode" button Resets the generator. #361

Closed paaljoachim closed 1 year ago

paaljoachim commented 2 years ago

Shortcodes - Main

I changed the Categories to display one specific category. Did not fill out any other change. Clicked Generate Shortcode.

Noticed this generated shortcode: Screenshot 2021-11-13 at 00 31 22

I also noticed that the Main shortcode generator reset itself.

Two things:

1- I expected that it would not reset itself. Here we can add the Reset Shortcode button as seen in the meta boxes in the My Calendar page.

Screenshot 2021-11-13 at 00 33 39

2- Instead of it mentioning the ID category 4 that it could instead use the category title in use. Making it more readable.

joedolson commented 2 years ago

1) Maybe; I'll see. There's some code for handling that already, since it shows current settings on the calendar page, so might not be a big lift.

2) Do you mean in the shortcode? [my_calendar category="General"]? If so, that's a no. It would work - but it adds an extra database lookup for every category included, and I don't generally choose default options that have worse performance.

paaljoachim commented 2 years ago
  1. We could just move the issue to 3.4.0.
  2. Skip/drop. Yes. I meant in the shortcode.
paaljoachim commented 1 year ago

Testing newest Github version. WordPress 6.1.1

Shortcodes. Main tab.

Selected one category to show. Clicked "Generate Shortcode"

Noticed this: Screenshot 2022-12-21 at 23 46 18

One category is selected. As can be seen in the Shortcode.

I can click between the tabs: Main, Upcoming and Today and the Shortcode will show the same code.

NB! When I click to Reset Shortcode the Content Filters -> Categories to display is blanked out. Earlier selection is removed. But the Shortcode [my_calendar category="3"] is still the same and did not get cleared out to go back to default value of [my_calendar]. To clear out the Shortcode in the grey box I have to click the Generate Shortcode blue button at the bottom of the screen.

Currently Resetting the Shortcode only clears the fields that have previously been set and does not show the change in the Shortcode field to the left of the Reset Shortcode button. The Shortcode field should return to default value.

paaljoachim commented 1 year ago

-1- Adjusting the Content Filters etc and clicking "Generate Shortcode" the Shortcode changes to reflect the selected fields. I can click "Copy to clipboard" and the Shortcode is selected and copied. I can paste the shortcode into example textedit file.

-2- After adjusting and generating the new shortcode it is reflected in the Shortcode field. Clicking Reset Shortcode will bring the shortcode field values back to default value, and any adjustments made will go back to default values.

-3- Refreshing the page by clicking the browser refresh button or the shortcut keys will also reset the Shortcode back to default. Should refreshing the browser reset the Shortcode field and values? Should the user created shortcode automatically be saved and stay that way until the user clicks to Reset Shortcode button?

I will reopen to get your response Joe.

joedolson commented 1 year ago

1) Should refreshing the browser reset the shortcode field and values: Yes. This is just a generator, it's not expected to store data. 2) In my opinion, no.

That would be pretty trivial to implement - just an option that stored the last generated shortcode - I just don't see the point of it.

paaljoachim commented 1 year ago

Case: I create a shortcode. Fill out various fields. Exit the screen and test out the shortcode. I noticed that I had forgot something. I return to the Shortcode Generator screen hoping the last genereted shortcode is still there so that I can adjust what I missed.

I see it is not there. I wonder if I have to start over or if I can perhaps past the shortcode back into the Shortcode field having the various fields be adjusted, so that I can with minimal effort adjust the shortcode that I need.

Instead of needing to start over it would be nice to have a simple way to recall the last shortcode generated code.

paaljoachim commented 1 year ago

Ahhh... I just retested on a dev site running WP 6.2 beta 4. I made a Shortcode in the Shortcodes Generator screen. Exited the screen and came back to it. The shortcode showed what I created the last time. Very nice!

It seems that whatever was adjusted in the UI checkboxes, numbers etc is automatically reset. Based on the shortcode seen I can through the UI recreate what I see in the shortcode.

It is nice to see the shortcode recreated the last time I was in the Shortcodes Generator screen is still available!