Updates the content type editor to have the list view customization inline instead of in a dialog.

This commit is contained in:
Shannon
2014-10-02 18:52:38 +10:00
parent 3400c52e45
commit c8264cff1e
18 changed files with 258 additions and 155 deletions

View File

@@ -242,20 +242,32 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
//get our angular navigation service
var injector = getRootInjector();
var rootScope = injector.get("$rootScope");
var angularHelper = injector.get("angularHelper");
var navService = injector.get("navigationService");
var locationService = injector.get("$location");
//if the path doesn't start with "/" or with the root path then
//prepend the root path
if (!strLocation.startsWith("/")) {
strLocation = this._rootPath + "/" + strLocation;
}
else if (strLocation.length >= this._rootPath.length
&& strLocation.substr(0, this._rootPath.length) != this._rootPath) {
strLocation = this._rootPath + "/" + strLocation;
}
var self = this;
navService.loadLegacyIFrame(strLocation);
angularHelper.safeApply(rootScope, function() {
if (strLocation.startsWith("#")) {
locationService.path(strLocation.trimStart("#")).search("");
}
else {
//if the path doesn't start with "/" or with the root path then
//prepend the root path
if (!strLocation.startsWith("/")) {
strLocation = self._rootPath + "/" + strLocation;
}
else if (strLocation.length >= self._rootPath.length
&& strLocation.substr(0, self._rootPath.length) != self._rootPath) {
strLocation = self._rootPath + "/" + strLocation;
}
navService.loadLegacyIFrame(strLocation);
}
});
},
getFakeFrame : function() {

View File

@@ -1,50 +0,0 @@
/**
* @ngdoc controller
* @name Umbraco.Editors.ContentType.ListViewController
* @function
*
* @description
* The controller for the customize list view dialog for content types
*/
function ContentTypeListViewController($scope, contentTypeResource, dataTypeResource) {
function init() {
contentTypeResource.getAssignedListViewDataType($scope.dialogOptions.contentTypeId)
.then(function(d) {
$scope.listViewName = d.name;
$scope.isSystem = d.isSystem;
$scope.dataTypeId = d.id;
});
}
$scope.listViewName = "";
$scope.isSystem = true;
$scope.dataTypeId = 0;
$scope.createCustom = function() {
dataTypeResource.save({
id: 0,
name: "List View - " + $scope.dialogOptions.contentTypeAlias,
selectedEditor: "Umbraco.ListView"
}, [], true)
.then(function(d) {
$scope.listViewName = d.name;
$scope.isSystem = d.isSystem;
$scope.dataTypeId = d.id;
});
}
$scope.removeCustom = function() {
if (!$scope.isSystem && $scope.dataTypeId > 0) {
dataTypeResource.deleteById($scope.dataTypeId)
.then(function() {
init();
});
}
}
init();
}
angular.module("umbraco").controller("Umbraco.Editors.ContentType.ListViewController", ContentTypeListViewController);

View File

@@ -1,43 +0,0 @@
<div class="umb-panel" ng-controller=" Umbraco.Editors.ContentType.ListViewController">
<div class="umb-panel-body no-header with-footer compact">
<h5><localize key="editcontenttype_customizeListView">Customize list view</localize> {{currentNode.name}}</h5>
<umb-pane>
<umb-control-group label="@editcontenttype_currentListView">
<strong>{{listViewName}}</strong>
<em ng-if="isSystem">&nbsp;(<localize key="general_default">default</localize>)</em>
<br/>
<a href="#/developer/datatype/edit/{{dataTypeId}}" class="text-info">
<localize key="general_edit">Edit</localize>
</a>
</umb-control-group>
<umb-control-group ng-if="isSystem == 1">
<div>
<button class="btn" type="button" ng-click="createCustom()">
<localize key="editcontenttype_createListView">Create custom list view</localize>
</button>
</div>
</umb-control-group>
<umb-control-group ng-if="isSystem == 0">
<button class="btn btn-warning" type="button" ng-click="removeCustom()">
<localize key="editcontenttype_removeListView">Remove custom list view</localize>
</button>
</umb-control-group>
</umb-pane>
</div>
<div class="umb-panel-footer">
<div class="umb-el-wrap umb-panel-buttons">
<div class="btn-toolbar umb-btn-toolbar pull-right">
<a href ng-click="close()" class="btn btn-link">
<localize key="general_close">Close</localize>
</a>
</div>
</div>
</div>
</div>