@@ -26,6 +26,14 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
26
26
$scope . selectedDocType = false ;
27
27
$scope . selectedDocTypeAlias = '' ;
28
28
$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" } ] ;
29
37
} ;
30
38
31
39
/**
@@ -150,15 +158,18 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
150
158
* with the matching `propertyAlias`.
151
159
* @param {string } docTypeAlias
152
160
* @param {string } propertyAlias
161
+ * @param {boolean } isBuiltInProperty
153
162
* @returns {boolean }
154
163
*/
155
- $scope . isPropertyVisible = function ( docTypeAlias , propertyAlias ) {
164
+ $scope . isPropertyVisible = function ( docTypeAlias , propertyAlias , isBuiltInProperty ) {
156
165
var isVisible = false ;
157
166
$scope . pendingPermissions . forEach ( function ( permission ) {
158
167
if ( permission . alias === docTypeAlias ) {
159
168
permission . properties . forEach ( function ( property ) {
160
169
if ( property . alias === propertyAlias ) {
161
- isVisible = true ;
170
+ if ( property . isBuiltInProperty === isBuiltInProperty ) {
171
+ isVisible = true ;
172
+ }
162
173
}
163
174
} )
164
175
}
@@ -228,6 +239,7 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
228
239
*/
229
240
$scope . onPropertyVisibilityChange = function ( e ) {
230
241
var propertyAlias = e . target . getAttribute ( 'data-alias' ) ;
242
+ var isBuiltInProperty = e . target . getAttribute ( 'data-isBuiltInProperty' ) ;
231
243
var isChecked = e . target . checked ;
232
244
var doesDocTypeHavePermissions = false ;
233
245
var doesPropertyPermissionExist = false ;
@@ -243,7 +255,7 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
243
255
if ( ! doesPropertyPermissionExist ) {
244
256
permission . properties . push ( {
245
257
alias : propertyAlias ,
246
- isBuiltInProperty : false , // TODO: Need to know how to get true value for this.
258
+ isBuiltInProperty : isBuiltInProperty ,
247
259
notes : '' ,
248
260
permission : 'Read'
249
261
} ) ;
@@ -255,7 +267,7 @@ angular.module("umbraco").controller("graphql.for.umbraco.dashboardcontroller",
255
267
alias : $scope . selectedDocTypeAlias ,
256
268
properties : [ {
257
269
alias : propertyAlias ,
258
- isBuiltInProperty : false , // TODO: Need to know how to get true value for this.
270
+ isBuiltInProperty : isBuiltInProperty ,
259
271
notes : '' ,
260
272
permission : 'Read'
261
273
} ]
0 commit comments