Skip to content
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

don't render labels when no label text is provided #347

Closed
zoul0813 opened this issue Nov 15, 2017 · 1 comment · Fixed by #350
Closed

don't render labels when no label text is provided #347

zoul0813 opened this issue Nov 15, 2017 · 1 comment · Fixed by #350

Comments

@zoul0813
Copy link
Member

While working on custom checkbox components that include a label, I've discovered that all fields have a label tag rendered when "fieldTypeHasLabel" returns true. I propose adding an additional check to this function to return false when the field's schema does not have a label property (or altering the v-if statement on the label.

// option 1: add the following to fieldTypeHasLabel(field)
if(isNil(field.label)) 
  return false;
// option 2: alter the label v-if
label(v-if="field.label && fieldTypeHasLabel(field)", :for="getFieldID(field)", :class="field.labelClasses")

This requires the unit tests to be aware of this change as well.

I can submit a PR for this change if approved. Just need to know which option makes more sense.

zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Nov 15, 2017
zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Nov 15, 2017
* feature/347-no-empty-labels:
  updated tests for modified label logic
  don't render labels when no label text is provided, proposed option 1 from vue-generators#347
@icebob
Copy link
Member

icebob commented Nov 16, 2017

Good idea. I think option 1 is a good solution.

zoul0813 added a commit to zoul0813/vue-form-generator that referenced this issue Dec 5, 2017
* master:
  fix bower.json validation
  updated tests for modified label logic
  don't render labels when no label text is provided, proposed option 1 from vue-generators#347
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants