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

Feature/custom fields default values #5389

Merged

Conversation

hannahtinkler
Copy link
Contributor

@hannahtinkler hannahtinkler commented Apr 17, 2018

Implements changes suggested in #2608 (Models custom fields preloaded with data)

This branch:

  • Fixes a usage of get() on result of relationship (CustomFieldsetController::fields()), which I don't think can work? I can't find any other usage across the codebase, but have tested areas around custom fields for issues.
  • Adds ability to assign default values to custom fields for specific models
  • Applies these defaults when creating an asset of this model
  • Does not apply default to empty custom fields in the edit screen for models (assumption that if they are blank this is intentional and the user would not want them to fill with the default upon edit)
  • Adds Bootstrap's mixin for spacing classes; overkill maybe but seemed useful for just tweaking the layout without dedicated class? Happy to remove and replace with dedicated styles

To test:

  • Create a new model and assign an existing fieldset

  • Check the 'Add default fields' box

  • 'Default values' box should appear below, enter some defaults

  • Save model

  • Create a new asset and set the model to the one created earlier

  • When custom fields appear they should be pre-filled

  • Edit an asset with some empty custom fields

  • Custom fields that were previously empty should still be empty

  • Custom fields tat were not empty should show their previous values

...only now realising it does not have ready for dev tag...oops! Will leave here anyway

@snipe snipe merged commit 8d501e1 into snipe:develop Apr 24, 2018
@snipe
Copy link
Owner

snipe commented Apr 24, 2018

Nice work, thanks!

sealofapproval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants