-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
boolean widget & some documentation #396
Conversation
@daddykotex great addition! Also love the bonus docs improvement, thanks for that. Two thoughts:
|
@daddykotex I think the best way to handle this would be to require a default in the widget declaration in |
@biilmann did you mean to make that comment on @rafaelconde's PR? I'm not following how it's related to this one. |
@Benaiah that's a good idea, I'll play around to see how to implement that ;) |
Ok, I turned it functionnal (AFAIK 😄 ), it uses the switch widget and falls back to the default value or false if not supplied. But now, I can't save because the validation proccess in It blows up on save because validation is triggered and Do you have any idea? |
536060e
to
61df8f4
Compare
Any input here? |
This implementation works correctly: daddykotex@eb1538c |
@daddykotex that commit does appear to be working the first time you edit a post, but afterwards I can't open any entry for editing. I'm looking into the issue. |
OK, so I'll try to be really clear so we avoid wasting time due to confusion. When I use the class implementation (bool-class branch https://github.com/daddykotex/netlify-cms/tree/bool-class). It works fine. I can save the When I use the fully functional approach (bool branch https://github.com/daddykotex/netlify-cms/tree/bool), it does not work properly. I can't save and this is probably due to what I explained above (related to ref and By the way, I rebased both branch on On another note, I see that on FF and Chrome, the included example has a slightly different behavior. On Firefox, the markdown widget has a switch turned on while it's off on chrome: I think this is completely unrelated though. |
@daddykotex functional components don't have refs, so class is fine. |
Ok, so the implementation now uses a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daddykotex My bad - the bug that I mentioned earlier (#420) was actually unrelated to this PR, and is now fixed. I've tested this again after rebasing onto the latest master and it works fine. 👍 to merge as soon as the config line is removed.
example/config.yml
Outdated
@@ -15,6 +15,7 @@ collections: # A list of collections the CMS should be able to edit | |||
- {label: "Publish Date", name: "date", widget: "datetime", format: "YYYY-MM-DD hh:mma"} | |||
- {label: "Cover Image", name: "image", widget: "image", required: false, tagname: ""} | |||
- {label: "Body", name: "body", widget: "markdown"} | |||
- {label: "Draft", name: "draft", widget: "boolean", required: false, defaultValue: true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to use the example config as a test case for new features - can this line be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do!
removed the line and rebase against master :) |
Simplified just a bit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
- Summary
While working on the file-system backend, I was working with
hugo
.hugo
uses a draft attribute to let you mark content as draft so it's not included in the output. I found there was noboolean
widget, so here it is.The MR passes
npm run lint:staged
but I have issues the the pre-commit hooks:- Test plan
There's no test for the other widget, so I did not really know where to start here. Let me know if you want one.
- Description for the changelog
Widget for
boolean
fields