Compare commits

..

60 Commits

Author SHA1 Message Date
Kevin Giszewski 014b407abb Let's do purple 2017-08-18 09:03:03 -04:00
Kenn Jacobsen 5aa16a6636 Bump package version 2017-08-18 08:10:43 +02:00
Kenn Jacobsen 7206bba46a Merge pull request #423 from kjac/min-fieldsets-feature
Add minimum fieldsets feature
2017-08-15 12:43:07 +02:00
Kenn Jacobsen af9db94fb6 Merge pull request #421 from kjac/Fix-418
Fix #418
2017-08-09 13:37:50 +02:00
Kenn Jacobsen d2014be81b Fix #418
Don't let the entire published content conversion break if one property
no longer exists.
2017-08-09 13:36:59 +02:00
Kenn Jacobsen 01b8b3b508 Merge remote-tracking branch 'refs/remotes/origin/master' into min-fieldsets-feature 2017-08-09 13:24:35 +02:00
Kenn Jacobsen 734125fa25 Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-08-09 13:24:06 +02:00
Kenn Jacobsen 76678f538d Merge pull request #420 from kjac/fix-414
Fix #414
2017-08-09 13:22:55 +02:00
Kenn Jacobsen 7fe23fdf4c Fix #414
Using ng-src instead of src fixes the issue.
2017-08-09 13:22:05 +02:00
Kenn Jacobsen c956c12cdf Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-08-09 13:16:19 +02:00
Kenn Jacobsen 8706feb882 Merge pull request #419 from kjac/fix-417
Tested with a custom property editor to make sure the JSON default value works.
2017-08-09 12:58:59 +02:00
Kenn Jacobsen c8364986a2 Fix #417
Don't turn an object into a string if it's not...
2017-08-09 12:49:47 +02:00
Kenn Jacobsen 4d24150bdc Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-08-09 12:48:17 +02:00
kjac a16c4b4da9 Merge remote-tracking branch 'refs/remotes/kgiszewski/master' into min-fieldsets-feature 2017-07-28 16:09:49 +02:00
Kevin Giszewski 75a312c309 Update README.md 2017-06-26 09:12:11 -04:00
Kenn Jacobsen aa6505d7f6 Merge pull request #412 from kjac/master
Bump package version
2017-06-13 08:41:09 +02:00
Kenn Jacobsen 6ed7af28bc Bump package version 2017-06-13 08:38:31 +02:00
Kenn Jacobsen 526f4c147a Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-13 08:28:22 +02:00
Kenn Jacobsen bb0df72dc7 Merge pull request #411 from kjac/fieldset-preview-image
Add fieldset image previews
2017-06-13 08:27:39 +02:00
Kenn Jacobsen 3cba5677bf Whoops... the preview image shouldn't be mandatory 2017-06-13 08:25:05 +02:00
kjac c4f88ab528 Remove max width comment 2017-06-12 22:29:16 +02:00
kjac 7bc9584940 Add min fieldsets handling 2017-06-12 22:26:03 +02:00
kjac 17be4b4253 Merge remote-tracking branch 'refs/remotes/origin/master' into fieldset-preview-image 2017-06-12 22:11:07 +02:00
kjac 2db196af6a Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-12 22:09:29 +02:00
Kenn Jacobsen b4b27cd1f8 Merge pull request #410 from kjac/mandatory-validation-disabled-fieldsets
Handle disabled fieldsets in mandatory validation
2017-06-12 22:07:02 +02:00
kjac a2cc052944 Handle disabled fieldsets in mandatory validation
Disabled fieldsets should not count when performing mandatory
validation. This ensures they aren't.
2017-06-12 22:04:46 +02:00
kjac 4d8a4f0b12 Merge remote-tracking branch 'refs/remotes/origin/master' into fieldset-preview-image 2017-06-11 22:10:07 +02:00
kjac 743f37c45f Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-11 22:09:40 +02:00
Kenn Jacobsen 1ba45969ee Merge pull request #409 from kjac/multiple-open-fieldsets
Enable multiple open fieldsets by datatype configuration. It's default enabled on newly created Archetypes.
2017-06-11 22:08:48 +02:00
kjac 349d6f69b3 Enable multiple open fieldsets
See #196
2017-06-11 22:06:14 +02:00
kjac 9431a70156 Merge remote-tracking branch 'refs/remotes/origin/master' into fieldset-preview-image 2017-06-11 21:38:04 +02:00
kjac ab780f72a4 Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-11 21:37:39 +02:00
Kenn Jacobsen 7d01be305f Merge pull request #408 from kjac/fix-mandatory-validation
Fix mandatory validation: The mandatory validation implementation prevents a valid Archetype from
being submitted on the first go because the mandatory validation isn't
initialized.
2017-06-11 21:36:34 +02:00
kjac 694b932e37 Fix mandatory validation issue
The mandatory validation implementation prevents a valid Archetype from
being submitted on the first go because the mandatory validation isn't
initialized.
2017-06-11 21:35:31 +02:00
kjac a4f6334761 Merge branch 'master' into fieldset-preview-image 2017-06-11 16:18:52 +02:00
kjac 9316e7c3f6 Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-11 16:17:46 +02:00
Kenn Jacobsen 8bc6c17921 Merge pull request #407 from kjac/styling-for-7.6
Styling for 7.6: Make the "add new item" button look ok in 7.6 + hide the "drag into"
area for non cross draggable Archetypes.
2017-06-11 16:16:53 +02:00
kjac 1161c7e6da A bit of styling
Make the "add new item" button look ok in 7.6 + hide the "drag into"
area for non cross draggable Archetypes.
2017-06-11 16:14:58 +02:00
kjac 93db3eb2ee Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-11 16:07:24 +02:00
Kenn Jacobsen b7b166562f Merge pull request #406 from kjac/collapsing-dollar-signs
Collapsing dollar signs
2017-06-11 16:05:26 +02:00
kjac e3c4c91de1 Fix #387 2017-06-11 16:03:56 +02:00
kjac f79849cf8a Open preview image in a new window when clicked 2017-06-10 08:49:59 +02:00
kjac f0b27e1507 Merge remote-tracking branch 'refs/remotes/origin/master' into fieldset-preview-image 2017-06-10 08:26:28 +02:00
kjac 42e92a4e74 Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-10 08:26:06 +02:00
Kenn Jacobsen 2c363a5d37 Merge pull request #405 from kjac/mandatory-validation
Mandatory validation - fixes #395
2017-06-09 21:19:32 +02:00
kjac 738e9282b6 Handle mandatory validation
Don't allow submission of an empty Archetype if the property is set to
mandatory
2017-06-09 21:11:11 +02:00
kjac 20fa1efc8e A bit more styling + localization 2017-06-09 21:04:44 +02:00
kjac 718f2deb47 Add preview image to fieldsets
See #374
2017-06-09 20:19:17 +02:00
kjac 1cea5d156a Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-08 16:46:00 +02:00
Kenn Jacobsen 109d4c7708 Merge pull request #404 from kjac/label-templates-for-v2-pickers
Label templates for the V2 pickers
2017-06-08 16:37:50 +02:00
Kenn Jacobsen 8306be60de Merge pull request #403 from kjac/lazy-load-configuration
Lazy load configuration
2017-06-08 16:36:52 +02:00
Kenn Jacobsen 27d0cb742b Label templates for the V2 pickers
..and also for the old content picker (it was missing for whatever
reason) - fixes #402
2017-06-08 09:02:31 +02:00
kjac 62a250cd83 Lazy load fieldsets in configuration
Fixes #393
2017-06-07 23:07:40 +02:00
kjac 6f94d608db Merge remote-tracking branch 'refs/remotes/kgiszewski/master' 2017-06-07 20:56:35 +02:00
Kenn Jacobsen 854e9873c8 Merge pull request #401 from kjac/image-cropper-and-upload-76
Adjust to 7.6 scheme for upload and image croppers
2017-06-07 17:56:20 +02:00
Kenn Jacobsen 2a6d5eaddf Merge pull request #400 from kjac/fix-upload-and-image-cropper-again
Fix upload and image cropper (again)
2017-06-07 17:48:23 +02:00
kjac 3d7ddb58c2 Adjust to 7.6 scheme for upload and image croppers
Fixes #397, at least for newly created sites.
2017-06-06 23:14:40 +02:00
kjac 4c7496840d Fix upload and image cropper (again)
Fixes #384, #389 and #394
2017-06-06 22:41:04 +02:00
Kevin Giszewski d816103981 Merge pull request #399 from codedemonuk/patch-1
Subheadings were not being rendered correctly in Readme
2017-05-29 11:14:18 -04:00
Pervez Choudhury b38ccc12f6 Subheadings were not being rendered correctly 2017-05-28 17:48:44 +01:00
20 changed files with 366 additions and 83 deletions
+2 -1
View File
@@ -62,4 +62,5 @@ VersionInfo.cs
.builds
.svn
.hg
.hgignore
.hgignore
app/Umbraco/.vs/config/applicationhost.config
+7 -3
View File
@@ -10,17 +10,21 @@ Install the selected <a href='https://github.com/imulus/Archetype/releases'>rele
## Official Docs ##
https://github.com/kgiszewski/ArchetypeManual
##News and Updates##
## News and Updates ##
Follow us on Twitter https://twitter.com/ArchetypeKit
##Core Team##
## Core Team ##
* Kevin Giszewski (founder/project lead) - University of Notre Dame - https://kevin.giszewski.com/
* Tom Fulton (founder) - Tonic - http://hellotonic.com/
* Lee Kelleher - Umbrella - http://www.umbrellainc.co.uk/
* Matt Brailsford - The Outfield - http://www.theoutfield.co.uk/
* Kenn Jacobsen - Vertica - http://kennjacobsen.dk/
## Donate!
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=KBKWLURGLGU6L)
This project is funded by the core team members' time only. We don't charge for Archetype but it does take quite a bit of effort to keep it up-to-date with Umbraco core changes. If you're making a few bucks off of Archetype, we wouldn't refuse a donation :)
## Contribute ##
Want to contribute to Archetype? You'll want to use Grunt (our task runner) to help you integrate with a local copy of Umbraco.
@@ -25,6 +25,9 @@ namespace Archetype.Models
[JsonProperty("enableCollapsing")]
public bool EnableCollapsing { get; set; }
[JsonProperty("enableMultipleOpen")]
public bool EnableMultipleOpen { get; set; }
[JsonProperty("enableCloning")]
public bool EnableCloning { get; set; }
@@ -46,6 +49,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; }
@@ -26,6 +26,9 @@ namespace Archetype.Models
[JsonProperty("label")]
public string Label { get; set; }
[JsonProperty("previewImage")]
public string PreviewImage { get; set; }
[JsonProperty("properties")]
public IEnumerable<ArchetypePreValueProperty> Properties { get; set; }
@@ -1,5 +1,6 @@
using System;
using Archetype.Extensions;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
@@ -24,14 +25,22 @@ namespace Archetype.Models
_property = property;
_rawValue = property.Value;
_propertyType = property.CreateDummyPropertyType();
// #418 - need to wrap this in a try/catch to prevent orphaned properties from breaking everything
try
{
_propertyType = property.CreateDummyPropertyType();
if (_propertyType != null)
{
_sourceValue = new Lazy<object>(() => _propertyType.ConvertDataToSource(_rawValue, preview));
_objectValue = new Lazy<object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview));
_xpathValue = new Lazy<object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview));
}
if (_propertyType != null)
{
_sourceValue = new Lazy<object>(() => _propertyType.ConvertDataToSource(_rawValue, preview));
_objectValue = new Lazy<object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, preview));
_xpathValue = new Lazy<object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, preview));
}
}
catch(Exception ex)
{
LogHelper.Warn<ArchetypePublishedProperty>(string.Format("Could not create an IPublishedProperty for property: {0} - the error was: {1}", property.Alias, ex.Message));
}
}
internal ArchetypePropertyModel ArchetypeProperty
@@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.13.1")]
[assembly: AssemblyFileVersion("1.13.1")]
[assembly: AssemblyVersion("1.15.1")]
[assembly: AssemblyFileVersion("1.15.1")]
@@ -206,13 +206,28 @@ 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 != null && u.FileName.Equals(f, StringComparison.OrdinalIgnoreCase))).Where(f => f != null).ToList();
var propertyFiles = propDef.EditorState.FileNames.Select(fileName =>
uploadedFiles.FirstOrDefault(u => u.FileName != null &&
// #384, #389 and #394 - look for "safe" file names (using the ToSafeFileName() extension)
// - for backwards compatibility we'll look for the raw filename as well as the "safe" file name
(u.FileName.Equals(fileName, StringComparison.OrdinalIgnoreCase) || u.FileName.Equals(fileName.ToSafeFileName(), StringComparison.OrdinalIgnoreCase))
)
).Where(f => f != null).ToList();
if(propertyFiles.Any())
{
additionalData["files"] = propertyFiles;
}
}
}
// #397 - pass along "cuid" and "puid" (part of the Umbraco 7.6 scheme)
if(editorValue.AdditionalData.ContainsKey("cuid"))
{
additionalData["cuid"] = editorValue.AdditionalData["cuid"];
}
if(editorValue.AdditionalData.ContainsKey("puid"))
{
additionalData["puid"] = editorValue.AdditionalData["puid"];
}
var propData = new ContentPropertyData(propDef.Value, preValues, additionalData);
var propEditor = PropertyEditorResolver.Current.GetByAlias(dtd.PropertyEditorAlias);
// make sure to send the current property value (if any) to the PE ValueEditor
+14 -12
View File
@@ -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 + '], "group": null}';
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, "enablePublishing": false, "enableMemberGroups": false, "enableCrossDragging": false, "fieldsets": [' + newFieldsetModel + '], "fieldsetGroups": []}');
var defaultFieldsetConfigModel = JSON.parse('{"showAdvancedOptions": false, "startWithAddButton": false, "hideFieldsetToolbar": false, "enableMultipleFieldsets": false, "hideFieldsetControls": false, "hidePropertyLabel": false, "maxFieldsets": null, "enableCollapsing": true, "enableMultipleOpen": true, "enableCloning": false, "enableDisabling": true, "enableDeepDatatypeRequests": false, "enablePublishing": false, "enableMemberGroups": false, "enableCrossDragging": false, "fieldsets": [' + newFieldsetModel + '], "fieldsetGroups": []}');
//ini the model
$scope.model.value = $scope.model.value || defaultFieldsetConfigModel;
@@ -47,6 +47,12 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
}
};
// added to track loaded fieldsets
$scope.loadedFieldsets = [];
$scope.isLoaded = function (fieldset) {
return $scope.loadedFieldsets.indexOf(fieldset) >= 0;
}
//function that determines how to manage expanding/collapsing fieldsets
$scope.focusFieldset = function(fieldset){
var iniState;
@@ -60,6 +66,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
if($scope.archetypeConfigRenderModel.fieldsets.length == 1 && fieldset.remove == false)
{
fieldset.collapse = false;
$scope.loadedFieldsets.push(fieldset);
return;
}
@@ -70,12 +77,14 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
else
{
fieldset.collapse = false;
$scope.loadedFieldsets.push(fieldset);
}
});
if(iniState)
{
fieldset.collapse = !iniState;
$scope.loadedFieldsets.push(fieldset);
}
}
@@ -123,27 +132,20 @@ angular.module("umbraco").controller("Imulus.ArchetypeConfigController", functio
//watch for changes
$scope.$watch('archetypeConfigRenderModel', function (v) {
//console.log(v);
if (typeof v === 'string') {
$scope.archetypeConfigRenderModel = JSON.parse(v);
$scope.archetypeConfigRenderModel.toString = stringify;
}
});
$scope.autoPopulateAlias = function(s) {
var modelType = s.hasOwnProperty('fieldset') ? 'fieldset' : 'property';
var modelProperty = s[modelType];
if (!modelProperty.aliasIsDirty) {
$scope.autoPopulateAlias = function (modelProperty) {
if (modelProperty && !modelProperty.aliasIsDirty) {
modelProperty.alias = modelProperty.label.toUmbracoAlias();
}
}
$scope.markAliasDirty = function(s) {
var modelType = s.hasOwnProperty('fieldset') ? 'fieldset' : 'property';
var modelProperty = s[modelType];
if (!modelProperty.aliasIsDirty) {
$scope.markAliasDirty = function (modelProperty) {
if (modelProperty && !modelProperty.aliasIsDirty) {
modelProperty.aliasIsDirty = true;;
}
}
+67 -14
View File
@@ -1,5 +1,5 @@
{{VERSION}}
angular.module("umbraco").controller("Imulus.ArchetypeController", function ($scope, $http, $filter, assetsService, angularHelper, notificationsService, $timeout, fileManager, entityResource, archetypeService, archetypeLabelService, archetypeCacheService, archetypePropertyEditorResource) {
angular.module("umbraco").controller("Imulus.ArchetypeController", function ($scope, $http, $filter, $interpolate, assetsService, angularHelper, notificationsService, $timeout, fileManager, entityResource, archetypeService, archetypeLabelService, archetypeCacheService, archetypePropertyEditorResource, archetypeLocalizationService) {
// Variables.
var draggedParent;
@@ -264,7 +264,8 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
alias: fieldset.alias,
label: fieldset.label,
icon: (fieldset.icon || "icon-document-dashed-line"), // default icon if none is chosen
group: fieldset.group ? fieldset.group.name : null
group: fieldset.group ? fieldset.group.name : null,
previewImage: fieldset.previewImage
});
});
// sanity check
@@ -304,13 +305,22 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.closeFieldsetPicker = function () {
$scope.overlayMenu.show = false;
$scope.overlayMenu.fieldsetPreview = null;
};
$scope.pickFieldset = function (fieldsetAlias, $index) {
$scope.closeFieldsetPicker();
$scope.addRow(fieldsetAlias, $index);
};
$scope.openFieldsetPreview = function (fieldset) {
$scope.overlayMenu.fieldsetPreview = fieldset;
}
$scope.closeFieldsetPreview = function () {
$scope.overlayMenu.fieldsetPreview = null;
}
$scope.addRow = function (fieldsetAlias, $index) {
if ($scope.canAdd()) {
if ($scope.model.config.fieldsets) {
@@ -340,6 +350,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
}
$scope.focusFieldset(newFieldset);
$scope.handleMandatoryValidation();
}
}
@@ -349,6 +360,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
$scope.setDirty();
$scope.model.value.fieldsets.splice($index, 1);
$scope.$broadcast("archetypeRemoveFieldset", {index: $index});
$scope.handleMandatoryValidation();
}
}
}
@@ -386,6 +398,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
fieldset.disabled = !fieldset.disabled;
// explicitly set the form as dirty when manipulating the enabled/disabled state of a fieldset
$scope.setDirty();
$scope.handleMandatoryValidation();
}
//helpers for determining if a user can do something
@@ -511,10 +524,30 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
return $scope.isDisabledByPublishing(fieldset);
}
$scope.numberOfEnabledFieldsets = function () {
if (!$scope.model.value.fieldsets) {
return 0;
}
return _.filter($scope.model.value.fieldsets, function (f) {
return $scope.isDisabled(f) == false;
}).length;
}
//helper, ini the render model from the server (model.value)
function init() {
$scope.model.value = removeNulls($scope.model.value);
addDefaultProperties($scope.model.value.fieldsets);
$timeout(function () {
$scope.handleMandatoryValidation();
}, 50);
// localize the message for minimum fieldsets validation errors
archetypeLocalizationService.localize("minFieldsetsMessage").then(function (value) {
value = value || "You must add minimum {{minFieldsets}} items";
var exp = $interpolate(value);
$scope.minFieldsetsMessage = exp({ minFieldsets: $scope.model.config.minFieldsets });
});
}
function addDefaultProperties(fieldsets)
@@ -594,17 +627,17 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
return;
}
var iniState;
if(fieldset)
// collapse all other fieldsets if "multiple open fieldsets" is not enabled
if(!$scope.model.config.enableMultipleOpen)
{
iniState = fieldset.collapse;
_.each($scope.model.value.fieldsets, function (f) {
if(f != fieldset)
{
f.collapse = true;
}
});
}
_.each($scope.model.value.fieldsets, function(fieldset){
fieldset.collapse = true;
});
if(!fieldset && $scope.model.value.fieldsets.length == 1)
{
$scope.model.value.fieldsets[0].collapse = false;
@@ -612,10 +645,13 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
return;
}
if(iniState && fieldset)
if(fieldset)
{
fieldset.collapse = !iniState;
$scope.loadedFieldsets.push(fieldset);
fieldset.collapse = !fieldset.collapse;
if($scope.loadedFieldsets.indexOf(fieldset) < 0)
{
$scope.loadedFieldsets.push(fieldset);
}
}
}
@@ -769,6 +805,13 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
}
}
$scope.minFieldsetsFulfilled = function () {
if (!$scope.model.config.minFieldsets) {
return true;
}
return $scope.numberOfEnabledFieldsets() >= $scope.model.config.minFieldsets;
}
//custom js
if ($scope.model.config.customJsPath) {
assetsService.loadJs($scope.model.config.customJsPath);
@@ -808,6 +851,16 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
});
});
// handle mandatory validation of the entire Archetype
// - no fieldsets = not valid
$scope.handleMandatoryValidation = function() {
var valid = true;
if ($scope.model.validation && $scope.model.validation.mandatory) {
valid = $scope.numberOfEnabledFieldsets() > 0;
}
$scope.model.mandatoryValidation = valid ? "valid" : null;
}
function toUtc(date) {
if (!date) {
return null;
+2 -1
View File
@@ -65,7 +65,8 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
if (!scope.renderModelPropertyIndex)
{
archetypeService.getFieldset(scope).properties.push(JSON.parse('{"alias": "' + alias + '", "value": "' + defaultValue + '"}'));
var propertyValue = { alias: alias, value: defaultValue };
archetypeService.getFieldset(scope).properties.push(propertyValue);
scope.renderModelPropertyIndex = archetypeService.getPropertyIndexByAlias(archetypeService.getFieldset(scope).properties, alias);
}
+4 -1
View File
@@ -55,5 +55,8 @@
"enableMemberGroups": "Aktivér medlems-grupper",
"enableMemerGroupsDescription": "Tillad at fieldsets kun vises for specifikke medlems-grupper",
"allowedMemberGroups": "Tilladte medlems-grupper",
"allowedMemberGroupsHelpText": "Vælg de medlems-grupper, der skal kunne se dette element. Hvis der ikke er valgt nogen, kan alle se elementet."
"allowedMemberGroupsHelpText": "Vælg de medlems-grupper, der skal kunne se dette element. Hvis der ikke er valgt nogen, kan alle se elementet.",
"previewFieldsetOpen": "(se eksempel)",
"previewFieldsetHeader": "Eksempel: ",
"previewFieldsetClose": "(luk eksempel)"
}
+4 -1
View File
@@ -55,5 +55,8 @@
"enableMemberGroups": "Aktivér medlems-grupper",
"enableMemerGroupsDescription": "Tillad at fieldsets kun vises for specifikke medlems-grupper",
"allowedMemberGroups": "Tilladte medlems-grupper",
"allowedMemberGroupsHelpText": "Vælg de medlems-grupper, der skal kunne se dette element. Hvis der ikke er valgt nogen, kan alle se elementet."
"allowedMemberGroupsHelpText": "Vælg de medlems-grupper, der skal kunne se dette element. Hvis der ikke er valgt nogen, kan alle se elementet.",
"previewFieldsetOpen": "(se eksempel)",
"previewFieldsetHeader": "Eksempel: ",
"previewFieldsetClose": "(luk eksempel)"
}
+43 -12
View File
@@ -249,7 +249,7 @@
.archetypeAddButton {
color: #ddd;
.icon {
vertical-align: text-top;
vertical-align: middle;
}
&:hover {
color: #333;
@@ -290,6 +290,12 @@
overflow: visible;
vertical-align: top;
height: 90px;
.fieldsetPreviewOpen {
font-style: italic;
a:hover {
text-decoration: underline;
}
}
}
ul.groups {
display: block;
@@ -310,6 +316,24 @@
}
}
}
.fieldsetPreview {
.fieldsetPreviewClose {
font-style: italic;
font-size: 12px;
text-align: center;
}
.fieldsetPreviewImage {
padding: 6px 0px;
img {
height: auto;
max-width: 100%;
vertical-align: middle;
border: 0;
cursor: zoom-in;
}
}
}
}
.settingsWrapper {
@@ -355,9 +379,11 @@
// Necessary to ensure empty lists can be dropped onto when sorting nested fieldsets.
.archetypeSortable.archetypeEmpty {
min-height: 42px;
border: 1px dashed #dddddd;
margin-top: 5px;
&.archetypeCrossDraggable {
min-height: 42px;
border: 1px dashed #dddddd;
margin-top: 5px;
}
}
}
@@ -390,10 +416,10 @@
small {
margin-left: 5px;
}
a {
float: right;
img {
width: 35px;
}
@@ -439,7 +465,8 @@
.archetypeFieldsetOption {
margin-bottom: 15px;
margin-right: 15px;
input[type=text]{
input[type=text] {
max-width: 100%;
width: 100%;
}
@@ -457,7 +484,7 @@
margin-bottom: 5px;
}
label{
label {
width: 400px;
}
}
@@ -497,7 +524,7 @@
label {
width: 100%;
}
input[type=text] {
width: 100%;
}
@@ -532,10 +559,10 @@
}
}
}
}
}
}
.archetypeMaxFieldsets{
.archetypeMaxFieldsets {
border: 1px solid #ddd;
width: 40px;
text-align: right;
@@ -548,7 +575,7 @@
.archetypePropertyCollapser {
margin-top: 10px;
div {
margin-bottom: 10px;
margin-right: 15px;
@@ -562,6 +589,10 @@
.fieldsetIcon {
margin-right: 10px;
}
small {
color: #817f85;
}
}
.ui-sortable-placeholder {
+29 -1
View File
@@ -73,6 +73,34 @@ angular.module('umbraco.services').factory('archetypeCacheService', function (ar
}
return null;
}
},
getEntityByUmbracoId: function(scope, udi, type) {
var cachedEntity = _.find(entityCache, function (e){
return e.udi == udi;
});
if(cachedEntity) {
return cachedEntity;
}
//go get it from server
if (!isEntityLookupLoading) {
isEntityLookupLoading = true;
scope.resources.entityResource.getByIds([udi], type).then(function (entities) {
// prevent infinite lookups with a default entity
var entity = entities.length > 0 ? entities[0] : { udi: udi, name: "" };
entityCache.push(entity);
isEntityLookupLoading = false;
return entity;
});
}
return null;
}
}
});
+83 -3
View File
@@ -19,7 +19,6 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
}
function getNativeLabel(datatype, value, scope) {
switch (datatype.selectedEditor) {
case "Imulus.UrlPicker":
return imulusUrlPicker(value, scope, {});
@@ -27,13 +26,22 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
return coreTinyMce(value, scope, {});
case "Umbraco.MultiNodeTreePicker":
return coreMntp(value, scope, datatype);
case "Umbraco.MultiNodeTreePicker2":
return coreMntpV2(value, scope, datatype);
case "Umbraco.MultipleMediaPicker":
case "Umbraco.MediaPicker":
return coreMediaPicker(value, scope, datatype);
case "Umbraco.MediaPicker2":
return coreMediaPickerV2(value, scope, datatype);
case "Umbraco.DropDown":
return coreDropdown(value, scope, datatype);
case "RJP.MultiUrlPicker":
return rjpMultiUrlPicker(value, scope, {});
default:
case "Umbraco.ContentPickerAlias":
return coreContentPicker(value, scope, datatype);
case "Umbraco.ContentPicker2":
return coreContentPickerV2(value, scope, datatype);
default:
return "";
}
}
@@ -87,6 +95,39 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
return entityArray.join(', ');
}
function coreMntpV2(value, scope, args) {
var ids = value.split(',');
if (ids.length == 0) {
return "";
}
var type = "document";
switch(args.preValues[0].value.type) {
case 'content':
type = 'document';
break;
case 'media':
type = 'media';
break;
case 'member':
type = 'member';
break;
default:
break;
}
var entity;
_.each(ids, function (id) {
if(id && !entity) {
entity = archetypeCacheService.getEntityByUmbracoId(scope, id, type);
}
});
return (entity != null ? entity.name : "") + (ids.length > 1 ? ", ..." : "");
}
function coreMediaPicker(value, scope, args) {
if(value) {
var entity = archetypeCacheService.getEntityById(scope, value, "media");
@@ -99,6 +140,42 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
return "";
}
function coreMediaPickerV2(value, scope, args) {
if(value) {
var entity = archetypeCacheService.getEntityByUmbracoId(scope, value, "media");
if(entity) {
return entity.name;
}
}
return "";
}
function coreContentPicker(value, scope, args) {
if (value) {
var entity = archetypeCacheService.getEntityById(scope, value, "document");
if (entity) {
return entity.name;
}
}
return "";
}
function coreContentPickerV2(value, scope, args) {
if (value) {
var entity = archetypeCacheService.getEntityByUmbracoId(scope, value, "document");
if (entity) {
return entity.name;
}
}
return "";
}
function imulusUrlPicker(value, scope, args) {
if(!args.propertyName) {
@@ -269,7 +346,10 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
if(!templateLabelValue) {
templateLabelValue = "";
}
// handle collapsing dollar signs in labels (#387)
if (templateLabelValue.indexOf("$$") >= 0) {
templateLabelValue = templateLabelValue.replace(/\$\$/g, "$$$$$$$$");
}
parsedTemplate = parsedTemplate.replace(match, templateLabelValue);
});
@@ -11,6 +11,13 @@
<div>
<label for="archetypeAdvancedOptionsCollapsing"><input type="checkbox" id="archetypeAdvancedOptionsCollapsing" ng-model="dialogData.model.enableCollapsing"/><archetype-localize key="enableCollapsing">Enable Collapsing?</archetype-localize><small><archetype-localize key="enableCollapsingDescription">Enable fieldset collapsing.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsMultipleOpen"><input type="checkbox" id="archetypeAdvancedOptionsMultipleOpen" ng-model="dialogData.model.enableMultipleOpen" /><archetype-localize key="enableMultipleOpen">Enable Multiple Open Fieldsets?</archetype-localize><small><archetype-localize key="enableMultipleOpenDescription">When fieldset collapsing is enabled, this allows multiple fieldsets to be open at the same time.</archetype-localize></small></label>
</div>
<div>
<label for="archetypeAdvancedOptionsMinFieldsets"><archetype-localize key="minFieldsets">Min Fieldsets</archetype-localize><small><archetype-localize key="minFieldsetsDescription">How many Fieldsets are required? Default is none.</archetype-localize></small></label>
<input type="number" id="archetypeAdvancedOptionsMinFieldsets" class="archetypeMaxFieldsets" ng-model="dialogData.model.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="dialogData.model.maxFieldsets"/>
+13 -5
View File
@@ -12,14 +12,16 @@
<i class="icon icon-navigation handle" ng-show="canSortFieldset()"></i>
</div>
<div class="archetypeFieldsetTitle" ng-click="focusFieldset(fieldset)">{{fieldset.label}}</div>
<div class="archetypeFieldsetCollapser" ng-hide="fieldset.collapse && fieldset.label">
<div class="archetypeFieldsetCollapser" ng-hide="fieldset.collapse && fieldset.label" ng-if="isLoaded(fieldset)">
<div class="archetypeFieldsetOption">
<label for="archetypeFieldLabel_{{$index}}"><archetype-localize key="label">Label</archetype-localize></label>
<input type="text" id="archetypeFieldLabel_{{$index}}" ng-model="fieldset.label" on-keyup="autoPopulateAlias(this)" />
<input type="text" id="archetypeFieldLabel_{{$index}}" ng-model="fieldset.label" on-keyup="autoPopulateAlias(fieldset)" />
<small>The label shown to the editors when adding a new fieldset.</small>
</div>
<div class="archetypeFieldsetOption">
<label for="archetypeFieldAlias_{{$index}}"><archetype-localize key="alias">Alias</archetype-localize></label>
<input type="text" id="archetypeFieldAlias_{{$index}}" ng-model="fieldset.alias" on-keyup="markAliasDirty(this)" required/>
<input type="text" id="archetypeFieldAlias_{{$index}}" ng-model="fieldset.alias" on-keyup="markAliasDirty(fieldset)" required/>
<small>The alias used to identify the fieldset when rendering.</small>
</div>
<div class="archetypeFieldsetOption" ng-show="archetypeConfigRenderModel.fieldsetGroups.length">
<label for="archetypeFieldsetGroup_{{$index}}"><archetype-localize key="fieldsetGroup">Group</archetype-localize></label>
@@ -28,6 +30,12 @@
<div class="archetypeFieldsetOption">
<label for="archetypeFieldLabelTemplate_{{$index}}"><archetype-localize key="labelTemplate">Label Template</archetype-localize></label>
<input type="text" id="archetypeFieldLabelTemplate_{{$index}}" ng-model="fieldset.labelTemplate" />
<small>Generates labels per fieldset. Can contain property aliases, e.g. "Article: &#123;&#123;title&#125;&#125;".</small>
</div>
<div class="archetypeFieldsetOption">
<label for="archetypeFieldPreview_{{$index}}">Preview image</label>
<input type="text" id="archetypeFieldPreview_{{$index}}" ng-model="fieldset.previewImage" on-keyup="markAliasDirty(fieldset)" />
<small>A relative path to a preview image, e.g. "/assets/fieldset.png".</small>
</div>
<div class="archetypeFieldsetOption" ng-show="archetypeConfigRenderModel.enableMultipleFieldsets">
<label for="archetypeFieldIcon_{{$index}}"><archetype-localize key="icon">Icon</archetype-localize></label>
@@ -50,11 +58,11 @@
<div class="archetypePropertyCollapser" ng-hide="property.collapse && property.label">
<div>
<label for="archetypePropertyLabel_{{$parent.$index}}_{{$index}}"><archetype-localize key="label">Label</archetype-localize></label>
<input type="text" id="archetypePropertyLabel_{{$parent.$index}}_{{$index}}" ng-model="property.label" on-keyup="autoPopulateAlias(this)"/>
<input type="text" id="archetypePropertyLabel_{{$parent.$index}}_{{$index}}" ng-model="property.label" on-keyup="autoPopulateAlias(property)"/>
</div>
<div>
<label for="archetypePropertyAlias_{{$parent.$index}}_{{$index}}"><archetype-localize key="alias">Alias</archetype-localize></label>
<input type="text" id="archetypePropertyAlias_{{$parent.$index}}_{{$index}}" ng-model="property.alias" on-keyup="markAliasDirty(this)" required/>
<input type="text" id="archetypePropertyAlias_{{$parent.$index}}_{{$index}}" ng-model="property.alias" on-keyup="markAliasDirty(property)" required/>
</div>
<div>
<label for="archetypePropertyHelpText_{{$parent.$index}}_{{$index}}"><archetype-localize key="helpText">Help Text</archetype-localize></label>
+47 -18
View File
@@ -10,8 +10,16 @@
</a>
</div>
<!-- Mandatory validation. -->
<input type="hidden" name="archetypeMandatory" ng-model="model.mandatoryValidation" ng-required="model.validation.mandatory" />
<div><span class="help-inline" val-msg-for="archetypeMandatory" val-toggle-msg="required"><archetype-localize key="required">Required</archetype-localize></span></div>
<!-- Min fieldsets validation. -->
<input type="hidden" name="archetypeMinFieldsets" ng-model="model.mandatoryMinFieldsets" ng-required="!minFieldsetsFulfilled()" />
<div><span class="help-inline" val-msg-for="archetypeMinFieldsets" val-toggle-msg="required">{{minFieldsetsMessage}}</span></div>
<!-- Fieldsets. -->
<ul ui-sortable="sortableOptions" class="archetypeSortable" ng-class="{archetypeEmpty: model.value.fieldsets.length === 0 || sortingLastItem()}" ng-model="model.value.fieldsets">
<ul ui-sortable="sortableOptions" class="archetypeSortable" ng-class="{archetypeEmpty: model.value.fieldsets.length === 0 || sortingLastItem(), archetypeCrossDraggable: model.config.enableCrossDragging}" ng-model="model.value.fieldsets">
<li ng-repeat="fieldset in model.value.fieldsets">
<fieldset ng-class="['archetype-fieldset-' + fieldset.alias, (getFieldsetValidity(fieldset) == false ? 'archetypeFieldsetError' : '')]" ng-init="fieldsetConfigModel = getConfigFieldsetByAlias(fieldset.alias)">
<div class="archetypeFieldsetLabel" ng-class="{enableCollapsing: model.config.enableCollapsing}">
@@ -104,24 +112,45 @@
<!-- Fieldset picker. -->
<div class="usky-grid fieldsetPicker" ng-class="{withGroups: overlayMenu.fieldsetGroups.length > 1}" 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="groups" ng-show="overlayMenu.fieldsetGroups.length > 1">
<li ng-repeat="fieldsetGroup in overlayMenu.fieldsetGroups" ng-class="{active: fieldsetGroup == overlayMenu.activeFieldsetGroup}">
<a ng-click="overlayMenu.activeFieldsetGroup = fieldsetGroup">
{{fieldsetGroup.name}}
<div ng-show="!overlayMenu.fieldsetPreview">
<h5>
<archetype-localize key="addFieldset">Add an item</archetype-localize>
</h5>
<ul class="groups" ng-show="overlayMenu.fieldsetGroups.length > 1">
<li ng-repeat="fieldsetGroup in overlayMenu.fieldsetGroups" ng-class="{active: fieldsetGroup == overlayMenu.activeFieldsetGroup}">
<a ng-click="overlayMenu.activeFieldsetGroup = fieldsetGroup">
{{fieldsetGroup.name}}
</a>
</li>
</ul>
<ul class="elements">
<li ng-repeat="fieldset in overlayMenu.activeFieldsetGroup.fieldsets">
<a ng-click="pickFieldset(fieldset.alias, overlayMenu.index)" href>
<i class="icon {{fieldset.icon}}"></i>
{{fieldset.label}}
</a>
<div class="fieldsetPreviewOpen" ng-if="fieldset.previewImage">
<a href ng-click="openFieldsetPreview(fieldset)"><archetype-localize key="previewFieldsetOpen">(see preview)</archetype-localize></a>
</div>
</li>
</ul>
</div>
<div ng-show="overlayMenu.fieldsetPreview" class="fieldsetPreview">
<h5>
<archetype-localize key="previewFieldsetHeader">Preview: </archetype-localize>{{overlayMenu.fieldsetPreview.label}}
</h5>
<div class="fieldsetPreviewClose">
<a href ng-click="closeFieldsetPreview()"><archetype-localize key="previewFieldsetClose">(close preview)</archetype-localize></a>
</div>
<div class="fieldsetPreviewImage">
<a href="{{overlayMenu.fieldsetPreview.previewImage}}" target="_blank">
<img ng-src="{{overlayMenu.fieldsetPreview.previewImage}}" />
</a>
</li>
</ul>
<ul class="elements">
<li ng-repeat="fieldset in overlayMenu.activeFieldsetGroup.fieldsets">
<a ng-click="pickFieldset(fieldset.alias, overlayMenu.index)" href>
<i class="icon {{fieldset.icon}}"></i>
{{fieldset.label}}
</a>
</li>
</ul>
</div>
<div class="fieldsetPreviewClose">
<a href ng-click="closeFieldsetPreview()"><archetype-localize key="previewFieldsetClose">(close preview)</archetype-localize></a>
</div>
</div>
</div>
</div>
</div>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Archetype",
"version": "1.13.1",
"version": "1.15.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/",