# HG changeset patch # User rougeronj # Date 1429368997 -7200 # Node ID 4f458e6d32bd909023ecda6dd0c920a8bd21d8c2 # Parent eb5f2313ce2bfb07a9e8536f729a434a99e11b56 export the templates of scene and edgeeditor to html files diff -r eb5f2313ce2b -r 4f458e6d32bd client/js/renderer/edgeeditor.js --- a/client/js/renderer/edgeeditor.js Sat Apr 18 16:55:15 2015 +0200 +++ b/client/js/renderer/edgeeditor.js Sat Apr 18 16:56:37 2015 +0200 @@ -10,31 +10,11 @@ var EdgeEditor = Utils.inherit(BaseEditor); _(EdgeEditor.prototype).extend({ - template: _.template( - '

×<%-renkan.translate("Edit Edge")%>

' + - '

' + - '<% if (options.show_edge_editor_uri) { %>

' + - '<% if (options.properties.length) { %>

<% } } %>' + - '<% if (options.show_edge_editor_color) { %>
<%-renkan.translate("Edge color:")%>
' + - '<%= renkan.colorPicker %><%- renkan.translate("Choose color") %>
<% } %>' + - '<% if (options.show_edge_editor_direction) { %>

<%- renkan.translate("Change edge direction") %>

<% } %>' + - '<% if (options.show_edge_editor_nodes) { %>

<%-renkan.translate("From:")%><%- shortenText(edge.from_title, 25) %>

' + - '

<%-renkan.translate("To:")%><%- shortenText(edge.to_title, 25) %>

<% } %>' + - '<% if (options.show_edge_editor_creator && edge.has_creator) { %>

<%-renkan.translate("Created by:")%><%- shortenText(edge.created_by_title, 25) %>

<% } %>' - ), - readOnlyTemplate: _.template( - '

×<% if (options.show_edge_tooltip_color) { %><% } %>' + - '<% if (edge.uri) { %><% } %><%-edge.title%><% if (edge.uri) { %><% } %>

' + - '<% if (options.show_edge_tooltip_uri && edge.uri) { %>

<%-edge.short_uri%>

<% } %>' + - '

<%-edge.description%>

' + - '<% if (options.show_edge_tooltip_nodes) { %>

<%-renkan.translate("From:")%><%- shortenText(edge.from_title, 25) %>

' + - '

<%-renkan.translate("To:")%><%- shortenText(edge.to_title, 25) %>

<% } %>' + - '<% if (options.show_edge_tooltip_creator && edge.has_creator) { %>

<%-renkan.translate("Created by:")%><%- shortenText(edge.created_by_title, 25) %>

<% } %>' - ), + _init: function() { + BaseEditor.prototype._init.apply(this); + this.template = this.options.templates['templates/edgeeditor.html']; + this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html']; + }, draw: function() { var _model = this.source_representation.model, _from_model = _model.get("from"), diff -r eb5f2313ce2b -r 4f458e6d32bd client/js/renderer/scene.js --- a/client/js/renderer/scene.js Sat Apr 18 16:55:15 2015 +0200 +++ b/client/js/renderer/scene.js Sat Apr 18 16:56:37 2015 +0200 @@ -10,7 +10,7 @@ this.renkan = _renkan; this.$ = $(".Rk-Render"); this.representations = []; - this.$.html(this.template(_renkan)); + this.$.html(_renkan.options.templates['templates/scene.html'](_renkan)); this.onStatusChange(); this.canvas_$ = this.$.find(".Rk-Canvas"); this.labels_$ = this.$.find(".Rk-Labels"); @@ -29,7 +29,7 @@ this.buttons_layer = new paper.Layer(); this.delete_list = []; this.redrawActive = true; - + if (_renkan.options.show_minimap) { this.minimap = { background_layer: new paper.Layer(), @@ -489,37 +489,6 @@ }; _(Scene.prototype).extend({ - template: _.template( - '<% if (options.show_top_bar) { %>
<% if (!options.editor_mode) { %>

<%- project.get("title") || translate("Untitled project")%>

' + - '<% } else { %>" placeholder="<%-translate("Untitled project")%>" /><% } %>' + - '<% if (options.show_user_list) { %>
<% if (options.show_user_color) { %>
<% if (options.user_color_editable) { %><% } %>' + - '<% if (options.user_color_editable) { print(colorPicker) } %>
<% } %><unknown user>
<% } %>' + - '<% if (options.home_button_url) {%>
' + - '<%- translate(options.home_button_title) %>
<% } %>' + - '<% if (options.show_fullscreen_button) { %>
<%-translate("Full Screen")%>
<% } %>' + - '<% if (options.editor_mode) { %>' + - '<% if (options.show_addnode_button) { %>
' + - '
<%-translate("Add Node")%>
<% } %>' + - '<% if (options.show_addedge_button) { %>
' + - '
<%-translate("Add Edge")%>
<% } %>' + - '<% if (options.show_export_button) { %>
<%-translate("Download Project")%>
<% } %>' + - '<% if (options.show_save_button) { %>
<% } %>' + - '<% if (options.show_open_button) { %>
<%-translate("Open Project")%>
<% } %>' + - '<% if (options.show_bookmarklet) { %>
' + - '<%-translate("Renkan \'Drag-to-Add\' bookmarklet")%>
<% } %>' + - '<% } else { %>' + - '<% if (options.show_export_button) { %>
<%-translate("Download Project")%>
<% } %>' + - '<% };' + - 'if (options.show_search_field) { %>' + - '
" />
<% } %>
<% } %>' + - '
' + - '
resize="" <% } %>>
' + - '<% if (options.show_bins) { %>
«
<% } %>' + - '<% if (options.show_zoom) { %>
">
">
">
' + - '<% if (options.editor_mode && options.save_view) { %>
">
<% } %>' + - '<% if (options.save_view) { %>
">
<% } %>
<% } %>' + - '
' - ), fixSize: function() { if( this.renkan.options.default_view && this.renkan.project.get("views").length > 0) { var view = this.renkan.project.get("views").last(); diff -r eb5f2313ce2b -r 4f458e6d32bd client/templates/edgeeditor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/templates/edgeeditor.html Sat Apr 18 16:56:37 2015 +0200 @@ -0,0 +1,67 @@ +

+ ×<%-renkan.translate("Edit Edge")%> +

+

+ + +

+<% if (options.show_edge_editor_uri) { %> +

+ + + +

+ <% if (options.properties.length) { %> +

+ + +

+<% } } %> +<% if (options.show_edge_editor_color) { %> +
+ <%-renkan.translate("Edge color:")%> +
+ + + + <%= renkan.colorPicker %> + <%- renkan.translate("Choose color") %> +
+
+<% } %> +<% if (options.show_edge_editor_direction) { %> +

+ <%- renkan.translate("Change edge direction") %> +

+<% } %> +<% if (options.show_edge_editor_nodes) { %> +

+ <%-renkan.translate("From:")%> + + <%- shortenText(edge.from_title, 25) %> +

+

+ <%-renkan.translate("To:")%> + + <%- shortenText(edge.to_title, 25) %> +

+<% } %> +<% if (options.show_edge_editor_creator && edge.has_creator) { %> +

+ <%-renkan.translate("Created by:")%> + + <%- shortenText(edge.created_by_title, 25) %> +

+<% } %> diff -r eb5f2313ce2b -r 4f458e6d32bd client/templates/edgeeditor_readonly.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/templates/edgeeditor_readonly.html Sat Apr 18 16:56:37 2015 +0200 @@ -0,0 +1,38 @@ +

+ × + <% if (options.show_edge_tooltip_color) { %> + + <% } %> + + <% if (edge.uri) { %> + + <% } %> + <%-edge.title%> + <% if (edge.uri) { %> <% } %> + +

+<% if (options.show_edge_tooltip_uri && edge.uri) { %> +

+ <%- edge.short_uri %> +

+<% } %> +

<%-edge.description%>

+<% if (options.show_edge_tooltip_nodes) { %> +

+ <%-renkan.translate("From:")%> + + <%- shortenText(edge.from_title, 25) %> +

+

+ <%-renkan.translate("To:")%> + + <%- shortenText(edge.to_title, 25) %> +

+<% } %> +<% if (options.show_edge_tooltip_creator && edge.has_creator) { %> +

+ <%-renkan.translate("Created by:")%> + + <%- shortenText(edge.created_by_title, 25) %> +

+<% } %> diff -r eb5f2313ce2b -r 4f458e6d32bd client/templates/scene.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/templates/scene.html Sat Apr 18 16:56:37 2015 +0200 @@ -0,0 +1,152 @@ +<% if (options.show_top_bar) { %> +
+
+ <% if (!options.editor_mode) { %> +

+ <%- project.get("title") || translate("Untitled project")%> +

+ <% } else { %> + + <% } %> + <% if (options.show_user_list) { %> +
+
+ <% if (options.show_user_color) { %> +
+ + <% if (options.user_color_editable) { %> + + <% } %> + + <% if (options.user_color_editable) { print(colorPicker) } %> +
+ <% } %> + <unknown user> +
+ +
+ <% } %> + <% if (options.home_button_url) {%> +
+ +
+
+ <%- translate(options.home_button_title) %> +
+
+
+ <% } %> + <% if (options.show_fullscreen_button) { %> +
+
+
+
+ <%-translate("Full Screen")%> +
+
+
+ <% } %> + <% if (options.editor_mode) { %> + <% if (options.show_addnode_button) { %> +
+
+
+
+ <%-translate("Add Node")%> +
+
+
+ <% } %> + <% if (options.show_addedge_button) { %> +
+
+
+
+ <%-translate("Add Edge")%> +
+
+
+ <% } %> + <% if (options.show_export_button) { %> +
+
+
+
+ <%-translate("Download Project")%> +
+
+
+ <% } %> + <% if (options.show_save_button) { %> +
+
+
+
+
+
+ <% } %> + <% if (options.show_open_button) { %> +
+
+
+
+ <%-translate("Open Project")%> +
+
+
+ <% } %> + <% if (options.show_bookmarklet) { %> +
+ +
+
+ <%-translate("Renkan \'Drag-to-Add\' bookmarklet")%> +
+
+
+
+ <% } %> + <% } else { %> + <% if (options.show_export_button) { %> +
+
+
+
+ <%-translate("Download Project")%> +
+
+
+
+ <% } %> + <% }; %> + <% if (options.show_search_field) { %> +
+ +
+
+ <% } %> +
+<% } %> +
+
+ resize="" <% } %>> +
+
+ <% if (options.show_bins) { %> +
«
+ <% } %> + <% if (options.show_zoom) { %> +
+
+
+
+ <% if (options.editor_mode && options.save_view) { %> +
+ <% } %> + <% if (options.save_view) { %> +
+ <% } %> +
+ <% } %> +
+
\ No newline at end of file