Create denomination filters

Registered by Tim Black

Create functionality to filter by denomination

Blueprint information

Status:
Started
Approver:
None
Priority:
Low
Drafter:
None
Direction:
Needs approval
Assignee:
Douglas Huston
Definition:
Approved
Series goal:
Accepted for trunk
Implementation:
Started
Milestone target:
milestone icon 0.3
Started by
Tim Black

Related branches

Sprints

Whiteboard

TODO: Make the database query sort by the number of congregations in each group. Update: Implemented in http://bazaar.launchpad.net/~caneypuggies/reformedchurcheslocator/trunk/revision/72.

This needs to be re-implemented in a backbone-couchdb way. Here's how to do that:

1. Step 1: Get a list of unique cgroup abbreviations out of the database, and display them in the filter control. Example code:

var thiz = this;
var cgroups = new model.CGroups();
cgroups.fetch({success:function(){
    var names = _.uniq(cgroups.pluck('name'));
    // You can then display these unique cgroup abbreviations in the filter control.
    _.each(names, function(name){
        thiz.$('.filter-control').append("<a href='#' id='cgroup-" + name + "'>" + name + "</a> ");

        // 2. Step 2: Onclick of an abbreviation in the filter control, query the database for congs which have that cgroup abbreviation, and display those congs in the map.
        thiz.listenTo('click', thiz.$('#cgroup-' + name), function(){
            // So, load one cgroup collection in Backbone into the map.
            var cgroup = cgroups.findWhere({name:name});
            // TODO: Load that cgroup's related congs into the map using whatever function we have available to do that. Something like:
            thiz.collection = cgroup.get('congregations')
            })
        })
    });
}})

TODO: Figure out how to make a cgroup filter for only its own related congregations. Some links which might help are below.

http://stackoverflow.com/questions/17811451/implementing-a-many-to-many-relationship-with-backbone-relational
http://jsfiddle.net/mmacaula/XaESG/2/
https://antoviaque.org/docs/tutorials/backbone-relational-tutorial/

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.