           $(".#{data.single}-search").addClass("hide")
           $(".#{data.single}-search-query").attr("value","")
         return false
-=======
-    navEvents[templateEvent] = (event, template) ->
-      context = template.data
-      single = context.single
-      value = event.target.value
-      $(".#{data.single}-search").removeClass("hide")
-      if value?
-        if value.has("=")
-          key = value.split("=")[0]
-          search_string = value.split("=")[1]
-          search = {}
-          search[key] = 
-            $regex: ".*#{search_string}.*"
-            $options: "i"
-          Session.set("#{data.single}Find", search)
-        else if value.has(" ")
-          search_terms = value.split " "
-          regex_array = 
-            for term in search_terms
-               ".*#{term}.*"
-          regex = regex_array.join "|"
-          Session.set("#{data.single}Find", {name: {$regex: regex, $options: "i"}})
-        else
-          regex = ".*#{value}.*"
-          Session.set("#{data.single}Find", {name: {$regex: regex, $options: "i"}})
-      else
-        Session.set("#{data.single}Find", {})
-        $(".#{data.single}-search").addClass("hide")
-        $(".#{data.single}-search-query").attr("value","")
-      return false
->>>>>>> 2d6d00a2da830ee8d011084d970a22eed0949f7f
 
     if data.nav?.events?
       _.extend(data.nav.events, navEvents)

Template.listNav.helpers
  nav: () ->
    # console.log 'listNav:nav', this
=======
    if data.items? and typeof data.items is 'function'
      for item in data.items()
        data = Object.reject(data, 'items')
        item.context = data
        items.add item

      if items.length > 0
        return items

Template.listNav.helpers
  nav: () ->
>>>>>>> 2d6d00a2da830ee8d011084d970a22eed0949f7f
    data = this
    single = data.single
    plural = data.plural

        $(".#{single}-search-query").attr('value','')
        Session.set("#{single}Find",{})
        return false
        
    # ---------------------------------------------------------------------------------------
    # Search
    # At the moment the query for search uses name as the key.  Need to revist this
    # to make it so that the package user can set what the default
    templateEvent = "keyup .#{data.single}-search-query"
    if not DMUtils.find(Template.listNav._events, 'selector', ".#{data.single}-search-query")
      navEvents[templateEvent] = (event, template) ->
        context = template.data
