Fixes getScaffold issue, starts adding Create dialog for doc types

This commit is contained in:
Shannon
2015-06-08 13:10:52 +02:00
parent bbb4a25070
commit 08762e5a00
4 changed files with 67 additions and 5 deletions

View File

@@ -112,13 +112,13 @@ function contentTypeResource($q, $http, umbRequestHelper) {
'Failed to retrieve all content types');
},
getEmpty: function () {
getScaffold: function () {
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"contentTypeApiBaseUrl",
"getEmpty")),
"GetEmpty")),
'Failed to retrieve content type scaffold');
},

View File

@@ -0,0 +1,45 @@
<div class="umb-dialog-body with-footer" ng-controller="Umbraco.Editors.DocumentType.CreateController">
<div class="umb-pane">
<h5><localize key="create_createUnder">Create a page under</localize> {{currentNode.name}}</h5>
<p class="abstract" ng-hide="allowedTypes">
<localize key="create_noDocumentTypes" />
</p>
<ul class="umb-actions umb-actions-child">
<li ng-repeat="docType in allowedTypes | orderBy:'name':false">
<a href="#content/content/edit/{{currentNode.id}}?doctype={{docType.alias}}&create=true" ng-click="nav.hideNavigation()">
<i class="large {{docType.icon}}"></i>
<span class="menu-label">
{{docType.name}}
<small>
{{docType.description}}
</small>
</span>
</a>
</li>
<!--
<li class="add">
<a href="#settings/documenttype/create/{{currentNode.id}}?doctype={{docType.alias}}&create=true" ng-click="nav.hideNavigation()">
<i class="large icon-add"></i>
<span class="menu-label">
Create a new document type
<small>
Design and configure a new document type
</small>
</span>
</a>
</li> -->
</ul>
</div>
</div>
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<button class="btn" ng-click="nav.hideDialog(true)">
<localize key="buttons_somethingElse">Do something else</localize>
</button>
</div>

View File

@@ -0,0 +1,16 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.DocumentType.CreateController
* @function
*
* @description
* The controller for the document type creation dialog
*/
function docTypeCreateController($scope, $routeParams, contentTypeResource, iconHelper) {
contentTypeResource.getAllowedTypes($scope.currentNode.id).then(function(data) {
$scope.allowedTypes = iconHelper.formatContentTypeIcons(data);
});
}
angular.module('umbraco').controller("Umbraco.Editors.DocumentType.CreateController", docTypeCreateController);

View File

@@ -9,6 +9,7 @@ using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core.Services;
namespace Umbraco.Web.Trees
{
@@ -36,14 +37,14 @@ namespace Umbraco.Web.Trees
if (id == Constants.System.Root.ToInvariantString())
{
// root actions
menu.Items.Add<CreateChildEntity, ActionNew>(ui.Text("actions", ActionNew.Instance.Alias));
menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
menu.Items.Add<CreateChildEntity, ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)));
return menu;
}
else
{
//delete doc type
menu.Items.Add<ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias));
menu.Items.Add<ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
}
return menu;