Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -1778,6 +1778,36 @@ |
1779 | 1779 | |
1780 | 1780 | '1': { |
1781 | 1781 | |
| 1782 | + // {{{ templates |
| 1783 | + |
| 1784 | + /** |
| 1785 | + * Pull out the markup so it's easy to find |
| 1786 | + */ |
| 1787 | + templates: { |
| 1788 | + |
| 1789 | + /** |
| 1790 | + * The template for the whole block |
| 1791 | + */ |
| 1792 | + block: '\ |
| 1793 | + <p>Eventually this will have a pretty button and some nice messages. For now, though...</p>\ |
| 1794 | + <p><a href="" class="articleFeedbackv5-edit-cta-link">EDIT THIS PAGE</a></p>\ |
| 1795 | + ' |
| 1796 | + |
| 1797 | + }, |
| 1798 | + |
| 1799 | + // }}} |
| 1800 | + // {{{ getTitle |
| 1801 | + |
| 1802 | + /** |
| 1803 | + * Gets the title |
| 1804 | + * |
| 1805 | + * @return string the title |
| 1806 | + */ |
| 1807 | + getTitle: function () { |
| 1808 | + return 'TODO: EDIT CTA'; |
| 1809 | + }, |
| 1810 | + |
| 1811 | + // }}} |
1782 | 1812 | // {{{ build |
1783 | 1813 | |
1784 | 1814 | /** |
— | — | @@ -1787,19 +1817,8 @@ |
1788 | 1818 | */ |
1789 | 1819 | build: function () { |
1790 | 1820 | |
1791 | | - // The overall template |
1792 | | - var block_tpl = '\ |
1793 | | - <div class="articleFeedbackv5-panel">\ |
1794 | | - <div class="articleFeedbackv5-buffer">\ |
1795 | | - <h5 class="articleFeedbackv5-title">TODO: EDIT CTA</h5>\ |
1796 | | - <p>Eventually this will have a pretty button and some nice messages. For now, though...</p>\ |
1797 | | - <p><a href="" class="articleFeedbackv5-edit-cta-link">EDIT THIS PAGE</a></p>\ |
1798 | | - </div>\ |
1799 | | - </div>\ |
1800 | | - '; |
1801 | | - |
1802 | 1821 | // Start up the block to return |
1803 | | - var $block = $( block_tpl ); |
| 1822 | + var $block = $( $.articleFeedbackv5.currentCTA().templates.block ); |
1804 | 1823 | |
1805 | 1824 | // Fill in the link |
1806 | 1825 | $block.find( '.articleFeedbackv5-edit-cta-link' ) |
— | — | @@ -2200,7 +2219,15 @@ |
2201 | 2220 | if ( 'bindEvents' in cta ) { |
2202 | 2221 | cta.bindEvents( $block ); |
2203 | 2222 | } |
2204 | | - $.articleFeedbackv5.$holder.html( $block ); |
| 2223 | + if ( 'getTitle' in cta ) { |
| 2224 | + if ( $.articleFeedbackv5.inDialog ) { |
| 2225 | + $.articleFeedbackv5.$dialog.dialog( 'option', 'title', cta.getTitle() ); |
| 2226 | + } else { |
| 2227 | + $.articleFeedbackv5.find( '.articleFeedbackv5-title' ).html( cta.getTitle() ); |
| 2228 | + } |
| 2229 | + } |
| 2230 | + $.articleFeedbackv5.find( '.articleFeedbackv5-ui' ).empty(); |
| 2231 | + $.articleFeedbackv5.find( '.articleFeedbackv5-ui' ).append( $block ); |
2205 | 2232 | }; |
2206 | 2233 | |
2207 | 2234 | // }}} |
— | — | @@ -2315,6 +2342,7 @@ |
2316 | 2343 | var $title = $( '#ui-dialog-title-articleFeedbackv5-dialog-wrap' ); |
2317 | 2344 | var $titlebar = $title.parent(); |
2318 | 2345 | $title.addClass( 'articleFeedbackv5-title' ); |
| 2346 | + |
2319 | 2347 | // Set up the tooltip |
2320 | 2348 | $titlebar.append( $.articleFeedbackv5.templates.helpToolTip ); |
2321 | 2349 | $titlebar.find( '.articleFeedbackv5-tooltip' ).hide(); |
— | — | @@ -2323,6 +2351,9 @@ |
2324 | 2352 | } ); |
2325 | 2353 | $titlebar.localize( { 'prefix': 'articlefeedbackv5-' } ); |
2326 | 2354 | |
| 2355 | + // Hide the panel |
| 2356 | + $.articleFeedbackv5.$holder.hide(); |
| 2357 | + |
2327 | 2358 | $.articleFeedbackv5.inDialog = true; |
2328 | 2359 | } |
2329 | 2360 | }; |
— | — | @@ -2339,6 +2370,7 @@ |
2340 | 2371 | $inner = $.articleFeedbackv5.$dialog.find( '.articleFeedbackv5-ui' ).detach(); |
2341 | 2372 | $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-buffer' ).append( $inner ); |
2342 | 2373 | $.articleFeedbackv5.$dialog.dialog( 'destroy' ); |
| 2374 | + $.articleFeedbackv5.$holder.show(); |
2343 | 2375 | $.articleFeedbackv5.inDialog = false; |
2344 | 2376 | } |
2345 | 2377 | }; |