Update comments
This commit is contained in:
@@ -3,12 +3,15 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
//$scope.model.value = "";
|
||||
//console.log($scope.model.value);
|
||||
|
||||
//define empty items
|
||||
var newPropertyModel = '{alias: "", remove: false, collapse: false, label: "", helpText: "", view: "", value: "", config: ""}';
|
||||
var newFieldsetModel = '{alias: "", remove: false, collapse: false, labelTemplate: "", tooltip: "", icon: "", label: "", headerText: "", footerText: "", properties:[' + newPropertyModel + ']}';
|
||||
var defaultFieldsetConfigModel = eval("({showAdvancedOptions: false, hideFieldsetToolbar: false, enableMultipleFieldsets: false, hideFieldsetControls: false, hideFieldsetLabels: false, hidePropertyLabel: false, maxFieldsets: null, fieldsets: [" + newFieldsetModel + "]})");
|
||||
|
||||
//ini the model
|
||||
$scope.model.value = $scope.model.value || defaultFieldsetConfigModel;
|
||||
|
||||
//ini the render model
|
||||
initConfigRenderModel();
|
||||
|
||||
//get the available views
|
||||
@@ -16,6 +19,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
$scope.availableViews = data;
|
||||
});
|
||||
|
||||
//config for the sorting
|
||||
$scope.sortableOptions = {
|
||||
axis: 'y',
|
||||
cursor: "move",
|
||||
@@ -28,6 +32,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
}
|
||||
};
|
||||
|
||||
//function that determines how to manage expanding/collapsing fieldsets
|
||||
$scope.focusFieldset = function(fieldset){
|
||||
var iniState;
|
||||
|
||||
@@ -58,9 +63,11 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
fieldset.collapse = !iniState;
|
||||
}
|
||||
}
|
||||
//ini
|
||||
|
||||
//ini the fieldsets
|
||||
$scope.focusFieldset();
|
||||
|
||||
//function that determines how to manage expanding/collapsing properties
|
||||
$scope.focusProperty = function(properties, property){
|
||||
var iniState;
|
||||
|
||||
@@ -141,6 +148,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
return count;
|
||||
}
|
||||
|
||||
//determines how many properties are visible
|
||||
function countVisibleProperty(fieldset)
|
||||
{
|
||||
var count = 0;
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
angular.module("umbraco").controller("Imulus.ArchetypeController", function ($scope, $http, $interpolate, assetsService, angularHelper, notificationsService) {
|
||||
|
||||
//$scope.model.value = "";
|
||||
//set default value of the model
|
||||
//this works by checking to see if there is a model; then cascades to the default model then to an empty fieldset
|
||||
|
||||
//get a reference to the current form
|
||||
var form = angularHelper.getCurrentForm($scope);
|
||||
|
||||
//set the config equal to our prevalue config
|
||||
$scope.model.config = $scope.model.config.archetypeConfig;
|
||||
|
||||
//ini the model
|
||||
$scope.model.value = $scope.model.value || { fieldsets: [getEmptyRenderFieldset($scope.model.config.fieldsets[0])] };
|
||||
|
||||
//ini
|
||||
//ini the render model
|
||||
$scope.archetypeRenderModel = {};
|
||||
initArchetypeRenderModel();
|
||||
|
||||
@@ -31,10 +32,7 @@
|
||||
return parsedTemplate;
|
||||
};
|
||||
|
||||
/* add/remove/sort */
|
||||
|
||||
//defines the options for the jquery sortable
|
||||
//i used an ng-model="archetypeRenderModel" so the sort updates the right model
|
||||
//sort config
|
||||
$scope.sortableOptions = {
|
||||
axis: 'y',
|
||||
cursor: "move",
|
||||
@@ -128,7 +126,7 @@
|
||||
return (typeof property !== 'undefined') ? property.value : '';
|
||||
};
|
||||
|
||||
//helper for collapsing
|
||||
//helper for expanding/collapsing fieldsets
|
||||
$scope.focusFieldset = function(fieldset){
|
||||
|
||||
var iniState;
|
||||
@@ -154,7 +152,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
//ini
|
||||
//ini the fieldset expand/collapse
|
||||
$scope.focusFieldset();
|
||||
|
||||
//developerMode helpers
|
||||
@@ -213,7 +211,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
//helper to add an empty fieldset
|
||||
//helper to add an empty fieldset to the render model
|
||||
function getEmptyRenderFieldset (fieldsetModel)
|
||||
{
|
||||
return eval("({ alias: '" + fieldsetModel.alias + "', remove: false, properties: []})");
|
||||
@@ -273,6 +271,7 @@
|
||||
return validation;
|
||||
}
|
||||
|
||||
//helper to lookup validity when given a fieldsetIndex and property alias
|
||||
$scope.getPropertyValidity = function(fieldsetIndex, alias)
|
||||
{
|
||||
if($scope.archetypeRenderModel.fieldsets[fieldsetIndex])
|
||||
|
||||
Reference in New Issue
Block a user