'Provide a dropdown of links to shelters'

def shelter_list(self):

    T = current.T
    s3db = current.s3db
    resource = s3db.resource('cr_shelter', filter=FS('status').belongs([2, None]))
    data = resource.select(['id', 'name'])
    shelter_list = UL(_id='shelter_list', _class='f-dropdown', data={'dropdown-content': ''})
    rows = data['rows']
    if rows:
        for row in rows:
            shelter_list.append(LI(A(row['cr_shelter.name'], _href=URL(c='cr', f='shelter', args=[row['cr_shelter.id']]))))
        return LI(A(T('Shelters'), _class='button    dropdown', data={'dropdown': 'shelter_list'}), shelter_list)
    else:
        return ''
