metashare / META-SHARE

Public repository of the META-SHARE software
http://www.meta-share.eu/
Other
23 stars 31 forks source link

Selected Facets and Facet Items Should Be at the Top #20

Closed cspurk closed 12 years ago

cspurk commented 12 years ago

Two related suggestions for improvement:

  1. Selected facets items (i.e., selected items within a single facet – e.g., “Polish” under “Language”) should be at the top in a facet items list. Otherwise it may even happen that a selected facet is not initially visible (→ hidden under “more”).
  2. Facets with active facet items could perhaps be listed before facets in the search/browse view which have no selected items.
olihamon commented 12 years ago

Point 1 should be fixed now.

olihamon commented 12 years ago

Point 2 fixed too, with pull request #83

cspurk commented 12 years ago

@olihamon I’m not very happy with the fix for point 2. Although the solution appears to work, it is somehow awkward: the facets are all rendered twice into the resulting HTML, however, only half of them are hard coded with CSS to either be visible or not. Brrr … Aside from elegancy concerns, I don’t know what a screen reader for blind people would do with this HTML code.

The underlying problem seems to be that a good solution for point 2 needs more logic than is easily feasible with the Django template language. This is actually a sign that the logic should rather be moved to Python code (cf. KISS principle for templates). In the concrete case we might need extra context for the template which contains information about whether a facet is currently being used or not; although this information is somehow already encoded in the request, it is not easily accessible using the Django template language.

So, an attempt to better solve point 2 might be to override the extra_context method of SearchView in our MetashareFacetedSearchView class and add a new entry selected_facets there which contains one entry per facet with one or more facet items.

Aside from all this, there still appears to be a bug in the implementation. Although the multilinguality type is used as a facet in the following example, it appears after the linguality type facet which is not used: http://localhost:8000/repo2/search2/?q=&selected_facets=multilingualityTypeFilter_exact%3Acomparable