Skip to content
Permalink
Browse files

Improve presentation of temporary filters

- Show a visual indication in the filter widget icon when the active
filter is a temporary filter
- Create a filter action to make the current temporary filter a
  persistent filter

Fixes: #0024775
  • Loading branch information...
cproensa authored and dregad committed Sep 13, 2018
1 parent 93d6ea6 commit 20116326fff43f01420e39984c8f212f1dcf7e13
Showing with 44 additions and 7 deletions.
  1. +20 −2 core/filter_api.php
  2. +4 −0 css/ace-mantis.css
  3. +2 −0 lang/strings_english.txt
  4. +18 −5 view_all_set.php
@@ -2526,18 +2526,28 @@ function filter_draw_selection_area( $p_page_number, $p_for_screen = true, $p_ex
<input type="hidden" name="view_type" value="<?php echo $t_view_type?>" />
<?php
$t_stored_queries_arr = filter_db_get_available_queries();
$t_is_temporary = filter_is_temporary( $t_filter );
if( $p_expanded ) {
$t_collapse_block = is_collapsed( 'filter' );
$t_block_css = $t_collapse_block ? 'collapsed' : '';
$t_block_icon = $t_collapse_block ? 'fa-chevron-down' : 'fa-chevron-up';
# further use of this icon must be inlined to avoid spaces in rendered html
if( $t_is_temporary ) {
$t_temporary_icon_html = '<i class="fa fa-clock-o fa-xs-top" title="' . lang_get( 'temporary_filter' ) . '"></i>';
} else {
$t_temporary_icon_html = '';
}
?>

<div id="filter" class="widget-box widget-color-blue2 <?php echo $t_block_css ?>">
<div class="widget-header widget-header-small">
<h4 class="widget-title lighter">
<i class="ace-icon fa fa-filter"></i>
<i class="ace-icon fa fa-filter"><?php echo $t_temporary_icon_html ?>
</i>
<?php echo lang_get( 'filters' ) ?>
</h4>

<div class="widget-toolbar">
<?php
$t_view_filters = config_get('view_filters');
@@ -2572,7 +2582,15 @@ function filter_draw_selection_area( $p_page_number, $p_for_screen = true, $p_ex
echo '<i class="ace-icon fa fa-wrench"></i>&#160;&#160;' . lang_get( 'open_queries' );
echo '</a>';
echo '</li>';
} ?>
}
if( $t_is_temporary ) {
echo '<li>';
echo '<a href="view_all_set.php?temporary=n&filter=' . filter_get_temporary_key( $t_filter ) . '">';
echo '<i class="ace-icon fa fa-thumb-tack"></i>&#160;&#160;' . lang_get( 'set_as_persistent_filter' );
echo '</a>';
echo '</li>';
}
?>
</ul>
</div>
<?php } ?>
@@ -512,6 +512,10 @@ input.typeahead.scrollable ~ .tt-menu {
margin: 0 1px 0 0;
}

.fa-xs-top {
font-size: 60%;
vertical-align: top;
}
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px) {
.page-content {
@@ -1259,6 +1259,8 @@ $s_manage_filter_page_title = 'Manage Filters';
$s_manage_filter_edit_page_title = 'Edit filter';
$s_delete_filter_button = 'Delete';
$s_apply_filter_button = 'Apply';
$s_temporary_filter = 'Temporary filter';
$s_set_as_persistent_filter = 'Set as persistent filter';

# bug_view_advanced_page.php
$s_view_simple_link = 'View Simple';
@@ -58,10 +58,26 @@
$f_type = gpc_get_int( 'type', -1 );
$f_source_query_id = gpc_get_int( 'source_query_id', -1 );
$f_print = gpc_get_bool( 'print' );
$f_isset_temporary = gpc_isset( 'temporary' );
$f_make_temporary = gpc_get_bool( 'temporary' );
if( $f_make_temporary && $f_type < 0 ) {
$f_type = 1;
# Get the filter in use
$t_setting_arr = current_user_get_bug_filter();
# If there is an explicit "temporary" parameter true/false, will force the new filter
# to be termporary (true) or persistent (false), according to its value.
# If the parameter is not present, the filter will be kept the same as original.
if( $f_isset_temporary ) {
# when only changing the temporary status of a filter and no action is specified
# we assume not to reset current filter
if( $f_type < 0 ) {
# use type 2 wich keeps current filter values
$f_type = 2;
}
$t_temp_filter = $f_make_temporary;
} else {
$t_temp_filter = filter_is_temporary( $t_setting_arr );
}
if( $f_type < 0 ) {
@@ -73,9 +89,6 @@
$f_type = 0;
}
# Get the filter in use
$t_setting_arr = current_user_get_bug_filter();
$t_temp_filter = $f_make_temporary || filter_is_temporary( $t_setting_arr );
$t_previous_temporary_key = filter_get_temporary_key( $t_setting_arr );
# If user is anonymous, force the creation of a temporary filter

0 comments on commit 2011632

Please sign in to comment.
You can’t perform that action at this time.