mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-01 20:29:49 -04:00
Make search box appear based on all templates
We reckon it’s jarring to have the search box appear and disappear as you navigate through the folders. Instead it should appear whenever your service has more things (templates or folders) than you can easily keep in your head (let’s go with 7 for now). This keeps the bahviour the same for current services that don’t have any folders.
This commit is contained in:
@@ -121,8 +121,6 @@ def choose_template(service_id, template_type='all', template_folder_id=None):
|
||||
)
|
||||
return redirect(request.url)
|
||||
|
||||
templates_on_page = current_service.get_templates(template_type, template_folder_id)
|
||||
|
||||
return render_template(
|
||||
'views/templates/choose.html',
|
||||
current_template_folder_id=template_folder_id,
|
||||
@@ -130,8 +128,8 @@ def choose_template(service_id, template_type='all', template_folder_id=None):
|
||||
template_folder_path=current_service.get_template_folder_path(template_folder_id),
|
||||
template_folder_has_contents=current_service.get_template_folders_and_templates('all', template_folder_id),
|
||||
template_folders=current_service.get_template_folders(template_type, template_folder_id),
|
||||
templates=templates_on_page,
|
||||
show_search_box=(len(templates_on_page) > 7),
|
||||
templates=current_service.get_templates(template_type, template_folder_id),
|
||||
show_search_box=current_service.count_of_templates_and_folders > 7,
|
||||
show_template_nav=(
|
||||
current_service.has_multiple_template_types
|
||||
and (len(current_service.all_templates) > 2)
|
||||
|
||||
@@ -367,6 +367,10 @@ class Service():
|
||||
self.get_template_folders(template_type, template_folder_id)
|
||||
)
|
||||
|
||||
@property
|
||||
def count_of_templates_and_folders(self):
|
||||
return len(self.get_template_folders_and_templates('all', None))
|
||||
|
||||
def move_to_folder(self, ids_to_move, move_to):
|
||||
|
||||
ids_to_move = set(ids_to_move)
|
||||
|
||||
Reference in New Issue
Block a user