Skip to content

Instantly share code, notes, and snippets.

@rashfael
Forked from anonymous/gist:4546270
Last active December 11, 2015 04:38
Show Gist options
  • Save rashfael/4546281 to your computer and use it in GitHub Desktop.
Save rashfael/4546281 to your computer and use it in GitHub Desktop.
module.exports = class ReportController extends Controller
historyURL: 'reports'
index: ->
collection = new Reports()
collection.fetch()
@view = new ReportListView
collection: collection
a(href='/reports/add') Neuer Report
table.table
thead
tr
th #
th Name
th Erstellt
th PDF
th Actions
tbody#list
td= number
td: a(href='/reports/'+_id)= name
td= createdAt
td: a(href='/reports/'+_id+'/report.pdf') PDF
td: i.remove.icon-remove
class ReportListItemView extends View
tagName: 'tr'
template: require 'views/templates/report_list_item'
events:
'click .remove': 'remove'
remove: (event) =>
@model.destroy()
module.exports.ReportListView = class ReportListView extends CollectionView
container: '#page-container'
autoRender: yes
template: require 'views/templates/report_list'
className: 'report-list'
listSelector: '#list'
itemView: ReportListItemView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment