Compare commits

..

14 Commits

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