diff --git a/app/assets/javascripts/app/controllers/calendar.js.coffee b/app/assets/javascripts/app/controllers/calendar.js.coffee index 3640e8686..249556e6c 100644 --- a/app/assets/javascripts/app/controllers/calendar.js.coffee +++ b/app/assets/javascripts/app/controllers/calendar.js.coffee @@ -2,6 +2,8 @@ class Index extends App.ControllerContent events: 'click .js-new': 'new' 'click .js-edit': 'edit' + 'click .js-delete': 'delete' + 'click .js-default': 'default' 'click .js-description': 'description' constructor: -> @@ -102,6 +104,28 @@ class Index extends App.ControllerContent large: true ) + delete: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Calendar.find(id) + new App.ControllerGenericDestroyConfirm( + item: item + container: @el.closest('.content') + callback: @load + ) + + default: (e) => + e.preventDefault() + id = $(e.target).closest('.action').data('id') + item = App.Calendar.find(id) + item.default = true + item.save( + done: => + @load() + fail: => + @load() + ) + description: (e) => new App.ControllerGenericDescription( description: App.Calendar.description diff --git a/app/assets/javascripts/app/views/calendar/index.jst.eco b/app/assets/javascripts/app/views/calendar/index.jst.eco index 2913d691a..274722110 100644 --- a/app/assets/javascripts/app/views/calendar/index.jst.eco +++ b/app/assets/javascripts/app/views/calendar/index.jst.eco @@ -53,6 +53,7 @@
<%- @Tdate(holiday) %> | <%= meta.summary %> |