 
    Template.gallery.helpers fileTableHelpers
 
-   Template.gallery.dataEntries = () ->
-      # Reactively populate the table
-      this.find({'metadata.thumbOf': {$exists: false}}, {sort:{filename: 1}})
-
-   Template.gallery.thumb = () ->
-      "#{this.metadata.thumb}"
-
-   Template.gallery.rendered = () ->
-      # This assigns a file drop zone to the "file table"
-      this.data.resumable.assignDrop $(".#{myData.root}DropZone")
+   Template.gallery.helpers
+      dataEntries: () ->
+         # Reactively populate the table
+         this.find({'metadata.thumbOf': {$exists: false}}, {sort:{filename: 1}})
+
+      thumb: () ->
+         "#{this.metadata.thumb}"
+
+      rendered: () ->
+         # This assigns a file drop zone to the "file table"
+         this.data.resumable.assignDrop $(".#{myData.root}DropZone")
 
    Template.fileControls.events
       'click .remove-files': (e, t) ->

      userId: () ->
         Meteor.userId()

   Template.nav.active = (pill) ->
      return "active" if pill is "#{this}"

   fileTableHelpers =
      owner: () ->

         this.find({}).forEach ((d) -> this.remove(d._id)), this

   Template.fileTable.helpers fileTableHelpers

   Template.fileTable.helpers 
      dataEntries: () ->
         # Reactively populate the table
         this.find({}, {sort:{filename: 1}})

   Template.fileTable.events fileTableEvents

