Giter Club home page Giter Club logo

Comments (12)

jamiepollock avatar jamiepollock commented on June 10, 2024

Sounds like a sensible option, but surely you'd change the POCO property to be IsHidden rather than IsVisible?

from umbraco-ditto.

mattbrailsford avatar mattbrailsford commented on June 10, 2024

The issue really pops up when you have multiple checkbox options and you've named them because of how the checkbox works so you end up with HideX, ShowX depending on what the default action should be. The only reason for this suggestions is so that on your viewmodel at least, you can reference them all in the same way.

from umbraco-ditto.

jamiepollock avatar jamiepollock commented on June 10, 2024

Sure, I see! I'd probably go for InvertedBooleanValueResolver though, personally find it more descriptive than a BooleanValueResolver with a flag inverting things.

from umbraco-ditto.

mattbrailsford avatar mattbrailsford commented on June 10, 2024

Hmm, I wonder if this should actually be an InvertBooleanTypeConverter rather than a value resolver as at this point you know it's resovled as boolean, and it's a case of converting it (ie, inverting it)

Note to self, the lines between Value Resolvers and Type Converters can get a little blury :)

from umbraco-ditto.

jamiepollock avatar jamiepollock commented on June 10, 2024

Yea, I'm still not up to speed yet as I've not used 0.7.0 in anger. My mind is still in the TypeConverter frame of mind.

from umbraco-ditto.

mattbrailsford avatar mattbrailsford commented on June 10, 2024

Wadda you know, this works :)

capture

from umbraco-ditto.

jamiepollock avatar jamiepollock commented on June 10, 2024

badda bing, badda boom! (instant regret for typing that, leaving it there anyways)

from umbraco-ditto.

mattbrailsford avatar mattbrailsford commented on June 10, 2024

Sweet! Well I'm happy with this as a solution so gonna class it as closed. Thanks for you input @jamiepollock (I'll ignore your last comment ;))

from umbraco-ditto.

leekelleher avatar leekelleher commented on June 10, 2024

I know you've closed this, but it got me thinking about the difference between ValueResolvers and TypeConverters... my take on it here would be that you are manipulating the value, so that would come under a resolver. Whereas if you were changing the type, that would be a converter.

I dunno... apples and oranges :bowtie:

from umbraco-ditto.

mattbrailsford avatar mattbrailsford commented on June 10, 2024

I think this is where the lines blur. To me, you've resolved a value already, which is the boolean, then you want to convert it into another type, which in this case is an inverted boolean.

Like I say, you could do either, I just think this is less messy, ie, you don't have an attribute config setting that only applies if the value is boolean.

If we find loads of people asking for it, we can review that decision.

from umbraco-ditto.

leekelleher avatar leekelleher commented on June 10, 2024

👍 💯

from umbraco-ditto.

JimBobSquarePants avatar JimBobSquarePants commented on June 10, 2024

I'm kinda glad this is closed as it feels a little icky to me. Inversion like this should be blatantly obvious in the code. I like to be able to trace a models properties easily from the back office to my view.

from umbraco-ditto.

Related Issues (20)

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.