kgiszewski / archetype Goto Github PK
View Code? Open in Web Editor NEWArchetype is an Umbraco 7 property editor that wraps other installed property editors.
Home Page: https://github.com/kgiszewski/ArchetypeManual
License: MIT License
Archetype is an Umbraco 7 property editor that wraps other installed property editors.
Home Page: https://github.com/kgiszewski/ArchetypeManual
License: MIT License
This isn't an Archetype issue itself, but I found it when trying to install a generated Umbraco (zip) in the back-office (v7.1.1).
I pulled/rebased on the latest master
branch and ran grunt package
- this created the NuGet and Umbraco packages fine.
I took the Umbraco package zip, and tried to install it in the back-office... and got the following error:
Could not upload file
System.Exception: Error unpacking extension... ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ICSharpCode.SharpZipLib.Zip.Compression.DeflaterHuffman.BitReverse(Int32 toReverse)
at ICSharpCode.SharpZipLib.Zip.Compression.InflaterHuffmanTree.BuildTree(Byte[] codeLengths)
at ICSharpCode.SharpZipLib.Zip.Compression.InflaterDynHeader.Decode(StreamManipulator input)
at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Decode()
at ICSharpCode.SharpZipLib.Zip.Compression.Inflater.Inflate(Byte[] buffer, Int32 offset, Int32 count)
at ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.BodyRead(Byte[] buffer, Int32 offset, Int32 count)
at ICSharpCode.SharpZipLib.Zip.ZipInputStream.Read(Byte[] buffer, Int32 offset, Int32 count)
at umbraco.cms.businesslogic.packager.Installer.UnPack(String zipName)
at umbraco.cms.businesslogic.packager.Installer.Import(String InputFile)
--- End of inner exception stack trace ---
at umbraco.cms.businesslogic.packager.Installer.Import(String InputFile)
at umbraco.presentation.developer.packages.Installer.uploadFile(Object sender, EventArgs e)
I'm not sure whether this is an error with tomfulton/grunt-umbraco-package or the Umbraco package installer itself?
If you have a Media Picker field on your Archetype and set it to Required, Umbraco lets you save the page without selecting any media.
Presumably the media picker has 0 as it's default value, and Archetype's validation looks for null/empty/etc. This is similar to what we're discussing in #89 with checkboxes.
Unsure what the proper fix is here since we don't know what "empty" really means to every given PropertyEditor. May need to dig in and see how Umbraco handles this, or worst case, start adding checks for specific types...
Add repository field, as npm
complains about it being missing.
(I'll submit a PR)
Need to update the package task to include the binaries and place them into the correct folders.
We have a couple of Archetypes that are single fieldsets (e.g. hide fieldset editor controls = true; enable multiple fields = false). These work very well as a composite property, many fields within a single property.
However they can look overwhelming to a content editor - especially if there are several properties/fields. I'm wondering if it would look better if the single fieldset could be collapsible?
Trying to use built-in Umbraco Upload PE with Archetype - I just have a text string + upload for my archetype (originally had a nested archetype with an upload pe).
When I add some content (text string + a single file upload) and then hit Save + Publish I see this error in the Console:
TypeError: undefined is not a function
at initialize (http://innovasian.local/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9…nUvQWN0aW9uTmV3UmVsYXRpb25UeXBlLmpzOw&t=Javascript&cdv=1153965183:1051:148)
at new fileUploadController (http://innovasian.local/DependencyHandler.axd?s=L3VtYnJhY28vbGliL2pxdWVyeS9…lbnUvQWN0aW9uTmV3UmVsYXRpb25UeXBlLmpzOw&t=Javascript&cdv=1153965183:1054:1)
at d (http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:28:304)
at Object.instantiate (http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:28:434)
at http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:53:326
at http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:44:274
at n (http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:7:74)
at k (http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:44:139)
at e (http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:40:139)
at http://innovasian.local/umbraco/lib/angular/1.1.5/angular.min.js:39:205
An running on 7.1.1
Am using the latest from master as of a few minutes ago.
Regards,
Matt
When adding a new row in Archetype, some properties don't fully render until you click them. I've seen this with the Date Picker and Slider so far.
It seems like the code in the datatype's controller isn't getting executed when the row is added, only once you click inside the newly added row.
I created a custom Property Editor using Kevin's blogged examples from Dec/Jan - they use "formSubmitting" events to clean up the model and to actually set the model.value.
When I add one of these custom PropEditors to Archetype and set some breakpoints I see your "formSubmitting" fire first and then mine, therefore my values are not stored in the json.
Any workarounds for this or can I change my code to make it fire before yours somehow?
Regards,
Matt
I have a self-contained pure T-SQL migration that migrates all Embedded Content (http://our.umbraco.org/projects/backoffice-extensions/embedded-content, I tested for 1.2.122) prevalues and values to Archetype.
You can see it here: https://gist.github.com/ashmind/4be6f3a2984dcadfcf6f
It is probably imperfect, but may be useful for people.
Is it something you would be interested to have? I can add it through a proper pull request then, along with some notes (e.g. it currently expects that everything mapped to Archetype was once Embedded Content).
I am not an expert on Umbraco, so I do not yet know where people normally put those kinds of migrations, but I assume SQL would be useful in any case.
If you set Max Fieldsets to 1
, but you create multiple Fieldset Types, it's impossible to switch between them, so the user is stuck with the "default" type.
It's impossible because the default behavior of clicking the fieldset button is to insert a new row, but we don't allow this due to the Max Fieldsets setting. We also hide the editor controls (add/remove) in this case, preventing the user from removing the default type and adding a new one.
Ideas:
1
?When defining properties in a fieldset, it'd be nice if typing in the property Name
would auto-populate the Alias
with a camel-cased version - similar to how the DocType editor behaves.
Umbraco has some logic for this built-in and available, but I think it's geared towards WebForms so it may not be readily available on the Angular side. It's calling a webservice to handle the formatting: /umbraco/RestServices/CoreStrings/ToSafeAlias?value=My%20Field
, but I don't think there's any API.
It might be easier to just do it ourselves. The tricky part might be not updating the alias once it's been defined.
When you have a Number field marked as Required, it thinks the value 0
is invalid.
This is inconsistent with how the built-in Number field validates, as it accepts 0
as a valid value.
Because we couldn't find anywhere Umbraco provides access to PropertyEditor
, we created a mapping file that tells Archetype where the View for each Core DataType's
PropertyEditor
lives. This means to use a custom PropertyEditor
, one needs to make sure to add it to this file, which isn't ideal.
The properties we need access to are public on PropertyEditor
, but there doesn't seem to be any way for us to get a reference to the PropertyEditor
of a DataType
. Nor does their seem to be a way to get a list of all PropertyEditors
available - only for DataType
, which don't include the info we need.
The fix might involve bundling our own service (if we can get access to the data we need) or an Umbraco core pull request to expose the data somewhere.
Not sure if this is a core issue or an Archetype issue.
Can Archetype support multiple instances of the same Archetype on the same document-type (on the same tab)?
I'm trying this against v0.3-alpha on Umbraco v7.0.3. When trying to save the content node, I get a warning message saying "The document could not be saved because of missing required fields."
When I remove the multiple instances, leaving just one instance of the Archetype, the content node saves correctly.
We have an Archetype that contains a nested Archetype (which only contains a DropDownList). We are finding that when we update the nested Archetype values, they aren't being updated correctly.
Adding fieldsets seems to work fine. Removing them doesn't work.
I can provide more details if needed, (e.g. JSON configs, etc) - Let me know, thanks.
In case you have an Archetype with multiple fieldsets:
If you
Remove deploy
and watch:dev
tasks in favor of this approach
Will need to update packaging tasks to be aware of the new structure as well
We are designing an Archetype T-shirt for Codegarden 14.
So far besides a logo and the GitHub usernames of all contribs, we'll take any design ideas you may have.
If you want a shirt, we'll have to work something out ;)
We're storing the configuration of each Archetype in the cmsDataTypePrevalues
table, but the field is an nvarchar(2500)
. This causes a YSOD to bubble up on Save if your Archetype's configuration (JSON blob) ends up being longer than that.
Since we've removed some of the config options, this issue probably isn't as prevalent, but it still happens on some of my test datatypes.
The current workaround is to change the limit in SQL:
ALTER TABLE [your-db] ALTER COLUMN [value] nvarchar(MAX)
There's probably not much we can do to fix this, but maybe we can ease the pain somehow so users don't see a YSOD and help guide them towards the solution.
<html>
dialog, then save.orange dotted line
instead of the actual macro.I see that prevalues reference field datatypes by ids (e.g. "dataTypeId": "1034"
).
That might be a problem for setups that use tools like uSync to sync datatypes between different CMS instances.
A more portable idea would be to store the node name instead. However, as it does create a potential rename problem, maybe it should be an opt-in setting for people using uSync.
Key areas:
Where to store?
Prevalues
Editor
Template Data Extraction
Extending
Please look this video. http://www.screenr.com/MiNN
Thanks,
This is a holdover that needs cleaned up.
Low priority.
In this example, there's an Archetype with two fields, the second one is required. If I create a new page using it, I'm able to click Save/Publish and the page successfully publishes, even though I left the second field blank.
It seems like the validation gets triggered after the publish.
If I type some test into Test 1 first, the validation gets triggered correctly.
In Firefox, its impossible to click on any input fields in the Archetype Editor (or dropdowns, etc) or Prevalue Editor when sorting is enabled.
This looks to be because the copy of angular-ui-sortable
in the Umbraco Core that we're referencing, is calling .disableSelection()
, which causes this known issue in Firefox.
This doesn't look to be an issue in the angular-ui-sortable standalone directive, but it appears the copy in the core has been modified a bit. Unfortunately, the copy in the core is minified, so it's difficult to see what's really going on, though I think its only that one change.
I'm hoping we can find out from HQ about why that was added and if it can be removed, since it's deprecated anyway. Couldn't seem to find any bugs with it removed.
As a VERY hacky workaround, I tried doing this, but it seems its happening on more than just input
elements (option
, who knows what else), so I'm not sure how well this really works or if we should just run it on a bunch of controls.
$timeout(function() {
$('.archetypeEditor .controls input')
.bind('mousedown.ui-disableSelection selectstart.ui-disableSelection', function(e) {
e.stopImmediatePropagation();
});
}, 1000);
As another option, I was hoping we could just use the real copy of angular-ui-sortable
, but I don't think that's possible since it'll be using the same name as the core's copy.
Umbraco bug: U4-4281
With the new "Enable Collapsing?" option, I'd noticed that it wasn't being resolved by Courier (on UaaS).
This is because we deserialize/re-serialize the prevalue options (so any DataType Ids can be parsed/resolved).
To solve this, the "Enable Collapsing?" property needs to be added to the ArchetypePreValue
model.
I'll supply the PR for this, but wanted to flag it up first.
I want to use this code:
@foreach (var item in myField.GetPropertyValue<Archetype>("propertyAlias").Fieldsets)
{
}
But, it's not really safe and will cause an exception for a page that doesn't have a value set (the PVC can return null, so fails on .Fieldsets
).
Of course I can wrap this in a check, but I'm thinking we can optimize to avoid the need for that.
Suggestions:
Archetype
with an empty list of Fieldsets
when no valueAnyone have ideas on the best route? // @mattbrailsford @leekelleher
Because the top level namespace is 'Archetype', and it's also the name of a model class, you have to fully qualify the class name in generics, otherwise VS gets confused.
.GetPropertyValue<Archetype.Umbraco.Models.Archetype>("myDocTypePropAlias")
I also get 'compile time squiggles (that's a formal term :-) ) under 'Umbraco' in my using statement in a view, also, I think, because VS is confused by the use of 'Archetype'.
@using Archetype.Umbraco.Models;
Maybe change the top level namespace to ArchetypeKit?
If we write a custom DataResolver for Courier, would it something that you would be interested in bundling with the Archetype package? or as a standalone package?
Bit of background... the current website we're building is running on UaaS and uses Courier when deploying CMS changes from local to development environment.
Since we are using Archetype extensively, we are finding that we have to re-map the content/media pickers within the fieldsets.
Steps to reproduce:
I'm not sure when this was introduced, I don't recall that has always been an issue.
I am testing a fix for it, will submit a PR soon - just needed an issue to link the PR to.
Hi,
I think there's a bug with Archetype when there are multiple archetype datatypes on a document type, which contain date pickers. I've not had chance to try to replicate this on a fresh install, but in my current set-up the first archetype works 100% correctly but the second one doesn't render the calendar icon in the date picker, and the button to launch the calendar modal doesn't do anything when clicked. There's no console error, but hard-inputting a date does save, so it would seem to be just UI issue whereby the calendar icon isn't there and isn't working correctly.
This is using Archetype alpha 4 and Umbraco 7.0.3, using SQLCe for dev.
Amazing work on this datatype guys by the way, it's absolutely incredible.
Would be great if we could use regular expression validation on a property, just like on native doctype properties.
If any of your fields in an Archetype are marked as Required, it then essentially makes the entire Umbraco property required, forcing the user to add a fieldset. IE, when you create a new page, it automatically has a blank Archetype in the "invalid" state, and you're forced to enter some data for the page to save.
In this case, I want the Umbraco property itself to be optional, but if the user enters data, I want to ensure the first field is filled out by requiring it. For example, requiring a URL be entered but providing an optional Caption.
Currently it marks the entire Fieldset as invalid as soon as the page is created, thus forcing the user to enter data.
Hi Chaps,
There would seem to be an issue with Archetype affecting user permissions. If Archetype is installed a user can't access the content section of the CMS without having access to the developer section. Grant them developer access, all good, revoke access and the user gets redirected to the log-in screen when trying to edit any content page. There are console errors at this point which show 401 (unauthorised access) errors on some data-types e.g.
http://www.example.com/umbraco/backoffice/UmbracoApi/DataType/GetById?id=-88
On one of our Archetypes we have a nested Archetype. This all works fine in the back-office, but when we try to use the value on the front-end we get a YSoD.
I think this is because when the value is being converted/deserialized into an Archetype
model, the Property.Value
is a string
... but the JSON for the nested isn't a string
, so it can't be deserialized.
One solution could be to change Property.Value
to be an object
, but not sure what complications that would lead to?
I've got a fresh 7.0.1 install with starter pack. I grabbed the latest Archetype package from the lease tab and install. Restart app pool to clear the cache. When I create a new data type in Umbraco, get an error when I select Archetype from the Property Editor dropdown:
Request error: The URL returned a 404 (not found):
/umbraco/backoffice/UmbracoTrees/DataTypeTree/GetNodes
I can fill in the Archetype information, but the Data Type drop down is empty. Any advice??
Cheers!
In the Config Editor, the DataType
dropdown shows an improperly sorted list.
The data is actually sorted properly in the variables, but the sort order seems to get lost once we bind to the <select>
. It would seem that it's sorting by id
instead of value
.
I found here you can add | orderBy:'name'
, but that doesn't seem to work, likely because of the different syntax we're using here
Need to figure out just how to handle.
It needs to happen in C# via exentsions and/or property value converters.
This is not necessarily a launch requirement, but would be a huge value add.
If you have two archetypes on the same page with the same property alias names, there will be ambiguous names for the some elements:
i.e. datepickerarchetype-property-0-0 where the 0-0 is the fieldset and property index. But if another archetype on the same page also uses 'datepicker' as a property name, it'll be duplicated.
Archetype.Tests.PropertyValueConverter.PropertyValueConverterTests
fail in 'develop' branch:
Returns_Null_When_Data_Is_Null
Expected: null
But was: <empty>
Returns_Original_String_When_Data_Is_Invalid_Json
Expected is <System.String>
, actual is <Archetype.Umbraco.Models.Archetype>
Values differ at index [0]
Both are probably caused by change dd453fc?
Need to implement as many as we can and report on any issues we have with core properties.
Now that we're using Archetype with production content/data, we are noticing many database hits with the PropertyValueConverter.
These can be pinpointed to the GetArchetypePreValueFromDataTypeId
method, which needs to query the prevalue config for an Archetype instance.
I've considered wrapping the method with ApplicationContext.Current.ApplicationCache.GetCacheItem
for a set duration, but wanted to discuss any other options/ideas first.
@tomfulton When I run the package tool, the binary gets left out.
The fieldsets should only be highlighted where errors occurs, e.g. the first
Also the second fieldset have here a missing required field (age), but the field "name" has valid data.. furthermore it might be misleading to the editors that the "image" label is highlighted as it's set to optional, so they might think it's required.
Related to this post: http://our.umbraco.org/projects/backoffice-extensions/archetype/sound-off!/49058-Validation-seems-to-have-minor-issues
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.