CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Widget / Page / Inline / Example.tpl
1 <h2>This is an example of a template you can call inline</h2>
2 <p>If you call it from an <a href='#' id="dialog">ajax call</a>, it's ready to be embeded in your page. </p><p>You can pass an <a href="?id=42">id as param</a> and access it in {ldelim}$id{rdelim}.
3 {if $id}
4 <p><b>Well done, you have an id as param ( {$id} )</b></p>
5 {/if}
6
7 <br>You can also have extra params (?example_param=dummy) and access it in {ldelim}$request.example_param{rdelim}.
8 <br>These are the param I could find :
9 </p>
10 <ul>
11 {foreach from=$request key=k item=p}
12 <li>{ldelim}$request{rdelim}.{$k} = <b>{$p}</b></li>
13 {/foreach}
14 </ul>
15 <p>It's done to work with the smarty api, so you can fetch more data, and update or create using the ajax API.</p>
16 <p>
17
18 If load the page directly from your browser, it automatically adds all the page template, including the header with all the jquery plugins. This isn't usual way of calling it, but convenient for debugging purpose.
19 </p>
20
21 <script>
22 {literal}
23 CRM.$(function($) {
24 $("#dialog").click (function () {
25 var $n=$('<div>Loading '+window.location+'</div>').appendTo('body');
26 $n.load(''+window.location, function(){
27 alert ("loaded. might initialise more javascript");
28 });
29 $n.dialog ({modal:true,width:500});
30 return false;
31 });
32 $(".ui-dialog-content #dialog").on ('click', function () { // only triggered on the dialog link in the popup
33 alert ("one level of dialog is enough");
34 return false;
35 });
36
37 });
38
39 {/literal}
40 </script>