Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9da0aa351 | |||
| b42e411e49 | |||
| 4c4b09b187 |
@@ -58,7 +58,6 @@ module.exports = function(grunt) {
|
||||
'app/directives/archetypesubmitwatcher.js',
|
||||
'app/directives/archetypecustomview.js',
|
||||
'app/directives/archetypeLocalize.js',
|
||||
'app/directives/archetypeclickoutside.js',
|
||||
'app/services/archetypeLocalizationService.js',
|
||||
'app/helpers/sampleLabelHelpers.js',
|
||||
'app/resources/archetypePropertyEditorResource.js',
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace Archetype.Models
|
||||
[JsonProperty("hidePropertyLabel")]
|
||||
public bool HidePropertyLabel { get; set; }
|
||||
|
||||
[JsonProperty("minFieldsets", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int MinFieldsets { get; set; }
|
||||
|
||||
[JsonProperty("maxFieldsets", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int MaxFieldsets { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("1.10")]
|
||||
[assembly: AssemblyFileVersion("1.10-ui-rc1")]
|
||||
[assembly: AssemblyVersion("1.9")]
|
||||
[assembly: AssemblyFileVersion("1.9")]
|
||||
|
||||
@@ -6,7 +6,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
|
||||
//define empty items
|
||||
var newPropertyModel = '{"alias": "", "remove": false, "collapse": false, "label": "", "helpText": "", "dataTypeGuid": "0cc0eba1-9960-42c9-bf9b-60e150b429ae", "value": ""}';
|
||||
var newFieldsetModel = '{"alias": "", "remove": false, "collapse": false, "labelTemplate": "", "icon": "", "label": "", "properties": [' + newPropertyModel + ']}';
|
||||
var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "enableCloning": false, "enableDisabling": true, "enableDeepDatatypeRequests": false, "fieldsets": [' + newFieldsetModel + ']}');
|
||||
var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "minFieldsets": null, "maxFieldsets": null, "enableCollapsing": true, "enableCloning": false, "enableDisabling": true, "enableDeepDatatypeRequests": false, "fieldsets": [' + newFieldsetModel + ']}');
|
||||
|
||||
//ini the model
|
||||
$scope.model.value = $scope.model.value || defaultFieldsetConfigModel;
|
||||
|
||||
@@ -15,11 +15,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
// store the umbraco property alias to help generate unique IDs. Hopefully there's a better way to get this in the future :)
|
||||
$scope.umbracoHostPropertyAlias = $scope.$parent.$parent.model.alias;
|
||||
|
||||
$scope.overlayMenu = {
|
||||
show: false,
|
||||
style: {}
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
//hold references to helper resources
|
||||
@@ -79,54 +74,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
};
|
||||
|
||||
//handles a fieldset add
|
||||
$scope.openFieldsetPicker = function ($index, event) {
|
||||
if ($scope.canAdd() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.overlayMenu.fieldsets = [];
|
||||
_.each($scope.model.config.fieldsets, function (fieldset) {
|
||||
var icon = fieldset.icon;
|
||||
$scope.overlayMenu.fieldsets.push({
|
||||
alias: fieldset.alias,
|
||||
label: fieldset.label,
|
||||
icon: (fieldset.icon || "icon-document-dashed-line") // default icon if none is chosen
|
||||
});
|
||||
$scope.overlayMenu.index = $index;
|
||||
});
|
||||
|
||||
// sanity check
|
||||
if ($scope.overlayMenu.fieldsets.length == 0) {
|
||||
return;
|
||||
}
|
||||
if ($scope.overlayMenu.fieldsets.length == 1) {
|
||||
// only one fieldset type - no need to display the picker
|
||||
$scope.addRow($scope.overlayMenu.fieldsets[0].alias, $index);
|
||||
return;
|
||||
}
|
||||
|
||||
// calculate overlay position
|
||||
// - yeah... it's jQuery (ungh!) but that's how the Grid does it.
|
||||
var offset = $(event.target).offset();
|
||||
var scrollTop = $(event.target).closest(".umb-panel-body").scrollTop();
|
||||
if (offset.top < 400) {
|
||||
$scope.overlayMenu.style.top = 300 + scrollTop;
|
||||
}
|
||||
else {
|
||||
$scope.overlayMenu.style.top = offset.top - 150 + scrollTop;
|
||||
}
|
||||
$scope.overlayMenu.show = true;
|
||||
};
|
||||
|
||||
$scope.closeFieldsetPicker = function () {
|
||||
$scope.overlayMenu.show = false;
|
||||
};
|
||||
|
||||
$scope.pickFieldset = function (fieldsetAlias, $index) {
|
||||
$scope.closeFieldsetPicker();
|
||||
$scope.addRow(fieldsetAlias, $index);
|
||||
};
|
||||
|
||||
$scope.addRow = function (fieldsetAlias, $index) {
|
||||
if ($scope.canAdd()) {
|
||||
if ($scope.model.config.fieldsets) {
|
||||
@@ -147,7 +94,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
$scope.$broadcast("archetypeAddFieldset", {index: $index, visible: countVisible()});
|
||||
|
||||
newFieldset.collapse = $scope.model.config.enableCollapsing ? true : false;
|
||||
|
||||
$scope.focusFieldset(newFieldset);
|
||||
}
|
||||
}
|
||||
@@ -157,7 +103,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
if (confirm('Are you sure you want to remove this?')) {
|
||||
$scope.setDirty();
|
||||
$scope.model.value.fieldsets.splice($index, 1);
|
||||
$scope.$broadcast("archetypeRemoveFieldset", {index: $index});
|
||||
$scope.$broadcast("archetypeRemoveFieldset", {index: $index, visible: countVisible()});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,6 +367,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
|
||||
// recursive validation of nested fieldsets
|
||||
var nestedFieldsetsValid = true;
|
||||
|
||||
_.each(fieldset.properties, function (property) {
|
||||
if (property != null && property.value != null && property.propertyEditorAlias == "Imulus.Archetype") {
|
||||
_.each(property.value.fieldsets, function (inner) {
|
||||
@@ -460,10 +407,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
// we need to monitor the "formSubmitting" event from a custom property and broadcast our own event
|
||||
// to forcefully update the appropriate model.value's
|
||||
$scope.activeSubmitWatcher = 0;
|
||||
|
||||
$scope.submitWatcherOnLoad = function () {
|
||||
$scope.activeSubmitWatcher++;
|
||||
return $scope.activeSubmitWatcher;
|
||||
}
|
||||
|
||||
$scope.submitWatcherOnSubmit = function () {
|
||||
$scope.$broadcast("archetypeFormSubmitting");
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
angular.module("umbraco.directives")
|
||||
.directive('archetypeClickOutside', function ($timeout, $parse) {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function (scope, element, attrs, ctrl) {
|
||||
var fn = $parse(attrs.archetypeClickOutside);
|
||||
|
||||
// add click event handler (delayed so we don't trigger the callback immediately if this directive itself was triggered by a mouse click)
|
||||
$timeout(function () {
|
||||
$(document).on("click", mouseClick);
|
||||
}, 500);
|
||||
|
||||
function mouseClick(event) {
|
||||
if($(event.target).closest(element).length > 0) {
|
||||
return;
|
||||
}
|
||||
var callback = function () {
|
||||
fn(scope, { $event: event });
|
||||
};
|
||||
scope.$apply(callback);
|
||||
}
|
||||
|
||||
// unbind event
|
||||
scope.$on('$destroy', function () {
|
||||
$(document).off("click", mouseClick);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper, $timeout, $rootScope, $q, fileManager, editorState, archetypeService, archetypeCacheService) {
|
||||
angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper, $timeout, $rootScope, $q, fileManager, editorState, archetypeService, archetypeCacheService, notificationsService) {
|
||||
|
||||
var linker = function (scope, element, attrs, ngModelCtrl) {
|
||||
var configFieldsetModel = archetypeService.getFieldsetByAlias(scope.archetypeConfig.fieldsets, scope.fieldset.alias);
|
||||
@@ -114,6 +114,11 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
|
||||
archetypeService.propertyValueChanged(archetypeService.getFieldset(scope), archetypeService.getFieldsetProperty(scope));
|
||||
});
|
||||
|
||||
scope.$on('formSubmitting', function(ev, args){
|
||||
archetypeCacheService.clearInvalidations();
|
||||
archetypeCacheService.clearNotifications();
|
||||
});
|
||||
|
||||
scope.$on('archetypeFormSubmitting', function (ev, args) {
|
||||
// validate all fieldset properties
|
||||
_.each(scope.fieldset.properties, function (property) {
|
||||
@@ -135,6 +140,10 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
|
||||
// notify the linker that the property value changed
|
||||
archetypeService.propertyValueChanged(archetypeService.getFieldset(scope), archetypeService.getFieldsetProperty(scope));
|
||||
}
|
||||
|
||||
archetypeService.validateMinFieldsets(scope);
|
||||
|
||||
archetypeCacheService.notifyEditor();
|
||||
});
|
||||
|
||||
// issue 114: handle file selection on property editors
|
||||
@@ -159,6 +168,14 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
|
||||
scope.$on("archetypeRemoveFieldset", function (ev, args) {
|
||||
var validationKey = "validation-f" + args.index;
|
||||
ngModelCtrl.$setValidity(validationKey, true);
|
||||
|
||||
scope.archetypeRenderModel.fieldsets.length = args.visible;
|
||||
|
||||
archetypeService.validateMinFieldsets(scope);
|
||||
});
|
||||
|
||||
scope.$on("archetypeAddFieldset", function (ev, args) {
|
||||
archetypeService.validateMinFieldsets(scope);
|
||||
});
|
||||
|
||||
element.html(data).show();
|
||||
@@ -191,4 +208,4 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
|
||||
umbracoForm: '='
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Tilføj et element",
|
||||
"hideFieldsetControls": "Skjul fieldsets?",
|
||||
"hideFieldsetControlsDescription": "Skjuler kontrollerne tilføj/fjern/sortér.",
|
||||
"toggleAdvanced": "Slå avancerede muligheder til/fra",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Tilføj et element",
|
||||
"hideFieldsetControls": "Skjul fieldsets?",
|
||||
"hideFieldsetControlsDescription": "Skjuler kontrollerne tilføj/fjern/sortér.",
|
||||
"toggleAdvanced": "Slå avancerede muligheder til/fra",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
+1
-1
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
"toggleAdvancedDescription": "Show advanced options.",
|
||||
"hidePropertyLabels": "Hide Property Labels?",
|
||||
"hidePropertyLabelsDescription": "Hides the property labels.",
|
||||
"minFieldsets": "Min Fieldsets",
|
||||
"maxFieldsets": "Max Fieldsets",
|
||||
"maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.",
|
||||
"enableMultipleFieldsets": "Enable Multiple Fieldsets?",
|
||||
|
||||
+1
-1
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
"toggleAdvancedDescription": "Show advanced options.",
|
||||
"hidePropertyLabels": "Hide Property Labels?",
|
||||
"hidePropertyLabelsDescription": "Hides the property labels.",
|
||||
"minFieldsets": "Min Fieldsets",
|
||||
"maxFieldsets": "Max Fieldsets",
|
||||
"maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.",
|
||||
"enableMultipleFieldsets": "Enable Multiple Fieldsets?",
|
||||
|
||||
+1
-1
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
"toggleAdvancedDescription": "Show advanced options.",
|
||||
"hidePropertyLabels": "Hide Property Labels?",
|
||||
"hidePropertyLabelsDescription": "Hides the property labels.",
|
||||
"minFieldsets": "Min Fieldsets",
|
||||
"maxFieldsets": "Max Fieldsets",
|
||||
"maxFieldsetsDescription": "How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.",
|
||||
"enableMultipleFieldsets": "Enable Multiple Fieldsets?",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"label": "Label",
|
||||
"alias": "Alias",
|
||||
"addFieldset": "Add an item",
|
||||
"hideFieldsetControls": "Hide Fieldset Controls?",
|
||||
"hideFieldsetControlsDescription": "Hides the fieldset add/remove/sort controls.",
|
||||
"toggleAdvanced": "Toggle Advanced Options",
|
||||
|
||||
+32
-65
@@ -23,28 +23,19 @@
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: #ddd;
|
||||
padding: 2px;
|
||||
font-size: 16px;
|
||||
&:hover {
|
||||
color: #333;
|
||||
}
|
||||
&.icon-delete:hover {
|
||||
color: #b94a48;
|
||||
}
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.fieldsetIcon {
|
||||
float: left;
|
||||
padding: 0 4px 0 0;
|
||||
color: #333;
|
||||
vertical-align: text-bottom;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border-bottom: 1px dashed #dddddd;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 0;
|
||||
margin-bottom: 5px;
|
||||
background-color: #f1f1f1;
|
||||
clear: both;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
@@ -73,28 +64,11 @@
|
||||
min-height: 42px;
|
||||
|
||||
.label-sub {
|
||||
padding: 8px 0 8px 0;
|
||||
padding: 8px 0 4px 0;
|
||||
display: inline-block;
|
||||
min-height: 20px; /* this makes the header clickable when there's no icon and no text */
|
||||
&.module-label {
|
||||
width: 100%;
|
||||
}
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
|
||||
label {
|
||||
span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.caret-right {
|
||||
border-left-color: #333;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
@@ -115,14 +89,27 @@
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&.enableCollapsing:hover {
|
||||
cursor: pointer;
|
||||
|
||||
label {
|
||||
span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.caret {
|
||||
margin: 8px 1px 0 2px;
|
||||
margin: 8px 1px 0 15px;
|
||||
position: absolute;
|
||||
|
||||
&.caret-right {
|
||||
border-bottom: 4px solid transparent;
|
||||
border-top: 4px solid transparent;
|
||||
border-left: 4px solid #ddd;
|
||||
border-left: 4px solid #000000;
|
||||
content: "";
|
||||
margin-top: 6px;
|
||||
}
|
||||
@@ -130,10 +117,10 @@
|
||||
|
||||
label {
|
||||
margin-bottom: 0;
|
||||
margin-left: 18px;
|
||||
margin-left: 38px;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
width: ~"calc(100% - 144px)";
|
||||
width: ~"calc(100% - 132px)";
|
||||
position: absolute;
|
||||
span {
|
||||
display: block;
|
||||
@@ -141,9 +128,7 @@
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
&.dimmed {
|
||||
i, span {
|
||||
color: #d9d9d9 !important;
|
||||
}
|
||||
color: #d9d9d9;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,9 +138,6 @@
|
||||
right: 15px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
}
|
||||
}
|
||||
|
||||
.archetypePropertyError {
|
||||
@@ -175,8 +157,9 @@
|
||||
.archetypeCollapser {
|
||||
clear: both;
|
||||
height: 100%;
|
||||
padding: 12px 0 0 20px;
|
||||
padding-top: 12px;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid silver;
|
||||
border-radius: 0 0 0 5px;
|
||||
|
||||
form {
|
||||
@@ -208,25 +191,13 @@
|
||||
border: 1px solid #b94a48;
|
||||
}
|
||||
|
||||
.archetypeAddButton {
|
||||
color: #ddd;
|
||||
.icon {
|
||||
vertical-align: text-top;
|
||||
.archetypeAddButton:hover {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
|
||||
.archetypeAddButtonText {
|
||||
text-decoration: underline;
|
||||
}
|
||||
&:hover {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
|
||||
.archetypeAddButtonText {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.multiPropertyTextbox {
|
||||
@@ -243,10 +214,6 @@
|
||||
color: #343434;
|
||||
}
|
||||
}
|
||||
|
||||
.fieldsetPicker .icon {
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.archetypeEditor, .archetypeConfig {
|
||||
@@ -358,7 +325,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.archetypeMaxFieldsets{
|
||||
.archetypeMaxFieldsets, .archetypeMinFieldsets {
|
||||
border: 1px solid #ddd;
|
||||
width: 40px;
|
||||
text-align: right;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('umbraco.services').factory('archetypeCacheService', function (archetypePropertyEditorResource) {
|
||||
angular.module('umbraco.services').factory('archetypeCacheService', function (archetypePropertyEditorResource, notificationsService) {
|
||||
//private
|
||||
|
||||
var isEntityLookupLoading = false;
|
||||
@@ -7,7 +7,78 @@ angular.module('umbraco.services').factory('archetypeCacheService', function (ar
|
||||
var isDatatypeLookupLoading = false;
|
||||
var datatypeCache = [];
|
||||
|
||||
var notificationQueue = [];
|
||||
var notificationCache = [];
|
||||
|
||||
var invalidationCache = [];
|
||||
|
||||
function findItem(array, item) {
|
||||
return _.find(array, function(value){
|
||||
return value == item;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
notifyEditor: function() {
|
||||
console.log("queue-v");
|
||||
console.log(notificationQueue);
|
||||
console.log("sent-v");
|
||||
console.log(notificationCache);
|
||||
|
||||
if(this.shouldBeNotified("minFieldsets") && !this.hasBeenNotified("minFieldsets")) {
|
||||
notificationsService.error("Error", "Some of your properties do not contain enough fieldsets.");
|
||||
|
||||
this.removeNotification("minFieldsets");
|
||||
|
||||
notificationCache.push("minFieldsets");
|
||||
}
|
||||
},
|
||||
|
||||
clearInvalidations: function() {
|
||||
invalidationCache = [];
|
||||
},
|
||||
|
||||
addInvalidation: function(key) {
|
||||
if(!this.hasBeenInvalidated(invalidationCache, key)) {
|
||||
invalidationCache.push(key);
|
||||
}
|
||||
},
|
||||
|
||||
removeInvalidation: function(key) {
|
||||
invalidationCache = _.reject(invalidationCache, function(value){
|
||||
return value == key;
|
||||
});
|
||||
},
|
||||
|
||||
hasBeenInvalidated: function(key) {
|
||||
return (typeof findItem(invalidationCache, key) != 'undefined');
|
||||
},
|
||||
|
||||
clearNotifications: function() {
|
||||
notificationCache = [];
|
||||
|
||||
},
|
||||
|
||||
addNotification: function(key) {
|
||||
if(!this.shouldBeNotified(key) && !this.hasBeenNotified(notificationCache, key)) {
|
||||
notificationQueue.push(key);
|
||||
}
|
||||
},
|
||||
|
||||
removeNotification: function(key) {
|
||||
notificationQueue = _.reject(notificationQueue, function(value){
|
||||
return value == key;
|
||||
});
|
||||
},
|
||||
|
||||
shouldBeNotified: function(key) {
|
||||
return (typeof findItem(notificationQueue, key) != 'undefined');
|
||||
},
|
||||
|
||||
hasBeenNotified: function(key) {
|
||||
return (typeof findItem(notificationCache, key) != 'undefined');
|
||||
},
|
||||
|
||||
getDataTypeFromCache: function(guid) {
|
||||
return _.find(datatypeCache, function (dt){
|
||||
return dt.dataTypeGuid == guid;
|
||||
|
||||
@@ -140,7 +140,7 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
}
|
||||
|
||||
var suffix = "";
|
||||
var strippedText = $("<div/>").html(value).text();
|
||||
var strippedText = $(value).text();
|
||||
|
||||
if(strippedText.length > args.contentLength) {
|
||||
suffix = "…";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('umbraco.services').factory('archetypeService', function () {
|
||||
angular.module('umbraco.services').factory('archetypeService', function (archetypeCacheService) {
|
||||
//public
|
||||
return {
|
||||
//helper that returns a JS ojbect from 'value' string or the original string
|
||||
@@ -99,6 +99,16 @@ angular.module('umbraco.services').factory('archetypeService', function () {
|
||||
// it's the Umbraco way to hide the invalid state when altering an invalid property, even if the new value isn't valid either
|
||||
property.isValid = true;
|
||||
this.setFieldsetValidity(fieldset);
|
||||
},
|
||||
validateMinFieldsets: function(scope) {
|
||||
//ngModelCtrl.$setValidity('propertyForm', true);
|
||||
archetypeCacheService.removeInvalidation("minFieldsets");
|
||||
|
||||
if(scope.archetypeConfig.minFieldsets && scope.archetypeRenderModel.fieldsets.length < scope.archetypeConfig.minFieldsets) {
|
||||
//ngModelCtrl.$setValidity('propertyForm', false);
|
||||
archetypeCacheService.addInvalidation("minFieldsets");
|
||||
archetypeCacheService.addNotification("minFieldsets");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -97,6 +97,10 @@
|
||||
<label for="archetypeAdvancedOptionsHideLabels"><archetype-localize key="hidePropertyLabels">Hide Property Labels?</archetype-localize><small><archetype-localize key="hidePropertyLabelsDescription">Hides the property labels.</archetype-localize></small></label>
|
||||
<input type="checkbox" id="archetypeAdvancedOptionsHideLabels" ng-model="archetypeConfigRenderModel.hidePropertyLabels"/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="archetypeAdvancedOptionsMinFieldsets"><archetype-localize key="minFieldsets">Min Fieldsets</archetype-localize><small><archetype-localize key="minFieldsetsDescription">How many Fieldsets are required? Leaving blank will disable the control. Default is unlimited.</archetype-localize></small></label>
|
||||
<input type="number" id="archetypeAdvancedOptionsMinFieldsets" class="archetypeMinFieldsets" ng-model="archetypeConfigRenderModel.minFieldsets"/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="archetypeAdvancedOptionsMaxFieldsets"><archetype-localize key="maxFieldsets">Max Fieldsets</archetype-localize><small><archetype-localize key="maxFieldsetsDescription">How many Fieldsets are allowed? Entering '1' will disable the controls. Default is unlimited.</archetype-localize></small></label>
|
||||
<input type="number" id="archetypeAdvancedOptionsMaxFieldsets" class="archetypeMaxFieldsets" ng-model="archetypeConfigRenderModel.maxFieldsets"/>
|
||||
|
||||
@@ -13,11 +13,19 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="archetypeEditorControls label-sub" ng-hide="model.config.hideFieldsetControls">
|
||||
<i class="icon icon-add" ng-show="canAdd()" ng-click="openFieldsetPicker($index, $event)"></i>
|
||||
<i class="icon icon-navigation handle" ng-show="canSort()"></i>
|
||||
<i class="icon icon-add dropdown-toggle" ng-show="canAdd()" data-toggle="{{ model.config.fieldsets.length > 1 ? 'dropdown' : ''}}" ng-click="model.config.fieldsets.length == 1 ? addRow(fieldset.alias, $index) : return"></i>
|
||||
<ul class="dropdown-menu umb-actions">
|
||||
<li ng-repeat="fieldsetModel in model.config.fieldsets" ng-click="addRow(fieldsetModel.alias, $parent.$index)">
|
||||
<a>
|
||||
<i class="fieldsetIcon icon ng-class:fieldsetModel.icon"></i>
|
||||
<span class="menu-label">{{fieldsetModel.label}}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<i class="icon icon-documents" ng-click="cloneRow($index)" ng-show="canClone()"></i>
|
||||
<i class="icon icon-power" ng-click="enableDisable(fieldset)" ng-show="canDisable()"></i>
|
||||
<i class="icon icon-delete" ng-click="removeRow($index)" ng-show="canRemove()"></i>
|
||||
<i class="icon icon-remove" ng-click="removeRow($index)" ng-show="canRemove()"></i>
|
||||
<i class="icon icon-power" ng-class="{dimmed: fieldset.disabled}" ng-click="enableDisable(fieldset)" ng-show="canDisable()"></i>
|
||||
<i class="icon icon-navigation handle" ng-show="canSort()"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="archetypeCollapser animate-hide" ng-hide="model.config.enableCollapsing && isCollapsed(fieldset)">
|
||||
@@ -41,24 +49,17 @@
|
||||
</li>
|
||||
</ul>
|
||||
<div ng-show="showAddButton()">
|
||||
<a class="archetypeAddButton" ng-click="openFieldsetPicker(0, $event)" prevent-default>
|
||||
<i class="icon icon-add"></i>
|
||||
<archetype-localize key="addFieldset">Add an item</archetype-localize>
|
||||
<a class="archetypeAddButton" data-toggle="{{ model.config.fieldsets.length > 1 ? 'dropdown' : ''}}" ng-click="model.config.fieldsets.length == 1 ? addRow(model.config.fieldsets[0].alias, 0) : return" prevent-default>
|
||||
<i class="icon icon-add dropdown-toggle"></i>
|
||||
<localize key="general_add" class="archetypeAddButtonText">Add</localize>
|
||||
</a>
|
||||
</div>
|
||||
<div class="usky-grid fieldsetPicker" ng-if="overlayMenu.show">
|
||||
<div class="cell-tools-menu" ng-style="overlayMenu.style" delayed-mouseleave="closeFieldsetPicker()" archetype-click-outside="closeFieldsetPicker()">
|
||||
<h5>
|
||||
<archetype-localize key="addFieldset">Add an item</archetype-localize>
|
||||
</h5>
|
||||
<ul class="elements">
|
||||
<li ng-repeat="fieldset in overlayMenu.fieldsets">
|
||||
<a ng-click="pickFieldset(fieldset.alias, overlayMenu.index)" href>
|
||||
<i class="icon {{fieldset.icon}}"></i>
|
||||
{{fieldset.label}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class="dropdown-menu umb-actions">
|
||||
<li ng-repeat="fieldsetModel in model.config.fieldsets" ng-click="addRow(fieldsetModel.alias, 0)">
|
||||
<a>
|
||||
<i class="fieldsetIcon icon ng-class:fieldsetModel.icon"></i>
|
||||
<span class="menu-label">{{fieldsetModel.label}}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Archetype",
|
||||
"version": "1.10-ui-rc1",
|
||||
"version": "1.9",
|
||||
"url": "http://github.com/imulus/archetype/",
|
||||
"author": "Imulus - Kevin Giszewski - Tom Fulton - Lee Kelleher - Matt Brailsford - Kenn Jacobsen - Et. Al.",
|
||||
"authorUrl": "http://imulus.com/",
|
||||
|
||||
Reference in New Issue
Block a user