Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Reset all filters button #6239

Closed
wants to merge 1 commit into from
Closed

Reset all filters button #6239

wants to merge 1 commit into from

Conversation

Toflar
Copy link
Member

@Toflar Toflar commented Sep 26, 2013

My ticket #1979 is floating around for quite some time now and everytime I have to reset all filters I think about this again, so here's my pull request to speed up this feature ;)

I've added a @todo because I seriously couldn't find out in what circumstances Contao displays a filter panel at the bottom of a page :D

@Toflar
Copy link
Member Author

Toflar commented Sep 26, 2013

Ah for those who like pictures:
bildschirmfoto 2013-09-26 um 17 29 42

@Aybee
Copy link
Contributor

Aybee commented Sep 26, 2013

+1

@aschempp
Copy link
Member

Afaik the panel at the bottom is only for limit.

I really hate the icons and I think they are totally unclear...

@aschempp
Copy link
Member

Also, be aware (about the icons) that this is not only for filters, its also the limit, search and sorting. It should match "apply" and "reset" action.

@xchs
Copy link
Contributor

xchs commented Sep 26, 2013

What about adding an (advanced) click event handler? Something similar like we already have implemented for the "Click-to-edit" functionality (see https://github.com/contao/core/blob/master/system/themes/default/src/hover.js#L92-L144).

So we might, for example, reset all filter settings by applying a [Ctrl]+Click or [Shift]+Click on the Apply/Reload icon.

@Toflar
Copy link
Member Author

Toflar commented Sep 27, 2013

Afaik the panel at the bottom is only for limit.

Which is no reason for it to use a different FORM_SUBMIT, is it? :)

I really hate the icons and I think they are totally unclear...

I've searched good ones for a while. Feel free to suggest others.

Also, be aware (about the icons) that this is not only for filters, its also the limit, search and sorting. It should match "apply" and "reset" action.

I know. In my opinion they perfectly do.

What about adding an (advanced) click event handler?

We can still do that when the rest is clear ;)

@MacKP
Copy link

MacKP commented Sep 27, 2013

Hm i think it would be better, when we have an extra line for Filter 'Apply' and 'Reset'. Then we don't need Icons and its a little bit better for understanding. ATM its not clear, that the Apply Button for all Lines is. It looks like it is only for the secend one and the first one has no...
Maybe the new Line in a darker grey.

regards

@Toflar
Copy link
Member Author

Toflar commented Sep 27, 2013

This would look something like this...
bildschirmfoto 2013-09-27 um 10 23 39

@MacKP
Copy link

MacKP commented Sep 27, 2013

Yes, maybe without the hr between the lines... and maybe in one color.. so it would be clear, that this is all together? But this looks like it goes in the right way i think.

@frontendschlampe
Copy link

+1 for the layout idea @Toflar :-)

@Toflar
Copy link
Member Author

Toflar commented Sep 27, 2013

So rather buttons than icons? What do others think? @leofeyer?

@tristanlins
Copy link
Contributor

I like the icon version #6239 (comment) but the buttons are also okay. 👍

@bekanntmacher
Copy link
Contributor

Buttons without the hr between because sort, search and show are also filters. The icons are not clear enough.

@Aybee
Copy link
Contributor

Aybee commented Sep 27, 2013

+1 for buttons

@aschempp
Copy link
Member

Buttons are very nice, though they are pretty big.. maybe we can make them a little smaller?

@Toflar
Copy link
Member Author

Toflar commented Sep 27, 2013

We'd need to add a CSS class "tl_submit small" or so then. But I want to have @leofeyer's feedback on this first.

@leofeyer
Copy link
Member

I don't like the buttons at all.

@Toflar
Copy link
Member Author

Toflar commented Sep 27, 2013

:D So back to icons? And if so, which ones? :)

@leofeyer
Copy link
Member

No idea. I'm not even saying that we need a reset button :)

@discordier
Copy link
Contributor

+1 for buttons instead of icons.
+1 for reset button in general.

@davidmaack
Copy link

+1 for the buttons
+1+1+1 for the reset function :)

@christianromeni
Copy link

+1 for Reset..

But I'm also not sure about the Buttons.. They take up more space.. And we already have 2 or sometimes 3 lines up there (I'm counting the tl_buttons div as a line)

@Toflar
Copy link
Member Author

Toflar commented Sep 27, 2013

I actually like the buttons better too and also I like them in the size they are. It looks exactly the same e.g. in the edit mode for the "restore version" option.

@fabil
Copy link

fabil commented Oct 3, 2013

+1 for the buttons
+1 for the reset-button

@ralfhartmann
Copy link

+1

@tpk109
Copy link

tpk109 commented Dec 6, 2013

image3048

+1 for buttons otherwise

@Toflar
Copy link
Member Author

Toflar commented Oct 24, 2014

So how do we proceed? I still think a "reset all filters" is a very useful feature in terms of usability!

@aschempp
Copy link
Member

How about making the header fields collapsible? Then the button's size would not be a problem at all...

@leofeyer leofeyer modified the milestones: 3.5.0, 3.x.x Nov 4, 2014
@leofeyer leofeyer modified the milestones: 3.x.x, 3.5.0 Mar 27, 2015
@leofeyer leofeyer mentioned this pull request Nov 19, 2015
@Aybee
Copy link
Contributor

Aybee commented Nov 19, 2015

Ich benutze in meinem BE etwas Javascript zum Resetten. Vielleicht sind ein paar Stellen davon ja hilfreich. (Ganz unten ist noch ne Option, damit ein ausgewählter Filter sofort greift ohne auf den Submit-Button zu klicken - fand ich immer sehr hilfreich.)

(function($) {
  window.addEvent('domready', function() {

    // Create a reset button to reset the panel selects and submit
    // TODO: Create ticket for marking default options with class="default" or data-default="true"
    var submitPanel = $$('.tl_submit_panel') || false;

    if(submitPanel[0]){
      var
        resetButton,
        resetSelects = $$('.tl_filter select, .tl_limit select'),
        //searchText = $$('input[type=search]')
        searchText = $$('input[type=search], .tl_search input')
      ;

      // create the reset button
      resetButton = new Element('div.reset_button', {
        title: 'Filter, Suche und Limit zurücksetzen - dann neu laden',
        text: 'reset',
        styles: {
          backgroundColor: 'orange',
          borderRadius: '5px',
          cursor: 'pointer',
          display: 'inline-block',
          width: 42,
          height: 22,
          lineHeight: 20,
          textAlign: 'center'
        }
      });

      resetButton.addEvent('click', function() {
        Array.each(resetSelects, function(el) {
          el.getSelected().setProperty('selected', '');
        });
        //searchText.erase('value');
        searchText.set('value', '');
        submitPanel[0].getParent('form').submit();
      });

      resetButton.inject(submitPanel[0]);
    }



    // Immediatly reload page after filter select or sort select
    $$('.tl_filter select, .tl_sorting select').addEvent('change', function() {
      this.form.submit();
    });

  });
})(document.id);

edit: corrected 2 lines

@Toflar
Copy link
Member Author

Toflar commented Nov 26, 2015

I still think this is a very good feature and should be moved to core-bundle for 4.2. However, as I did my proposal I cannot really work on this more than I did here. @contao/developers

@leofeyer leofeyer modified the milestones: 4.x.x, 3.x.x, 4.2.0 Nov 26, 2015
@bezin
Copy link

bezin commented Dec 9, 2015

I just had the exact same demand for a filter reset button as proposed here. I would really appreciate this feature :)

@leofeyer
Copy link
Member

Implemented in contao/core-bundle@bbd17d3. The icon will be exchanged when we merge the back end icons PR.

@leofeyer leofeyer closed this Apr 13, 2016
@Toflar Toflar deleted the feature/reset-filter-button branch April 13, 2016 13:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.