r111595 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111594‎ | r111595 | r111596 >
Date:23:04, 15 February 2012
Author:yonishostak
Status:resolved (Comments)
Tags:
Comment:
AFTv5: activity feature - another sync-up commit
Modified paths:
  • /trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css (modified) (history)
  • /trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php
@@ -87,7 +87,7 @@
8888 'articlefeedbackv5-form-abuse-masked' => 'Flag as abuse',
8989 'articlefeedbackv5-form-delete' => 'Oversight',
9090 'articlefeedbackv5-form-oversight' => 'Request oversight',
91 - 'articlefeedbackv5-form-unoversight' => 'Unmark for oversight',
 91+ 'articlefeedbackv5-form-unoversight' => 'Unrequest oversight',
9292 'articlefeedbackv5-form-undelete' => 'Un-oversight',
9393 'articlefeedbackv5-form-decline' => 'Decline Oversight',
9494 'articlefeedbackv5-form-header' => 'Feedback #$1, at $2',
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css
@@ -465,6 +465,23 @@
466466 /* @embed */
467467 background-image: url(images/bg-close-hov.png);
468468 }
 469+#articlefeedbackv5-noteflyover-helpbutton {
 470+ display: block;
 471+ float: right;
 472+ width: 20px;
 473+ height: 20px;
 474+ margin-top: -18px;
 475+ margin-right: 30px;
 476+ /* @embed */
 477+ background-image: url(images/bg-tooltip-trigger.png);
 478+ background-repeat: no-repeat;
 479+ background-position: left top;
 480+ background-size: 20px 20px;
 481+}
 482+#articlefeedbackv5-noteflyover-helpbutton:hover {
 483+ /* @embed */
 484+ background-image: url(images/bg-tooltip-trigger-hov.png);
 485+}
469486 .articlefeedbackv5-flyover-button {
470487 display: inline-block;
471488 float: left;
@@ -494,4 +511,15 @@
495512 color: #333;
496513 text-decoration: none;
497514 }
498 -
 515+#articlefeedbackv5-activity-log {
 516+ width: 300px;
 517+ height: 360px;
 518+}
 519+.articleFeedbackv5-activity-pane {
 520+ height: 60px;
 521+}
 522+.articleFeedbackv5-activity-log-items {
 523+ height: 280px;
 524+ overflow: auto;
 525+ padding: 10px;
 526+}
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js
@@ -86,22 +86,15 @@
8787 */
8888 $.articleFeedbackv5special.notePanelHtmlTemplate = '\
8989 <div class="articlefeedbackv5-flyover-header">\
90 - <h3 id="articlefeedbackv5-noteflyover-caption">' + mw.msg( 'articlefeedbackv5-noteflyover-hide-caption' ) + '</h3>\
 90+ <h3 id="articlefeedbackv5-noteflyover-caption"></h3>\
9191 <a id="articlefeedbackv5-noteflyover-close" href="#"></a>\
9292 </div>\
9393 <form class="articlefeedbackv5-form-flyover">\
94 - <label id="articlefeedbackv5-noteflyover-label" for="articlefeedbackv5-noteflyover-note">'
95 - + mw.msg( 'articlefeedbackv5-noteflyover-hide-label' ) +
96 - '</label>\
 94+ <label id="articlefeedbackv5-noteflyover-label" for="articlefeedbackv5-noteflyover-note"></label>\
9795 <textarea id="articlefeedbackv5-noteflyover-note" name="articlefeedbackv5-noteflyover-note"></textarea>\
9896 <div class="articlefeedbackv5-flyover-footer">\
99 - <a id="articlefeedbackv5-noteflyover-submit" class="articlefeedbackv5-flyover-button" href="#">'
100 - + mw.msg( 'articlefeedbackv5-noteflyover-hide-submit' ) +
101 - '</a>\
102 - <a class="articlefeedbackv5-flyover-help" id="articlefeedbackv5-noteflyover-help" href="'
103 - + mw.msg( 'articlefeedbackv5-noteflyover-hide-help-link' ) + '">'
104 - + mw.msg( 'articlefeedbackv5-noteflyover-hide-help' ) +
105 - '</a>\
 97+ <a id="articlefeedbackv5-noteflyover-submit" class="articlefeedbackv5-flyover-button" href="#"></a>\
 98+ <a class="articlefeedbackv5-flyover-help" id="articlefeedbackv5-noteflyover-help" href="#"></a>\
10699 </div>\
107100 </form>';
108101
@@ -128,14 +121,11 @@
129122 $.articleFeedbackv5special.logPanelHtml = '\
130123 <div>\
131124 <div class="articlefeedbackv5-flyover-header">\
132 - <h3>Activity log</h3>\
133 - <a>HELP</a>\
134 - <a>CLOSE</a>\
 125+ <h3 id="articlefeedbackv5-noteflyover-caption">Activity log</h3>\
 126+ <a id="articlefeedbackv5-noteflyover-helpbutton" href="#"></a>\
 127+ <a id="articlefeedbackv5-noteflyover-close" href="#"></a>\
135128 </div>\
136 - <div>SOME ACTIVITY HERE\
137 - </div>\
138 - <div class="articlefeedbackv5-activityflyover-viewactivity">FOOTER HERE\
139 - </div>\
 129+ <div id="articlefeedbackv5-activity-log"></div>\
140130 </div>';
141131
142132 // }}}
@@ -336,6 +326,10 @@
337327 }
338328 $l.tipsy( 'show' );
339329 $.articleFeedbackv5special.currentPanelHostId= $l.attr( 'id' );
 330+ // load activity if it is an activity log
 331+ if( -1 != $l.attr( 'id' ).indexOf( 'articleFeedbackv5-activity-link-' ) ) {
 332+ $.articleFeedbackv5special.loadActivityLog( $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ) );
 333+ }
340334 }
341335 } );
342336 }
@@ -416,28 +410,28 @@
417411 var $selector = !id ? $( '#articleFeedbackv5-show-feedback' ) : $( '.articleFeedbackv5-feedback[rel="' + id + '"]' );
418412
419413 // hide/show action
420 - $selector.find( '.articleFeedbackv5-hide-link' ).tipsy( {
 414+ $selector.find( '.articleFeedbackv5-hide-link,.articleFeedbackv5-show-link' ).tipsy( {
421415 title: function() {
422416 var activity = $.articleFeedbackv5special.getActivity( id );
423417 return ( activity.hide || this.text == mw.msg( 'articlefeedbackv5-form-unhide' ) ) ?
424418 $.articleFeedbackv5special.notePanelHtml['show'] : $.articleFeedbackv5special.notePanelHtml['hide'];
425419 }
426420 } );
427 -
 421+
428422 // oversight/unoversight action
429 - $selector.find( '.articleFeedbackv5-oversight-link' ).tipsy( {
 423+ $selector.find( '.articleFeedbackv5-oversight-link,.articleFeedbackv5-unoversight-link' ).tipsy( {
430424 title: function() {
431425 var activity = $.articleFeedbackv5special.getActivity( id );
432426 return ( activity.delete || this.text == mw.msg('articlefeedbackv5-form-undelete') ) ?
433427 $.articleFeedbackv5special.notePanelHtml['unoversight'] : $.articleFeedbackv5special.notePanelHtml['oversight'];
434428 }
435429 } );
436 -
 430+
437431 // request/unrequest oversight action
438 - $selector.find( '.articleFeedbackv5-requestoversight-link' ).tipsy( {
 432+ $selector.find( '.articleFeedbackv5-requestoversight-link,.articleFeedbackv5-unrequestoversight-link' ).tipsy( {
439433 title: function() {
440434 var activity = $.articleFeedbackv5special.getActivity( id );
441 - return ( activity.requestoversight || this.text == mw.msg('articlefeedbackv5-form-unrequestoversight') ) ?
 435+ return ( activity.oversight || this.text == mw.msg('articlefeedbackv5-form-unoversight') ) ?
442436 $.articleFeedbackv5special.notePanelHtml['unrequestoversight'] : $.articleFeedbackv5special.notePanelHtml['requestoversight'];
443437 }
444438 } );
@@ -621,7 +615,7 @@
622616 */
623617 $.articleFeedbackv5special.markHidden = function ( $row ) {
624618 if ( $row.data( 'hidden' ) ) {
625 - $.articleFeedbackv5special.unmarkHidden();
 619+ $.articleFeedbackv5special.unmarkHidden( $row );
626620 }
627621 $row.addClass( 'articleFeedbackv5-feedback-hidden' )
628622 .data( 'hidden', true );
@@ -730,6 +724,7 @@
731725 if ( 'result' in data['articlefeedbackv5-flag-feedback'] ) {
732726 if ( data['articlefeedbackv5-flag-feedback'].result == 'Success' ) {
733727 var $l = $( '#articleFeedbackv5-' + type + '-link-' + id );
 728+ var $post = $l.closest( '.articleFeedbackv5-feedback' );
734729 // Helpful or unhelpful
735730 if ( 'helpful' in data['articlefeedbackv5-flag-feedback'] ) {
736731 $( '#articleFeedbackv5-helpful-votes-' + id ).text( data['articlefeedbackv5-flag-feedback'].helpful );
@@ -764,24 +759,46 @@
765760 if ( data['articlefeedbackv5-flag-feedback']['abuse-hidden'] ) {
766761 $.articleFeedbackv5special.markHidden( $l.closest( '.articleFeedbackv5-feedback' ) );
767762 }
768 - // Hide
 763+ // Hide/show
769764 } else if ( 'hide' == type ) {
770765 if ( dir > 0 ) {
 766+ var $l = $( '#articleFeedbackv5-hide-link-' + id );
 767+ $l.attr( 'id', 'articleFeedbackv5-show-link-' + id );
771768 $l.text( mw.msg( 'articlefeedbackv5-form-unhide' ) );
772769 $.articleFeedbackv5special.markHidden( $l.closest( '.articleFeedbackv5-feedback' ) );
773770 } else {
 771+ var $l = $( '#articleFeedbackv5-show-link-' + id );
 772+ $l.attr( 'id', 'articleFeedbackv5-hide-link-' + id );
774773 $l.text( mw.msg( 'articlefeedbackv5-form-hide' ) );
775 - $.articleFeedbackv5special.unmarkHidden( $l.closest( '.articleFeedbackv5-feedback' ) );
 774+ $.articleFeedbackv5special.unmarkHidden( $l.closest( '.articleFeedbackv5-feedback' ));
776775 }
777 - // Delete
 776+ // oversight/unoversight
778777 } else if ( 'delete' == type ) {
779778 if ( dir > 0 ) {
 779+ var $l = $( '#articleFeedbackv5-oversight-link-' + id );
 780+ $l.attr( 'id', 'articleFeedbackv5-unoversight-link-' + id );
780781 $l.text( mw.msg( 'articlefeedbackv5-form-undelete' ) );
781782 $.articleFeedbackv5special.markDeleted( $l.closest( '.articleFeedbackv5-feedback' ) );
782783 } else {
 784+ var $l = $( '#articleFeedbackv5-unoversight-link-' + id );
 785+ $l.attr( 'id', 'articleFeedbackv5-oversight-link-' + id );
783786 $l.text( mw.msg( 'articlefeedbackv5-form-delete' ) );
784787 $.articleFeedbackv5special.unmarkDeleted( $l.closest( '.articleFeedbackv5-feedback' ) );
785788 }
 789+ // decline oversight
 790+ } else if( 'resetoversight' == type ) {
 791+
 792+ // request/unrequest oversight
 793+ } else if( 'oversight' == type ) {
 794+ if( dir > 0 ) {
 795+ var $l = $( '#articleFeedbackv5-requestoversight-link-' + id );
 796+ $l.attr( 'id', 'articleFeedbackv5-unrequestoversight-link-' + id );
 797+ $l.text( mw.msg( 'articlefeedbackv5-form-unoversight' ) );
 798+ } else {
 799+ var $l = $( '#articleFeedbackv5-unrequestoversight-link-' + id );
 800+ $l.attr( 'id', 'articleFeedbackv5-requestoversight-link-' + id );
 801+ $l.text( mw.msg( 'articlefeedbackv5-form-oversight' ) );
 802+ }
786803 }
787804 // Save activity
788805 if ( !( id in $.articleFeedbackv5special.activity ) ) {
@@ -808,6 +825,34 @@
809826 }
810827
811828 // }}}
 829+ // {{{ loadActivityLog
 830+
 831+ $.articleFeedbackv5special.loadActivityLog = function( id ) {
 832+ console.log('loadActivityLog');
 833+ $.ajax( {
 834+ 'url': $.articleFeedbackv5special.apiUrl,
 835+ 'type': 'GET',
 836+ 'dataType': 'json',
 837+ 'data': {
 838+ 'action': 'query',
 839+ 'list': 'articlefeedbackv5-view-activity',
 840+ 'format': 'json',
 841+ 'affeedbackid': id,
 842+ 'continue': 0
 843+ },
 844+ 'success': function( data ) {
 845+ console.log(data['articlefeedbackv5-view-activity'].activity);
 846+ $( '#articlefeedbackv5-activity-log' ).html( data['articlefeedbackv5-view-activity'].activity );
 847+ },
 848+ 'error': function( data ) {
 849+ console.log('error');
 850+ }
 851+ } );
 852+
 853+ return false;
 854+ }
 855+
 856+ // }}}
812857 // {{{ loadFeedback
813858
814859 /**
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewActivityArticleFeedbackv5.php
@@ -104,7 +104,15 @@
105105 $html .= Html::element( 'div', array('class' => 'articleFeedbackv5-activity-count'),
106106 wfMessage( 'articlefeedbackv5-activity-count',
107107 array( $feedback->af_activity_count ))->text() );
 108+
 109+ // </div> for class="articleFeedbackv5-activity-pane"
 110+ $html .= Html::closeElement( 'div' );
108111
 112+ //<div class="articleFeedbackv5-activity-log-items">
 113+ $html .= Html::openElement( 'div', array(
 114+ 'class' => 'articleFeedbackv5-activity-log-items'
 115+ ) );
 116+
109117 // divs of activity items
110118 foreach($activities as $item) {
111119
@@ -148,9 +156,9 @@
149157 wfMessage( 'articlefeedbackv5-activity-more', array())->text() );
150158 }
151159
152 - // </div> for class="articleFeedbackv5-activity-pane"
 160+ // </div> for class="acticleFeedbackv5-activity-log-items"
153161 $html .= Html::closeElement( 'div' );
154 -
 162+
155163 // finally add our generated html data
156164 $result = $this->getResult();
157165 $result->addValue( $this->getModuleName(), 'limit', $limit );

Comments

#Comment by Catrope (talk | contribs)   19:48, 1 March 2012

console.log() calls were removed in a later revision.

Status & tagging log