Little improvements to filters settings page (#12793)

When you have many filters, it may be hard for you to reach the button
to create yet another one. This commit moves creation button to the
heading, leaving the page just for the list.

On the other hand, when there are no filters, page looks kind of
strange with the empty table. So text stating obvious fact that user
has no filters was added in this commit too.

Closes #11020
Closes #12790
pull/12797/head
Sasha Sorokin 2020-01-07 16:41:19 +07:00 committed by Eugen Rochko
parent 12a9813a0c
commit 345dd93310
2 changed files with 22 additions and 16 deletions

View File

@ -1,6 +1,13 @@
- content_for :page_title do - content_for :page_title do
= t('filters.index.title') = t('filters.index.title')
- content_for :page_heading_actions do
= link_to t('filters.new.title'), new_filter_path, class: 'button'
- if @filters.count == 0
%div{ style: 'display: flex; justify-content: center' }
%div.muted-hint= t 'filters.index.empty'
- else
.table-wrapper .table-wrapper
%table.table %table.table
%thead %thead
@ -16,5 +23,3 @@
%td %td
= table_link_to 'pencil', t('filters.edit.title'), edit_filter_path(filter) = table_link_to 'pencil', t('filters.edit.title'), edit_filter_path(filter)
= table_link_to 'times', t('filters.index.delete'), filter_path(filter), method: :delete = table_link_to 'times', t('filters.index.delete'), filter_path(filter), method: :delete
= link_to t('filters.new.title'), new_filter_path, class: 'button'

View File

@ -744,6 +744,7 @@ en:
invalid_irreversible: Irreversible filtering only works with home or notifications context invalid_irreversible: Irreversible filtering only works with home or notifications context
index: index:
delete: Delete delete: Delete
empty: You have no filters.
title: Filters title: Filters
new: new:
title: Add new filter title: Add new filter