smartxml: Cache DocumentNode instances in the underlying DOM structure
[fnpeditor.git] / src / editor / modules / rng / documentSummary.js
1 define(function(require) {
2     
3 'use strict';
4
5 var $ = require('libs/jquery'),
6     _ = require('libs/underscore'),
7     template = require('libs/text!./documentSummary.html');
8
9
10 var view = {
11     dom: $('<ul></ul>'),
12     init: function(config, doc) {
13         this.config = config;
14         this.doc = doc;
15         this.template = _.template(template);
16
17         this.doc.on('propertyChanged', this.render, this);
18     },
19     render: function() {
20         this.dom.html(this.template({
21             title: this.config.title,
22             properties: this.config.properties,
23             propertyValues: this.doc.properties
24         }));
25     },
26     setDraftField: function(value) {
27         this.dom.find('.draft').text(value);
28     }
29 };
30
31 return view;
32
33 });