]>
Commit | Line | Data |
---|---|---|
1354d172 AD |
1 | define("dijit/layout/LinkPane", [ |
2 | "./ContentPane", | |
3 | "../_TemplatedMixin", | |
4 | "dojo/_base/declare" // declare | |
5 | ], function(ContentPane, _TemplatedMixin, declare){ | |
6 | ||
7 | /*===== | |
8 | var _TemplatedMixin = dijit._TemplatedMixin; | |
9 | var ContentPane = dijit.layout.ContentPane; | |
10 | =====*/ | |
11 | ||
12 | // module: | |
13 | // dijit/layout/LinkPane | |
14 | // summary: | |
15 | // A ContentPane with an href where (when declared in markup) | |
16 | // the title is specified as innerHTML rather than as a title attribute. | |
17 | ||
18 | ||
19 | return declare("dijit.layout.LinkPane", [ContentPane, _TemplatedMixin], { | |
20 | // summary: | |
21 | // A ContentPane with an href where (when declared in markup) | |
22 | // the title is specified as innerHTML rather than as a title attribute. | |
23 | // description: | |
24 | // LinkPane is just a ContentPane that is declared in markup similarly | |
25 | // to an anchor. The anchor's body (the words between `<a>` and `</a>`) | |
26 | // become the title of the widget (used for TabContainer, AccordionContainer, etc.) | |
27 | // example: | |
28 | // | <a href="foo.html">my title</a> | |
29 | ||
30 | // I'm using a template because the user may specify the input as | |
31 | // <a href="foo.html">title</a>, in which case we need to get rid of the | |
32 | // <a> because we don't want a link. | |
33 | templateString: '<div class="dijitLinkPane" data-dojo-attach-point="containerNode"></div>', | |
34 | ||
35 | postMixInProperties: function(){ | |
36 | // If user has specified node contents, they become the title | |
37 | // (the link must be plain text) | |
38 | if(this.srcNodeRef){ | |
39 | this.title += this.srcNodeRef.innerHTML; | |
40 | } | |
41 | this.inherited(arguments); | |
42 | }, | |
43 | ||
44 | _fillContent: function(){ | |
45 | // Overrides _Templated._fillContent(). | |
46 | ||
47 | // _Templated._fillContent() relocates srcNodeRef innerHTML to templated container node, | |
48 | // but in our case the srcNodeRef innerHTML is the title, so shouldn't be | |
49 | // copied | |
50 | } | |
51 | }); | |
52 | }); |