Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js |
— | — | @@ -13,22 +13,23 @@ |
14 | 14 | * This plugin supports a choice of forms and CTAs. Each form option is called |
15 | 15 | * a "bucket" because users are sorted into buckets and each bucket gets a |
16 | 16 | * different form option. Right now, these buckets are: |
17 | | - * 1. Share Your Feedback - NOT implemented |
| 17 | + * 0. No Feedback |
| 18 | + * Shows nothing at all. |
| 19 | + * 1. Share Your Feedback |
18 | 20 | * Has a yes/no toggle on "Did you find what you were looking for?" and a |
19 | 21 | * text area for comments. |
20 | | - * 2. Make A Suggestion - NOT implemented |
| 22 | + * 2. Make A Suggestion |
21 | 23 | * Modeled after getsatisfaction.com; users can say that their comment is a |
22 | 24 | * suggestion, question, problem, or praise. |
23 | | - * 3. Review This Page - NOT implemented |
| 25 | + * 3. Review This Page |
24 | 26 | * Has a single star rating field and a comment box. |
25 | | - * 4. Help Edit This Page - NOT implemented |
| 27 | + * 4. Help Edit This Page |
26 | 28 | * Has no input fields; just links to the Edit page. |
27 | 29 | * 5. Rate This Page |
28 | 30 | * The existing article feedback tool, except that it can use any of the |
29 | 31 | * CTA types. |
30 | | - * 0. No Feedback |
31 | | - * Shows nothing at all. |
32 | 32 | * The available CTAs are: |
| 33 | + * 0. Just a confirmation notice |
33 | 34 | * 1. Edit this page |
34 | 35 | * Just a big glossy button to send the user to the edit page. |
35 | 36 | * 2. Take a survey - NOT implemented |
— | — | @@ -190,6 +191,13 @@ |
191 | 192 | |
192 | 193 | helpToolTipTrigger: '<div class="articleFeedbackv5-tooltip-trigger-wrap"><a class="articleFeedbackv5-tooltip-trigger"></a></div>', |
193 | 194 | |
| 195 | + ctaTitleConfirm: '\ |
| 196 | + <div class="articleFeedbackv5-confirmation-text">\ |
| 197 | + <span class="articleFeedbackv5-confirmation-thanks"><html:msg key="cta1-thanks" /></span>\ |
| 198 | + <span class="articleFeedbackv5-confirmation-follow-up"><html:msg key="cta1-confirmation-followup" /></span>\ |
| 199 | + </div>\ |
| 200 | + ', |
| 201 | + |
194 | 202 | clear: '<div class="clear"></div>' |
195 | 203 | |
196 | 204 | }; |
— | — | @@ -1535,7 +1543,7 @@ |
1536 | 1544 | * holder |
1537 | 1545 | */ |
1538 | 1546 | afterBuild: function () { |
1539 | | - // Drop the tooltip and trigger |
| 1547 | + // Drop the tooltip trigger |
1540 | 1548 | $.articleFeedbackv5.$holder |
1541 | 1549 | .add( $.articleFeedbackv5.$dialog) |
1542 | 1550 | .find( '.articleFeedbackv5-tooltip-trigger' ).hide(); |
— | — | @@ -1787,6 +1795,40 @@ |
1788 | 1796 | */ |
1789 | 1797 | $.articleFeedbackv5.ctas = { |
1790 | 1798 | |
| 1799 | + // {{{ CTA 0: Just a confirmation message |
| 1800 | + |
| 1801 | + '0': { |
| 1802 | + |
| 1803 | + // {{{ build |
| 1804 | + |
| 1805 | + /** |
| 1806 | + * Builds the CTA |
| 1807 | + * |
| 1808 | + * @return Element the form |
| 1809 | + */ |
| 1810 | + build: function () { |
| 1811 | + return $( '<div></div>' ); |
| 1812 | + }, |
| 1813 | + |
| 1814 | + // }}} |
| 1815 | + // {{{ afterBuild |
| 1816 | + |
| 1817 | + /** |
| 1818 | + * Handles any setup that has to be done once the markup is in the |
| 1819 | + * holder |
| 1820 | + */ |
| 1821 | + afterBuild: function () { |
| 1822 | + // Drop the tooltip trigger |
| 1823 | + $.articleFeedbackv5.$holder |
| 1824 | + .add( $.articleFeedbackv5.$dialog) |
| 1825 | + .find( '.articleFeedbackv5-tooltip-trigger' ).hide(); |
| 1826 | + } |
| 1827 | + |
| 1828 | + // }}} |
| 1829 | + |
| 1830 | + }, |
| 1831 | + |
| 1832 | + // }}} |
1791 | 1833 | // {{{ CTA 1: Encticement to edit |
1792 | 1834 | |
1793 | 1835 | '1': { |
— | — | @@ -1812,36 +1854,11 @@ |
1813 | 1855 | <a href="&action=edit" class="articleFeedbackv5-edit-cta-link"><span class="ui-button-text"><html:msg key="cta1-edit-linktext" /></span></a>\ |
1814 | 1856 | <div class="clear"></div>\ |
1815 | 1857 | </div>\ |
1816 | | - ', |
1817 | | - |
1818 | | - /** |
1819 | | - * The title/confirmation |
1820 | | - */ |
1821 | | - titleConfirm: '\ |
1822 | | - <div class="articleFeedbackv5-confirmation-text">\ |
1823 | | - <span class="articleFeedbackv5-confirmation-thanks"><html:msg key="cta1-thanks" /></span>\ |
1824 | | - <span class="articleFeedbackv5-confirmation-follow-up"><html:msg key="cta1-confirmation-followup" /></span>\ |
1825 | | - </div>\ |
1826 | 1858 | ' |
1827 | 1859 | |
1828 | 1860 | }, |
1829 | 1861 | |
1830 | 1862 | // }}} |
1831 | | - // {{{ getTitle |
1832 | | - |
1833 | | - /** |
1834 | | - * Gets the title |
1835 | | - * |
1836 | | - * @return string the title |
1837 | | - */ |
1838 | | - getTitle: function () { |
1839 | | - |
1840 | | - var $title = $( '<div></div>' ).html( $.articleFeedbackv5.currentCTA().templates.titleConfirm ); |
1841 | | - $title.localize( { 'prefix': 'articlefeedbackv5-' } ); |
1842 | | - return $title.html(); |
1843 | | - }, |
1844 | | - |
1845 | | - // }}} |
1846 | 1863 | // {{{ build |
1847 | 1864 | |
1848 | 1865 | /** |
— | — | @@ -2374,9 +2391,15 @@ |
2375 | 2392 | |
2376 | 2393 | // Set the title in both places |
2377 | 2394 | if ( 'getTitle' in cta ) { |
2378 | | - $.articleFeedbackv5.$dialog.dialog( 'option', 'title', cta.getTitle() ); |
2379 | | - $.articleFeedbackv5.find( '.articleFeedbackv5-title' ).html( cta.getTitle() ); |
| 2395 | + var title = cta.getTitle(); |
| 2396 | + } else { |
| 2397 | + var title = $( '<div></div>' ) |
| 2398 | + .html( $.articleFeedbackv5.templates.ctaTitleConfirm ) |
| 2399 | + .localize( { 'prefix': 'articlefeedbackv5-' } ) |
| 2400 | + .html(); |
2380 | 2401 | } |
| 2402 | + $.articleFeedbackv5.$dialog.dialog( 'option', 'title', title ); |
| 2403 | + $.articleFeedbackv5.find( '.articleFeedbackv5-title' ).html( title ); |
2381 | 2404 | |
2382 | 2405 | // Set the tooltip link |
2383 | 2406 | $.articleFeedbackv5.find( '.articleFeedbackv5-tooltip-link' ) |
— | — | @@ -2391,6 +2414,11 @@ |
2392 | 2415 | $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-title-wrap .articleFeedbackv5-tooltip-trigger' ) |
2393 | 2416 | .before( $close ); |
2394 | 2417 | |
| 2418 | + // Do anything special the CTA requires |
| 2419 | + if ( 'afterBuild' in cta ) { |
| 2420 | + cta.afterBuild(); |
| 2421 | + } |
| 2422 | + |
2395 | 2423 | // Reset the panel dimensions |
2396 | 2424 | $.articleFeedbackv5.setDialogDimensions(); |
2397 | 2425 | |