Using the Dojo Javascript library in Ruby Rails
I have been using the fine Dojo Javascript library in a web app written in Common Lisp and this morning added Dojo to the code base for a current Rails project. The easiest way to get started using Dojo and Rails is to simply install the developer's version (non-compacted) of dojo.js and the src directory directly in your Rail project's public/javascripts directory, so it looks like this:
public/Again, the "src" directory contains the dojo source files (besides the dojo.js loader). Dojo will complain about rendered Rails web pages withot HTML and HEAD tags, so I added the following HTML with Dojo setup to the view for my main application controller:
javascripts/
dojo.js
src/
<html>Dojo is definitely "heavier weight" than the prototype.js Javascript library that is provided with Rails so you may not want to use Dojo for very high traffic sites.
<head>
<title>KBSportal KnowledgeManagement</title>
<script type="text/javascript">
djConfig = {isDebug: true};
</script>
<script src="/javascripts/dojo.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("dojo.io.*");
dojo.require("dojo.event.*");
dojo.require("dojo.widget.TabContainer");
dojo.require("dojo.widget.LinkPane");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.widget.LayoutContainer");
dojo.require("dojo.widget.Checkbox");
</script>
<style type="text/css">
body {
font-family : sans-serif;
}
.dojoTabPaneWrapper {
padding : 10px 10px 10px 10px;
}
</style>
</head>
Comments
Post a Comment