--- a/client/js/renderer/nodeeditor.js Mon Jun 15 12:08:14 2015 +0200
+++ b/client/js/renderer/nodeeditor.js Tue Jun 16 11:36:09 2015 +0200
@@ -14,12 +14,12 @@
this.template = this.options.templates['templates/nodeeditor.html'];
//this.templates['default']= this.options.templates['templates/nodeeditor.html'];
//fusionner avec this.options.node_editor_templates
- this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html'];
+ this.readOnlyTemplate = this.options.node_editor_templates;
},
draw: function() {
var _model = this.source_representation.model,
_created_by = _model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan),
- _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ),
+ _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate[_model.get("type")] || this.readOnlyTemplate["default"]),
_image_placeholder = this.options.static_url + "img/image-placeholder.png",
_size = (_model.get("size") || 0);
this.editor_$
@@ -29,6 +29,7 @@
has_creator: !!_model.get("created_by"),
title: _model.get("title"),
uri: _model.get("uri"),
+ type: _model.get("type") || "default",
short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40),
description: _model.get("description"),
image: _model.get("image") || "",
@@ -46,6 +47,7 @@
options: this.options,
shortenText: Utils.shortenText,
shapes : _(ShapeBuilder.builders).omit('svg').keys().value(),
+ types : _(this.options.node_editor_templates).keys().value(),
}));
this.redraw();
var _this = this,
@@ -126,6 +128,11 @@
_data.shape = _this.editor_$.find(".Rk-Edit-Shape").val();
}
}
+ if (_this.options.change_types) {
+ if(_model.get("type")!==_this.editor_$.find(".Rk-Edit-Type").val()){
+ _data.type = _this.editor_$.find(".Rk-Edit-Type").val();
+ }
+ }
_model.set(_data);
_this.redraw();
} else {