diff --git a/src/Umbraco.Community.Sustainability.TestSite.10.x/Umbraco.Community.Sustainability.TestSite.10.x.csproj b/src/Umbraco.Community.Sustainability.TestSite.10.x/Umbraco.Community.Sustainability.TestSite.10.x.csproj index e7436a7..d52128b 100644 --- a/src/Umbraco.Community.Sustainability.TestSite.10.x/Umbraco.Community.Sustainability.TestSite.10.x.csproj +++ b/src/Umbraco.Community.Sustainability.TestSite.10.x/Umbraco.Community.Sustainability.TestSite.10.x.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Umbraco.Community.Sustainability.TestSite.11.x/Umbraco.Community.Sustainability.TestSite.11.x.csproj b/src/Umbraco.Community.Sustainability.TestSite.11.x/Umbraco.Community.Sustainability.TestSite.11.x.csproj index 37b99a1..ef7aa38 100644 --- a/src/Umbraco.Community.Sustainability.TestSite.11.x/Umbraco.Community.Sustainability.TestSite.11.x.csproj +++ b/src/Umbraco.Community.Sustainability.TestSite.11.x/Umbraco.Community.Sustainability.TestSite.11.x.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Umbraco.Community.Sustainability.TestSite.12.x/Umbraco.Community.Sustainability.TestSite.12.x.csproj b/src/Umbraco.Community.Sustainability.TestSite.12.x/Umbraco.Community.Sustainability.TestSite.12.x.csproj index fb8ea91..39a558a 100644 --- a/src/Umbraco.Community.Sustainability.TestSite.12.x/Umbraco.Community.Sustainability.TestSite.12.x.csproj +++ b/src/Umbraco.Community.Sustainability.TestSite.12.x/Umbraco.Community.Sustainability.TestSite.12.x.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Umbraco.Community.Sustainability.TestSite.13.x/Umbraco.Community.Sustainability.TestSite.13.x.csproj b/src/Umbraco.Community.Sustainability.TestSite.13.x/Umbraco.Community.Sustainability.TestSite.13.x.csproj index 33d2339..7d9ab69 100644 --- a/src/Umbraco.Community.Sustainability.TestSite.13.x/Umbraco.Community.Sustainability.TestSite.13.x.csproj +++ b/src/Umbraco.Community.Sustainability.TestSite.13.x/Umbraco.Community.Sustainability.TestSite.13.x.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Umbraco.Community.Sustainability/Models/ExternalResourceGroup.cs b/src/Umbraco.Community.Sustainability/Models/ExternalResourceGroup.cs index f75c623..019c94f 100644 --- a/src/Umbraco.Community.Sustainability/Models/ExternalResourceGroup.cs +++ b/src/Umbraco.Community.Sustainability/Models/ExternalResourceGroup.cs @@ -47,7 +47,7 @@ public enum ResourceGroupType Scripts, [Display(Name = "Links")] Links, - [Display(Name = "Css")] + [Display(Name = "CSS")] Css, [Display(Name = "Other")] Other diff --git a/src/Umbraco.Community.Sustainability/SustainabilityManifestFilter.cs b/src/Umbraco.Community.Sustainability/SustainabilityManifestFilter.cs index 391436f..ea6d8db 100644 --- a/src/Umbraco.Community.Sustainability/SustainabilityManifestFilter.cs +++ b/src/Umbraco.Community.Sustainability/SustainabilityManifestFilter.cs @@ -14,8 +14,6 @@ public void Filter(List manifests) Version = assembly.GetName()?.Version?.ToString(3) ?? "0.1.0", AllowPackageTelemetry = true, Scripts = new string[] { - // List any Script files - // Urls should start '/App_Plugins/UmbracoCommunitySustainability/' not '/wwwroot/UmbracoCommunitySustainability/', e.g. "/App_Plugins/UmbracoCommunitySustainability/js/sustainability.resource.js", "/App_Plugins/UmbracoCommunitySustainability/js/sustainability-stats.controller.js", "/App_Plugins/UmbracoCommunitySustainability/js/sustainability-overview.controller.js", @@ -23,9 +21,7 @@ public void Filter(List manifests) }, Stylesheets = new string[] { - // List any Stylesheet files - // Urls should start '/App_Plugins/UmbracoCommunitySustainability/' not '/wwwroot/Umbraco.Community.Sustainability/', e.g. - // "/App_Plugins/UmbracoCommunitySustainability/Styles/styles.css" + "/App_Plugins/UmbracoCommunitySustainability/css/sustainability.styles.css" } }); } diff --git a/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/backoffice/sustainability/stats.html b/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/backoffice/sustainability/stats.html index 575d790..44f7f7f 100644 --- a/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/backoffice/sustainability/stats.html +++ b/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/backoffice/sustainability/stats.html @@ -2,11 +2,7 @@ - + @@ -18,42 +14,44 @@ - Scripts + Images - Styles + Scripts + Links + Css Other @@ -61,7 +59,8 @@ - {{data.NodeName}} + {{data.NodeName}} @@ -74,16 +73,20 @@ + + {{data.Images}} + + {{data.Scripts}} - {{data.Images}} + {{data.Links}} - {{data.Styles}} + {{data.Css}} @@ -103,14 +106,12 @@
- +
- +

No data to show yet.

diff --git a/src/Umbraco.Community.Sustainability/wwwroot/Umbraco.Community.Sustainability/css/sustainability.styles.css b/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/css/sustainability.styles.css similarity index 100% rename from src/Umbraco.Community.Sustainability/wwwroot/Umbraco.Community.Sustainability/css/sustainability.styles.css rename to src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/css/sustainability.styles.css diff --git a/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/js/sustainability-stats.controller.js b/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/js/sustainability-stats.controller.js index 8ca44e9..041ca01 100644 --- a/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/js/sustainability-stats.controller.js +++ b/src/Umbraco.Community.Sustainability/wwwroot/UmbracoCommunitySustainability/js/sustainability-stats.controller.js @@ -1,8 +1,16 @@ -angular.module('umbraco').controller('Umbraco.Sustainability.Stats.Controller', - ['$scope', '$routeParams', 'navigationService', 'Umbraco.Sustainability.Resources.SustainabilityResource', +angular + .module("umbraco") + .controller("Umbraco.Sustainability.Stats.Controller", [ + "$scope", + "$routeParams", + "navigationService", + "Umbraco.Sustainability.Resources.SustainabilityResource", function ($scope, $routeParams, navigationService, sustainabilityResource) { - - navigationService.syncTree({ tree: $routeParams.tree, path: [-1, $routeParams.method], forceReload: false }); + navigationService.syncTree({ + tree: $routeParams.tree, + path: [-1, $routeParams.method], + forceReload: false, + }); let vm = this; @@ -12,7 +20,7 @@ angular.module('umbraco').controller('Umbraco.Sustainability.Stats.Controller', vm.pageSize = 10; vm.sustainabilityData = []; vm.sortingDesc = false; - vm.sortingColumn = 'CarbonRating'; + vm.sortingColumn = "CarbonRating"; vm.changePageNumber = changePageNumber; vm.getTagColour = sustainabilityResource.getTagColour; @@ -21,29 +29,46 @@ angular.module('umbraco').controller('Umbraco.Sustainability.Stats.Controller', init(); function init() { - sustainabilityResource.getOverviewData(vm.pageNumber, vm.pageSize, vm.sortingColumn, vm.sortingDesc).then(function (data) { - vm.sustainabilityData = data.items; + sustainabilityResource + .getOverviewData( + vm.pageNumber, + vm.pageSize, + vm.sortingColumn, + vm.sortingDesc + ) + .then(function (data) { + vm.sustainabilityData = data.items; - vm.pageNumber = data.pageNumber; - vm.pageSize = data.pageSize; - vm.totalItems = data.totalItems; - vm.totalPages = data.totalPages; + vm.pageNumber = data.pageNumber; + vm.pageSize = data.pageSize; + vm.totalItems = data.totalItems; + vm.totalPages = data.totalPages; - angular.forEach(vm.sustainabilityData, function (item) { - item.RequestDate = moment(item.RequestDate).format( - "MMM Do YYYY HH:mm:ss" - ); + angular.forEach(vm.sustainabilityData, function (item) { + item.RequestDate = moment(item.RequestDate).format( + "MMM Do YYYY HH:mm:ss" + ); - item.PageData = JSON.parse(item.PageData); - item.Scripts = item.PageData.ResourceGroups.find(x => x.Name === 'Scripts').Resources.length; - item.Images = item.PageData.ResourceGroups.find(x => x.Name === 'Images').Resources.length; - item.Styles = item.PageData.ResourceGroups.find(x => x.Name === 'Styles').Resources.length; - item.Other = item.PageData.ResourceGroups.find(x => x.Name === 'Other').Resources.length; + item.PageData = JSON.parse(item.PageData); + item.Scripts = item.PageData.ResourceGroups.find( + (x) => x.Name === "Scripts" + )?.Resources?.length; + item.Images = item.PageData.ResourceGroups.find( + (x) => x.Name === "Images" + )?.Resources?.length; + item.Css = item.PageData.ResourceGroups.find( + (x) => x.Name === "Css" + )?.Resources?.length; + item.Links = item.PageData.ResourceGroups.find( + (x) => x.Name === "Links" + )?.Resources?.length; + item.Other = item.PageData.ResourceGroups.find( + (x) => x.Name === "Other" + )?.Resources?.length; + }); + vm.loading = false; }); - - vm.loading = false; - }); } function changePageNumber(pageNumber) { @@ -54,17 +79,16 @@ angular.module('umbraco').controller('Umbraco.Sustainability.Stats.Controller', function getTagColour(carbonRating) { if (carbonRating == "E" || carbonRating == "F") { return "danger"; - } - else if (carbonRating == "D") { + } else if (carbonRating == "D") { return "warning"; - } - else return "positive"; + } else return "positive"; } function sortingHandler(columnName) { - vm.sortingDesc = vm.sortingColumn === columnName ? !vm.sortingDesc : false; + vm.sortingDesc = + vm.sortingColumn === columnName ? !vm.sortingDesc : false; vm.sortingColumn = columnName; init(); } - } + }, ]);