Custom Designer for Custom Widget isn't registering
I've followed the custom designer tutorial so many times now. I'm at the point of giving up now. I'm attempting to have a label that uses the advanced editor and allows shared content. That's why you see all the bells and whistles from github.com/.../Telerik.Sitefinity.Frontend.ContentBlock. My custom designer is not registering as the primary and I don't see it as an option in the designer window. I'm not using the standard Content Block widget because I want to have this be in a widget. Imagine a label that's editable and allows shared content and a button in one widget. That's as basic as I can describe it. We want to allow our Content Managers free reign over the text, but have no control over the other stuff going on in a widget like that button.
I have my model MyCustom.cs. I have MyCustomController.cs that is being called. Under Mvc->Scripts->MyCustom I have designerview-mycustom.js
(function ($)
var EMPTY_GUID = '00000000-0000-0000-0000-000000000000';
var simpleViewModule = angular.module('simpleViewModule', ['designer', 'kendo.directives', 'sharedContentServices', 'sfFields', 'sfSelectors']);
angular.module('designer').requires.push('simpleViewModule');
simpleViewModule.factory('contentBlockService', ['dialogFeedbackService', 'sharedContentService', function (dialogFeedbackService, sharedContentService)
var contentItem;
var properties;
var unlockContentItem = function ()
return sharedContentService.deleteTemp(properties.SharedContentID.PropertyValue);
;
var updateContentItem = function ()
return sharedContentService.update(contentItem, properties.Content.PropertyValue, properties.ProviderName.PropertyValue);
;
return function (data)
properties = data;
var isShared = properties.SharedContentID.PropertyValue != EMPTY_GUID;
if (isShared && !contentItem)
var checkOut = true;
return sharedContentService.get(properties.SharedContentID.PropertyValue, properties.ProviderName.PropertyValue, checkOut)
.then(function (data)
contentItem = data;
if (contentItem)
properties.Content.PropertyValue = contentItem.Item.Content.Value;
dialogFeedbackService.savingHandlers.push(updateContentItem);
dialogFeedbackService.cancelingHandlers.push(unlockContentItem);
, function ()
properties.Content.PropertyValue = '';
properties.SharedContentID.PropertyValue = EMPTY_GUID;
);
;
]);
//basic controller for the simple designer view
simpleViewModule.controller('MyCustomCtrl', ['$scope', 'propertyService', 'sharedContentService', 'contentBlockService',
function ($scope, propertyService, sharedContentService, contentBlockService)
var contentItem;
// ------------------------------------------------------------------------
// event handlers
// ------------------------------------------------------------------------
var onGetPropertiesSuccess = function (data)
$scope.properties = propertyService.toAssociativeArray(data.Items);
$scope.isShared = $scope.properties.SharedContentID.PropertyValue != EMPTY_GUID;
kendo.bind();
if ($scope.isShared)
return contentBlockService($scope.properties);
;
// ------------------------------------------------------------------------
// scope variables and set up
// ------------------------------------------------------------------------
$scope.feedback.showLoadingIndicator = true;
$scope.isShared = false;
propertyService.get()
.then(onGetPropertiesSuccess)
.catch(function (data)
$scope.feedback.showError = true;
if (data)
$scope.feedback.errorMessage = data.Detail;
)
.finally(function ()
$scope.isShared = $scope.properties.SharedContentID.PropertyValue != EMPTY_GUID;
$scope.feedback.showLoadingIndicator = false;
);
]);
)(jQuery);
I have under Mvc->Views->MyCustom DesignerView.MyCustom.cshtml and DesignerView.MyCustom.json as embedded files. There's also Default.cshtml.
DesignerView.MyCustom.cshtml.
@using Telerik.Sitefinity.Frontend.Mvc.Helpers
<
h3
>Is any of this working?</
h3
>
<
div
ng-show
=
"isShared"
class
=
"alert alert-warning"
>
<
b
>@Html.Resource("ThisContentIsShared")</
b
> @Html.Resource("SharedContentWarning")
</
div
>
<
sf-html-field
class
=
"kendo-content-block"
sf-model
=
"properties.Content.PropertyValue"
></
sf-html-field
>
DesignerView.MyCustom.json
"priority": 1,
"scripts": [
"Mvc/Scripts/ContentBlock/shared-content-services.js",
"client-components/selectors/taxonomies/sf-taxonomy-service.js"
],
"components": [ "sf-html-field" ]
"sf-html-field" is located under ResourcePackages->Bootstrap->client-components->fields->html-fields->sf-html-field.sf-cshtml
I have the Feather nuget package and the module hasn't been enabled on the server (it breaks stuff when I do it). Can anyone see what I'm messing up?
[quote]Bryson said:
I have the Feather nuget package and the module hasn't been enabled on the server (it breaks stuff when I do it). Can anyone see what I'm messing up?
[/quote]
Do you mean that the Feather module hasn't been enabled?
The Feather Module isn't enabled. When I did it breaks things. See this guy: www.sitefinity.com/.../turning-on-feather-caused-unable-to-upgrade-database-schema-warnings-and-error
In that case, I upgraded Feather and all of its nuget dependencies THEN turned on the Feather module. I'll try again and see if it works this time.
It's working now. All of it. I upgraded Feather nuget packages, built it, turned on the Feather module, the project didn't reinitialize, and all was good.
Yes, without the Feather module being activated, things won't work. I am happy you resolved it, thanks for the update!