1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/d7eba0838597/ changeset: d7eba0838597 user: jgoecks date: 2012-10-04 16:51:10 summary: Make Phyloviz into an AMD module and use requireJS for Phyloviz. affected #: 2 files diff -r 6f9ce8692bb6aae38d720abd489f8e0edfd5f8c3 -r d7eba083859770e676f173b75f2053f575305113 static/scripts/viz/phyloviz.js --- a/static/scripts/viz/phyloviz.js +++ b/static/scripts/viz/phyloviz.js @@ -1,3 +1,5 @@ +define(['libs/d3', 'viz/visualization'], function(d3, visualization_mod) { + var UserMenuBase = Backbone.View.extend({ /** * Base class of any menus that takes in user interaction. Contains checking methods. @@ -165,7 +167,7 @@ /** * -- PhyloTree Model -- */ -var PhyloTree = Visualization.extend({ +var PhyloTree = visualization_mod.Visualization.extend({ defaults : { layout: "Linear", separation : 250, // px dist between nodes of different depth to represent 1 evolutionary until @@ -588,7 +590,7 @@ $("#title").text("Phylogenetic Tree from " + self.phyloTree.get("title") + ":"); // -- Create Linear view instance -- - var linearView = new PhylovizLinearView(self.layoutOptions) + var linearView = new PhylovizLinearView(self.layoutOptions); }, zoomAndPan : function(event){ @@ -952,4 +954,10 @@ } }); } +}); + +return { + PhylovizView: PhylovizView +}; + }); \ No newline at end of file diff -r 6f9ce8692bb6aae38d720abd489f8e0edfd5f8c3 -r d7eba083859770e676f173b75f2053f575305113 templates/visualization/phyloviz.mako --- a/templates/visualization/phyloviz.mako +++ b/templates/visualization/phyloviz.mako @@ -138,7 +138,43 @@ <%def name="javascripts()"> ${parent.javascripts()} - ${h.js( "galaxy.panels", "libs/d3", "mvc/data", "viz/visualization", "viz/phyloviz")} + ${h.js( "libs/require" )} + + <script type="text/javascript"> + + require.config({ + baseUrl: "${h.url_for('/static/scripts')}", + shim: { + "libs/underscore": { exports: "_" }, + "libs/d3": { exports: "d3" } + } + }); + + require(["viz/phyloviz"], function(phyloviz_mod) { + + function initPhyloViz(data, config) { + var phyloviz; + + // -- Initialization code |--> + phyloviz = new phyloviz_mod.PhylovizView({ + data: data, + layout : "Linear", + config : config + }); + + // -- Render viz. -- + phyloviz.render(); + + } + + $(function firstVizLoad(){ // calls when viz is loaded for the first time + var config = JSON.parse( '${ h.to_json_string( config )}'); + var data = JSON.parse('${h.to_json_string(data)}'); + initPhyloViz(data, config); + }); + }); + + </script></%def> @@ -290,31 +326,6 @@ <div id="PhyloViz" ></div> - <script type="text/javascript"> - - function initPhyloViz(data, config) { - var phyloviz; - - // -- Initialization code |--> - phyloviz = new PhylovizView({ - data: data, - layout : "Linear", - config : config - }); - - // -- Render viz. -- - phyloviz.render(); - - } - - $(function firstVizLoad(){ // calls when viz is loaded for the first time - var config = JSON.parse( '${ h.to_json_string( config )}'); - var data = JSON.parse('${h.to_json_string(data)}'); - initPhyloViz(data, config); - }); - - </script> - </%def> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.