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

allow override of Visibility field business logic from organisation field #423

Open
avowkind opened this issue Sep 9, 2024 · 0 comments

Comments

@avowkind
Copy link

avowkind commented Sep 9, 2024

The ckanext/scheming/templates/scheming/form_snippets/organisation.html snippet closely couples the visibility field to the organisation field. Forcing them to be adjacent, visibility always showing and unable to set a default value for visibility.

A dataset schema containing this:

  - field_name: "owner_org"
    label: "Organization"
    preset: "dataset_organization"

results in two fields Organisation and Visibility where each time the organisation is changed the visibility is reset to private or to the previously saved value.

{% block package_metadata_fields_visibility %}
    <div class="control-group form-group control-medium">
      <label for="field-private" class="control-label">{{ _('Visibility') }}</label>
      <div class="controls">
        <select id="field-private" name="private" class="form-control form-select">
          {% for option in [('True', _('Private')), ('False', _('Public'))] %}
          <option value="{{ option[0] }}" {% if option[0] == data.private|trim %}selected="selected"{% endif %}>{{ option[1] }}</option>
          {% endfor %}
        </select>
      </div>
    </div>
  {% endblock %}
  • There is no documented method to set the default visibility to public either globally or on a per- organisation basis.

I suggest that either:

  1. The visibility field can be optionally dropped out of the dataset_organization preset and visibility added independently as a field which then allows setting of the default value.
  2. or a parameter default: True is available and used if the data.private is not set
  3. or perhaps a check is made for the organisation record having a default_visibility field and the default is set to that option
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

No branches or pull requests

1 participant