From f49159d2d08cd6e504078b2cfca73cf8caa48455 Mon Sep 17 00:00:00 2001 From: Tom Fulton Date: Sun, 2 Mar 2014 00:38:34 -0700 Subject: [PATCH] Add option to make "collapsing" feature optional * View: Prevent collapse/expand depending on config option, add class when enabled * Config: Add option to view, set default to enabled for new datatypes * CSS: Revert to normal cursor when collapsing disabled * Note, this is a breaking change - you'll need set `Enable Collapsing?` to `true` on any existing Archetypes to retain the behavior. --- app/controllers/config.controller.js | 2 +- app/controllers/controller.js | 4 ++++ app/less/archetype.less | 15 ++++++++++++--- app/views/archetype.config.html | 4 ++++ app/views/archetype.html | 2 +- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/app/controllers/config.controller.js b/app/controllers/config.controller.js index 9ad4d38..4aa1899 100644 --- a/app/controllers/config.controller.js +++ b/app/controllers/config.controller.js @@ -6,7 +6,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio //define empty items var newPropertyModel = '{"alias": "", "remove": false, "collapse": false, "label": "", "helpText": "", "dataTypeId": "-88", "value": ""}'; var newFieldsetModel = '{"alias": "", "remove": false, "collapse": false, "labelTemplate": "", "icon": "", "label": "", "properties": [' + newPropertyModel + ']}'; - var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "fieldsets": [' + newFieldsetModel + ']}'); + var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "fieldsets": [' + newFieldsetModel + ']}'); //ini the model $scope.model.value = $scope.model.value || defaultFieldsetConfigModel; diff --git a/app/controllers/controller.js b/app/controllers/controller.js index 1e603cd..bef94a1 100644 --- a/app/controllers/controller.js +++ b/app/controllers/controller.js @@ -133,6 +133,10 @@ //helper for expanding/collapsing fieldsets $scope.focusFieldset = function(fieldset){ + + if (!$scope.model.config.enableCollapsing) { + return; + } var iniState; diff --git a/app/less/archetype.less b/app/less/archetype.less index f008824..e395d21 100644 --- a/app/less/archetype.less +++ b/app/less/archetype.less @@ -21,11 +21,20 @@ font-weight: bold; } - &:hover { + label:hover { + cursor: default; + } + + &.enableCollapsing:hover { cursor: pointer; - label span { - text-decoration: underline; + label { + span { + text-decoration: underline; + } + &:hover { + cursor: pointer; + } } } diff --git a/app/views/archetype.config.html b/app/views/archetype.config.html index b7f3cc5..b2a7e00 100644 --- a/app/views/archetype.config.html +++ b/app/views/archetype.config.html @@ -97,6 +97,10 @@ +
+ + +
diff --git a/app/views/archetype.html b/app/views/archetype.html index 5877477..3069263 100644 --- a/app/views/archetype.html +++ b/app/views/archetype.html @@ -12,7 +12,7 @@