Compare commits

...

11 Commits

Author SHA1 Message Date
Kenn Jacobsen 033cbbc8f6 Fix #385 2017-02-16 15:05:21 +01:00
Kenn Jacobsen 7ee3cfca5c Merge pull request #378 from Nicholas-Westby/fix/372-drag-drop-broken
Fix for drag & drop failing when dropping fieldset in the same Archet…
2017-02-16 12:16:44 +01:00
Kenn Jacobsen e9b478c186 Fix #384
For some reason Umbraco has started lowercasing the names of uploaded
files. This fixes the problem by ignoring case when looking for the
uploaded files.
2017-02-15 11:17:01 +01:00
Nicholas-Westby 155355aa00 Fix for drag & drop failing when dropping fieldset in the same Archetype and the max fieldsets is reached: https://github.com/kgiszewski/Archetype/issues/372 2016-09-14 22:08:04 -07:00
kgiszewski abf6917b1c bump to v1.13.1 2016-06-26 12:10:11 -04:00
kgiszewski 40ad701f7f Merge branch 'master' into pr/365 2016-06-26 12:05:18 -04:00
Kevin Giszewski a8113f926c Merge pull request #369 from kipusoep/master
Fixed #368
2016-06-16 16:21:21 -04:00
Kevin Giszewski 3c527396de Merge pull request #364 from Nicholas-Westby/fix/362-drag-fieldset-undefined
Fix for error during Archetype drags when there are rich text editors…
2016-06-16 16:12:33 -04:00
Stefan Kip 59bf66dcd1 Fixed #368 2016-06-16 20:11:02 +02:00
Nicholas-Westby c125042a86 Avoid fieldsets that can't be expanded: https://github.com/imulus/Archetype/issues/363 2016-05-20 21:38:39 -07:00
Nicholas-Westby 85ea472129 Fix for error during Archetype drags when there are rich text editors outside of Archetype: https://github.com/imulus/Archetype/issues/362 2016-05-18 20:03:05 -07:00
7 changed files with 66 additions and 28 deletions
@@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.13.0")]
[assembly: AssemblyFileVersion("1.13.0")]
[assembly: AssemblyVersion("1.13.1")]
[assembly: AssemblyFileVersion("1.13.1")]
@@ -206,7 +206,7 @@ namespace Archetype.PropertyEditors
else if (propDef.EditorState != null && propDef.EditorState.FileNames != null && propDef.EditorState.FileNames.Any())
{
// pass the uploaded files that belongs to this property (if any) to the value editor
var propertyFiles = propDef.EditorState.FileNames.Select(f => uploadedFiles.FirstOrDefault(u => u.FileName == f)).Where(f => f != null).ToList();
var propertyFiles = propDef.EditorState.FileNames.Select(f => uploadedFiles.FirstOrDefault(u => u.FileName != null && u.FileName.Equals(f, StringComparison.OrdinalIgnoreCase))).Where(f => f != null).ToList();
if(propertyFiles.Any())
{
additionalData["files"] = propertyFiles;
+38 -5
View File
@@ -211,6 +211,16 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
}
// Checks if the specified array of fieldsets contains the specified fieldset.
function arrayContainsFieldset(fieldset, fieldsets) {
for (var i = 0; i < fieldsets.length; i++) {
if (fieldsets[i] === fieldset) {
return true;
}
}
return false;
}
// Confirms that an array of properties is a subset of another array of properties.
function arePropertiesSubset(subset, superset) {
@@ -323,6 +333,11 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.$broadcast("archetypeAddFieldset", {index: $index, visible: countVisible()});
newFieldset.collapse = $scope.model.config.enableCollapsing ? true : false;
// If the fieldset is not collapsed, it should be instantly loaded.
if (!newFieldset.collapse) {
$scope.loadedFieldsets.push(newFieldset);
}
$scope.focusFieldset(newFieldset);
}
@@ -356,6 +371,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.setDirty();
newFieldset.collapse = $scope.model.config.enableCollapsing ? true : false;
// If the fieldset is not collapsed, it should be instantly loaded.
if (!newFieldset.collapse) {
$scope.loadedFieldsets.push(newFieldset);
}
$scope.focusFieldset(newFieldset);
}
}
@@ -554,10 +575,10 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
{
if(typeof fieldset.collapse === "undefined")
{
fieldset.collapse = true;
fieldset.collapse = $scope.model.config.enableCollapsing ? true : false;
}
return fieldset.collapse;
}
};
// added to track loaded fieldsets
$scope.loadedFieldsets = [];
@@ -601,6 +622,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
//ini the fieldset expand/collapse
$scope.focusFieldset();
// Fieldsets which cannot be collapsed should start expanded.
_.each($scope.model.value.fieldsets, function(fieldset) {
fieldset.collapse = $scope.model.config.enableCollapsing;
});
$scope.loadedFieldsets = _.where($scope.model.value.fieldsets, { collapse: false });
//developerMode helpers
$scope.model.value.toString = stringify;
@@ -652,6 +679,9 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.activeSubmitWatcher = 0;
// init loaded fieldsets tracking
_.each($scope.model.value.fieldsets, function (fieldset) {
fieldset.collapse = $scope.model.config.enableCollapsing ? true : false;
});
$scope.loadedFieldsets = _.where($scope.model.value.fieldsets, { collapse: false });
// create properties needed for the backoffice to work (data that is not serialized to DB)
@@ -837,12 +867,15 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
// The source scope is the scope of the fieldset being dragged.
// The target scope is the scope of the Archetype to drop into.
function canMove(sourceScope, targetScope) {
var targetFieldsets = targetScope.model.config.fieldsets;
var targetFieldsetConfigs = targetScope.model.config.fieldsets;
var targetFieldsets = targetScope.model.value.fieldsets;
var sourceFieldset = sourceScope.fieldset;
var sameArchetype = arrayContainsFieldset(sourceFieldset, targetFieldsets);
var model = sourceScope.fieldsetConfigModel;
var canRemove = sourceScope.canRemove();
var canAdd = targetScope.canAdd();
var valid = canRemove && canAdd;
valid = valid && modelMatchesAnyFieldset(model, targetFieldsets);
var valid = sameArchetype || (canRemove && canAdd);
valid = valid && modelMatchesAnyFieldset(model, targetFieldsetConfigs);
return valid;
}
+9 -8
View File
@@ -123,16 +123,17 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
});
scope.$on('archetypeFormSubmitting', function (ev, args) {
if(args.action !== 'save') {
// validate all fieldset properties
_.each(scope.fieldset.properties, function (property) {
archetypeService.validateProperty(scope.fieldset, property, configFieldsetModel);
});
// #385 - revert the changes made in #311 to avoid publishing invalid fieldsets (leaving the code from #311 here, in case we figure out how to re-introduce "save as draft")
// if(args.action !== 'save') {
// validate all fieldset properties
_.each(scope.fieldset.properties, function (property) {
archetypeService.validateProperty(scope.fieldset, property, configFieldsetModel);
});
var validationKey = "validation-f" + scope.fieldsetIndex;
var validationKey = "validation-f" + scope.fieldsetIndex;
ngModelCtrl.$setValidity(validationKey, scope.fieldset.isValid);
}
ngModelCtrl.$setValidity(validationKey, scope.fieldset.isValid);
// }
// did the value change (if it did, it most likely did so during the "formSubmitting" event)
var property = archetypeService.getFieldsetProperty(scope);
+3 -3
View File
@@ -13,7 +13,7 @@ var ArchetypeSampleLabelTemplates = (function() {
var id = value.split(",")[0];
if (id) {
var entity = scope.services.archetypeLabelService.getEntityById(scope, id, args.entityType);
var entity = scope.services.archetypeCacheService.getEntityById(scope, id, args.entityType);
if(entity) {
return entity[args.propertyName];
@@ -34,13 +34,13 @@ var ArchetypeSampleLabelTemplates = (function() {
switch (value.type) {
case "content":
if(value.typeData.contentId) {
entity = scope.services.archetypeLabelService.getEntityById(scope, value.typeData.contentId, "Document");
entity = scope.services.archetypeCacheService.getEntityById(scope, value.typeData.contentId, "Document");
}
break;
case "media":
if(value.typeData.mediaId) {
entity = scope.services.archetypeLabelService.getEntityById(scope, value.typeData.mediaId, "Media");
entity = scope.services.archetypeCacheService.getEntityById(scope, value.typeData.mediaId, "Media");
}
break;
+12 -8
View File
@@ -2,7 +2,7 @@ angular.module('umbraco.services').factory('archetypeService', function () {
// Variables.
var draggedRteArchetype;
var rteClass = ".umb-rte textarea";
var rteClass = ".archetypeEditor .umb-rte textarea";
var editorSettings = {};
var disabledSortables = [];
@@ -75,10 +75,12 @@ angular.module('umbraco.services').factory('archetypeService', function () {
return reversed.join("-");
},
getFieldset: function(scope) {
return scope.archetypeRenderModel.fieldsets[scope.fieldsetIndex];
var renderModel = scope.archetypeRenderModel;
return renderModel ? renderModel.fieldsets[scope.fieldsetIndex] : null;
},
getFieldsetProperty: function (scope) {
return this.getFieldset(scope).properties[scope.renderModelPropertyIndex];
var fieldset = this.getFieldset(scope);
return fieldset ? fieldset.properties[scope.renderModelPropertyIndex] : null;
},
setFieldsetValidity: function (fieldset) {
// mark the entire fieldset as invalid if there are any invalid properties in the fieldset, otherwise mark it as valid
@@ -146,10 +148,10 @@ angular.module('umbraco.services').factory('archetypeService', function () {
// Get the property's temporary ID.
var scope = angular.element(this).scope().$parent;
var property = self.getFieldsetProperty(scope);
var tempId = property.editorState.temporaryId;
var tempId = property ? property.editorState.temporaryId : null;
// Store the editor settings by the temporary ID?
if (editor && editor.settings) {
if (editor && editor.settings && tempId) {
editorSettings[tempId] = editor.settings;
}
@@ -180,12 +182,14 @@ angular.module('umbraco.services').factory('archetypeService', function () {
// Get the stored editor settings.
var scope = angular.element(this).scope().$parent;
var property = self.getFieldsetProperty(scope);
var tempId = property.editorState.temporaryId;
var tempId = property ? property.editorState.temporaryId : null;
var settings = editorSettings[tempId];
// Remove and reinitialize the editor.
tinyMCE.execCommand("mceRemoveEditor", false, id);
tinyMCE.init(settings);
if (settings) {
tinyMCE.execCommand("mceRemoveEditor", false, id);
tinyMCE.init(settings);
}
});
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Archetype",
"version": "1.13.0",
"version": "1.13.1",
"url": "http://github.com/imulus/archetype/",
"author": "Imulus - Kevin Giszewski - Tom Fulton - Lee Kelleher - Matt Brailsford - Kenn Jacobsen - Et. Al.",
"authorUrl": "http://imulus.com/",