The /groups listing provides exposed sort controls, as shown in:
https://skitch.com/ezra-g/f9ruq/groups-drupal-commons-community-site

Per #1298378: Identify undocumented contrib changes, this requires a feature (#228510: Exposed Sorts) that is available in Views 6.x-3.x, but not Views 6.x-2.x, which we're using but is feature frozen.

This means that the patch that this listing depends on will never get committed to the version of Views (6.x-2.x) that we are using.

Per #1270348: Upgrade to Views 3, the 6.x-3.x version of Views isn't quite mature enough for inclusion in Commons, and we realistically aren't in a position to commit to pushing that long significantly.

In the long term, we should move to 3.x either in Drupal 6 or as part of the move to Drupal 7. In the short term, we should either make this View a table with sortable headers, or consider re-rolling the relevant patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

adding move to d.o tag.

ezra-g’s picture

Status: Active » Needs review
FileSize
9.92 KB

Here's a screenshot of the current groups directory:
 current

Here's a screenshot of the proposed groups directory using table sort controls instead of the list of exposed sorts in a fieldset above the table:

proposed groups directory

Attached is a patch that changes the view definition and provides related CSS to make this look presentable.

ezra-g’s picture

Title: Evaluate exposed sorts on /groups listing » Evaluate and refactor exposed sorts on /groups listing
Status: Needs review » Fixed

It's also worth pointing out that in the current group directory the exposed sorts are incorrectly labeled as "filters."

This change is committed:
http://drupalcode.org/project/commons.git/commit/5276561

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Robin van Emden’s picture

Glad that patch #228510 is no longer used. It introduced a bug breaking random sort.
See: http://drupal.org/node/228510#comment-5302740

mstef’s picture

Looks like we missed the groups_main_listing view. If subgroups are enabled, the view that was altered and committed, subgroups_main_listing, takes over the previously-mentioned view. So, things will seem fine, until subgroups are disabled.

Attached is a patch that fixes groups_main_listing, removes the broken handler from subgroups_main_listings as well as the unneeded sort criteria (since the table settings handle the sorts), and fixes a few other little things.

This patch will most likely conflict with #1272620: Remove unnecessary distinct from views, add caching to Views blocks.

lightsurge’s picture

Status: Closed (fixed) » Needs review

In this patch maybe it's worth adding back the link you can see in comment #2 'Subgroups: 0' (i.e. groups/sub/%) into the subgroups main listing, in the transition to a table display it got overlooked.

Note the breadcrumbs in this view are a mess though - see http://drupal.org/node/1265636#comment-5358714

lightsurge’s picture

Also, it looks like you've put the leave link back into a separate column, was this intentional?

@@ -590,7 +557,6 @@ function commons_subgroups_views_default_views() {
       'description' => 'description',
       'created' => 'created',
       'subscribe' => 'subscribe',
-      'leave_group' => 'subscribe',
mstef’s picture

@ligthsurge: I'm not sure what you're talking about. There was a broken handler on both views which I removed. Is that what you're referring to? You are right, there is no child group count/link on there, but I see that's how it was before this patch as well - so I'm not sure where it belongs, if I were to re-add it. As for the "leave" field, is that the custom field we used to have in commons, which was a patch for OG, that's no longer in here?

mstef’s picture

Status: Needs review » Needs work
lightsurge’s picture

lol I don't know what you're talking about either... what broken handler? I didn't see one last time I built commons from 2.x after the subgroup view was patched with this and then #1332352: Group directory buttons are inconsistently sized/placed, although there was one user in the latter issue who mentioned problems which might be something completely unrelated.

The patch in this thread was earlier than patch in #1332352 and just established the group directory as a table display (so if there were any sorts left behind then removing them is good).

The "leave" field is just the link to leave a group? Unless the subscribe/leave links are now the same and some sort of switch? News to me though.

lightsurge’s picture

Plus before the patch in this issue was committed, there was a child group count/link as seen in the screenshot in #2.

mstef’s picture

It looks like, as I suspected early in this thread, is that with 2.x, the patch that I originally created for OG, to add the "leave_group" views field, is now gone.

Here's a grep of 1.7:

$ grep -ri "leave_group" . --include=*.views.inc
./drupal_commons/modules/contrib/og/modules/og_views/og_views.views.inc:      'og_views_handler_field_og_leave_group' => array(
./drupal_commons/modules/contrib/og/modules/og_views/og_views.views.inc:  $data['og_uid']['leave_group'] = array(
./drupal_commons/modules/contrib/og/modules/og_views/og_views.views.inc:      'handler' => 'og_views_handler_field_og_leave_group',

And a grep of the current code:

$ grep -ri "leave_group" . --include=*.views.inc

Here's the issue/patch: http://drupal.org/node/1128492

What's strange now, is that this patch is in the drupal_commons.make file, but appears to not appear after the build.

And here's the PATCHES.txt inside og after the build, and it only lists:

/profiles/drupal_commons/modules/contrib/og$ cat PATCHES.txt 
The following patches have been applied to this project:
- http://drupal.org/files/issues/og-DRUPAL-6--2.views-constants.0.patch

This file was automatically generated by Drush Make (http://drupal.org/project/drush_make).

And this keeps getting weirder (at least for me).. I tried to manually apply the patch now, just to see what happens, and I get:

profiles/drupal_commons/modules/contrib/og$ patch -p0 < og_views-add-leave-group-field.patch 
The next patch would create the file b/modules/og_views/includes/og_views_handler_field_og_leave_group.inc,
which already exists!  Assume -R? [n] 

But, that file doesn't already exist..

ezra-g’s picture

I haven't yet tested the proposed revision to this issue but I haven't experienced any broken handlers.

When I grep OG for leave_group I get results in both og_views.views.inc and og_views_handler_field_og_leave_group.inc so if you don't have those results @mstef perhaps there is an issue with your Commons build.

mstef’s picture

Regardless of broken handlers, let's at least iron out the decisions that need to be made:
1) Which views, if any, should have the "leave group" field, and where, exactly?
2) Should, and if so, where, should the subgroup count and link be for the subgroups_main_groups view?

mstef’s picture

FileSize
92.23 KB

I just did a complete rebuild based on instructions from commons.acquia.com.

See attached.

I see the view include file that creates the field, the problem is that og_views.views.inc is *missing* the definition for it. Perhaps that portion of the patch is not applying correctly.

ezra-g’s picture

I discussed the issues from #13 with mikesteff in IRC and we concluded that this was due to an out-of-date version of Drush make. Hopefully this clears up the confusion about missing handlers.

To answer mikesteff's questions from #15:

1) Which views, if any, should have the "leave group" field, and where, exactly?

Please use the current subgroups_main_listing listing as a guide for the main subgroup listing page. Note, if I do a fresh install of Commons and then disable commons_subgroups and all dependencies, the group listing displays empty text even though we have the default Commons group enabled.

2) Should, and if so, where, should the subgroup count and link be for the subgroups_main_groups view?

Seems reasonable to add. I don't have a strong feeling about where this should go but under the Group title "(x subgroups)" or in its own column seem like 2 decent solutions.

ezra-g’s picture

Assigned: Unassigned » mstef

I think mikesteff is taking the lead on this but please unassign if that's not correct :).

mstef’s picture

It shows empty because the view throws an SQL error, caused by the leftover functionality from the now-removed patch that provided exposed sorts. It's not shown because Commons defaults to printing errors only to the log. My patch fixes that issue.

Now that we've figured out the missing handler bit, I'll work that back into a new patch so it remains. And I'll figure out the best place to put the subgroups link.

Patch coming shortly.

mstef’s picture

New patch attached.

All the fixes from #6, added the missing "leave group" field to both views, and added subgroup column to listings.

mstef’s picture

Status: Needs work » Needs review

I can never remember to change the status..

ezra-g’s picture

Status: Needs review » Needs work

Removing distincts causes duplicate groups to display.

ezra-g’s picture

Status: Needs work » Needs review

Here's a re-roll of #20 that restores distincts to these views and also changes "Group title" to "Title" to avoid redundancy.

I think this is RTBC but will leave here for testing for a bit before committing.

ezra-g’s picture

ezra-g’s picture

Status: Needs review » Fixed

I've re-tested and committed #24. Thanks!
http://drupalcode.org/project/commons.git/commit/f56ea39

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updating description