Needs review
Project:
Citizens Connected
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Issue tags:
Reporter:
Created:
5 Dec 2012 at 17:21 UTC
Updated:
9 Dec 2012 at 02:54 UTC
Jump to comment: Most recent file
'nuff said.
This module could benefit greatly from integrating with the views module.
I've never written any kind of views integration before so I have no idea how to even start this.
Comments
Comment #1
ian clysdale commentedBased on the quick chat on IRC, here's an initial look at where I'm going.
The citcon_views module automatically generates contextual views of supporters based on the existing supporter types. If supporter types change, then the view will change too, and if new supporter types are added new views will be added for them. (TODO: Do we need to clear the views cache when we change supporter types, then? Probably.)
The views can be invoked for specific campaigns by /node/NODEID/results_views_SUPPORTER_TYPE e.g. /node/3/results_views_email_min .
As well, if the node ID contextualizer isn't a node ID, it'll show the results for all supporters.
/node/all/results_views_email_min
I think this is a necessary first step in anything else, so I'm checking it in at this point, both in case I don't get usefully further and because I'd love feedback. Here's what I'm thinking that we do to go beyond that.
1) Replace the results tab on individual nodes with a tab that goes to the appropriate view for that campaign's supporter type.
2) Add table results (to all supporter types) for the participation level. Since all the table columns are sortable, if people can sort by that, does that then remove the need for anything separate for top supporters? I'd think so, but I don't know the history of the feature.
3) Add contextual filters to the view to allow us to search the supporters through the views results.
My plan is that I'm going to start implementing this first with the node-specific results before expanding to the global results. I'll check if citcon_views is enabled. If not, the current results tab will still be used, if not it will invoke the appropriate view.
Feedback REALLY REALLY welcome at this point.
Comment #2
ian clysdale commentedOK, here's a second patch against 7.x-1.x-dev that contains everything in the first patch, plus some more things that make it actually useful.
It adds contextual filters for every field in the supporter type. It also overrides the results tab for per-node results if citcon_views is enabled, and gives all the functionality that the old one did, plus much more elegant CSV download through the data export link at the bottom.
Still needed:
* This could really use some theming love. The search fields are beyond ugly.
* This really should be applied to the global admin supporter search as well as to the node-specific stuff.
* If people like this and it gets tested a little, we may want to clean it up and take out the old CSV and search stuff.
I think I'm done for today, but I'm willing to come back and tackled the global admin stuff at some point in the future.
Comment #3
ian clysdale commentedActually, I'm moving this to needs review - I think it might be worth merging in now, and it means I won't have nasty git merges later if that happens. It doesn't break anything as it stands right now.
Comment #4
ian clysdale commentedThis fixes a fairly serious error in the previous patch where it wasn't properly catching the node ID in the results. *sigh for last minute bug fixes*.
Comment #5
ian clysdale commentedOK, I'm hitting the tired. Ignore patch #4 too. The probably with both of them was my switching at the last minute from drupal_goto to views_view_embed (which is a much better way of doing it), but which first of all I didn't properly pass the node ID to, and now I'm realizing isn't working right with the external filters. There'll be another patch soon but not right away.
Comment #6
ian clysdale commentedAnd here's what's really my last run for today through this.
I brought in Advomatic's embed_views module to make the embedded filters actually work; it also lets us do some nicer formatting. I've added the results, a collapsible search section, and a collapsible download section. The downloads work on the current search results, and use views data export to export as Word, XML or CSV.
I'm pretty pleased with where it stands right now for the node-specific results.
What does it still need?
* There should perhaps be something bringing in top supporter functionality.
* This needs to apply to the global supporter results, not just node-specific ones.
* It would be nice to have a simple plugin module for which node export types should be available, so people can pick what's loaded.