GithubHelp home page GithubHelp logo

kgiszewski / archetype Goto Github PK

View Code? Open in Web Editor NEW
89.0 89.0 54.0 2.56 MB

Archetype is an Umbraco 7 property editor that wraps other installed property editors.

Home Page: https://github.com/kgiszewski/ArchetypeManual

License: MIT License

C# 31.75% JavaScript 51.94% HTML 11.35% CSS 4.96%

archetype's People

Contributors

ashmind avatar batjan avatar bjarnef avatar cankoluman avatar ceee avatar codedemonuk avatar dillonmorton avatar doronuziel71 avatar gavinfaux avatar idontbyte avatar jbreuer avatar jeavon avatar kgiszewski avatar kimpil avatar kjac avatar leekelleher avatar markwemekamp avatar martinabrahams avatar mattbrailsford avatar nicholas-westby avatar rasmusjp avatar sitereactor avatar sniffdk avatar taylorsmith avatar tomfulton avatar tvanro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

archetype's Issues

Grunt packager doesn't install

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?

Unable to have a required Media Picker field

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...

Collapsible single fieldset

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?

7.1.1 and Upload Property Editor in an Archetype

Some properties require a 'click' before fully showing/working

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.

Custom Property Editor that uses "formSubmitting" fires after your "formSubmitting"

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

RTE isn't working properly

  • When adding multiple rows, the subsequent rows are missing the WYSIWYG (only shows the toolbar).
  • When adding a new row and returning to the first row, the WYSIWYG area is very long (1000px+)

Migration from EmbeddedContent to Archetype

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.

Unable to change between Fieldset Types when only one row

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.

2014-04-28_12-12-46

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:

  • Show the Remove button to allow users to remove the default row and add a new one of a different type
  • Make New Fieldset buttons behave like tabs, when Max Fieldsets is 1?
  • ... ?

Auto-populate property alias from name

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.

Remove dependency on mapping file for Views

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.

Multiple Archetypes on same DocType/tab

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.

Nested Archetype don't update

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.

Prompt the editor to save unsaved fieldset changes

In case you have an Archetype with multiple fieldsets:
If you

  1. change the sort order of the fieldsets on a document, or
  2. remove one or more fieldsets
    and subsequently navigate away from the document without saving, Umbraco does not prompt you to save the unsaved changes.

Brainstorm: "2500 limit" issue

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.

Archetype Core RTE macros not working

  • Very difficult to get the macro to save. Appears to work until page is reloaded.
    Only saves if using dialog, then opening <html>dialog, then save.
  • Macros do not render properly when you do get it to save on the template. Rendering the orange dotted line instead of the actual macro.

uSync and dataTypeId in prevalues

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.

Create Documentation

Key areas:

Where to store?

  • Git Wiki?
  • PDF's?

Prevalues

  • Fieldset Models (JSON)
  • Default Model
  • Developer Mode
  • Trivial Settings
  • Handling large Archetypes due to Core DB ceiling (prevalue data)

Editor

  • How to use on the editor side
  • Effect of hiding controls once create

Template Data Extraction

  • Property value converters
  • Extensions

Extending

  • Custom.js
  • Custom.css
  • Compilation debug='true'
  • Custom Sort Options

Get rid of 'remove: false' from each fieldset in model.value

This is a holdover that needs cleaned up.

  • During onFormSubmitting this value is checked to exclude from the saved data, however the property is never actually removed.
  • If we remove it, we need to add it back in during the model to renderModel ini.

Low priority.

Validation isn't always triggered

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.

http://screencast.com/t/ivHZQ74giL

Firefox - Can't click any input fields

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

Add new options to `ArchetypePreValue` model

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.

PropertyValueConverter and empty properties

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:

  • Return an empty Archetype with an empty list of Fieldsets when no value
  • Change the PVC to serialize to something enumerable, ie removing the need for the additional property?

Anyone have ideas on the best route? // @mattbrailsford @leekelleher

'Archetype' for both namespace and model class name --> bad juju

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?

Courier DataResolver

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.

Archetype keeps prompting editor to save unsaved changes after saving

Steps to reproduce:

  1. In the Umbraco backend, open a page with an Archetype property
  2. Make some changes to the Archetype property data
  3. Save the document (or save and publish)
  4. Navigate to another page
  5. Umbraco displays the "You have unsaved changes" modal dialog, even though the changes were just saved

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.

Suggestion for style of Add button

When lined up next to the standard Umbraco Add buttons, for example, the one MNTP uses, ours looks a bit out of place.

Might be nice to have this styled exactly like Umbraco's for consistency.

2014-05-16_13-51-15

Issue with two archetypes containing date pickers

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.

If Archetype has required fields, the property can't be optional

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.

2014-02-27_18-03-36

User permissions issues

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

PropertyValueConverter breaks with nested Archetype

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?

Error post install

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!

DataTypes don't sort properly in dropdown

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

Provide Template Helpers

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.

html ID attributes still are not unique enough

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.

PropertyValueConverterTests fail

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?

Test Core Properties

Need to implement as many as we can and report on any issues we have with core properties.

PropertyValueConverter reduce database hits

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.

Highlight only fieldsets and labels where errors occur

The fieldsets should only be highlighted where errors occurs, e.g. the first

  • with a fieldset has valid data, so it shouldn't be highlighted as an error.

    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

    2014-03-12_20-16-03

  • Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.