/*
 * ADOBE CONFIDENTIAL
 *
 * Copyright (c) 2014 Adobe Systems Incorporated. All rights reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 */

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4 */
/*global define: true, graphite: true, window: true*/

define(['jquery',
        'underscore',
        'backbone',
        'parfait/PSDAssetsView',
        'plugin-dependencies',
        'ccweb.files.extract/utils/TemplateUtil',
        'text!dreamweaver/views/templates/dwDerivedAssetsListTemplate.html'], function ($, _, Backbone, PSDAssetsView, deps, TemplateUtil, DwDerivedAssetsListTemplate) {
    "use strict";

    var DwPSDAssetsView = PSDAssetsView.extend({
        initialize: function () {
            this.assetViews = [];
            this.render();
        },
        
        render: function () {
            this.setElement(TemplateUtil.createTemplate(DwDerivedAssetsListTemplate));
            return this;
        },
        
        handleDerivedAssetError: function (response) {
            // Overriding error handling. We want to show no error messages for now.
        },
        
        remove: function () {
            this.assetViews = [];
            if (this.derivedAssetCollection) {
                this.derivedAssetCollection.off(null, null, this);
                this.derivedAssetCollection.length = 0;
            }
            
            Backbone.View.prototype.remove.apply(this, arguments);
        }
    });

    return DwPSDAssetsView;
});