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