Skip to content

Kentico MVC FullCalendar widget allows you to render various content as calendar events.

License

Notifications You must be signed in to change notification settings

drilic/kentico-mvcwidget-fullcalendar

Repository files navigation

Kentico MVC Full Calendar widget

MIT

Full calendar allows you to render various content as calendar events.

Requirements

Download & Installation

  1. Download and install widget:
    • Install widget through nuget package
      • (need updated package) Download nuget package from this link
      • Setup local nugetfeed and copy nuget package EXLRT.Kentico.Mvc.Widgets.FullCalendar.2.0.0.nupkg to newly created feed.
      • Install package to your MVC solution
    • Install widget by source code
      • Clone this repostiory to your file system: https://github.com/drilic/kentico-mvcwidget-fullcalendar
      • Reference EXLRT.Kentico.Mvc.Widgets.FullCalendar.csproj in your existing project
      • Copy following files to exact same file structure in MVC project:
        • Views\Shared\Widgets\FullCalendarWidget\_FullCalendarWidget.cshtml
        • Views\Shared\FormComponents\FullCalendarTypeSelector\_FormComponents.FullCalendarTypeSelector.cshtml
        • Content\Widgets\FullCalendar\css\fullCalendar.css
        • Content\Widgets\FullCalendar\js\fullCalendar.js
      • Build solution
  2. Configure routing for widget
  3. Register dependency injection
  4. Setup predefined calendars
    • Calendars can be configured per site, but name must be unique globally
  5. Register necessary styles and scripts for full calendar in layout

Configure routing

Method definition:

void MapFullCalendarRoutes(this RouteCollection routes, MvcRouteHandler routeHandler = null, object constraint = null, CultureInfo defaultCulture = null);

Example of configuration for DancingGoat site (RouteConfig.cs):

using EXLRT.Kentico.Mvc.Widgets.FullCalendar;
...
routes.MapFullCalendarRoutes(new MultiCultureMvcRouteHandler(defaultCulture), new { culture = new SiteCultureConstraint() }, defaultCulture);

Register dependency injection

Method definition:

void RegisterFullCalendarDependencies(this ContainerBuilder builder);

Example of configuration for DancingGoat site (AutoFacConfig.cs):

using EXLRT.Kentico.Mvc.Widgets.FullCalendar;
...
// add to end of your ConfigureDependencyResolver(ContainerBuilder builder) method
builder.RegisterFullCalendarDependencies();

Setup predefined calendars

Method definition:

Dictionary<string, FullCalendarWidgetConfiguration> AddConfiguration(this Dictionary<string, FullCalendarWidgetConfiguration> _, string widgetType, FullCalendarConfigurationType configurationType, string classOrObjectName, string widgetTypeDisplayName, string titleColumnName, string startDateColumnName, string endDateColumnName, UrlConfiguration url = null, string descriptionColumnName = null, string allDayColumnName = null, string siteCodeName = null);

Example of configuration for DancingGoat site (ApplicationConfig.cs):

using EXLRT.Kentico.Mvc.Widgets.FullCalendar;
...
// If you are using content tree based routing, leave the Pattern and Columns set to NodeAliasPath as shown below, the IPageUrlRetriever will resolve the URLs based on the NodeAliasPath
FullCalendarConfiguration.InitializeFullCalendarForMultiCultureSites()
                    .AddConfiguration("articlesWithRetriever", FullCalendarConfigurationType.Pages, "DancingGoatMvc.Article",
                                      "Articles (Pages - Retriever)", "DocumentName", "DocumentPublishFrom", "DocumentPublishTo", new UrlConfiguration()
                                      {
                                          // can't be used in combination with 'pattern' feature
                                          UseDefaultKenticoRetriever = true
                                      })
                    
                    .AddConfiguration("articles", FullCalendarConfigurationType.Pages, "DancingGoatMvc.Article",
                                      "Articles (Pages)", "DocumentName", "DocumentPublishFrom", "DocumentPublishTo", new UrlConfiguration()
                                      {
                                          Pattern = "/#DocumentCulture#/Articles/#NodeGUID#/#NodeAlias#",
                                          Columns = new string[] { "DocumentCulture", "NodeAlias", "NodeGUID" }
                                      })
									  
                    // Objects bellow does not exist in DancingGoat sample. They must be created in Kentico CMS before using
                    .AddConfiguration("events", FullCalendarConfigurationType.CustomTables, "customtable.Events",
                                      "Events (Custom Tables)", "ItemName", "StartDate", "EndDate", descriptionColumnName: "Description")
									  
                    .AddConfiguration("classes", FullCalendarConfigurationType.Classes, "dancinggoat.Events",
                                      "Events (Module Classes)", "EventsName", "EventsStartDate", "EventsEndDate");

Register layout scripts

Example of configuration for DancingGoat site (_Layout.cshtml):

@using EXLRT.Kentico.Mvc.Widgets.FullCalendar.Extensions;
...
<head>
	...
	 @Html.RenderFullCalendarStyles()
</head>
<body>
	...
	@Html.RenderFullCalendarScripts();
</body>

Contributions and Support

Feel free to fork and submit pull requests or report issues to contribute. Either this way or another one, we will look into them as soon as possible.

Thanks:

  • bkehren for forking and updating the code base to Kentico 13, .NET 4.8.

About

Kentico MVC FullCalendar widget allows you to render various content as calendar events.

Resources

License

Stars

Watchers

Forks

Packages

No packages published