ckan / ckanext-showcase

A ckan extension to showcase datasets in use
GNU Affero General Public License v3.0
43 stars 77 forks source link

bug in displaying visibility on the showcase detail page #150

Closed sabinem closed 2 years ago

sabinem commented 2 years ago

When a showcase has the field private added to a custom schema, then the value of this field is not displayed correctly on the showcases detail page:

  1. the value is hidden behind the manage button
  2. it will always indicate a draft, no matter which value the field is set to

This is due to a bug in the template https://github.com/ckan/ckanext-showcase/blob/b472647677abdcc6aae59afbde5d3b8275773d8f/ckanext/showcase/templates/showcase/read.html#L60

It should be changed to pkg.private == 'True' in this line to fix the bug 2. Regarding the formatting 1.: pull right should be removed from the css classes of the fields display

Here is a PR to fix 1. and 2.: https://github.com/ckan/ckanext-showcase/pull/149

bellisk commented 2 years ago

The showcase schema doesn't include the field private, so I'm not sure why this line is in the template—I guess it was copied over from the CKAN package/read.html template and not removed.

If a developer does add a private field to a custom schema for showcases, they can use the boolean_validator on that field to make sure that it will always return a bool instead of a string (which is what CKAN does with the field private in the package schema). Then the test in the template will work correctly.

Personally, I would rather remove this unneeded part of the template than fix the HTML for it. :)