Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContentTypeAlias undefined for settings section #78

Merged
merged 3 commits into from
Nov 9, 2017
Merged
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
28 changes: 23 additions & 5 deletions src/Our.Umbraco.Vorto/Web/UI/App_Plugins/Vorto/js/vorto.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
'Our.Umbraco.Resources.Vorto.vortoResources',
'Our.Umbraco.Services.Vorto.vortoLocalStorageService',
function ($scope, $rootScope, appState, editorState, formHelper, umbPropEditorHelper, vortoResources, localStorageService) {

var currentSection = appState.getSectionState("currentSection");


// Get node context
// DTGE/NC expose the context on the scope
// to avoid overwriting the editorState
Expand Down Expand Up @@ -295,6 +293,21 @@
}
}

var getCurrentSection = function() {
var currentSection = appState.getSectionState("currentSection");

if (currentSection === "settings") {
if (window.location.hash.match(new RegExp("mediaTypes"))) {
currentSection = "media";
}
else if (window.location.hash.match(new RegExp("documentTypes"))) {
currentSection = "content";
}
}

return currentSection;
}

// Load the datatype
vortoResources.getDataTypeById($scope.model.config.dataType.guid).then(function (dataType) {

Expand All @@ -307,8 +320,13 @@
// Get the property alias
var propAlias = $scope.model.propertyAlias || $scope.model.alias;

// Get the current properties datatype
vortoResources.getDataTypeByAlias(currentSection, nodeContext.contentTypeAlias, propAlias).then(function (dataType2) {
// Get the content type alias
var contentTypeAlias = nodeContext.contentTypeAlias || nodeContext.alias;

var currentSection = getCurrentSection();

// Get the current properties datatype
vortoResources.getDataTypeByAlias(currentSection, contentTypeAlias, propAlias).then(function (dataType2) {

$scope.model.value.dtdGuid = dataType2.guid;

Expand Down