Repeatable field additions and minor refactoring. #408

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

This is a slightly more generic approach to making fields repeatable that doesn't require as much custom code for each field. A check of the repeatable property is done initially in cmb_Meta_Box::show_form and calls the cmb_Meta_Box_types::render_repeatable_field method if it is set to true instead of directly calling $field['type'].

Modifications made in cmb.js to accomodate repeatable datepicker, timepicker, and file fields. Also removes all .empty-row elements when form is submitted to prevent default data from being saved.

Modification made in style.css to not dispaly .empty-row elements.

Some fields still don't work as repeatable - colorpicker (changes needed in javascript for cases where wpColorPicker function not defined), radio and checkbox based fields (need to figure out a way to handle name attribute and groups), file_list, text areas / wysiwyg. oEmbed field partially works.

@Chaser324 Chaser324 Repeatable field additions and minor refactoring.
Slightly more generic approach to making fields repeatable that doesn't require as much custom code for each field. Some fields still don't work as repeatable - colorpicker, radio and checkbox based fields, file_list, text areas / wysiwyg. oEmbed field partially works.

Signed-off-by: Chase Pettit <chasepettit@gmail.com>
bc4c22c
Collaborator

Thank you very much. I'll take a look at this as soon as I can!

Xavvi commented Jan 15, 2014

I know you guys only recently released an update with some elements that are now repeatable, so it's probably not worth me asking this. But I wondered if there was any eta on repeatable textarea fields or whether anyone has ideas on how to move that forward? I'm itching for it!

Collaborator

@Chaser324 Hey, can you walk me through the best way to test your changes? What's changed from before, and what I should look for?

@jtsternberg I guess my suggestion would be to just try out the repeatable => true property on all available fields.

However, hold off on testing because I need to add another commit to this pull request first. This pull request is based on work I did on 0.9, and I made a few errors in redoing it for 1.0.

Collaborator

@Chaser324 ok. I just released version 1.0.1 too. It might have conflicts, but if you could update to the most recent version of trunk before submitting, that would be awesome.

Collaborator

Hey @Chaser324, Let me know if you think you'll be able to submit a new PR in the next week or 2. Want to have an improved repeatable-fields situation for the release of 1.0.2.

@jtsternberg Sorry about not getting back to you sooner, but yeah, I can get the commit in tonight or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment