/*global define: true, metaproject: true, ko: true, $: true */
define(function (require) {
    "use strict";


    // Module dependencies
    var Boiler = require('Boiler'),
        models = require('../models'),
        viewTemplate = require('text!./detail.html');

    var Model = models['<%= model %>'];

    var viewModel = {
        model: ko.observable(),
        create: function() {
            viewModel.model(Model.create());
        },
        load: function(id) {
            Model.get(id, viewModel.model);
        },
        destroy: function() {
            //if(confirm('Are you sure ?')) {
            viewModel.model().destroy(function() {
                viewModel.close();
            });
            //}
        },
        save: function() {
            viewModel.model().save(function() {
                viewModel.close();
            });
        },
        close: function() {
            viewModel.model(null);
            Boiler.UrlController.up();
        }
    };

    return {
        template: viewTemplate,
        viewModel: viewModel,
        activate: function(parent, params) {
            // called after the template is loaded and viewModel is bound
            viewModel.load(params.id);
        },
        deactivate: function() {
            // called before hiding this module
        }
    }
});
@@ -1181,16 +1181,126 @@
 s bound%0A
+            if(params.id == 'new') %7B%0A                viewModel.create();%0A            %7D%0A            else %7B%0A    
         
@@ -1330,16 +1330,30 @@
 ms.id);%0A
+            %7D%0A
         

fix "new" crud