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

Add support for hiding/unhiding objects #884

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from

Conversation

dodumosu
Copy link
Collaborator

This pull request addresses nditech/apollo-issues#171 by allowing a user to hide or show location sets, participant sets, events and forms.

migrations/versions/14d0310ab80f_add_is_hidden_field.py Outdated Show resolved Hide resolved
apollo/submissions/views_submissions.py Show resolved Hide resolved
apollo/formsframework/fixtures/38fff911ea3.sql Outdated Show resolved Hide resolved
show_hidden = bool(query_params.get(show_hidden_param))

if show_hidden:
show_toggle_link_label = _('Hide Hidden')
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does "Hide Hidden" mean? The language should probably be clearer than this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed to Hide Archived

add_show_url_param = False
else:
show_toggle_link_label = _(
'Show All (%(count)d Hidden)', count=hidden_form_count)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain the rational for having the number of hidden objects displayed here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was to give the user the number of items that weren't being displayed, but it's been removed

{'is_hidden': True}, synchronize_session=False)
db.session.commit()

@action('unhide', _('Always Show'), _('Are you sure you want to always show the selected items?'))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using Hide and Always Show, could we instead use Archive and Unarchive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been changed

apollo/templates/admin/form_list.html Outdated Show resolved Hide resolved
@takinbo
Copy link
Collaborator

takinbo commented May 1, 2024

Screenshot 2024-05-01 at 14 10 20

@dodumosu can you update the migration so it's applied after 7cbcd7443117? Given there are no conflicts of course.

@dodumosu
Copy link
Collaborator Author

dodumosu commented May 1, 2024

done

Screenshot 2024-05-01 at 14 10 20 @dodumosu can you update the migration so it's applied after `7cbcd7443117`? Given there are no conflicts of course.

done

@takinbo
Copy link
Collaborator

takinbo commented May 13, 2024

Trying to edit any of the events (whether archived or not), yields this error:

Screenshot 2024-05-13 at 17 15 01

this commit fixes an issue noticed by @takinbo.
it's caused by flask-admin using the `resource_id` field as the primary key for events, not the `id` field
@takinbo
Copy link
Collaborator

takinbo commented May 14, 2024

There are still issues with the PR:

  1. Hiding/Unhiding events does not work - they are still being displayed and I have no way of knowing if the event was hidden
  2. Hiding a participant set does not remove it from available options when creating an event
  3. Hiding a location set does not remove it from available options when creating a participant set
  4. There's no way to archive forms
Screenshot 2024-05-14 at 04 50 09

@takinbo
Copy link
Collaborator

takinbo commented May 15, 2024

Archive/Unarchive buttons do not show up when the "All Forms" checkbox is selected.

Screenshot 2024-05-15 at 20 43 46

@dodumosu
Copy link
Collaborator Author

dodumosu commented May 15, 2024 via email

@takinbo
Copy link
Collaborator

takinbo commented May 15, 2024

After archiving Events, the archived events are still selectable from the Events selection menu dropdown

Screenshot 2024-05-15 at 20 56 49

- hidden events cannot be switched to by admins anymore
- the default event processing skips hidden events
- role based access to resources excludes hidden ones (events and forms)
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.

None yet

2 participants