@@ -26,6 +26,14 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
2626 $scope . selectedDocType = false ;
2727 $scope . selectedDocTypeAlias = '' ;
2828 $scope . selectedDocTypeName = '' ;
29+
30+ // TODO: pull from API?
31+ $scope . builtInProperties = [ { name : "Id" , alias : "id" } , { name : "Name" , alias : "name" } , { name : "Url" , alias : "url" } ,
32+ { name : "Url Absolute" , alias : "urlAbsolute" } , { name : "Creator Name" , alias : "creatorName" } , { name : "Writer Name" , alias : "writerName" } ,
33+ { name : "Create Date" , alias : "createDate" } , { name : "Update Date" , alias : "updateDate" } ,
34+ { name : "Document Type Alias" , alias : "documentTypeAlias" } , { name : "Is Visible" , alias : "isVisible" } ,
35+ { name : "Index" , alias : "index" } , { name : "Level" , alias : "level" } , { name : "Parent" , alias : "parent" } ,
36+ { name : "Sort Order" , alias : "sortOrder" } , { name : "Is First" , alias : "isFirst" } , { name : "Is Last" , alias : "isLast" } ] ;
2937 } ;
3038
3139 /**
@@ -150,15 +158,18 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
150158 * with the matching `propertyAlias`.
151159 * @param {string } docTypeAlias
152160 * @param {string } propertyAlias
161+ * @param {boolean } isBuiltInProperty
153162 * @returns {boolean }
154163 */
155- $scope . isPropertyVisible = function ( docTypeAlias , propertyAlias ) {
164+ $scope . isPropertyVisible = function ( docTypeAlias , propertyAlias , isBuiltInProperty ) {
156165 var isVisible = false ;
157166 $scope . pendingPermissions . forEach ( function ( permission ) {
158167 if ( permission . alias === docTypeAlias ) {
159168 permission . properties . forEach ( function ( property ) {
160169 if ( property . alias === propertyAlias ) {
161- isVisible = true ;
170+ if ( property . isBuiltInProperty === isBuiltInProperty ) {
171+ isVisible = true ;
172+ }
162173 }
163174 } )
164175 }
@@ -228,6 +239,7 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
228239 */
229240 $scope . onPropertyVisibilityChange = function ( e ) {
230241 var propertyAlias = e . target . getAttribute ( 'data-alias' ) ;
242+ var isBuiltInProperty = e . target . getAttribute ( 'data-isBuiltInProperty' ) ;
231243 var isChecked = e . target . checked ;
232244 var doesDocTypeHavePermissions = false ;
233245 var doesPropertyPermissionExist = false ;
@@ -243,7 +255,7 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
243255 if ( ! doesPropertyPermissionExist ) {
244256 permission . properties . push ( {
245257 alias : propertyAlias ,
246- isBuiltInProperty : false , // TODO: Need to know how to get true value for this.
258+ isBuiltInProperty : isBuiltInProperty ,
247259 notes : '' ,
248260 permission : 'Read'
249261 } ) ;
@@ -255,7 +267,7 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
255267 alias : $scope . selectedDocTypeAlias ,
256268 properties : [ {
257269 alias : propertyAlias ,
258- isBuiltInProperty : false , // TODO: Need to know how to get true value for this.
270+ isBuiltInProperty : isBuiltInProperty ,
259271 notes : '' ,
260272 permission : 'Read'
261273 } ]
0 commit comments