Fanray v1.1-preview1 - Widgets

I haven't posted in a while due to some health issues, I've been battling with chronic lower back pain for years and it elevated to a new level last year. I tried my best to rehab myself till I was convinced the pain was not going anywhere, earlier this month I opted for surgery. I'm still recovering and hopefully as I get better I'll be able to put more time into the project. 

Version Changes Back to 1.x

I started this project with the goal to learn new technologies by building something useful we can all benefit from and learn from. Inevitably I will make mistakes along the way as part of the learning process. I originally intended for the next release to be v2.0 because it's been a year since I released v1.0 and thought it was a good time to start anew with Asp.net Core 2.x. But then I realized the existing feature set is still relatively small, it'd be more appropriate to version it as 1.x. Therefore I'm making the next release 1.1 instead of 2.0. Also I'm abandoning the "alpha" and "beta" release convention and will use "preview" instead. So for each release there will be a number of previews followed by a final release. Any issues after a final release will go to the patch number.  Today I'm releasing v1.1-preview1, please let me know of any issues you run into with this release. Note that previews like alphas are not recommended for production. My apologies for the version confusion!

Introducing Widgets

This preview incorporates what I worked on for the past few months: fixes, improvements but most of all a brand new widget system. Widgets provide a way for theme designers to optionally define regions (widget areas) on their theme for end users to drag and drop pieces of UI (widgets) onto these areas to customize their site. Note that widgets are optional, developers / designers still have full control when they develop theme and they don't have to include widgets if they don't want to. 

Widgets
Widgets

Having said that, widget does give developers a way to extend the functionality of the application. For example it's common for a site to have social icons that link to the user's social media pages. A Social Icons widget allows a user to input her social media links and social icons will appear accordingly. The user can also sort the icons in any order by drag and drop them. In the coming days and weeks I'll provide more info on how to create your own widgets.

Social Icons Widget
Social Icons Widget

Upgrade to v1.1

If you start fresh, this section does not apply to you, you can just run the app and the database will be created for you.  But if you are running a previous version, here is how to upgrade your existing database. Always remember to backup your database first!

From v2.0-a4

Run the following script before launching app.

UPDATE [dbo].[__EFMigrationsHistory] 
  SET [MigrationId] = '20171120170827_FanV1' 
WHERE MigrationId like '%FanSchemaV1%' 
GO 
UPDATE [dbo].[__EFMigrationsHistory] 
  SET [MigrationId] = '20190318202954_FanV1_1' 
     ,[ProductVersion] = '2.2.3-servicing-35854' 
WHERE MigrationId like '%FanV2_0%' 
GO 
DROP INDEX [IX_Core_Meta_Key] ON [Core_Meta] 
GO 
ALTER TABLE [Core_Meta] ADD [Type] int NOT NULL DEFAULT 0 
GO 
CREATE UNIQUE CLUSTERED INDEX [IX_Core_Meta_Type_Key] ON [Core_Meta] ([Type], [Key]) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'clarity', N'', 1) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'blog-after-post', N'{"id":"blog-after-post","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'blog-after-post-list', N'{"id":"blog-after-post-list","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'blog-before-post', N'{"id":"blog-before-post","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'blog-before-post-list', N'{"id":"blog-before-post-list","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'blog-sidebar1', N'{"id":"blog-sidebar1","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'blog-sidebar2', N'{"id":"blog-sidebar2","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'footer1', N'{"id":"footer1","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'footer2', N'{"id":"footer2","widgetIds":[]}', 2) 
GO 
INSERT [dbo].[Core_Meta] ([Key], [Value], [Type]) VALUES (N'footer3', N'{"id":"footer3","widgetIds":[]}', 2) 
GO

After that you will not see your sidebar anymore, go to the Admin Panel's Widgets page, add your widgets back.

From v1.0

First run the following sql.

UPDATE [dbo].[__EFMigrationsHistory] 
  SET [MigrationId] = '20171120170827_FanV1' 
WHERE MigrationId like '%FanSchemaV1%' 
GO

Then you have a choice of either just run the app and let EF migrations update your database, or go to the solution in the sql folder run 1.0-1.1.sql to update your database.