Closed snide closed 9 years ago
This is pushed live.
Was just wanting this and neither checkboxes or multiple choice seem to fit, thanks. Sorry to be unfun, but I'm wondering if it could have a configurable default value? I just created the field and saved an entry (without touching the field in the entry) and so it shows as false, which is not my default.
I can just turn it off. I added it merely to be explicit that you can evaluate it that way, but I think you're right that the entry side may not always match. I'll have a fix out in 5.
Or were you saying, you'd want to set the default to True?
I was saying one should be able to choose the default. Or, thinking through it… My use case is a field that says "For Sale?" where most items are for sale, but a few are not. I could change the label to be the opposite, but the true state, being green, doesn't seem to go with a negative state. Does that make sense?
Makes sense. Mike's deep in some code, but will get to it soon.
Would it be easy to add the functionality to customize the true/false labels? So in Bud's case the name of his switch widget could be "Status" with the labels of "For Sale" "Sold". The values would remain the same, just would look better to the client. True/false just isn't welcoming, imo.
@ChaseGiunta that's a good idea and easy enough to implement. I'll do that when I add the default value functionality. Been a little swamped lately, but I'll get this out soon.
@budparr @ChaseGiunta default toggle and labels are out now.
Hey, @gpbmike - throwing errors on two different sites pulling up the content editing form where I had that field:
Property set failed: object in path "meta" could not be found or was destroyed.
c@http://cms.webhook.com/v2/assets/vendor.min.js:10:11280
i@http://cms.webhook.com/v2/assets/vendor.min.js:11:7350
http://cms.webhook.com/v2/assets/vendor.min.js:11:14886
set@http://cms.webhook.com/v2/assets/vendor.min.js:14:16214
http://cms.webhook.com/v2/assets/js/app.min.js:5:2451
forEach@[native code]
d@http://cms.webhook.com/v2/assets/js/app.min.js:5:1522
forEach@[native code]
setupController@http://cms.webhook.com/v2/assets/js/app.min.js:5:1885
u@http://cms.webhook.com/v2/assets/vendor.min.js:11:23727
c@http://cms.webhook.com/v2/assets/vendor.min.js:11:22217
setup@http://cms.webhook.com/v2/assets/vendor.min.js:12:30842
o@http://cms.webhook.com/v2/assets/vendor.min.js:17:37393
n@http://cms.webhook.com/v2/assets/vendor.min.js:17:37335
n@http://cms.webhook.com/v2/assets/vendor.min.js:17:6673
http://cms.webhook.com/v2/assets/vendor.min.js:17:6417
h@http://cms.webhook.com/v2/assets/vendor.min.js:17:36288
m@http://cms.webhook.com/v2/assets/vendor.min.js:17:6386
q@http://cms.webhook.com/v2/assets/vendor.min.js:17:7662
http://cms.webhook.com/v2/assets/vendor.min.js:17:5800
s@http://cms.webhook.com/v2/assets/vendor.min.js:17:45089
t@http://cms.webhook.com/v2/assets/vendor.min.js:17:45173
q@http://cms.webhook.com/v2/assets/vendor.min.js:17:44992
http://cms.webhook.com/v2/assets/vendor.min.js:13:45995
invoke@http://cms.webhook.com/v2/assets/vendor.min.js:7:24542
flush@http://cms.webhook.com/v2/assets/vendor.min.js:7:25086
end@http://cms.webhook.com/v2/assets/vendor.min.js:7:14221
run@http://cms.webhook.com/v2/assets/vendor.min.js:7:14600
j@http://cms.webhook.com/v2/assets/vendor.min.js:7:13397
http://cms.webhook.com/v2/assets/vendor.min.js:7:13326
I'm taking a look now.
Awesome thank you. And the field is perfect, by the way. Very useful. I talked you guys up at the Web Performance Meetup here in NYC tonight.
confirming it works now, thanks again.
:+1:
Small bug @gpbmike. If I'm editing a template and I'm on the switch widget, selecting a color widget right after will also display the 'Default Value/Labels' section within the color settings. No idea if it happens with other widgets.
I don't know why, but when a partial template is empty, the previous one is not cleared out.
Relevant line: https://github.com/webhook/webhook-cms/blob/master/app/templates/form/_nav.hbs#L49
But adding an HTML comment seems to do the trick.
For a slow day. It'd be nice to have a "switch" widget that basically just returns a boolean to the frontend.
Featured? (on/off)