-
Notifications
You must be signed in to change notification settings - Fork 9
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
Changes from 1 commit
9a78a9b
8c34353
5487018
efd7261
477649d
f0a14ed
8bc623c
921f54e
515ca89
1e38016
ae7c882
b3d03c2
2ba60c7
ed20655
442926e
0cc4940
c070a27
55d7572
7e45fc9
dc3f7f3
fc0d837
c004063
8d4abaf
3bb957c
bc5c973
d046314
ad3610f
09ff82f
cf2be16
470ee6c
684ecfa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,25 +227,27 @@ def forms_list(view): | |
query_params = request.args.to_dict(flat=False) | ||
hidden_form_count = models.Form.query.filter( | ||
models.Form.is_hidden == True).count() # noqa | ||
query = models.Form.query.order_by('name') | ||
show_hidden = bool(query_params.get(show_hidden_param)) | ||
|
||
if show_hidden: | ||
show_toggle_link_label = _('Hide Hidden') | ||
add_show_url_param = False | ||
query = models.Form.query.order_by('name') | ||
else: | ||
show_toggle_link_label = _( | ||
'Show All (%(count)d Hidden)', count=hidden_form_count) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
add_show_url_param = True | ||
query = models.Form.query.filter( | ||
query = query.filter( | ||
models.Form.is_hidden == False).order_by('name') # noqa | ||
|
||
if show_hide_form.validate_on_submit(): | ||
posted_data = show_hide_form.data.copy() | ||
if len(posted_data.get('forms')) > 0: | ||
hide_forms = True if posted_data.get('mode') == 'hide' else False | ||
for questionnaire in posted_data.get('forms'): | ||
questionnaire.is_hidden = hide_forms | ||
db.session.commit() | ||
hide_forms = True if posted_data.get('mode') == 'hide' else False | ||
posted_form_ids = [f.id for f in posted_data.get('forms')] | ||
models.Form.query.filter(models.Form.id.in_(posted_form_ids)).update( | ||
{'is_hidden': hide_forms}, synchronize_session='fetch') | ||
db.session.commit() | ||
db.session.expire_all() | ||
|
||
all_forms = query.all() | ||
checklist_forms = query.filter(models.Form.form_type == 'CHECKLIST').all() | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to
Hide Archived