Last active
June 12, 2022 15:52
-
-
Save ivaneftimov/bb13fd06495f771bd0186e9ec61cce84 to your computer and use it in GitHub Desktop.
Webinar widget - 02 | Added simple widget designer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SitefinityWebapp\Mvc\Scripts\Webinar\DesignerView-Friendly.js | |
| angular.module('designer') | |
| .controller('FriendlyCtrl', ['$scope', 'propertyService', function ($scope, propertyService) { | |
| $scope.feedback.showLoadingIndicator = true; | |
| // Get widget properies and load them in the controller's scope | |
| propertyService.get() | |
| .then(function (data) { | |
| if (data) { | |
| $scope.properties = propertyService.toAssociativeArray(data.Items); | |
| if ($scope.properties.Start.PropertyValue && !($scope.properties.Start.PropertyValue instanceof Date)) { | |
| var startDate = $scope.properties.Start.PropertyValue; | |
| // This parsing is specific for UK dates. It may be different depending on your website culture. | |
| // Dealing with dates is always a complex matter in the programming :) | |
| $scope.properties.Start.PropertyValue = new Date(startDate.split('/')[2], startDate.split('/')[1] - 1, startDate.split('/')[0]); | |
| } | |
| if ($scope.properties.End.PropertyValue && !($scope.properties.End.PropertyValue instanceof Date)) { | |
| var endDate = $scope.properties.End.PropertyValue; | |
| $scope.properties.End.PropertyValue = new Date(endDate.split('/')[2], endDate.split('/')[1] - 1, endDate.split('/')[0]); | |
| } | |
| } | |
| }, function (data) { | |
| $scope.feedback.showError = true; | |
| if (data) { | |
| $scope.feedback.errorMessage = data.Detail; | |
| } | |
| }) | |
| .finally(function () { | |
| $scope.feedback.showLoadingIndicator = false; | |
| }); | |
| }]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @* SitefinityWebapp\Mvc\Views\Webinar\DesignerView.Friendly.cshtml *@ | |
| <div> | |
| <label>Webinar title: </label> | |
| <input type="text" ng-model="properties.Title.PropertyValue" /> | |
| </div> | |
| <div> | |
| <label>Description: </label> | |
| <input type="text" ng-model="properties.Description.PropertyValue" /> | |
| </div> | |
| <div> | |
| <label>Webinar starts at: </label> | |
| <!-- input of type date will not work in IE and Firefox. Use Chrome, or Edge to see the result --> | |
| <input type="date" ng-model="properties.Start.PropertyValue" /> | |
| </div> | |
| <div> | |
| <label>Webinar ends at: </label> | |
| <!-- input of type date will not work in IE and Firefox. Use Chrome, or Edge to see the result --> | |
| <input type="date" ng-model="properties.End.PropertyValue" /> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment