Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a4c1a59e23 | |||
| e164be1823 | |||
| f32451fffa | |||
| a541dbd038 | |||
| 69e0bb70e5 | |||
| c22a2623c2 | |||
| c229cc9953 | |||
| 7d155ee176 | |||
| 93659e5a22 | |||
| 46bbf24edf | |||
| da1057c681 | |||
| 81881a5734 | |||
| 25678a812c | |||
| ec2edce74c | |||
| 4756551518 | |||
| e053b42950 | |||
| ff21951ea1 | |||
| 18935b4a69 | |||
| cd93e17494 | |||
| 3a2190b232 | |||
| 46b0396652 | |||
| 0c3fcce58b | |||
| cef7a36bd4 | |||
| 03d511ca80 | |||
| 123546b11c | |||
| 4aa6b83d82 | |||
| 6f3a414c4d | |||
| 4443d628dc | |||
| 0f9a44c539 | |||
| dd47218bd3 | |||
| 5e3e37af31 | |||
| dbf1bffe34 | |||
| cbf87264ac |
@@ -322,4 +322,5 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('nuget', ['copy:nuget', 'template:nuspec', 'template:nuspec_binaries', 'template:nuspec_courier', 'nugetpack']);
|
||||
grunt.registerTask('umbraco', ['copy:umbraco', 'umbracoPackage']);
|
||||
grunt.registerTask('package', ['clean:tmp', 'default', 'nuget', 'copy:umbraco', 'umbracoPackage', 'clean:tmp']);
|
||||
grunt.registerTask('assets', ['clean', 'string-replace', 'less', 'concat', 'assemblyinfo', 'copy:assets', 'copy:html', 'copy:config', 'clean:html', 'clean:js', 'clean:less']);
|
||||
};
|
||||
@@ -20,6 +20,9 @@ namespace Archetype.Api
|
||||
[PluginController("ArchetypeApi")]
|
||||
public class ArchetypeDataTypeController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private static DateTime _lastVersionCheck;
|
||||
private const int IntervalInDaysBetweenVersionChecks = 7;
|
||||
|
||||
public IEnumerable<object> GetAllPropertyEditors()
|
||||
{
|
||||
return
|
||||
@@ -30,13 +33,33 @@ namespace Archetype.Api
|
||||
/// <summary>
|
||||
/// Gets all datatypes.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>System.Object.</returns>
|
||||
public object GetAll()
|
||||
{
|
||||
var dataTypes = Services.DataTypeService.GetAllDataTypeDefinitions();
|
||||
return dataTypes.Select(t => new { guid = t.Key, name = t.Name });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all details.
|
||||
/// </summary>
|
||||
/// <returns>System.Object.</returns>
|
||||
public object GetAllDetails()
|
||||
{
|
||||
var dataTypes = Services.DataTypeService.GetAllDataTypeDefinitions();
|
||||
|
||||
var list = new List<object>();
|
||||
|
||||
foreach (var dataType in dataTypes)
|
||||
{
|
||||
var dataTypeDisplay = Mapper.Map<IDataTypeDefinition, DataTypeDisplay>(dataType);
|
||||
|
||||
list.Add(new { selectedEditor = dataTypeDisplay.SelectedEditor, preValues = dataTypeDisplay.PreValues, dataTypeGuid = dataType.Key });
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the datatype by GUID.
|
||||
/// </summary>
|
||||
@@ -119,7 +142,7 @@ namespace Archetype.Api
|
||||
[HttpPost]
|
||||
public object CheckForUpdates()
|
||||
{
|
||||
if (!ArchetypeGlobalSettings.Instance.CheckForUpdates)
|
||||
if (!ArchetypeGlobalSettings.Instance.CheckForUpdates || !IsItTimeToCheck())
|
||||
{
|
||||
return new
|
||||
{
|
||||
@@ -128,6 +151,7 @@ namespace Archetype.Api
|
||||
}
|
||||
|
||||
var updateNotificationModel = ArchetypeHelper.Instance.CheckForUpdates();
|
||||
_lastVersionCheck = DateTime.UtcNow;
|
||||
|
||||
return new
|
||||
{
|
||||
@@ -138,5 +162,10 @@ namespace Archetype.Api
|
||||
url = updateNotificationModel.Url
|
||||
};
|
||||
}
|
||||
|
||||
internal bool IsItTimeToCheck()
|
||||
{
|
||||
return _lastVersionCheck.AddDays(IntervalInDaysBetweenVersionChecks) < DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("1.16.0")]
|
||||
[assembly: AssemblyFileVersion("1.16.0")]
|
||||
[assembly: AssemblyVersion("1.17.1")]
|
||||
[assembly: AssemblyFileVersion("1.17.1")]
|
||||
|
||||
@@ -3,6 +3,8 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
|
||||
// Variables.
|
||||
var draggedParent;
|
||||
|
||||
var isCacheInitialized = false;
|
||||
|
||||
//$scope.model.value = "";
|
||||
$scope.model.hideLabel = $scope.model.config.hideLabel == 1;
|
||||
@@ -27,24 +29,15 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
//hold references to helper resources
|
||||
$scope.resources = {
|
||||
entityResource: entityResource,
|
||||
archetypePropertyEditorResource: archetypePropertyEditorResource
|
||||
}
|
||||
|
||||
//hold references to helper services
|
||||
$scope.services = {
|
||||
archetypeService: archetypeService,
|
||||
archetypeLabelService: archetypeLabelService,
|
||||
archetypeCacheService: archetypeCacheService
|
||||
}
|
||||
|
||||
|
||||
//helper to get $eval the labelTemplate
|
||||
$scope.fieldsetTitles = [];
|
||||
$scope.getFieldsetTitle = function (fieldsetConfigModel, fieldsetIndex) {
|
||||
|
||||
|
||||
if(!isCacheInitialized) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// Ensure the collection of titles is large enough.
|
||||
ensureEnoughTitles(fieldsetIndex + 1);
|
||||
var title = $scope.fieldsetTitles[fieldsetIndex];
|
||||
@@ -63,18 +56,13 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
title.loading = true;
|
||||
title.loaded = false;
|
||||
title.value = null;
|
||||
archetypeLabelService.getFieldsetTitle($scope, fieldsetConfigModel, fieldsetIndex)
|
||||
.then(function(value) {
|
||||
|
||||
// Finished loading the title.
|
||||
title.loaded = true;
|
||||
title.loading = false;
|
||||
title.value = value;
|
||||
|
||||
});
|
||||
|
||||
// Still loading a title, so do not return a title.
|
||||
|
||||
archetypeLabelService.getFieldsetTitle($scope, fieldsetConfigModel, fieldsetIndex).then(function(value) {
|
||||
// Finished loading the title.
|
||||
title.loaded = true;
|
||||
title.loading = false;
|
||||
title.value = value;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -126,6 +114,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
|
||||
},
|
||||
start: function(ev, ui) {
|
||||
archetypeService.getEditors().addClass('archetypeDragging');
|
||||
archetypeService.storeEditors(ui.item.parent());
|
||||
$scope.$apply(function() {
|
||||
draggedParent = ui.item.parent();
|
||||
@@ -187,7 +176,6 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
|
||||
},
|
||||
stop: function (ev, ui) {
|
||||
|
||||
// Done sorting.
|
||||
draggedParent.scope().doingSort = false;
|
||||
|
||||
@@ -202,6 +190,7 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
}
|
||||
archetypeService.restoreEditors(parent);
|
||||
|
||||
archetypeService.getEditors().removeClass('archetypeDragging');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -500,6 +489,13 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
|
||||
//helpers for determining if the add button should be shown
|
||||
$scope.showAddButton = function () {
|
||||
var visible = countVisible();
|
||||
return (visible === 0 && $scope.model.config.startWithAddButton)
|
||||
|| (visible > 0 && $scope.canAdd());
|
||||
}
|
||||
|
||||
//helper for determining if no content is available yet
|
||||
$scope.showEmptyContentHint = function () {
|
||||
return $scope.model.config.startWithAddButton
|
||||
&& countVisible() === 0;
|
||||
///&& $scope.model.config.fieldsets.length == 1;
|
||||
@@ -582,6 +578,10 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
function init() {
|
||||
$scope.model.value = removeNulls($scope.model.value);
|
||||
addDefaultProperties($scope.model.value.fieldsets);
|
||||
|
||||
archetypeCacheService.initialize().then(function() {
|
||||
isCacheInitialized = true;
|
||||
});
|
||||
|
||||
$timeout(function () {
|
||||
$scope.handleMandatoryValidation();
|
||||
@@ -998,5 +998,4 @@ angular.module("umbraco").controller("Imulus.ArchetypeController", function ($sc
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
var linker = function (scope, element, attrs, ngModelCtrl) {
|
||||
var configFieldsetModel = archetypeService.getFieldsetByAlias(scope.archetypeConfig.fieldsets, scope.fieldset.alias);
|
||||
@@ -25,9 +25,6 @@ angular.module("umbraco.directives").directive('archetypeProperty', function ($c
|
||||
|
||||
config = configObj;
|
||||
|
||||
//caching for use by label templates later
|
||||
archetypeCacheService.addDatatypeToCache(data, dataTypeGuid);
|
||||
|
||||
//determine the view to use [...] and load it
|
||||
archetypePropertyEditorResource.getPropertyEditorMapping(data.selectedEditor).then(function(propertyEditor) {
|
||||
var pathToView = umbPropEditorHelper.getViewPath(propertyEditor.view);
|
||||
|
||||
@@ -1,70 +1,51 @@
|
||||
var ArchetypeSampleLabelTemplates = (function() {
|
||||
//create a namespace (optional)
|
||||
var ArchetypeSampleLabelHelpers = {};
|
||||
|
||||
//public functions
|
||||
return {
|
||||
Entity: function (value, scope, args) {
|
||||
|
||||
if(!args.entityType) {
|
||||
args = {entityType: "Document", propertyName: "name"}
|
||||
}
|
||||
|
||||
if (value) {
|
||||
//if handed a csv list, take the first only
|
||||
var id = value.split(",")[0];
|
||||
|
||||
if (id) {
|
||||
var entity = scope.services.archetypeCacheService.getEntityById(scope, id, args.entityType);
|
||||
|
||||
if(entity) {
|
||||
return entity[args.propertyName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
UrlPicker: function(value, scope, args) {
|
||||
|
||||
if(!args.propertyName) {
|
||||
args = {propertyName: "name"}
|
||||
}
|
||||
|
||||
var entity;
|
||||
|
||||
switch (value.type) {
|
||||
case "content":
|
||||
if(value.typeData.contentId) {
|
||||
entity = scope.services.archetypeCacheService.getEntityById(scope, value.typeData.contentId, "Document");
|
||||
}
|
||||
break;
|
||||
|
||||
case "media":
|
||||
if(value.typeData.mediaId) {
|
||||
entity = scope.services.archetypeCacheService.getEntityById(scope, value.typeData.mediaId, "Media");
|
||||
}
|
||||
break;
|
||||
|
||||
case "url":
|
||||
return value.typeData.url;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(entity) {
|
||||
return entity[args.propertyName];
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
Rte: function (value, scope, args) {
|
||||
|
||||
if(!args.contentLength) {
|
||||
args = {contentLength: 50}
|
||||
}
|
||||
|
||||
return $(value).text().substring(0, args.contentLength);
|
||||
}
|
||||
//create a function
|
||||
//you will add it to your label template field as `{{ArchetypeSampleLabelHelpers.testPromise(someArchetypePropertyAlias)}}`
|
||||
ArchetypeSampleLabelHelpers.testPromise = function(value) {
|
||||
//you can inject services
|
||||
return function ($timeout, archetypeCacheService) {
|
||||
//best to return a promise
|
||||
//NOTE: $timeout returns a promise
|
||||
return $timeout(function () {
|
||||
return "As Promised: " + value;
|
||||
}, 1000);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
ArchetypeSampleLabelHelpers.testEntityPromise = function(value, scope, args) {
|
||||
//hey look, args!
|
||||
//{{ArchetypeSampleLabelHelpers.testEntityPromise(someArchetypePropertyAlias, {foo: 1})}}
|
||||
console.log(args);
|
||||
|
||||
return function ($q, entityResource) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
entityResource.getById(args.foo, 'document').then(function(entity) {
|
||||
console.log("Hello from testEntityPromise");
|
||||
console.log(entity);
|
||||
deferred.resolve(entity.name);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
|
||||
ArchetypeSampleLabelHelpers.testEntityPromise2 = function(value, scope, args) {
|
||||
//hey look, args but we're also using the built-in archetypeCacheService
|
||||
//{{ArchetypeSampleLabelHelpers.testEntityPromise(someArchetypePropertyAlias, {foo: 1234})}}
|
||||
console.log(args);
|
||||
|
||||
return function ($q, archetypeCacheService) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
archetypeCacheService.getEntityById(args.foo, 'document').then(function(entity) {
|
||||
console.log("Hello from testEntityPromise2");
|
||||
console.log(entity);
|
||||
deferred.resolve(entity.name);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
+146
-53
@@ -35,8 +35,7 @@
|
||||
|
||||
.fieldsetIcon {
|
||||
float: left;
|
||||
padding: 0 4px 0 0;
|
||||
color: #333;
|
||||
padding: 0 10px 0 0;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
|
||||
@@ -54,7 +53,6 @@
|
||||
fieldset {
|
||||
border-bottom: 1px dashed #dddddd;
|
||||
padding: 0;
|
||||
margin-bottom: 5px;
|
||||
clear: both;
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
@@ -93,10 +91,10 @@
|
||||
.archetypeFieldsetLabel {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
min-height: 42px;
|
||||
background: white;
|
||||
|
||||
.label-sub {
|
||||
padding: 8px 0 8px 0;
|
||||
padding: 18px 0;
|
||||
display: inline-block;
|
||||
min-height: 20px; /* this makes the header clickable when there's no icon and no text */
|
||||
&.module-label {
|
||||
@@ -106,9 +104,9 @@
|
||||
cursor: pointer;
|
||||
|
||||
label {
|
||||
span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
// span {
|
||||
// text-decoration: underline;
|
||||
// }
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -129,7 +127,7 @@
|
||||
}
|
||||
|
||||
span {
|
||||
font-weight: bold;
|
||||
// font-weight: bold;
|
||||
|
||||
&.menu-label { font-weight: normal; }
|
||||
}
|
||||
@@ -145,57 +143,99 @@
|
||||
label {
|
||||
margin-bottom: 0;
|
||||
margin-left: 18px;
|
||||
white-space: nowrap;
|
||||
padding: 0;
|
||||
width: ~"calc(100% - 144px)";
|
||||
position: absolute;
|
||||
display: block;
|
||||
span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-height: 40px;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
display: -webkit-box;
|
||||
}
|
||||
&.dimmed {
|
||||
i, span {
|
||||
color: #d9d9d9 !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.dimmed {
|
||||
label {
|
||||
color: #d9d9d9 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.archetypeEditorControls {
|
||||
float: none;
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
opacity: 0;
|
||||
transition: opacity .15s ease-in-out;
|
||||
-moz-transition: opacity .15s ease-in-out;
|
||||
-webkit-transition: opacity .15s ease-in-out;
|
||||
background: white;
|
||||
|
||||
&:before {
|
||||
content: ' ';
|
||||
position: absolute;
|
||||
display: block;
|
||||
left: -40px;
|
||||
width: 40px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: -webkit-linear-gradient(90deg, rgba(255,255,255,0), white);
|
||||
background: -moz-linear-gradient(90deg, rgba(255,255,255,0), white);
|
||||
background: linear-gradient(90deg, rgba(255,255,255,0), white);
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: #ddd;
|
||||
padding: 2px;
|
||||
display: inline-block;
|
||||
height: 28px;
|
||||
width: 28px;
|
||||
line-height: 28px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #d6d6d6;
|
||||
color: #5f5f5f;
|
||||
background: white;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
margin-left: 8px;
|
||||
|
||||
&:hover {
|
||||
color: #333;
|
||||
background: #f3f3f5;
|
||||
}
|
||||
&.icon-delete:hover {
|
||||
color: #b94a48;
|
||||
&.icon-trash:hover {
|
||||
background: #fe5b57;
|
||||
border-color: #fe5b57;
|
||||
color: white;
|
||||
}
|
||||
&.icon-disabled {
|
||||
cursor: default;
|
||||
&:hover {
|
||||
color: #ddd;
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
&.icon-active {
|
||||
color: #333;
|
||||
color: #bbb;
|
||||
&:hover {
|
||||
color: #333;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
|
||||
&:hover .archetypeEditorControls {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-open > .archetypeFieldsetLabel .archetypeEditorControls {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.archetypePropertyError {
|
||||
margin-bottom: 5px;
|
||||
padding-top: 3px;
|
||||
@@ -213,9 +253,24 @@
|
||||
.archetypeCollapser {
|
||||
clear: both;
|
||||
height: 100%;
|
||||
padding: 12px 0 0 20px;
|
||||
background-color: #fff;
|
||||
border-radius: 0 0 0 5px;
|
||||
padding: 24px 20px 0 20px;
|
||||
background-color: #fafafa;
|
||||
border-top: 1px dashed #e0e0e0;
|
||||
line-height: 20px;
|
||||
|
||||
.archetypeFieldsetLabel {
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.archetypeEditorControls {
|
||||
background: #fafafa;
|
||||
|
||||
&:before {
|
||||
background: -webkit-linear-gradient(90deg, rgba(250,250,250,0), #fafafa);
|
||||
background: -moz-linear-gradient(90deg, rgba(250,250,250,0), #fafafa);
|
||||
background: linear-gradient(90deg, rgba(250,250,250,0), #fafafa);
|
||||
}
|
||||
}
|
||||
|
||||
form {
|
||||
margin-left:20px;
|
||||
@@ -246,25 +301,69 @@
|
||||
border: 1px solid #b94a48;
|
||||
}
|
||||
|
||||
.archetypeFooter {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.archetypeAddButton {
|
||||
color: #ddd;
|
||||
.icon {
|
||||
vertical-align: middle;
|
||||
}
|
||||
display: inline-block;
|
||||
height: 28px;
|
||||
width: 28px;
|
||||
line-height: 28px;
|
||||
border-radius: 14px;
|
||||
border: 1px solid #b6b6b6;
|
||||
color: #5f5f5f;
|
||||
background: white;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
|
||||
.archetypeAddButtonText {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.icon {
|
||||
color: #333;
|
||||
}
|
||||
background: #00aea2;
|
||||
border-color: #00aea2;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.archetypeEmptyContent {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
padding: 10px 20px;
|
||||
clear: both;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
background: #f8f8f8;
|
||||
border-radius: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.archetypeCrossDraggable + .archetypeEmptyContent {
|
||||
margin-top: -42px;
|
||||
}
|
||||
|
||||
&.archetypeDragging .archetypeCrossDraggable + .archetypeEmptyContent {
|
||||
display: none;
|
||||
}
|
||||
|
||||
// Necessary to ensure empty lists can be dropped onto when sorting nested fieldsets.
|
||||
.archetypeSortable.archetypeEmpty.archetypeCrossDraggable {
|
||||
min-height: 40px;
|
||||
border: 1px dashed transparent;
|
||||
}
|
||||
|
||||
&.archetypeDragging .archetypeSortable.archetypeEmpty.archetypeCrossDraggable {
|
||||
min-height: 56px;
|
||||
border-color: #dddddd;
|
||||
}
|
||||
|
||||
|
||||
.archetypeCollapser .archetypeEmptyContent span {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.multiPropertyTextbox {
|
||||
@@ -275,6 +374,9 @@
|
||||
list-style: none;
|
||||
margin-left: 0;
|
||||
}
|
||||
li {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.show-validation.ng-invalid .control-group.error .control-label {
|
||||
span {
|
||||
@@ -377,15 +479,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Necessary to ensure empty lists can be dropped onto when sorting nested fieldsets.
|
||||
.archetypeSortable.archetypeEmpty {
|
||||
&.archetypeCrossDraggable {
|
||||
min-height: 42px;
|
||||
border: 1px dashed #dddddd;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.archetypeEditor, .archetypeConfig {
|
||||
|
||||
@@ -6,6 +6,11 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f
|
||||
$http.get("backoffice/ArchetypeApi/ArchetypeDataType/GetAll"), 'Failed to retrieve datatypes from tree service'
|
||||
);
|
||||
},
|
||||
getAllDataTypesForCache: function() {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get("backoffice/ArchetypeApi/ArchetypeDataType/GetAllDetails"), 'Failed to retrieve datatypes from tree service'
|
||||
);
|
||||
},
|
||||
getDataType: function (guid, useDeepDatatypeLookup, contentTypeAlias, propertyTypeAlias, archetypeAlias, nodeId) {
|
||||
if(useDeepDatatypeLookup) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
|
||||
@@ -1,106 +1,87 @@
|
||||
angular.module('umbraco.services').factory('archetypeCacheService', function (archetypePropertyEditorResource) {
|
||||
angular.module('umbraco.services').factory('archetypeCacheService', function (archetypePropertyEditorResource, $q, entityResource) {
|
||||
//private
|
||||
|
||||
var isEntityLookupLoading = false;
|
||||
var entityCache = [];
|
||||
|
||||
var isDatatypeLookupLoading = false;
|
||||
var datatypeCache = [];
|
||||
|
||||
|
||||
return {
|
||||
getDataTypeFromCache: function(guid) {
|
||||
return _.find(datatypeCache, function (dt){
|
||||
return dt.dataTypeGuid == guid;
|
||||
});
|
||||
},
|
||||
|
||||
addDatatypeToCache: function(datatype, dataTypeGuid) {
|
||||
var cachedDatatype = this.getDataTypeFromCache(dataTypeGuid);
|
||||
|
||||
if(!cachedDatatype) {
|
||||
datatype.dataTypeGuid = dataTypeGuid;
|
||||
datatypeCache.push(datatype);
|
||||
}
|
||||
},
|
||||
initialize: function() {
|
||||
return archetypePropertyEditorResource.getAllDataTypesForCache().then(function(data) {
|
||||
_.each(data, function(datatype) {
|
||||
datatypeCache[datatype.dataTypeGuid] = datatype;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getDataTypeFromCache: function(guid) {
|
||||
return datatypeCache[guid];
|
||||
},
|
||||
|
||||
getDatatypeByGuid: function(guid) {
|
||||
var cachedDatatype = this.getDataTypeFromCache(guid);
|
||||
getDatatypeByGuid: function(guid) {
|
||||
var cachedDatatype = this.getDataTypeFromCache(guid);
|
||||
|
||||
if(cachedDatatype) {
|
||||
return cachedDatatype;
|
||||
}
|
||||
|
||||
if(cachedDatatype) {
|
||||
return cachedDatatype;
|
||||
}
|
||||
|
||||
//go get it from server, but this should already be pre-populated from the directive, but I suppose I'll leave this in in case used ad-hoc
|
||||
if (!isDatatypeLookupLoading) {
|
||||
isDatatypeLookupLoading = true;
|
||||
|
||||
archetypePropertyEditorResource.getDataType(guid).then(function(datatype) {
|
||||
|
||||
datatype.dataTypeGuid = guid;
|
||||
|
||||
datatypeCache.push(datatype);
|
||||
|
||||
isDatatypeLookupLoading = false;
|
||||
|
||||
return datatype;
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
},
|
||||
|
||||
getEntityById: function(scope, id, type) {
|
||||
var cachedEntity = _.find(entityCache, function (e){
|
||||
return e.id == id;
|
||||
});
|
||||
getEntityById: function(id, type) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
//console.log(entityCache);
|
||||
|
||||
var cachedEntity = entityCache[id];
|
||||
|
||||
if(cachedEntity) {
|
||||
return cachedEntity;
|
||||
}
|
||||
if(cachedEntity) {
|
||||
//console.log("Found ID " + id);
|
||||
|
||||
deferred.resolve(cachedEntity);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
//go get it from server
|
||||
if (!isEntityLookupLoading) {
|
||||
isEntityLookupLoading = true;
|
||||
//go get it from server
|
||||
entityResource.getById(id, type).then(function(entity) {
|
||||
entityCache[id] = entity;
|
||||
|
||||
//console.log("entity ID is now resolved into cache...");
|
||||
//console.log(entityCache);
|
||||
|
||||
deferred.resolve(entity);
|
||||
});
|
||||
|
||||
scope.resources.entityResource.getById(id, type).then(function(entity) {
|
||||
return deferred.promise;
|
||||
},
|
||||
|
||||
entityCache.push(entity);
|
||||
//perhaps this should return a promise?
|
||||
getEntityByUmbracoId: function(udi, type) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var cachedEntity = entityCache[udi];
|
||||
|
||||
isEntityLookupLoading = false;
|
||||
if(cachedEntity) {
|
||||
//console.log("Found UDI " + udi);
|
||||
|
||||
deferred.resolve(cachedEntity);
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
return entity;
|
||||
});
|
||||
}
|
||||
//go get it from server
|
||||
entityResource.getByIds([udi], type).then(function (entities) {
|
||||
// prevent infinite lookups with a default entity
|
||||
var entity = entities.length > 0 ? entities[0] : { udi: udi, name: "" };
|
||||
|
||||
return null;
|
||||
},
|
||||
entityCache[udi] = entity;
|
||||
|
||||
//console.log("entity UDI is now resolved into cache...");
|
||||
//console.log(entityCache);
|
||||
|
||||
getEntityByUmbracoId: function(scope, udi, type) {
|
||||
var cachedEntity = _.find(entityCache, function (e){
|
||||
return e.udi == udi;
|
||||
});
|
||||
deferred.resolve(entity);
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module('umbraco.services').factory('archetypeLabelService', function (archetypeCacheService, $q, $injector) {
|
||||
angular.module('umbraco.services').factory('archetypeLabelService', function (archetypeCacheService, $q, $injector, $timeout) {
|
||||
//private
|
||||
|
||||
/**
|
||||
@@ -12,6 +12,7 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
|
||||
// Remember the original number of promises being resolved.
|
||||
var originalLength = promises.length;
|
||||
|
||||
return $q.all(promises).then(function () {
|
||||
|
||||
// If there are new promises, resolve those too.
|
||||
@@ -19,9 +20,7 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
promises = promises.slice(originalLength);
|
||||
return repeatedlyWaitForPromises(promises);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,21 +46,18 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
}
|
||||
|
||||
// Set a new value now that it has been processed.
|
||||
//console.log("Processing string..." + labelValue);
|
||||
match.value = labelValue;
|
||||
|
||||
} else if (isPromise(labelValue)) {
|
||||
|
||||
// Remember the promise so we can wait for it to be completed before constructing the
|
||||
// fieldset label.
|
||||
promises.push(labelValue);
|
||||
labelValue.then(function (value) {
|
||||
|
||||
//console.log("Processing final value..." + value);
|
||||
// The value will probably be a string, but recursively process it in case it's
|
||||
// something else.
|
||||
processLabelValue(value, promises, match);
|
||||
|
||||
});
|
||||
|
||||
} else if (_.isFunction(labelValue)) {
|
||||
|
||||
// Allow for the function to accept injected parameters, and invoke it.
|
||||
@@ -70,14 +66,10 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
// Recursively check result (may be a string, promise, or another function (another
|
||||
// function would be pretty strange, though I see no reason to disallow it).
|
||||
processLabelValue(labelValue, promises, match);
|
||||
|
||||
} else {
|
||||
|
||||
// Some other data type (e.g., number, date, object).
|
||||
match.value = labelValue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +107,6 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
* indicating whether or not that substring was matched the regular expression.
|
||||
*/
|
||||
function splitByRegex(rgx, value) {
|
||||
|
||||
// Validate input.
|
||||
if (!rgx || !value) {
|
||||
return [];
|
||||
@@ -158,7 +149,6 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
|
||||
// Get next match.
|
||||
match = rgx.exec(value);
|
||||
|
||||
}
|
||||
|
||||
// The text after the last match.
|
||||
@@ -175,7 +165,6 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
|
||||
// Return information about the matches.
|
||||
return splitParts;
|
||||
|
||||
}
|
||||
|
||||
function executeFunctionByName(functionName, context) {
|
||||
@@ -196,31 +185,31 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
}
|
||||
|
||||
function getNativeLabel(datatype, value, scope) {
|
||||
switch (datatype.selectedEditor) {
|
||||
case "Imulus.UrlPicker":
|
||||
return imulusUrlPicker(value, scope, {});
|
||||
case "Umbraco.TinyMCEv3":
|
||||
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, {});
|
||||
case "Umbraco.ContentPickerAlias":
|
||||
return coreContentPicker(value, scope, datatype);
|
||||
case "Umbraco.ContentPicker2":
|
||||
return coreContentPickerV2(value, scope, datatype);
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
switch (datatype.selectedEditor) {
|
||||
case "Imulus.UrlPicker":
|
||||
return imulusUrlPicker(value, scope, {});
|
||||
case "Umbraco.TinyMCEv3":
|
||||
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, {});
|
||||
case "Umbraco.ContentPickerAlias":
|
||||
return coreContentPicker(value, scope, datatype);
|
||||
case "Umbraco.ContentPicker2":
|
||||
return coreContentPickerV2(value, scope, datatype);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function coreDropdown(value, scope, args) {
|
||||
@@ -240,6 +229,7 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
function coreMntp(value, scope, args) {
|
||||
var ids = value.split(',');
|
||||
var type = "Document";
|
||||
var deferred = $q.defer();
|
||||
|
||||
switch(args.preValues[0].value.type) {
|
||||
case 'content':
|
||||
@@ -251,32 +241,39 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
case 'member':
|
||||
type = 'member';
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var entityArray = [];
|
||||
var promises = [];
|
||||
|
||||
_.each(ids, function(id){
|
||||
if(id) {
|
||||
|
||||
var entity = archetypeCacheService.getEntityById(scope, id, type);
|
||||
|
||||
if(entity) {
|
||||
entityArray.push(entity.name);
|
||||
}
|
||||
promises.push(archetypeCacheService.getEntityById(id, type).then(function(entity){
|
||||
if(entity) {
|
||||
entityArray.push(entity.name);
|
||||
}
|
||||
}).promise);
|
||||
}
|
||||
});
|
||||
|
||||
return entityArray.join(', ');
|
||||
$q.all(promises).then(function() {
|
||||
deferred.resolve(entityArray.join(', '));
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function coreMntpV2(value, scope, args) {
|
||||
function coreMntpV2(value, scope, args) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
var ids = value.split(',');
|
||||
|
||||
if (ids.length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
var type = "document";
|
||||
|
||||
switch(args.preValues[0].value.type) {
|
||||
@@ -293,119 +290,173 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
var entity;
|
||||
|
||||
var entityArray = [];
|
||||
var promises = [];
|
||||
|
||||
_.each(ids, function (id) {
|
||||
if(id && !entity) {
|
||||
entity = archetypeCacheService.getEntityByUmbracoId(scope, id, type);
|
||||
if(id) {
|
||||
promises.push(archetypeCacheService.getEntityByUmbracoId(id, type).then(function(entity) {
|
||||
if(entity) {
|
||||
entityArray.push(entity.name);
|
||||
}
|
||||
}).promise);
|
||||
}
|
||||
});
|
||||
|
||||
return (entity != null ? entity.name : "") + (ids.length > 1 ? ", ..." : "");
|
||||
|
||||
$q.all(promises).then(function() {
|
||||
if(entityArray.length == 0) {
|
||||
deferred.resolve("");
|
||||
}
|
||||
|
||||
var firstEntityName = entityArray[0];
|
||||
|
||||
var value = firstEntityName + (ids.length > 1 ? ", ..." : "");
|
||||
|
||||
deferred.resolve(value);
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function coreMediaPicker(value, scope, args) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
if(value) {
|
||||
var entity = archetypeCacheService.getEntityById(scope, value, "media");
|
||||
|
||||
if(entity) {
|
||||
return entity.name;
|
||||
}
|
||||
archetypeCacheService.getEntityById(value, "media").then(function(entity) {
|
||||
deferred.resolve(entity.name);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
deferred.resolve("");
|
||||
}
|
||||
|
||||
return "";
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function coreMediaPickerV2(value, scope, args) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
//console.log("value=");
|
||||
//console.log(value);
|
||||
|
||||
if(value) {
|
||||
var entity = archetypeCacheService.getEntityByUmbracoId(scope, value, "media");
|
||||
|
||||
if(entity) {
|
||||
return entity.name;
|
||||
}
|
||||
archetypeCacheService.getEntityByUmbracoId(value, "media").then(function(entity) {
|
||||
deferred.resolve(entity.name);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
deferred.resolve("");
|
||||
}
|
||||
|
||||
return "";
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function coreContentPicker(value, scope, args) {
|
||||
if (value) {
|
||||
var entity = archetypeCacheService.getEntityById(scope, value, "document");
|
||||
|
||||
if (entity) {
|
||||
return entity.name;
|
||||
var deferred = $q.defer();
|
||||
|
||||
if(value) {
|
||||
archetypeCacheService.getEntityById(value, "document").then(function(entity) {
|
||||
deferred.resolve(entity.name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
else
|
||||
{
|
||||
deferred.resolve("");
|
||||
}
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function coreContentPickerV2(value, scope, args) {
|
||||
if (value) {
|
||||
var entity = archetypeCacheService.getEntityByUmbracoId(scope, value, "document");
|
||||
|
||||
if (entity) {
|
||||
return entity.name;
|
||||
var deferred = $q.defer();
|
||||
|
||||
if (value) {
|
||||
archetypeCacheService.getEntityByUmbracoId(value, "document").then(function(entity) {
|
||||
deferred.resolve(entity.name);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
deferred.resolve("");
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function imulusUrlPicker(value, scope, args) {
|
||||
|
||||
var deferred = $q.defer();
|
||||
|
||||
if(!value) {
|
||||
deferred.resolve("");
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
if(!args.propertyName) {
|
||||
args = {propertyName: "name"}
|
||||
}
|
||||
|
||||
if(typeof(value) != "object") {
|
||||
value = JSON.parse(value);
|
||||
}
|
||||
|
||||
var entity;
|
||||
|
||||
//console.log("urlpicker value...");
|
||||
//console.log(value);
|
||||
|
||||
if(value.length) {
|
||||
value = value[0];
|
||||
}
|
||||
|
||||
switch (value.type) {
|
||||
case "content":
|
||||
if(value.typeData.contentId) {
|
||||
entity = archetypeCacheService.getEntityById(scope, value.typeData.contentId, "Document");
|
||||
archetypeCacheService.getEntityById(value.typeData.contentId, "Document").then(function(entity) {
|
||||
//console.log("Retrived entity from cache!");
|
||||
//console.log("Resolving the entity name with " + entity[args.propertyName]);
|
||||
deferred.resolve(entity[args.propertyName]);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "media":
|
||||
if(value.typeData.mediaId) {
|
||||
entity = archetypeCacheService.getEntityById(scope, value.typeData.mediaId, "Media");
|
||||
archetypeCacheService.getEntityById(value.typeData.mediaId, "Media").then(function(entity) {
|
||||
deferred.resolve(entity[args.propertyName]);
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "url":
|
||||
return value.typeData.url;
|
||||
deferred.resolve(value.typeData.url);
|
||||
|
||||
return deferred.promise;
|
||||
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(entity) {
|
||||
return entity[args.propertyName];
|
||||
}
|
||||
|
||||
return "";
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function coreTinyMce(value, scope, args) {
|
||||
|
||||
if(!args.contentLength) {
|
||||
args = {contentLength: 50}
|
||||
args = {contentLength: 160}
|
||||
}
|
||||
|
||||
var suffix = "";
|
||||
var strippedText = $("<div/>").html(value).text();
|
||||
|
||||
if(strippedText.length > args.contentLength) {
|
||||
suffix = "…";
|
||||
suffix = "…";
|
||||
}
|
||||
|
||||
return strippedText.substring(0, args.contentLength) + suffix;
|
||||
}
|
||||
|
||||
function rjpMultiUrlPicker(values, scope, args) {
|
||||
function rjpMultiUrlPicker(values, scope, args) {
|
||||
var names = [];
|
||||
|
||||
_.each(values, function (value) {
|
||||
@@ -416,9 +467,9 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
|
||||
return names.join(", ");
|
||||
}
|
||||
|
||||
return {
|
||||
getFieldsetTitle: function(scope, fieldsetConfigModel, fieldsetIndex) {
|
||||
|
||||
return {
|
||||
getFieldsetTitle: function(scope, fieldsetConfigModel, fieldsetIndex) {
|
||||
|
||||
if(!fieldsetConfigModel)
|
||||
return $q.when("");
|
||||
@@ -475,12 +526,13 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
|
||||
args = JSON.parse(normalizedJsonString);
|
||||
}
|
||||
|
||||
|
||||
templateLabelValue = executeFunctionByName(functionName, window, scope.getPropertyValueByAlias(fieldset, propertyAlias), scope, args);
|
||||
}
|
||||
//normal {{foo}} syntax
|
||||
else {
|
||||
propertyAlias = template;
|
||||
|
||||
var rawValue = scope.getPropertyValueByAlias(fieldset, propertyAlias);
|
||||
|
||||
templateLabelValue = rawValue;
|
||||
@@ -491,41 +543,40 @@ angular.module('umbraco.services').factory('archetypeLabelService', function (ar
|
||||
});
|
||||
|
||||
if(propertyConfig) {
|
||||
var datatype = archetypeCacheService.getDatatypeByGuid(propertyConfig.dataTypeGuid);
|
||||
var datatype = archetypeCacheService.getDatatypeByGuid(propertyConfig.dataTypeGuid);
|
||||
|
||||
if(datatype) {
|
||||
|
||||
//try to get built-in label
|
||||
var label = getNativeLabel(datatype, templateLabelValue, scope);
|
||||
|
||||
if(label) {
|
||||
templateLabelValue = label;
|
||||
}
|
||||
}
|
||||
if(datatype) {
|
||||
//try to get built-in label
|
||||
var label = getNativeLabel(datatype, rawValue, scope);
|
||||
|
||||
if (label) {
|
||||
templateLabelValue = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Process the value (i.e., reduce any functions or promises down to strings).
|
||||
processLabelValue(templateLabelValue, promises, match);
|
||||
|
||||
});
|
||||
|
||||
// Wait for all of the promises to resolve before constructing the full fieldset label.
|
||||
return repeatedlyWaitForPromises(promises).then(function () {
|
||||
|
||||
//console.log("done waiting...")
|
||||
// Extract string values and combine them into a single string.
|
||||
var substrings = _.map(matches, function (value) {
|
||||
return value.value;
|
||||
});
|
||||
var combinedSubstrigs = substrings.join('');
|
||||
|
||||
var combinedSubstrings = substrings.join('');
|
||||
|
||||
//console.log(combinedSubstrings);
|
||||
|
||||
// Return the title.
|
||||
return combinedSubstrigs;
|
||||
|
||||
return combinedSubstrings;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2,6 +2,7 @@ angular.module('umbraco.services').factory('archetypeService', function () {
|
||||
|
||||
// Variables.
|
||||
var draggedRteArchetype;
|
||||
var archetypeEditors;
|
||||
var rteClass = ".archetypeEditor .umb-rte textarea";
|
||||
var editorSettings = {};
|
||||
var disabledSortables = [];
|
||||
@@ -215,6 +216,13 @@ angular.module('umbraco.services').factory('archetypeService', function () {
|
||||
sortable.enable();
|
||||
});
|
||||
disabledSortables = [];
|
||||
},
|
||||
// Get all active archetype editors on the current page
|
||||
getEditors: function() {
|
||||
if (archetypeEditors == null) {
|
||||
archetypeEditors = $('.archetypeEditor');
|
||||
}
|
||||
return archetypeEditors;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2,14 +2,6 @@
|
||||
<div class="archetypeEditor ng-class:model.config.customCssClass">
|
||||
<textarea class="archetypeDeveloperModel" ng-show="model.config.developerMode" ng-model="model.value"></textarea>
|
||||
|
||||
<!-- "Add" button. -->
|
||||
<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>
|
||||
</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>
|
||||
@@ -21,11 +13,11 @@
|
||||
<!-- 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}">
|
||||
<fieldset ng-class="['archetype-fieldset-' + fieldset.alias, (getFieldsetValidity(fieldset) == false ? 'archetypeFieldsetError' : ''), (isCollapsed(fieldset) ? '' : 'is-open')]" ng-init="fieldsetConfigModel = getConfigFieldsetByAlias(fieldset.alias)">
|
||||
<div class="archetypeFieldsetLabel" ng-class="{enableCollapsing: model.config.enableCollapsing, dimmed: isDisabled(fieldset)}">
|
||||
<div ng-click="focusFieldset(fieldset)" class="label-sub module-label">
|
||||
<span class="caret" ng-class="{'caret-right': isCollapsed(fieldset)}" ng-show="model.config.enableCollapsing"></span>
|
||||
<label ng-class="{dimmed: isDisabled(fieldset)}">
|
||||
<label>
|
||||
<i class="fieldsetIcon icon ng-class:fieldsetConfigModel.icon"></i>
|
||||
<span ng-bind="getFieldsetTitle(fieldsetConfigModel, $index)"></span>
|
||||
</label>
|
||||
@@ -34,9 +26,9 @@
|
||||
<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-documents" ng-click="cloneRow($index)" ng-show="canClone()"></i>
|
||||
<i class="icon icon-power" ng-class="{'icon-active': fieldset.disabled}" ng-click="enableDisable(fieldset)" ng-show="showDisableIcon(fieldset)"></i>
|
||||
<i class="icon icon-eye" ng-class="{'icon-active': fieldset.disabled}" ng-click="enableDisable(fieldset)" ng-show="showDisableIcon(fieldset)"></i>
|
||||
<i class="icon icon-time icon-disabled" ng-class="{'icon-active': isDisabledByPublishing(fieldset)}" ng-show="showPublishingIcon(fieldset)"></i>
|
||||
<i class="icon icon-delete" ng-click="removeRow($index)" ng-show="canRemove()"></i>
|
||||
<i class="icon icon-trash" ng-click="removeRow($index)" ng-show="canRemove()"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="archetypeCollapser animate-hide" ng-hide="model.config.enableCollapsing && isCollapsed(fieldset)" ng-if="isLoaded(fieldset)">
|
||||
@@ -109,6 +101,20 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- Empty content display. -->
|
||||
<div class="archetypeEmptyContent" ng-show="showEmptyContentHint()">
|
||||
<span>
|
||||
<archetype-localize key="addFieldset">Add an item</archetype-localize>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- "Add" button. -->
|
||||
<div class="archetypeFooter" ng-show="showAddButton()">
|
||||
<a class="archetypeAddButton" ng-click="openFieldsetPicker(model.value.fieldsets.length, $event)" prevent-default>
|
||||
<i class="icon icon-add"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- 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()">
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Archetype",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.1",
|
||||
"url": "http://github.com/kgiszewski/archetype/",
|
||||
"author": "Kevin Giszewski - Tom Fulton - Lee Kelleher - Matt Brailsford - Kenn Jacobsen - Nicholas Westby - Et. Al.",
|
||||
"authorUrl": "http://github.com/kgiszewski/archetype/",
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<projectUrl>http://github.com/kgiszewski/archetype</projectUrl>
|
||||
<description><![CDATA[Archetype for Umbraco]]></description>
|
||||
<tags>umbraco</tags>
|
||||
<iconUrl>http://imulus.github.io/Archetype/images/logo.png</iconUrl>
|
||||
<iconUrl>http://kgiszewski.github.io/Archetype/images/logo.png</iconUrl>
|
||||
<licenseUrl><%= licenseUrl %></licenseUrl>
|
||||
<dependencies>
|
||||
<dependency id="Archetype.Binaries" version="<%= version %>" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
||||
</package>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<projectUrl>http://github.com/kgiszewski/archetype</projectUrl>
|
||||
<description><![CDATA[Archetype binaries for Umbraco]]></description>
|
||||
<tags>umbraco</tags>
|
||||
<iconUrl>http://imulus.github.io/Archetype/images/logo.png</iconUrl>
|
||||
<iconUrl>http://kgiszewski.github.io/Archetype/images/logo.png</iconUrl>
|
||||
<licenseUrl><%= licenseUrl %></licenseUrl>
|
||||
<dependencies>
|
||||
<dependency id="UmbracoCms.Core" version="7.2.2" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
||||
</package>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
<projectUrl>http://github.com/kgiszewski/archetype</projectUrl>
|
||||
<description><![CDATA[Archetype Courier extension for Umbraco]]></description>
|
||||
<tags>umbraco</tags>
|
||||
<iconUrl>http://imulus.github.io/Archetype/images/logo.png</iconUrl>
|
||||
<iconUrl>http://kgiszewski.github.io/Archetype/images/logo.png</iconUrl>
|
||||
<licenseUrl><%= licenseUrl %></licenseUrl>
|
||||
<dependencies>
|
||||
<dependency id="Archetype.Binaries" version="<%= version %>" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
</package>
|
||||
</package>
|
||||
|
||||
Reference in New Issue
Block a user