Skip to content

Latest commit

 

History

History
101 lines (87 loc) · 5.08 KB

README.md

File metadata and controls

101 lines (87 loc) · 5.08 KB

Kentico MVC Full Calendar widget

MIT

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

Requirements

  • Kentico 12.0.41 or later version is required to use this component.
  • Autofac 3.5.2 for resolving dependency injection

Download & instalation

  1. Download and install widget:
    • Install widget through nuget package
      • Download nuget package from this link
      • Setup local nugetfeed and copy nuget package EXLRT.Kentico.Mvc.Widgets.FullCalendar.1.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
      • Link EXLRT.Kentico.Mvc.Widgets.FullCalendar.csproj as existing project
      • Copy files to exact same 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
      • Add project as reference to the MVC project
      • 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 (DependencyResolverConfig.cs):

using EXLRT.Kentico.Mvc.Widgets.FullCalendar;
...
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;
...
FullCalendarConfiguration.InitializeFullCalendarForMultiCultureSites()
                    .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.