r104924 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104923‎ | r104924 | r104925 >
Date:23:56, 1 December 2011
Author:rsterbin
Status:deferred
Tags:
Comment:
Broke out titles for the CTA(s), too:
- modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js:
- Added $.articleFeedbackv5.ctas[1].templates with block template
containing only the interior
- Added $.articleFeedbackv5.ctas[1].getTitle()
- Updated $.articleFeedbackv5.ctas[1].build() to use the template
- Updated $.articleFeedbackv5.showCTA() to replace the title and
interior seperately

Bug fix: Updated openAsModal() and closeAsModal() to hide the whole panel when
in dialog mode; now that only the interior gets moved, the title was still
sitting at the bottom of the page by itself.
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.js
@@ -1778,6 +1778,36 @@
17791779
17801780 '1': {
17811781
 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+ // }}}
17821812 // {{{ build
17831813
17841814 /**
@@ -1787,19 +1817,8 @@
17881818 */
17891819 build: function () {
17901820
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 -
18021821 // Start up the block to return
1803 - var $block = $( block_tpl );
 1822+ var $block = $( $.articleFeedbackv5.currentCTA().templates.block );
18041823
18051824 // Fill in the link
18061825 $block.find( '.articleFeedbackv5-edit-cta-link' )
@@ -2200,7 +2219,15 @@
22012220 if ( 'bindEvents' in cta ) {
22022221 cta.bindEvents( $block );
22032222 }
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 );
22052232 };
22062233
22072234 // }}}
@@ -2315,6 +2342,7 @@
23162343 var $title = $( '#ui-dialog-title-articleFeedbackv5-dialog-wrap' );
23172344 var $titlebar = $title.parent();
23182345 $title.addClass( 'articleFeedbackv5-title' );
 2346+
23192347 // Set up the tooltip
23202348 $titlebar.append( $.articleFeedbackv5.templates.helpToolTip );
23212349 $titlebar.find( '.articleFeedbackv5-tooltip' ).hide();
@@ -2323,6 +2351,9 @@
23242352 } );
23252353 $titlebar.localize( { 'prefix': 'articlefeedbackv5-' } );
23262354
 2355+ // Hide the panel
 2356+ $.articleFeedbackv5.$holder.hide();
 2357+
23272358 $.articleFeedbackv5.inDialog = true;
23282359 }
23292360 };
@@ -2339,6 +2370,7 @@
23402371 $inner = $.articleFeedbackv5.$dialog.find( '.articleFeedbackv5-ui' ).detach();
23412372 $.articleFeedbackv5.$holder.find( '.articleFeedbackv5-buffer' ).append( $inner );
23422373 $.articleFeedbackv5.$dialog.dialog( 'destroy' );
 2374+ $.articleFeedbackv5.$holder.show();
23432375 $.articleFeedbackv5.inDialog = false;
23442376 }
23452377 };

Status & tagging log