lbell / pretty-google-calendar

Simple WordPress plugin to embed Google Calendars in way that doesn't suck.
11 stars 7 forks source link

Don't restrict initial_view option #20

Closed jacobmc closed 8 months ago

jacobmc commented 1 year ago

Hey there! I would love to use this plugin but my client really wants a week view. It would also be great if you could set the default view manually.

lbell commented 1 year ago

Howdy! Try using views="dayGridMonth, dayGridWeek" or views="dayGridMonth, timeGridWeek"

I agree the initial_view option seems unnecessarily restrictive at this moment. I'll work on making that more permissive.

(Currently in initial view is restricted to: dayGridMonth, listDay, listWeek, listMonth, listYear, listCustom)

lbell commented 1 year ago

In the meantime, you can modify helpers.js line 32-36 to look like:

  //   let initialView = "dayGridMonth";

  //   if (allowedViews.includes(settings["initial_view"])) {
  //     initialView = settings["initial_view"];
  //   }

  let initialView = settings["initial_view"];

That should allow you to set initial_view="timeGridWeek"

mwguerra commented 1 year ago

Actually, there is!

image

Just use the shortcode attribute initial_view, setting it to a view defined in the views attribute.

The line:

https://github.com/lbell/pretty-google-calendar/blob/129ca27bb36383a472d34e4bcd820f9c21e1e049/public/js/helpers.js#L27

defines the views available. Any other available at Full Calendar can be used too, but I can't say for sure the CSS for them are ok or not. This will need some more testing to incllude it in the allowed views.

Hope this helps in anyway!

NurDerFCN commented 10 months ago

Hello,

support of "dayGridWeek" or "timeGridWeek" in initial_view would be really great.