Falafel Dashboard now available on NuGet The Falafel Dashboard has been updated today with new widgets, and better still, is now easily downloadable via NuGet! This release brings a few new widgets as well as some new features that will hopefully help developers more easily develop and add their own widgets to the dashboard.
New Widgets: Error Logs and Recent Comments
The Dashboard now includes two brand new widgets to give you even more at-a-glance info on your dashboard. The Error Logs widget reads all of the log files from your Sitefinity Logs folder and displays them in a selectable menu, allowing you to preview and refresh each log on demand. The log text is also rendered in a textarea control so you can easily copy an error message (or the entire log) such as if you need to report an issue via email or Telerik Support. Also present in the latest release of the Dashboard is a Recent Comments widget, which as you would expect, displays the most recent comments posted to your website. In addition, you can perform administrative actions on these recent comments including marking as spam, hiding, deleting, or publishing pending comments live to your site, all without ever leaving the dashboard.
New Falafel Dashboard Base Controller Helper Class
In addition to the new widgets, the Dashboard also introduces a new BaseController helper class to make it easier to develop your own custom widgets. Previously, to add custom script and styles to a custom dashboard widget, it was necessary for you to edit the dashboard configuration files either by using the Administration Settings, editing the config files, or manipulating them via the ConfigurationManager API. With the introduction of the new BaseController, you are provided with two properties: Scripts and Styles. Overriding these properties allows you to define at compile-time any additional scripts or CSS files that your widget requires, and the Dashboard widget will automatically take care of registering them for you. The Scripts property is a List of type Dictionary where the first parameter is a string containing the relative path to the script (such as ~/js/myscript.js). The second parameter is a simple boolean to tell the Dashboard widget whether the custom script should be loaded by the ScriptManager, or simply added to the page. This allows you to specify where and how to load the JavaScript file, in case it should be loaded before other scripts. The Styles property on the other hand is simply a list of string values which should contain the relative path to the CSS file (such as ~/css/mystyles.css). The Sitefinity Dashboard widget will automatically take care of registering the defined styles in the head tag. Here is a code sample of how you can use these properties to easily define a new custom widget with custom styles and scripts that should be included. Notice that the Controller inherits from BaseController, allowing us to override the necessary Scripts and Styles classes to define our custom files to be included.
public class MyWidgetController : BaseController
{
public override Dictionary<string, bool> Scripts
{
get
{
if (base.Scripts.Count == 0)
base.Scripts.Add("~/Mvc/Areas/MyWidget/Scripts/FalafelDashboard.MyWidget.js", false);
return base.Scripts;
}
}
public override List<string> Styles
{
get
{
if (base.Styles.Count == 0)
base.Styles.Add("~/Mvc/Areas/MyWidget/Styles/MyWidget.css");
return base.Styles;
}
}
}
It's important to note that using the BaseController is absolutely optional, as you can certainly register the scripts manually in the FalafelDashboardConfig file, or simply omit them if your widget does not in any way rely on custom JavaScript or CSS styling. However, by leveraging the newly included base class, you have a simple and intuitive way to reference your scripts, while ensuring that the Dashboard widget takes care of wiring up the necessary plumbing for your widget to operate and look as you expect.
Download Now via NuGet
As mentioned previously, the Falafel Sitefinity Dashboard is now available for download via NuGet, installing the free, Falafel branded version with a few simple clicks. As always, you can easily purchase a license allowing you to unlock the Dashboard and remove the Falafel branding for your own custom site. Simply purchase a license for the Falafel Dashboard Widget from our store. As part of a special offer, from now until the start of FalafelCon on June 10th, you can order the a license for the unbranded version of the widget for only $99! I encourage you to try the updated dashboard widget today for yourself, and leave a comment below how it's working for you, as well as any comments or suggestions for what we can do to improve the dashboard in future release. Happy Coding!
Enjoyed this post and/or found it useful?