Skip to content

Commit

Permalink
Minor refactor on amd-js example portlet
Browse files Browse the repository at this point in the history
  • Loading branch information
phuong_vu authored and trongtt committed Oct 8, 2012
1 parent 3f46e34 commit 78b5a1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<module>
<name>jquery-plugin</name>
<script>
<name>jquery-plugin</name>
<path>/jqueryPlugin/jquery-plugin.js</path>
</script>
<depends>
Expand All @@ -30,7 +29,6 @@
<name>JQueryPluginPortlet</name>
<module>
<script>
<name>jqueryPlugin</name>
<path>/jqueryPlugin/jqueryPluginPortlet.js</path>
</script>
<depends>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
<div style="clear: both;margin-top:51px;
border-color: #DDDDDD #DDDDDD transparent; border-top-style: solid; border-top-width: 1px;">
<ol>
<li>
All js files in this example are native requirejs. The code shown is simplified to make it easier to read
</li>
<li>
Each js library should be a GateIn resource - declare it in gatein-resources.xml
<pre class="code" lang="html">
&lt;module&gt;
&lt;name&gt;text&lt;/name&gt;
&lt;script&gt;
&lt;name&gt;requirejs.text&lt;/name&gt;
&lt;path&gt;/requirejs/js/plugins/text.js&lt;/path&gt;
&lt;/script&gt;
&lt;depends&gt;
Expand All @@ -39,7 +41,6 @@
&lt;name&gt;RequireJSPortlet&lt;/name&gt;
&lt;module&gt;
&lt;script&gt;
&lt;name&gt;starter&lt;/name&gt;
&lt;path&gt;/requirejs/js/requirejsPortlet.js&lt;/path&gt;
&lt;/script&gt;
&lt;depends&gt;
Expand All @@ -62,7 +63,7 @@
<ul>
<li>
<strong>"text.js"</strong> is not only a native requirejs lib, but also a requirejs-plugin. We use <strong>&lt;resource&gt;</strong> tag
to declare a requirejs-plugin resource
to declare a <a href="http://requirejs.org/docs/plugins.html" target="_blank">requirejs-plugin resource</a>
</li>
<li>
Notice how we use <strong>&lt;depends&gt;</strong> tag to declare dependencies -
Expand All @@ -84,7 +85,6 @@
&lt;module&gt;
&lt;name&gt;foo&lt;/name&gt;
&lt;script&gt;
&lt;name&gt;foo&lt;/name&gt;
&lt;path&gt;/path/foo.js&lt;/path&gt;
&lt;/script&gt;
&lt;depends&gt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
String id = uicomponent.getParent().getId();

JavascriptManager jsmanager = _ctx.getRequestContext().getJavascriptManager();
jsmanager.require("SHARED/webui-ext", "webuiExt")
.addScripts("webuiExt.UIRightClickPopupMenu.disableContextMenu('"+id+"') ;");
jsmanager.require("SHARED/uiRightClickPopupMenu", "uiRightClickPopupMenu")
.addScripts("uiRightClickPopupMenu.disableContextMenu('"+id+"') ;");
uicomponent.renderUIComponent(uiPopupMenu) ;
}
%>
Expand Down

0 comments on commit 78b5a1f

Please sign in to comment.