kgiszewski / Archetype

Archetype is an Umbraco 7 property editor that wraps other installed property editors.
https://github.com/kgiszewski/ArchetypeManual
MIT License
89 stars 54 forks source link

Archetype hogging the .config property #380

Closed MatsStam closed 7 years ago

MatsStam commented 7 years ago

Got a fix for it, but I'm all new to github. Tried using sourcetree to create a pull request and whatnot, but failed miserably... :P

On row 12 in the \app\controllers\controller.js just merge the existing .config object with the archetype one... Replace $scope.model.config = $scope.model.config.archetypeConfig; with _.extend($scope.model.config, $scope.model.config.archetypeConfig);

If anyone wanna contact me and show me how to actually contribute to this package I'd appreciate that too. Or maybe you just need to be part of the group you trust, in which case hope this makes sense :)

kgiszewski commented 7 years ago

Can you explain the issue you are fixing?

MatsStam commented 7 years ago

Ah yeah, sorry. I first noticed the issue when I tried using backofficetweaking at the same time as Archetype. backofficetweaking also uses the "property.config" property. The one that Archetype sets on row 12. Hence when using both, the backofficetweaking package failed, because all it's settings that it tried to store in property.config was gone. Because Archetype replaced them with theirs :)

Did that clear it up a bit? =)

kgiszewski commented 7 years ago

The $scope variable should be private to Archetype. I'm not familiar with the package you listed. Won't you have this issue with every property editor?

MatsStam commented 7 years ago

Hmm, I'm not sure... Not sure how backofficetweaking (https://our.umbraco.org/projects/collaboration/backoffice-tweaking/) manages to actually do this. I just noticed that it's in the same object.. Maybe they're doing this on another level, since they handle security (like hiding properties, buttons, tabs etc). Maybe that's why this messes things up... I can't see their code tho, so I focused on Archetype since it's my favourite 📦 First time I've actually looked into these things, so I might be wrong, but thats what I did to get both packages working together in my current project.

kgiszewski commented 7 years ago

$scope is contextual and relates to only a single instance of a property editor. In general all property editors operate independently of any other.

MatsStam commented 7 years ago

Yeah, I understand that, but what they're doing is probably just building on on every property, to be able to (through a config) control which users see which properties. So they're probably the ones doing the funny business stuff. They have to set their config per property, to be able to control which properties are shown and not, that has to be on a per property basis.

MatsStam commented 7 years ago

An equal fix would be for them to store their stuff in another property (thats not config). If thats possible, I have no clue what their code actually does :P Maybe you don't want others to be able to build on the propertys config object, then nothing should be done :) And I'm sorry for taking up your time...

kgiszewski commented 7 years ago

No worries 😊 we just need to keep the concerns separate. You could run a custom version of Archetype or maybe see how the other package works and go from there.

MatsStam commented 7 years ago

Yeah, I'm running a custom version of Archetype, it just took me a while to find the issue... :P So I just wanted to share what I did...

Thanks for getting back to me so quickly :)

kjac commented 7 years ago

@kgiszewski @MatsStam I think this issue can be closed now?

MatsStam commented 7 years ago

Oh heck, sorry. Yeah if you don't wanna fix it on your end then yes. Sorry for keeping this open, didnt realise I was the one that needed to close it :P

kjac commented 7 years ago

@MatsStam No worries, I am just doing some housekeeping... didn't want to close this one without asking first :)