Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 17:42
    GabeLeRoy
    0

    Is it possible to modify the backend ?

    I want to add a new toggle button between the "ReleaseDate" and the "UnpublishDate".

    Here is how that button would interact.

    If the button is toggled-on

    1. the article can be reached but only with the URL.
    2. The article is not visible on the website.

    Finally, I would like to only be able to toggle the button if the Release Date is later than the current time.

    Can Umbraco actually be modified in the Backend ? I have looked online and I haven't seen a single post of someone being able to modify the backend.

    Anyway, Thank you.

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Aug 24, 2017 @ 18:08
    Nicholas Westby
    0

    You can do everything you describe, but for simplicity I would recommend making some slight changes. Here's how I'd go about this:

    • Property Editor Create a property editor for this new field. This property editor would be able to understand the release date, and would allow you to perform a toggle.
    • Data Type Create a data type based on your property editor.
    • Property Add a property to your document types that makes use of this data type.
    • Conditional Logic Add code to your CS or CSHTML files to hide the article from the website (my guess is you mean that it'd remove links to the article), depending on the value of that property.

    It would be difficult (but not impossible) to place this property editor right in between the release date and unpublished date. If you really want to go down that path, I can give you some more recommendations, but I'd advise against it due to the complexity involved.

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 18:12
    GabeLeRoy
    0

    I thought about something else that could achieve the same result. Would it be possible to change the Hide in Navigation for a Date ?

    It would achieve exactly the same result.

    -Publish the article -Give a date to hide in navigation

    Result: The article will be published but hidden in navigation until the date is passed ???

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Aug 24, 2017 @ 18:21
    Nicholas Westby
    0

    Hide in Navigation

    I'm guessing this is a property you have on your pages? It's not a built in thing, so I suppose somebody must have added it. You might also be talking about a property with an alias of umbracoNaviHide. If so, that's nothing special, but it's a convention many Umbraco developers follow.

    If that's the case, it can do whatever you want.

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 18:31
    GabeLeRoy
    0

    Yeah, that was my bad. The Hide in Navigation is only a name I found in my code. The actual alias is umbracoNaviHide. Anyway I will test this out and I'll reply if I have any error happening.

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 18:58
    GabeLeRoy
    0

    I have found a small problem. When I try to change the true/false to a DatePickerWithTime, I cannot go back on any pages without receiving an error saying, Cannot Convert '0' to DateTime.

    Any idea what might be happening ?

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Aug 24, 2017 @ 19:47
    Nicholas Westby
    0

    When I try to change the true/false to a DatePickerWithTime, I cannot go back on any pages without receiving an error saying, Cannot Convert '0' to DateTime.

    Sounds like the old data for that property was stored as either "0" or "1" and the new property editor (date time) expects data to be in the format of a date. Is there some reason you need to use the same property? Can you simply delete the old property and create a new one rather than swapping the data type on the existing property?

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 19:49
    GabeLeRoy
    0

    I tried to do so. But how am I suppose to bind the UmbracoNaviHide with a DateTime ?

    My goal is that, the article will be hidden if the current Date/Time is earlier than the one entered.

    If the Date/Time is empty, then the umbracoNaviHide is false.

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 19:57
    GabeLeRoy
    0

    I tried to do so but I don't think I understand how am I suppose to bind a UmbracoNaviHide with a DatePickerWithTime ...

    My goal is that if the current date/time is earlier the choosen date/time from the picker, then the article will be hidden.

    If no date/time is entered then the article is not hidden.

    How am I suppose to bind the UmbracoNaviHide with a date time picker ? Do I need to change something in the code ?

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Aug 24, 2017 @ 20:11
    Nicholas Westby
    0

    how am I suppose to bind a UmbracoNaviHide with a DatePickerWithTime

    I have no idea what that means. Why not simply ignore the fact that umbracoNaviHide exists and start coding from there? Whatever code that was built for umbracoNaviHide would be custom anyway, so you'd just be modifying your already custom code with further custom code.

    Here's what I imagine you can do (correct me if you think you can't do this for some reason):

    • Create a new property. Call it something like "Navigation Reinstatement Date". It can be a date time picker.
    • For any navigational elements on the site, modify the code to look at the new property to determine whether or not to display the navigational item.

    Basically, completely ignore umbracoNaviHide. It doesn't seem to have any bearing on the functionality you are after.

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 20:12
    GabeLeRoy
    0

    Alright, I will try that.

  • GabeLeRoy 13 posts 83 karma points
    Aug 24, 2017 @ 20:25
    GabeLeRoy
    0

    I got an idea. I will just modify the get function from the property umbracoNaviHide and return True/False whether the date is valid or not. That way, I don't have to modify any code except the little get function.

Please Sign in or register to post replies

Write your reply to:

Draft