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

173 Custom Fields when modifying organisation #32

Merged

Conversation

A-Souhei
Copy link
Contributor

@A-Souhei A-Souhei commented Sep 25, 2024

Description

Removes custom fields from organization's new and edit pages.

image

Closes fjelltopp/zarr-ckan#173

Checklist

Put an x in the boxes that apply to this pull request (you can also fill these out after opening the pull request).
You may not need to check all boxes.

  • The Jira ticket for this issue has been updated to "Ready to Review" or equivalent.
  • I have developed these changes in discussion with the appropriate project manager.
  • My code follows the general Fjelltopp documentation (see Confluence).
  • I have made corresponding changes to the Fjelltopp documentation (see Confluence).
  • I have rebased this branch with master.
  • New dependency changes have been committed.
  • I have added automated tests that prove my fix is effective or that my feature works.
  • New and existing tests pass locally with my changes.
  • My changes generate no new warnings.
  • I have performed a self-review of my own code.
  • I have assigned at least one reviewer.
  • I have assigned at least one label to this PR: "patch", "minor", "major".

@A-Souhei A-Souhei self-assigned this Sep 25, 2024
@A-Souhei A-Souhei added the patch label Sep 25, 2024
@A-Souhei A-Souhei force-pushed the 173-accidental-custom-fields-when-modifying-organisation branch from 014ae48 to 993243b Compare September 25, 2024 10:23
@A-Souhei A-Souhei marked this pull request as ready for review September 25, 2024 11:29
Copy link
Member

@ChasNelson1990 ChasNelson1990 left a comment

Choose a reason for hiding this comment

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

Where do those fields originally come from?

@A-Souhei
Copy link
Contributor Author

@ChasNelson1990 , the fields are in the block in zarr-ckan/ckan/ckan/templates/organization/snippets/organization_form.html:

  {% block custom_fields %}
    {% snippet 'snippets/custom_form_fields.html', extras=data.extras, errors=errors, limit=3 %}
  {% endblock %}

@ChasNelson1990
Copy link
Member

@A-Souhei - but that block is only handling formatting of the custom fields why do we have these fields in the data dictionary at all?

@A-Souhei
Copy link
Contributor Author

I will look more at it tomorrow.

@A-Souhei
Copy link
Contributor Author

A-Souhei commented Sep 26, 2024

@ChasNelson1990 , from snippets/custom_form_fields.html:

  {# Add a max of 3 empty columns #}
  {% set total_extras = extras|count %}
  {% set empty_extras = (limit or 3) - total_extras %}
  {% if empty_extras <= 0 %}{% set empty_extras = 1 %}{% endif %}

This chunk will make it that even if we set limit to 0 in previous comment code, it will add 3 customs fields by default.

Should I update this template instead?

I tried with a vanilla ckan docker compose stack :

image

@ChasNelson1990
Copy link
Member

@A-Souhei do we know why this was added? Or when, is it recent? Is there a good reason?

@A-Souhei
Copy link
Contributor Author

A-Souhei commented Oct 2, 2024

Some interesting discussions about it :
ckan/ckan#6037

Copy link
Member

@ChasNelson1990 ChasNelson1990 left a comment

Choose a reason for hiding this comment

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

Let's get this merged

@A-Souhei A-Souhei merged commit c855e4f into main Oct 2, 2024
2 checks passed
@A-Souhei A-Souhei deleted the 173-accidental-custom-fields-when-modifying-organisation branch October 2, 2024 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accidental(?) Custom Fields when modifying organisation
2 participants