27 has_creator: !!_model.get("created_by"), |
27 has_creator: !!_model.get("created_by"), |
28 title: _model.get("title"), |
28 title: _model.get("title"), |
29 uri: _model.get("uri"), |
29 uri: _model.get("uri"), |
30 short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
30 short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
31 description: _model.get("description"), |
31 description: _model.get("description"), |
32 color: _model.get("color") || _created_by.get("color"), |
32 color: (_model.has("style") && _model.get("style").color) || _created_by.get("color"), |
|
33 dash: _model.has("style") && _model.get("style").dash ? "checked" : "", |
33 from_title: _from_model.get("title"), |
34 from_title: _from_model.get("title"), |
34 to_title: _to_model.get("title"), |
35 to_title: _to_model.get("title"), |
35 from_color: _from_model.get("color") || (_from_model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
36 from_color: (_from_model.has("style") && _from_model.get("style").color) || (_from_model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
36 to_color: _to_model.get("color") || (_to_model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
37 to_color: (_to_model.has("style") && _to_model.get("style").color) || (_to_model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan)).get("color"), |
37 created_by_color: _created_by.get("color"), |
38 created_by_color: _created_by.get("color"), |
38 created_by_title: _created_by.get("title") |
39 created_by_title: _created_by.get("title") |
39 }, |
40 }, |
40 renkan: this.renkan, |
41 renkan: this.renkan, |
41 shortenText: Utils.shortenText, |
42 shortenText: Utils.shortenText, |
62 var _data = { |
63 var _data = { |
63 title: _this.editor_$.find(".Rk-Edit-Title").val() |
64 title: _this.editor_$.find(".Rk-Edit-Title").val() |
64 }; |
65 }; |
65 if (_this.options.show_edge_editor_uri) { |
66 if (_this.options.show_edge_editor_uri) { |
66 _data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); |
67 _data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); |
|
68 } |
|
69 if (_this.options.show_node_editor_style) { |
|
70 var dash = _this.editor_$.find(".Rk-Edit-Dash").is(':checked'); |
|
71 _data.style = _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {dash: dash}); |
67 } |
72 } |
68 _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); |
73 _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); |
69 _model.set(_data); |
74 _model.set(_data); |
70 paper.view.draw(); |
75 paper.view.draw(); |
71 } else { |
76 } else { |
121 _e.preventDefault(); |
126 _e.preventDefault(); |
122 _this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); |
127 _this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); |
123 }, |
128 }, |
124 function(_e) { |
129 function(_e) { |
125 _e.preventDefault(); |
130 _e.preventDefault(); |
126 _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || (_model.get("created_by") || Utils._USER_PLACEHOLDER(_this.renkan)).get("color")); |
131 _this.editor_$.find(".Rk-Edit-Color").css("background", (_model.has("style") && _model.get("style").color)|| (_model.get("created_by") || Utils._USER_PLACEHOLDER(_this.renkan)).get("color")); |
127 } |
132 } |
128 ).click(function(_e) { |
133 ).click(function(_e) { |
129 _e.preventDefault(); |
134 _e.preventDefault(); |
130 if (_this.renderer.isEditable()) { |
135 if (_this.renderer.isEditable()) { |
131 _model.set("color", $(this).attr("data-color")); |
136 _model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {color: $(this).attr("data-color")})); |
132 _picker.hide(); |
137 _picker.hide(); |
133 paper.view.draw(); |
138 paper.view.draw(); |
134 } else { |
139 } else { |
135 closeEditor(); |
140 closeEditor(); |
136 } |
141 } |