Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.i18n.php |
— | — | @@ -133,7 +133,65 @@ |
134 | 134 | 'articlefeedbackv5-comment-more' => 'More', |
135 | 135 | 'articlefeedbackv5-comment-less' => 'Less', |
136 | 136 | 'articlefeedbackv5-beta-notice' => 'Beta', |
| 137 | + 'articlefeedbackv5-viewactivity' => 'View activity', |
| 138 | + |
| 139 | + /* Special page flyover panels */ |
| 140 | + /* Hide this post panel */ |
| 141 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 142 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 143 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 144 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 145 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 146 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 147 | + |
| 148 | + /* Show this post panel */ |
| 149 | + 'articlefeedbackv5-noteflyover-show-caption' => 'Show this post', |
| 150 | + 'articlefeedbackv5-noteflyover-show-label' => 'Add a note', |
| 151 | + 'articlefeedbackv5-noteflyover-show-placeholder' => 'Why are you showing this post?', |
| 152 | + 'articlefeedbackv5-noteflyover-show-submit' => 'Show this post', |
| 153 | + 'articlefeedbackv5-noteflyover-show-help' => 'Learn more', |
| 154 | + 'articlefeedbackv5-noteflyover-show-help-link' => '#', |
137 | 155 | |
| 156 | + /* Request oversight panel */ |
| 157 | + 'articlefeedbackv5-noteflyover-requestoversight-caption' => 'Request oversigt', |
| 158 | + 'articlefeedbackv5-noteflyover-requestoversight-label' => 'Add a note', |
| 159 | + 'articlefeedbackv5-noteflyover-requestoversight-placeholder' => 'Why are you requesting oversight?', |
| 160 | + 'articlefeedbackv5-noteflyover-requestoversight-submit' => 'Request oversight', |
| 161 | + 'articlefeedbackv5-noteflyover-requestoversight-help' => 'Learn more', |
| 162 | + 'articlefeedbackv5-noteflyover-requestoversight-help-link' => '#', |
| 163 | + |
| 164 | + /* Un-request oversight panel */ |
| 165 | + 'articlefeedbackv5-noteflyover-unrequestoversight-caption' => 'Cancel oversight request', |
| 166 | + 'articlefeedbackv5-noteflyover-unrequestoversight-label' => 'Add a note', |
| 167 | + 'articlefeedbackv5-noteflyover-unrequestoversight-placeholder' => 'Why are you canceling the oversight request?', |
| 168 | + 'articlefeedbackv5-noteflyover-unrequestoversight-submit' => 'Cancel request', |
| 169 | + 'articlefeedbackv5-noteflyover-unrequestoversight-help' => 'Learn more', |
| 170 | + 'articlefeedbackv5-noteflyover-unrequestoversight-help-link' => '#', |
| 171 | + |
| 172 | + /* Oversight this post panel */ |
| 173 | + 'articlefeedbackv5-noteflyover-ovesight-caption' => 'Oversight this post', |
| 174 | + 'articlefeedbackv5-noteflyover-ovesight-label' => 'Add a note', |
| 175 | + 'articlefeedbackv5-noteflyover-ovesight-placeholder' => 'Why are you oversighting this post?', |
| 176 | + 'articlefeedbackv5-noteflyover-ovesight-submit' => 'Oversight this post', |
| 177 | + 'articlefeedbackv5-noteflyover-ovesight-help' => 'Learn more', |
| 178 | + 'articlefeedbackv5-noteflyover-ovesight-help-link' => '#', |
| 179 | + |
| 180 | + /* Un-oversight this post panel */ |
| 181 | + 'articlefeedbackv5-noteflyover-unoversight-caption' => 'Un-oversight this post', |
| 182 | + 'articlefeedbackv5-noteflyover-unoversight-label' => 'Add a note', |
| 183 | + 'articlefeedbackv5-noteflyover-unoversight-placeholder' => 'Why are you unoversighting this post?', |
| 184 | + 'articlefeedbackv5-noteflyover-unoversight-submit' => 'Un-oversight this post', |
| 185 | + 'articlefeedbackv5-noteflyover-unoversight-help' => 'Learn more', |
| 186 | + 'articlefeedbackv5-noteflyover-unoversight-help-link' => '#', |
| 187 | + |
| 188 | + /* Decline oversight panel */ |
| 189 | + 'articlefeedbackv5-noteflyover-declineoversight-caption' => 'Decline oversight', |
| 190 | + 'articlefeedbackv5-noteflyover-declineoversight-label' => 'Add a note', |
| 191 | + 'articlefeedbackv5-noteflyover-declineoversight-placeholder' => 'Why are you declining oversight?', |
| 192 | + 'articlefeedbackv5-noteflyover-declineoversight-submit' => 'Decline oversight', |
| 193 | + 'articlefeedbackv5-noteflyover-declineoversight-help' => 'Learn more', |
| 194 | + 'articlefeedbackv5-noteflyover-declineoversight-help-link' => '#', |
| 195 | + |
138 | 196 | /* Feedback forms */ |
139 | 197 | /* Option 1 ("Did you find what you were looking for?") */ |
140 | 198 | 'articlefeedbackv5-bucket1-title' => 'Help improve this page', |
— | — | @@ -410,6 +468,64 @@ |
411 | 469 | {{Identical|More}}', |
412 | 470 | 'articlefeedbackv5-comment-less' => 'Previous label (articlefeedbackv5-comment-more) switches to this after being clicked. This is the label for collapsing the expanded comments.', |
413 | 471 | 'articlefeedbackv5-beta-notice' => 'The BETA state notice for article feedback v5', |
| 472 | + 'articlefeedbackv5-viewactivity' => 'View feedback post activity action text', |
| 473 | + |
| 474 | + /* Show this post panel */ |
| 475 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 476 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 477 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 478 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 479 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 480 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 481 | + |
| 482 | + /* Show this post panel */ |
| 483 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 484 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 485 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 486 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 487 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 488 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 489 | + |
| 490 | + /* Request oversight panel */ |
| 491 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 492 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 493 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 494 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 495 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 496 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 497 | + |
| 498 | + /* Un-request oversight panel */ |
| 499 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 500 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 501 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 502 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 503 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 504 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 505 | + |
| 506 | + /* Oversight this post panel */ |
| 507 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 508 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 509 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 510 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 511 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 512 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 513 | + |
| 514 | + /* Un-oversight this post panel */ |
| 515 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 516 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 517 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 518 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 519 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 520 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 521 | + |
| 522 | + /* Decline oversight panel */ |
| 523 | + 'articlefeedbackv5-noteflyover-hide-caption' => 'Hide this post', |
| 524 | + 'articlefeedbackv5-noteflyover-hide-label' => 'Add a note', |
| 525 | + 'articlefeedbackv5-noteflyover-hide-placeholder' => 'Why are you hiding this post?', |
| 526 | + 'articlefeedbackv5-noteflyover-hide-submit' => 'Hide this post', |
| 527 | + 'articlefeedbackv5-noteflyover-hide-help' => 'Learn more', |
| 528 | + 'articlefeedbackv5-noteflyover-hide-help-link' => '#', |
| 529 | + |
414 | 530 | 'articlefeedbackv5-bucket1-title' => 'This is the title of the feedback form for option 1 ("Did you find what you were looking for?" with yes/no buttons, plus a comment box)', |
415 | 531 | 'articlefeedbackv5-bucket1-question-toggle' => 'This is the question that appears before the yes/no buttons in option 1', |
416 | 532 | 'articlefeedbackv5-bucket1-toggle-found-yes' => 'The text for the yes button in option 1. |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/images/tipsy-flyover.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/images/tipsy-flyover.png |
___________________________________________________________________ |
Added: svn:mime-type |
417 | 533 | + application/octet-stream |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.css |
— | — | @@ -395,3 +395,84 @@ |
396 | 396 | clear: both; |
397 | 397 | margin-top: 10px; |
398 | 398 | } |
| 399 | + |
| 400 | +/* flyover panels */ |
| 401 | +.tipsy { |
| 402 | + padding: 5px 11px 5px 5px; |
| 403 | +} |
| 404 | +.tipsy-inner { |
| 405 | + padding: 0; |
| 406 | + border-color: #888; |
| 407 | + max-width: 40em; |
| 408 | + -moz-box-shadow: -2px 2px 1px #999; |
| 409 | + -webkit-box-shadow: -2px 2px 1px #999; |
| 410 | + box-shadow: -2px 2px 1px #999; |
| 411 | +} |
| 412 | +.tipsy-e .tipsy-arrow { |
| 413 | + /* @embed */ |
| 414 | + background-image: url(images/tipsy-flyover.png); |
| 415 | + width: 11px; |
| 416 | + height: 23px; |
| 417 | + margin-top: -11px; |
| 418 | +} |
| 419 | +form.articlefeedbackv5-form-flyover { |
| 420 | + padding: 0 25px 0 0; |
| 421 | +} |
| 422 | +form.articlefeedbackv5-form-flyover label { |
| 423 | + display: block; |
| 424 | + margin: 5px 10px; |
| 425 | +} |
| 426 | +form.articlefeedbackv5-form-flyover textarea { |
| 427 | + margin: 0 0 0 10px; |
| 428 | +} |
| 429 | +.articlefeedbackv5-flyover-header { |
| 430 | + background-color: #d2e5f7; |
| 431 | + padding: 0 10px 3px 10px; |
| 432 | + -moz-border-radius: 3px 3px 0 0; |
| 433 | + -webkit-border-radius: 3px 3px 0 0; |
| 434 | + border-radius: 3px 3px 0 0; |
| 435 | + -khtml-border-radius: 3px 3px 0 0; |
| 436 | +} |
| 437 | +.articlefeedbackv5-flyover-header h3 { |
| 438 | + font-size: 1.125em; |
| 439 | +} |
| 440 | +.articlefeedbackv5-flyover-footer { |
| 441 | + padding: 10px 10px 35px 10px; |
| 442 | + width: 100%; |
| 443 | +} |
| 444 | +.articlefeedbackv5-flyover-help { |
| 445 | + margin: 0 0 0 10px; |
| 446 | + display: inline-block; |
| 447 | + float: right; |
| 448 | + margin-top: 4px; |
| 449 | +} |
| 450 | +.articlefeedbackv5-flyover-button { |
| 451 | + display: inline-block; |
| 452 | + float: left; |
| 453 | + height: 22px; |
| 454 | + line-height: 22px; |
| 455 | + font-size: .9em; |
| 456 | + min-width: 34px; |
| 457 | + padding: 0 8px; |
| 458 | + margin: 0 10px 0 0; |
| 459 | + text-align: center; |
| 460 | + color: #333; |
| 461 | + font-weight: bold; |
| 462 | + /* @embed */ |
| 463 | + background: url(images/bg-button-disable.png) repeat-x; |
| 464 | + -moz-border-radius: 3px; |
| 465 | + -webkit-border-radius: 3px; |
| 466 | + border-radius: 3px; |
| 467 | + -khtml-border-radius: 3px; |
| 468 | + -moz-box-shadow: -2px 2px 1px #999; |
| 469 | + -webkit-box-shadow: -2px 2px 1px #999; |
| 470 | + box-shadow: -2px 2px 1px #999; |
| 471 | +} |
| 472 | +.articlefeedbackv5-flyover-button:hover { |
| 473 | + /* @embed */ |
| 474 | + background: url(images/bg-button-hov.png) repeat-x; |
| 475 | + cursor: pointer; |
| 476 | + color: #333; |
| 477 | + text-decoration: none; |
| 478 | +} |
| 479 | + |
Index: trunk/extensions/ArticleFeedbackv5/modules/jquery.articleFeedbackv5/jquery.articleFeedbackv5.special.js |
— | — | @@ -71,6 +71,72 @@ |
72 | 72 | * @var string |
73 | 73 | */ |
74 | 74 | $.articleFeedbackv5special.activityCookieName = 'activity-'; |
| 75 | + |
| 76 | + /** |
| 77 | + * Currently displayed panel host element id attribute value |
| 78 | + * |
| 79 | + * @var string |
| 80 | + */ |
| 81 | + $.articleFeedbackv5special.currentPanelHostId = undefined; |
| 82 | + |
| 83 | + /** |
| 84 | + * Action note flyover panel HTML template |
| 85 | + * |
| 86 | + * @var string |
| 87 | + */ |
| 88 | + $.articleFeedbackv5special.notePanelHtmlTemplate = '\ |
| 89 | + <div class="articlefeedbackv5-flyover-header">\ |
| 90 | + <h3 id="articlefeedbackv5-noteflyover-caption">' + mw.msg( 'articlefeedbackv5-noteflyover-hide-caption' ) + '</h3>\ |
| 91 | + <a id="articlefeedbackv5-noteflyover-close" href="#"></a>\ |
| 92 | + </div>\ |
| 93 | + <form class="articlefeedbackv5-form-flyover">\ |
| 94 | + <label id="articlefeedbackv5-noteflyover-label" for="articlefeedbackv5-noteflyover-note">' |
| 95 | + + mw.msg( 'articlefeedbackv5-noteflyover-hide-label' ) + |
| 96 | + '</label>\ |
| 97 | + <textarea id="articlefeedbackv5-noteflyover-note" name="articlefeedbackv5-noteflyover-note"></textarea>\ |
| 98 | + <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>\ |
| 106 | + </div>\ |
| 107 | + </form>'; |
| 108 | + |
| 109 | + /** |
| 110 | + * Formatted and localized flyover panel HTMLs. These are initialized once on page setup. |
| 111 | + * |
| 112 | + * @var object |
| 113 | + */ |
| 114 | + $.articleFeedbackv5special.notePanelHtml = { |
| 115 | + 'hide': undefined, |
| 116 | + 'show': undefined, |
| 117 | + 'requestoversight': undefined, |
| 118 | + 'unrequestoversight': undefined, |
| 119 | + 'oversight': undefined, |
| 120 | + 'declineoversight': undefined, |
| 121 | + 'unoversight': undefined |
| 122 | + }; |
| 123 | + |
| 124 | + /** |
| 125 | + * Activity log flyover panel HTML |
| 126 | + * |
| 127 | + * @var string |
| 128 | + */ |
| 129 | + $.articleFeedbackv5special.logPanelHtml = '\ |
| 130 | + <div>\ |
| 131 | + <div class="articlefeedbackv5-flyover-header">\ |
| 132 | + <h3></h3>\ |
| 133 | + <a></a>\ |
| 134 | + <a></a>\ |
| 135 | + </div>\ |
| 136 | + <div>\ |
| 137 | + </div>\ |
| 138 | + <div class="articlefeedbackv5-activityflyover-viewactivity">\ |
| 139 | + </div>\ |
| 140 | + </div>'; |
75 | 141 | |
76 | 142 | // }}} |
77 | 143 | // {{{ Init methods |
— | — | @@ -102,11 +168,50 @@ |
103 | 169 | $.articleFeedbackv5special.activityCookieName += $.articleFeedbackv5special.page; |
104 | 170 | $.articleFeedbackv5special.loadActivity(); |
105 | 171 | |
| 172 | + // initialize flyover panels for actions |
| 173 | + $.articleFeedbackv5special.initFlyoverPanels(); |
| 174 | + |
106 | 175 | // Initial load |
107 | 176 | $.articleFeedbackv5special.loadFeedback( true ); |
108 | 177 | }; |
109 | 178 | |
110 | 179 | // }}} |
| 180 | + // {{{ initFlyoverPanels |
| 181 | + |
| 182 | + /** |
| 183 | + * Initialize the action note flyover panels |
| 184 | + */ |
| 185 | + $.articleFeedbackv5special.initFlyoverPanels = function() { |
| 186 | + // set tipsy defaults, once |
| 187 | + $.fn.tipsy.defaults = { |
| 188 | + delayIn: 0, // delay before showing tooltip (ms) |
| 189 | + delayOut: 0, // delay before hiding tooltip (ms) |
| 190 | + fade: false, // fade tooltips in/out? |
| 191 | + fallback: '', // fallback text to use when no tooltip text |
| 192 | + gravity: 'e', // gravity |
| 193 | + html: true, // is tooltip content HTML? |
| 194 | + live: false, // use live event support? |
| 195 | + offset: 10, // pixel offset of tooltip from element |
| 196 | + opacity: 1.0, // opacity of tooltip |
| 197 | + title: 'title', // attribute/callback containing tooltip text |
| 198 | + trigger: 'manual' // how tooltip is triggered - hover | focus | manual |
| 199 | + }; |
| 200 | + |
| 201 | + // i18n, create specific panels from template |
| 202 | + var container = $( '<div></div>' ); |
| 203 | + container.html( $.articleFeedbackv5special.notePanelHtmlTemplate ); |
| 204 | + for( var action in $.articleFeedbackv5special.notePanelHtml ) { |
| 205 | + container.find( '#articlefeedbackv5-noteflyover-caption' ).html( mw.msg( 'articlefeedbackv5-noteflyover-' + action + '-caption' ) ); |
| 206 | + container.find( '#articlefeedbackv5-noteflyover-label' ).html( mw.msg( 'articlefeedbackv5-noteflyover-' + action + '-label' ) ); |
| 207 | + container.find( '#articlefeedbackv5-noteflyover-submit' ).html( mw.msg( 'articlefeedbackv5-noteflyover-' + action + '-submit' ) ); |
| 208 | + container.find( '#articlefeedbackv5-noteflyover-submit' ).attr( 'rel', action ); |
| 209 | + container.find( '#articlefeedbackv5-noteflyover-help' ).html( mw.msg( 'articlefeedbackv5-noteflyover-' + action + '-help' ) ); |
| 210 | + container.find( '#articlefeedbackv5-noteflyover-help' ).attr( 'href', mw.msg( 'articlefeedbackv5-noteflyover-' + action + '-help-link' ) ); |
| 211 | + $.articleFeedbackv5special.notePanelHtml[action] = container.html(); |
| 212 | + } |
| 213 | + } |
| 214 | + |
| 215 | + // }}} |
111 | 216 | // {{{ setBinds |
112 | 217 | |
113 | 218 | /** |
— | — | @@ -211,23 +316,56 @@ |
212 | 317 | } |
213 | 318 | } ); |
214 | 319 | |
215 | | - // Hide/Show this post |
216 | | - $( '.articleFeedbackv5-hide-link' ).live( 'click', function( e ) { |
| 320 | + // Bind tipsies |
| 321 | + for( var action in $.articleFeedbackv5special.notePanelHtml) { |
| 322 | + $( '.articleFeedbackv5-' + action + '-link' ).live( 'click', function( e ) { |
| 323 | + e.preventDefault(); |
| 324 | + var $l = $( e.target ); |
| 325 | + // are we hiding the current tipsy? |
| 326 | + if( $l.attr( 'id' ) == $.articleFeedbackv5special.currentPanelHostId ) { |
| 327 | + $l.tipsy( 'hide' ); |
| 328 | + $.articleFeedbackv5special.currentPanelHostId = undefined; |
| 329 | + } else { |
| 330 | + // no, we're displaying another one |
| 331 | + if( undefined != $.articleFeedbackv5special.currentPanelHostId ) { |
| 332 | + $( '#' + $.articleFeedbackv5special.currentPanelHostId ).tipsy( 'hide' ); |
| 333 | + } |
| 334 | + $l.tipsy( 'show' ); |
| 335 | + $.articleFeedbackv5special.currentPanelHostId= $l.attr( 'id' ); |
| 336 | + } |
| 337 | + } ); |
| 338 | + } |
| 339 | + |
| 340 | + // Bind submit actions on flyover panels |
| 341 | + $( '#articlefeedbackv5-noteflyover-submit' ).live( 'click', function( e ) { |
217 | 342 | e.preventDefault(); |
218 | | - var $l = $( e.target ); |
| 343 | + var $l = $( '#' + $.articleFeedbackv5special.currentPanelHostId ); |
| 344 | + var action = $( e.target ).attr( 'rel' ); |
219 | 345 | var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
220 | 346 | var activity = $.articleFeedbackv5special.getActivity( id ); |
221 | | - if ( activity.hide |
222 | | - || $( e.target ).text() == mw.msg('articlefeedbackv5-form-unhide') |
223 | | - ) { |
224 | | - $.articleFeedbackv5special.flagFeedback( id, 'hide', -1 ); |
225 | | - } else { |
226 | | - $.articleFeedbackv5special.flagFeedback( id, 'hide', 1 ); |
| 347 | + var note = $( '#articlefeedbackv5-noteflyover-note' ).attr( 'value' ); |
| 348 | + switch( action ) { |
| 349 | + case 'hide': case 'show': |
| 350 | + if ( activity.hide |
| 351 | + || $( e.target ).text() == mw.msg('articlefeedbackv5-form-unhide') |
| 352 | + ) { |
| 353 | + $.articleFeedbackv5special.flagFeedback( id, 'hide', -1, note ); |
| 354 | + } else { |
| 355 | + $.articleFeedbackv5special.flagFeedback( id, 'hide', 1, note ); |
| 356 | + } |
| 357 | + break; |
| 358 | + case 'oversight': case 'unoversight': case 'declineoversight': |
| 359 | + break; |
| 360 | + case 'requestoversight': case 'unrequestoversight': |
| 361 | + break; |
227 | 362 | } |
| 363 | + // hide tipsy |
| 364 | + $l.tipsy( 'hide' ); |
| 365 | + $.articleFeedbackv5special.currentPanelHostId = undefined; |
228 | 366 | } ); |
229 | 367 | |
230 | 368 | // Delete/Undelete this post |
231 | | - $( '.articleFeedbackv5-delete-link' ).live( 'click', function( e ) { |
| 369 | + /*$( '.articleFeedbackv5-delete-link' ).live( 'click', function( e ) { |
232 | 370 | e.preventDefault(); |
233 | 371 | var $l = $( e.target ); |
234 | 372 | var id = $l.closest( '.articleFeedbackv5-feedback' ).attr( 'rel' ); |
— | — | @@ -239,12 +377,42 @@ |
240 | 378 | } else { |
241 | 379 | $.articleFeedbackv5special.flagFeedback( id, 'delete', 1 ); |
242 | 380 | } |
243 | | - } ); |
| 381 | + } );*/ |
244 | 382 | } |
245 | 383 | |
246 | 384 | // }}} |
| 385 | + // {{{ bindPanels |
| 386 | + |
| 387 | + /** |
| 388 | + * Bind panels to controls - that cannot be 'live' events due to jQuery.typsy |
| 389 | + * limitations. This function should be invoked after feedback posts are loaded, |
| 390 | + * without parameters. The function should be invoked with the id parameter set |
| 391 | + * after an action is executed and its link is replaced with reverse action. |
| 392 | + * |
| 393 | + * @param id post id to bind panels for. If none is supplied, bind entire list. |
| 394 | + */ |
| 395 | + $.articleFeedbackv5special.bindPanels = function( id ) { |
| 396 | + // single post or entire list? |
| 397 | + var $selector = !id ? $( '#articleFeedbackv5-show-feedback' ) : $( '.articleFeedbackv5-feedback[rel="' + id + '"]' ); |
247 | 398 | |
| 399 | + // hide action |
| 400 | + $selector.find( '.articleFeedbackv5-hide-link' ).tipsy( { |
| 401 | + title: function() { |
| 402 | + var activity = $.articleFeedbackv5special.getActivity( id ); |
| 403 | + var temp = ( activity.hide || this.text == mw.msg( 'articlefeedbackv5-form-unhide' ) ) ? |
| 404 | + $.articleFeedbackv5special.notePanelHtml['show'] : $.articleFeedbackv5special.notePanelHtml['hide']; |
| 405 | + return temp; |
| 406 | + } |
| 407 | + } ); |
| 408 | + |
| 409 | + // request oversight action |
| 410 | + |
| 411 | + // oversight action |
| 412 | + } |
| 413 | + |
248 | 414 | // }}} |
| 415 | + |
| 416 | + // }}} |
249 | 417 | // {{{ Utility methods |
250 | 418 | |
251 | 419 | // {{{ toggleComment |
— | — | @@ -463,7 +631,7 @@ |
464 | 632 | }; |
465 | 633 | |
466 | 634 | // }}} |
467 | | - |
| 635 | + |
468 | 636 | // }}} |
469 | 637 | // {{{ Process methods |
470 | 638 | |
— | — | @@ -475,12 +643,16 @@ |
476 | 644 | * @param id int the feedback id |
477 | 645 | * @param type string the type of mark (valid values: hide, abuse, delete, helpful, unhelpful) |
478 | 646 | * @param dir int the direction of the mark (-1 = tick down; 1 = tick up) |
| 647 | + * @param note string note for action (default empty) |
479 | 648 | */ |
480 | | - $.articleFeedbackv5special.flagFeedback = function ( id, type, dir ) { |
| 649 | + $.articleFeedbackv5special.flagFeedback = function ( id, type, dir, note ) { |
| 650 | + // default parameters |
| 651 | + note = typeof note !== undefined ? note : ''; |
| 652 | + |
481 | 653 | if( $.articleFeedbackv5special.listControls.disabled ) { |
482 | 654 | return false; |
483 | 655 | } |
484 | | - |
| 656 | + |
485 | 657 | // This was causing problems with eg 'clicking helpful when the cookie |
486 | 658 | // already says unhelpful', which is a case where two ajax requests |
487 | 659 | // is perfectly legitimate. |
— | — | @@ -501,6 +673,7 @@ |
502 | 674 | 'feedbackid': id, |
503 | 675 | 'flagtype' : type, |
504 | 676 | 'direction' : dir > 0 ? 'increase' : 'decrease', |
| 677 | + 'note' : note, |
505 | 678 | 'format' : 'json', |
506 | 679 | 'action' : 'articlefeedbackv5-flag-feedback' |
507 | 680 | }, |
— | — | @@ -569,6 +742,7 @@ |
570 | 743 | } |
571 | 744 | $.articleFeedbackv5special.activity[id][type] = dir > 0 ? true : false; |
572 | 745 | $.articleFeedbackv5special.storeActivity(); |
| 746 | + $.articleFeedbackv5special.bindPanels( id ); |
573 | 747 | } else if ( data['articlefeedbackv5-flag-feedback'].result == 'Error' ) { |
574 | 748 | mw.log( mw.msg( data['articlefeedbackv5-flag-feedback'].reason ) ); |
575 | 749 | } |
— | — | @@ -657,6 +831,7 @@ |
658 | 832 | } else { |
659 | 833 | $( '#articleFeedbackv5-show-more').hide(); |
660 | 834 | } |
| 835 | + $.articleFeedbackv5special.bindPanels(); |
661 | 836 | } else { |
662 | 837 | $( '#articleFeedbackv5-show-feedback' ).text( mw.msg( 'articlefeedbackv5-error-loading-feedback' ) ); |
663 | 838 | } |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -434,7 +434,7 @@ |
435 | 435 | ), wfMessage( "articlefeedbackv5-form-" . $msg )->text() ) ); |
436 | 436 | } |
437 | 437 | |
438 | | -/* |
| 438 | + |
439 | 439 | $link = null; |
440 | 440 | if ( $record[0]->af_needs_oversight ) { |
441 | 441 | if ( $can_delete ) { |
— | — | @@ -453,7 +453,12 @@ |
454 | 454 | 'class' => "articleFeedbackv5-$link-link" |
455 | 455 | ), wfMessage( "articlefeedbackv5-form-$link", $record[0]->af_is_deleted )->text() ) ); |
456 | 456 | } |
457 | | -*/ |
| 457 | + |
| 458 | + // view activity link |
| 459 | + $tools .= Html::rawElement( 'li', array(), Html::element( 'a', array( |
| 460 | + 'id' => "articleFeedbackv5-activity-link-$id", |
| 461 | + 'class' => "articleFeedbackv5-activity-link" |
| 462 | + ), wfMessage( "articlefeedbackv5-viewactivity" )->text() ) ); |
458 | 463 | |
459 | 464 | $tools .= Html::closeElement( 'ul' ) |
460 | 465 | . Html::closeElement( 'div' ); |
Index: trunk/extensions/ArticleFeedbackv5/ArticleFeedbackv5.hooks.php |
— | — | @@ -178,10 +178,60 @@ |
179 | 179 | 'articlefeedbackv5-deleted', |
180 | 180 | 'articlefeedbackv5-comment-more', |
181 | 181 | 'articlefeedbackv5-comment-less', |
182 | | - 'articlefeedbackv5-error-loading-feedback' |
| 182 | + 'articlefeedbackv5-error-loading-feedback', |
| 183 | + |
| 184 | + 'articlefeedbackv5-noteflyover-hide-caption', |
| 185 | + 'articlefeedbackv5-noteflyover-hide-label', |
| 186 | + 'articlefeedbackv5-noteflyover-hide-placeholder', |
| 187 | + 'articlefeedbackv5-noteflyover-hide-submit', |
| 188 | + 'articlefeedbackv5-noteflyover-hide-help', |
| 189 | + 'articlefeedbackv5-noteflyover-hide-help-link', |
| 190 | + |
| 191 | + 'articlefeedbackv5-noteflyover-show-caption', |
| 192 | + 'articlefeedbackv5-noteflyover-show-label', |
| 193 | + 'articlefeedbackv5-noteflyover-show-placeholder', |
| 194 | + 'articlefeedbackv5-noteflyover-show-submit', |
| 195 | + 'articlefeedbackv5-noteflyover-show-help', |
| 196 | + 'articlefeedbackv5-noteflyover-show-help-link', |
| 197 | + |
| 198 | + 'articlefeedbackv5-noteflyover-requestoversight-caption', |
| 199 | + 'articlefeedbackv5-noteflyover-requestoversight-label', |
| 200 | + 'articlefeedbackv5-noteflyover-requestoversight-placeholder', |
| 201 | + 'articlefeedbackv5-noteflyover-requestoversight-submit', |
| 202 | + 'articlefeedbackv5-noteflyover-requestoversight-help', |
| 203 | + 'articlefeedbackv5-noteflyover-requestoversight-help-link', |
| 204 | + |
| 205 | + 'articlefeedbackv5-noteflyover-unrequestoversight-caption', |
| 206 | + 'articlefeedbackv5-noteflyover-unrequestoversight-label', |
| 207 | + 'articlefeedbackv5-noteflyover-unrequestoversight-placeholder', |
| 208 | + 'articlefeedbackv5-noteflyover-unrequestoversight-submit', |
| 209 | + 'articlefeedbackv5-noteflyover-unrequestoversight-help', |
| 210 | + 'articlefeedbackv5-noteflyover-unrequestoversight-help-link', |
| 211 | + |
| 212 | + 'articlefeedbackv5-noteflyover-oversight-caption', |
| 213 | + 'articlefeedbackv5-noteflyover-oversight-label', |
| 214 | + 'articlefeedbackv5-noteflyover-oversight-placeholder', |
| 215 | + 'articlefeedbackv5-noteflyover-oversight-submit', |
| 216 | + 'articlefeedbackv5-noteflyover-oversight-help', |
| 217 | + 'articlefeedbackv5-noteflyover-oversight-help-link', |
| 218 | + |
| 219 | + 'articlefeedbackv5-noteflyover-unoversight-caption', |
| 220 | + 'articlefeedbackv5-noteflyover-unoversight-label', |
| 221 | + 'articlefeedbackv5-noteflyover-unoversight-placeholder', |
| 222 | + 'articlefeedbackv5-noteflyover-unoversight-submit', |
| 223 | + 'articlefeedbackv5-noteflyover-unoversight-help', |
| 224 | + 'articlefeedbackv5-noteflyover-unoversight-help-link', |
| 225 | + |
| 226 | + 'articlefeedbackv5-noteflyover-declineoversight-caption', |
| 227 | + 'articlefeedbackv5-noteflyover-declineoversight-label', |
| 228 | + 'articlefeedbackv5-noteflyover-declineoversight-placeholder', |
| 229 | + 'articlefeedbackv5-noteflyover-declineoversight-submit', |
| 230 | + 'articlefeedbackv5-noteflyover-declineoversight-help', |
| 231 | + 'articlefeedbackv5-noteflyover-declineoversight-help-link' |
183 | 232 | ), |
184 | 233 | 'dependencies' => array( |
185 | 234 | 'mediawiki.util', |
| 235 | + 'jquery.tipsy' |
186 | 236 | ), |
187 | 237 | ), |
188 | 238 | // TODO: Move jquery.elastic into core resources |