DRUPAL, Views: exposed filter.. how can I unselect all tags? - drupal

I'm using Drupal, Views, tag exposed filter and I would like to allow my customer to select the default tags from back-end. However when he selects some tags is not possible anymore to unselect all of them.
See initial picture: http://dl.dropbox.com/u/72686/Picture%201.png
Now all the tags are unselected, but if I select just one of them, then I cannot anymore come back to the initial configuration. (at least one tag remains selected).
How can I fix this ?
thanks

If you set the Default view, and someone overrides child views, it no longer uses the default settings. However, if they don't click on 'Override' when changing a view setting type, it will apply those changes to that view and the default view.
You have to setup the views, and he makes the choice what tags to select. It sounds like you two are overwriting each other in the view filter options. When you create a child view and change its configuration, be sure to click 'Override' in the top right corner of the option that appears. This will let you override that views settings, and not alter the initial default settings.
Also, you probably know this, but if you ctrl click it should unselect one that is selected.

Related

Google Tag Manager Trigger by CSS class

I want to trigger a tag when a link with a certain css class is clicked. I create a trigger based on Clicks > Just Links, but when I go to select the variable, I just get "Page Hostname, Page Path, Page URL, Referrer, New Variable"... no "Click Class" as one would expect.
All the online help shows an outdated version of GTM that don't match the options I see. Even the GTM help docs are outdated.
How does one trigger by css class? (I tried using a custom variable, but didn't work either, and honestly the options didn't make much sense either).
Update: It works if I create a new custom variable "DOM Element has CSS selector" and then go to Trigger, select my custom variable, select "Equals" and enter the text of the link.
But this doesn't make much sense to me, all I want is trigger based on css class, not by the text contents of the tag.
Turns out GTM's "Click Element" built in variable (and many others) is off by default, that's why it was missing from the trigger dropdown. One has to go to Built In Variables > Configure > and tick the "Click Element" variable.
Why would they turn this off by default and offer no clues in the UI, I have no idea.

how to handle WAI ARIA role="listbox"

I have a list of options from which one can be selected. For all intents and purposes HTML's <select> element covers this. Since we need a different visual presentation, I'm looking at using WAI ARIA role="listbox". I'm unclear on how to use aria-activedescendant, aria-selected and aria-checked.
Questions regarding focus/active state:
If I use aria-activedescendant on the listbox to point to the [role="option"] that is currently active (has "virtual focus"), I would use [aria-selected]. How would best I tell the option element itself that it is active (has "virtual focus") to represent that visually? (:focus is on the listbox, after all)
an [role="option"] can have [aria-checked] and [aria-selected]. I guess I need [aria-selected] but don't see what I'd use [aria-checked] for.
Is there a trick to avoid having to put IDs on every option simply so it can be referenced by aria-activedescendant?
Questions regarding keyboard interaction:
"Checkbox - Space toggles checkboxes, if the list items are checkable" - how do I figure out if they are checkable or selectable?
Questions regarding validation:
If the listbox has [aria-required="true"] some sort of validation has to be performed. specifically if an option has been selected (or checked).
when do I trigger the validation? is on blur sufficient?
when invalid, what do I have to do besides setting [aria-invalid="true"] on the listbox?
aria-checked is indeed more something for a list of very closely related options with actual visible checkboxes that can be toggled on or off. This is most common in the Windows world. Explorer can be set to such a pseudo multi-select mode, or some apps use that to activate or deactivate a set of accounts. On the Mac, you can think of the list of accounts in Adium, which can be either checked (active) or not. A selection will always be there, and one or more of their checkboxes can be checked or not.
aria-selected is always the right one to indicate the selected state of an option. E. g. when traversing the list with the arrow keys, aria-selected="true" moves from item to item, while the others must then get aria-selected="false". As Patrick said, you can use this to also generate some nice looking CSS.
As for keyboard interaction: arrows up and down will select an item, and if the items are checkable, too, space will toggle the checked or unchecked state of the currently selected item.
In a true multi-select, like html:select #size>1, and multiselectable being true, the interaction would be:
Arrow keys select a single item.
Ctrl+Arrow keys would move focus from item to item, but not select the item yet.
Ctrl+Space would select the item.
Shift+up and down arrows would select contiguous items.
This is, again, standard Windows paradigm, can be observed in Explorer in Details view, for example.
As for validation: onBlur is sufficient, or you could dynamically do it via changes in selection/focused item, make sure at least one item is selected, or whatever validation you need.
aria-invalid="true" is sufficient for screen readers to know, but an error message and possibly a visual indication would be nice for everyone to know what's wrong.
How would best I tell the option element itself that it is active (has "virtual focus") to represent that visually?
Generally, you'd add aria-selected="true" and then craft some CSS that takes care of it using attribute selectors, e.g. div[role=option][aria-selected=true] { ... }, or add a css class dynamically?
[aria-checked] and [aria-selected]
This is more of a philosophical question I guess. aria-selected more closely matches what you'd have with a select...but then again (particularly for multi-select widgets) you can imagine the listbox actually being a series of checkboxes, and in that case you'd use aria-checked. there's no definitive right or wrong about either one (something you'll find a lot once you dive into more complex ARIA widgets).
Is there a trick to avoid having to put IDs on every option simply so it can be referenced by aria-activedescendant
Hmm...perhaps you could dynamically generate IDs for all options on page load via script? Or - but not tested - you could have something like a "roving" ID that moves around the options depending on which one is active (adding/removing the ID to the relevant option).

Reset Exposed filter on change in Drupal 7 Views

I have 2 exposed filters in a view. I need just one filter to work at a time.
So if I choose one filter at previous query it should be reseted when i choose another filter.
Filter by Category. Filter by Capacity.
Category OR Capacity.
If i use operator OR Instead of AND it doesnt help. It doesn't filter right.
It shows content in strange order.
Advanced >> Exposed form style >> settings >>
There is a check box for reset button. Check that and you should be done.
On the views exposed filter settings, uncheck the this option
"Remember the last selection"
Or,
You can try View hacks module.
I found this on Project page:
Views Filters Reset
Reset is initially off for all views. To turn it on, go to the
Administer > Site configuration > Views Filters Reset page
(admin/settings/views_filters_reset) and select the views where the
reset button should be active.
Reset button supports Ajax-enabled views as well.

Drupal: Views: how to group fields

I've created a views of node and I've selected the "fields" option in order to select which fields to display and in which order.
Is there a way to group such fields ? It would be very useful to have parent divs in my html code.
thanks
There's a simpler way to do it: http://www.arsnova.cc/web-development-articles/2012-07-27/grouping-fields-together-drupal-views
Let's say you want to group fields 1-3 together within a div.
First, exclude fields 1 and 2 from display. (By "exclude", I do not mean to delete them from the views display; rather, click on the "exclude from display" button within each field's options.) The fields you exclude from display must come before the other field for this to work. If they don't, rearrange them so they do.
Go to field 3, and rewrite the results, inserting the token for each of fields 1-3.
That's all you need to do. Fields 1, 2, and 3 will now appear within field 3's div. If you want, you can also add additional markup within the "rewrite results" area.
Recently found the best way for my needs and apparently for the needs of many people:
Use views_fieldsets module https://drupal.org/project/views_fieldsets, it allows yo to create a grouping div to put fields inside.
Grouping is built into Drupal 8 Views. So no need for any extra modules. Here's how:
Edit your view (be sure it has fields)
Click Format's Settings
A box will pop up with all your selected fields
Look right underneath all the field names, there should be "Grouping field Nr.1"
Select the field you'd like to group by
Click Apply
If you want to subgroup with a second field, just go back to 2 then you'll see "Grouping field Nr.2"
That's it.
Yes, click on the gear next to the Style option (under Basic Settings) and set the Grouping field. Keep in mind, the grouping field needs to be added to the view, but you can check the Exclude from display option to hide it, if needed.
I'm pretty sure that would give you a parent div. If not, you could add the parent div, by overriding the default templates (look to the Theme: Information section, under Basic Settings, for more information).

DRUPAL: customize dropdown Views filter

I'm using Views dropdown filter (with tags) and it works great. However I would like to customize it in this way:
1 - remove button "Apply" and automatically update Views (at the moment I'm updating it with Ajax)
2- allow my customer to change the order of the dropdown items (specifying top items)
3- select multiple items without having to press the SHIFT button on keyboard (do not unselect other items if new items are selected)
http://dl.dropbox.com/u/72686/viewsFilter1.png
Let's suppose the items in the image are tags... something like this:
http://dl.dropbox.com/u/72686/viewsFilter2.png
thanks
Use jQuery to .hide() the Apply button, and then set a handler on the filter fields so that whenever one of them is changed (i.e., by the user), the Apply button registers a click.
Hmm, can't help with this one. You might be stuck writing a custom module that hooks into the Views API.
Sounds like the Sexy Exposed module would solve this problem?
I'm using the following code to keep the items selected and it works.
$('#edit-tid option').click(function() {
$(this).toggleClass("selected");
$("option:not(.selected)").removeAttr("selected");
$("option.selected").attr("selected", "selected");
//submit request
$('#edit-submit-Portfolio').click();
});
When a request is submitted the page is refreshed. The selected items are still selected (class="selected") but the javascript code do not keep them selected.. I don't understand why, since they have the correct class attribute.
So.. it doesn't work after refresh, even if the html code is the same (the same class="selected" attribute is assigned to the same items).
thanks
I've solved point 1 and 2, installing better exposed filter module from drupal website.

Resources