diff --git a/README.md b/README.md index bed2d55..2904684 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ http://dmytroyarmak.github.io/codeangels-marionette-introduction - [Step 0 - Initialization of project](https://github.com/dmytroyarmak/marionette-contact-manager/releases/tag/step-0) - [Step 1 - Install Marionette.js](https://github.com/dmytroyarmak/marionette-contact-manager/releases/tag/step-1) - [Step 2 - Use ItemView](https://github.com/dmytroyarmak/marionette-contact-manager/releases/tag/step-2) -- [Step 3 - Use CollectionView](https://github.com/dmytroyarmak/marionette-contact-manager/releases/tag/step-3) -- [Step 4 - Use CompositeView](https://github.com/dmytroyarmak/marionette-contact-manager/releases/tag/step-4) +- [Step 3 - Use CompositeView](https://github.com/dmytroyarmak/marionette-contact-manager/releases/tag/step-3) ## Previous lesson https://github.com/dmytroyarmak/backbone-contact-manager diff --git a/app/js/views/contact.js b/app/js/views/contact.js index eb8fb63..7a88939 100644 --- a/app/js/views/contact.js +++ b/app/js/views/contact.js @@ -7,10 +7,6 @@ ContactManager.Views.Contact = Marionette.ItemView.extend({ 'click .delete-contract': 'onClickDelete' }, - modelEvents: { - 'remove': 'close' - }, - onClickDelete: function(e) { e.preventDefault(); this.model.collection.remove(this.model); diff --git a/app/js/views/contacts.js b/app/js/views/contacts.js index 4ab6b1a..c9e3cbe 100644 --- a/app/js/views/contacts.js +++ b/app/js/views/contacts.js @@ -1,17 +1,5 @@ -ContactManager.Views.Contacts = Backbone.View.extend({ - template: _.template($('#tpl-contacts').html()), - - renderOne: function(contact) { - var itemView = new ContactManager.Views.Contact({model: contact}); - this.$('.contacts-container').append(itemView.render().$el); - }, - - render: function() { - var html = this.template(); - this.$el.html(html); - - this.collection.each(this.renderOne, this); - - return this; - } +ContactManager.Views.Contacts = Marionette.CompositeView.extend({ + template: '#tpl-contacts', + itemView: ContactManager.Views.Contact, + itemViewContainer: '.contacts-container' });