Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions templates/ItemTemplates/ContentApp/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "UmbracoPackageTeam",
"classifications": [
"Web",
"Umbraco",
"ContentApp"
],
"tags": {
"language": "JavaScript",
"type": "item"
},

"identity": "Umbraco.Templates.Items.ContentApp",
"groupIdentity": "Umbraco.Templates.Items.ContentApp",

"name": "Umbraco Content App",
"shortName": "umbraco-contentapp",
"description": "Files to add a content app to an Umbraco v10 project",

"sourceName": "UmbracoPackage.1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<language alias="en" intName="English (UK)" localName="English (UK)" lcid="" culture="en-GB">
<area alias="UmbracoPackage.1">
<key alias="contentAppHeader">UmbracoPackage.1 super content app</key>
<key alias="contentAppDesc">My super awesome content app</key>
</area>
</language>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @ngdoc
*
* @name: contentAppController
* @description: code for a content app in the umbraco back office
*
*/
(function () {
'use strict';

function contentAppController() {

var vm = this;
vm.loading = true;
vm.message = "";

function init() {
getInfo();
}

function getInfo() {
vm.message = "Content App init() has run";
vm.loading = false;
}

// call init, when controller is loaded
init();
}

angular.module('umbraco')
.controller('umbracopackage__1ContentAppController', contentAppController);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div ng-controller="umbracopackage__1ContentAppController as vm">

<umb-load-indicator ng-if="vm.loading"></umb-load-indicator>

<div ng-if="!vm.loading">
<umb-box>
<umb-box-header title-key="UmbracoPackage.1_contentAppHeader"
description-key="UmbracoPackage.1_contentAppDesc">
</umb-box-header>
<umb-box-content>
<h4>{{vm.message}}</h4>
</umb-box-content>

</umb-box>
</div>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"javascript": [
"~/App_Plugins/UmbracoPackage.1/ContentApp/contentapp.controller.js"
],
"contentApps": [
{
"name": "My App", // required - the name that appears under the icon
"alias": "umbracopackage._1-contentapp", // required - unique alias for your app
"weight": 0, // optional, default is 0, use values between -99 and +99 to appear between the existing Content (-100) and Info (100) apps
"icon": "icon-cupcake", // required - the icon to use
"view": "~/App_Plugins/UmbracoPackage.1/ContentApp/contentapp.html", // required - the location of the view file
"show": [
"+content/*" // show app for all content types
]
}
]
}
22 changes: 22 additions & 0 deletions templates/ItemTemplates/Dashboard/.template.config/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "UmbracoPackageTeam",
"classifications": [
"Web",
"Umbraco",
"Dashboard"
],
"tags": {
"language": "C#",
"type": "item"
},

"identity": "Umbraco.Templates.Items.Dashboard",
"groupIdentity": "Umbraco.Templates.Items.Dashboard",

"name": "Umbraco Dashboard Item",
"shortName": "umbraco-dashboard",
"description": "Umbraco dashboard files",

"sourceName": "UmbracoPackage.1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<language alias="en" intName="English (UK)" localName="English (UK)" lcid="" culture="en-GB">
<area alias="UmbracoPackage.1">
<key alias="dashboardHeader">UmbracoPackage.1 super dashboard</key>
<key alias="dashboardDesc">My super awesome dashboard</key>
</area>
<area alias="dashboardTabs">
<key alias="umbracopackage._1-dashboard">UmbracoPackage.1</key>
</area>

</language>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @ngdoc
*
* @name: dashboardController
* @description: code for a dashboard in the umbraco back office
*
*/
(function () {
'use strict';

function dashboardController($scope,
notificationsService,
umbracopackage__1DashboardService) {

var vm = this;
vm.loading = true;
vm.info = {};

function init() {
getServerInfo();
}

// ask the server what version it is and what time it things it is.
function getServerInfo() {
umbracopackage__1DashboardService.getServerInfo()
.then(function (result) {
vm.info = result.data;
vm.loading = false;
}, function (error) {
console.warn(error);
notificationsService.error('Error', 'Unable to get the server info');
});
}

// call init, when controller is loaded
init();
}

angular.module('umbraco')
.controller('umbracopackage__1DashboardController', dashboardController);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div ng-controller="umbracoproject1DashboardController as vm">

<umb-load-indicator ng-if="vm.loading"></umb-load-indicator>

<div ng-if="!vm.loading">
<umb-box>
<umb-box-header title-key="UmbracoProject1_dashboardHeader"
description-key="UmbracoProject1_dashboardDesc">
</umb-box-header>
<umb-box-content>
<h4>Server Time : {{vm.info | date:'medium'}}</h4>
</umb-box-content>

</umb-box>
</div>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @ngdoc
*
* @name: dashboardService
* @description: provides an interface between the javascript dashboard and our
* backoffice api.
*/
(function () {
'use strict';

function dashboardService($http) {

var serviceRoot = Umbraco.Sys.ServerVariables.umbracopackage__1.dashboardController;

return {
getServerInfo: getServerInfo
}

/////

function getServerInfo() {
return $http.get(serviceRoot + "GetServerInfo");
}
};

angular.module('umbraco')
.factory('umbracopackage__1DashboardService', dashboardService);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"javascript": [
"~/App_Plugins/UmbracoPackage.1/dashboard/dashboard.service.js",
"~/App_Plugins/UmbracoPackage.1/dashboard/dashboard.controller.js"
],
"dashboards": [
{
"alias": "umbracopackage._1-dashboard",
"sections": [
"content"
],
"view": "~/App_Plugins/UmbracoPackage.1/dashboard/dashboard.html"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Web.BackOffice.Controllers;

namespace UmbracoPackage._1.Controllers;

public class DashboardApiController : UmbracoAuthorizedApiController
{
/// <summary>
/// GetApi - Called in our ServerVariablesParser.Parsing event handler
/// this gets the URL of this API, so we don't have to hardwire it anywhere
/// </summary>
[HttpGet]
public bool GetApi() => true;

/// <summary>
/// Simple call return the time,
/// </summary>
/// <returns></returns>
[HttpGet]
public DateTime GetServerInfo() => DateTime.UtcNow;
}
34 changes: 34 additions & 0 deletions templates/ItemTemplates/Dashboard/Controllers/DashboardComposer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.DependencyInjection;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Core.Notifications;
using Umbraco.Extensions;

namespace UmbracoPackage._1.Controllers;

public class DashboardComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
builder
.AddNotificationHandler<ServerVariablesParsingNotification,
DashboardServerVariablesParserNotificationHandler>();
}
}

public class DashboardServerVariablesParserNotificationHandler : INotificationHandler<ServerVariablesParsingNotification>
{
private readonly LinkGenerator _linkGenerator;

public DashboardServerVariablesParserNotificationHandler(LinkGenerator linkGenerator)
{
_linkGenerator = linkGenerator;
}
public void Handle(ServerVariablesParsingNotification notification)
{
notification.ServerVariables.Add("umbracopackage__1", new Dictionary<string, object>
{
{ "dashboardController", _linkGenerator.GetUmbracoApiServiceBaseUrl<DashboardApiController>(controller => controller.GetApi()) }
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "UmbracoPackageTeam",
"classifications": [
"Web",
"Umbraco",
"PropertyEditor"
],
"tags": {
"language": "JavaScript",
"type": "item"
},

"identity": "Umbraco.Templates.Items.PropertyEditor",
"groupIdentity": "Umbraco.Templates.Items.PropertyEditor",

"name": "Umbraco Property Editor Item",
"shortName": "umbraco-property-editor",
"description": "Umbraco property editor files",

"sourceName": "UmbracoPackage.1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @ngdoc
*
* @name: editorController
* @description: code for a property editor in the umbraco back office
*
*/
(function () {
'use strict';

function editorController() {

var vm = this;

function init() {
}

// call init, when controller is loaded
init();
}

angular.module('umbraco')
.controller('umbracopackage__1EditorController', editorController);
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div ng-controller="umbracopackage__1EditorController">
<p>Add your markup here</p>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"javascript": [
"~/App_Plugins/UmbracoPackage.1/PropertyEditor/editor.controller.js"
],
"propertyEditors": [
{
/*this must be a unique alias*/
"alias": "umbracopackage._1-editor",
/*the name*/
"name": "My editor",
/*the icon*/
"icon": "icon-code",
/*grouping for "Select editor" dialog*/
"group": "Rich Content",
/*the HTML file we will load for the editor*/
"editor": {
"view": "~/App_Plugins/UmbracoPackage.1/PropertyEditor/editor.html"
}
}
]
}
2 changes: 2 additions & 0 deletions templates/Umbraco.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
</PropertyGroup>

<ItemGroup>
<Compile Remove="ItemTemplates\**" />
<Content Include="icon.png" Visible="false" />
<Content Include="ItemTemplates\**" Exclude="bin;obj" />
<Content Include="UmbracoPackage\**" Exclude="bin;obj" />
<Content Include="UmbracoProject\**" Exclude="bin;obj" />
<Content Include="..\src\Umbraco.Web.UI\Program.cs">
Expand Down