Skip to content

Conversation

@goldenapples
Copy link
Contributor

Adds an additional field to shortcode attribute data model called 'default_value'. If a default_value is set and the value is empty, the value will be set to the default value.

Can I get a review of this? @jitendraharpalani58 @noppanit @danielbachhuber
This attribute would be useful to me for https://github.com/fusioneng/image-shortcake and I'd like to have it added here if possible. This is the first time I've looked at Shortcake internals and I don't know if this is the best way to do this, though...

Adds an additional field to shortcode attribute data model called
'default_value'. If a default_value is set and the value is empty, the
value will be set to the default value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you set an empty value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. Probably this needs more thought put into the data structure to hold it.

I was only thinking of the case of selects / radio buttons, where it would be easy to make a value required. Text fields where an empty string is a valid choice, but a default value is still useful, add an extra complication.

@danielbachhuber danielbachhuber added this to the v0.4.0 milestone Apr 28, 2015
@goldenapples
Copy link
Contributor Author

Closing this. I was misunderstanding the role of the value field, which does something like what I wanted to do here. A better approach is something more like #323 - treating the first value in a select or radio button list as the value if none is otherwise set.

@goldenapples goldenapples deleted the add-default-value branch October 2, 2015 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants