Nischayn22 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/49471


Change subject: (bug 34498) Customizable headings for feedback responses.
......................................................................

(bug 34498) Customizable headings for feedback responses.

Change-Id: I8f8f24888771b1087b18acf3cd66542b1006140e
---
M ApiFeedbackDashboardResponse.php
M MoodBar.i18n.php
M MoodBar.php
M modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
4 files changed, 22 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MoodBar 
refs/changes/71/49471/1

diff --git a/ApiFeedbackDashboardResponse.php b/ApiFeedbackDashboardResponse.php
index aaeea77..5c70d6f 100644
--- a/ApiFeedbackDashboardResponse.php
+++ b/ApiFeedbackDashboardResponse.php
@@ -54,10 +54,6 @@
 
                        $response = Parser::cleanSigInSig($params['response']);
 
-                       $feedback_link = 
wfMessage('moodbar-feedback-response-title')->inContentLanguage()->
-                               params( SpecialPage::getTitleFor( 
'FeedbackDashboard', $item->getProperty('feedback') )->
-                               getPrefixedText() )->escaped();
-
                        $summary = 
wfMessage('moodbar-feedback-edit-summary')->inContentLanguage()->
                                rawParams( $item->getProperty('feedback'),  
$response)->escaped();
 
@@ -76,7 +72,7 @@
                                        'summary' => $summary,
                                        'notminor' => true,
                                        'section' => 'new',
-                                       'sectiontitle' => $feedback_link
+                                       'sectiontitle' => $params['heading']
                                ), true),
                        true );
 
@@ -141,6 +137,11 @@
                        ),
                        'response' => array(
                                ApiBase::PARAM_REQUIRED => true,
+                               ApiBase::PARAM_TYPE => 'string',
+                       ),
+                       'heading' => array(
+                               ApiBase::PARAM_REQUIRED => true,
+                               ApiBase::PARAM_TYPE => 'string',
                        ),
                        'anonymize' => array(
                                ApiBase::PARAM_TYPE => 'boolean',
@@ -171,6 +172,7 @@
                return array(
                        'feedback' => 'The moodbar feedback unique identifier',
                        'response' => 'The feedback text',
+                       'heading' => 'The heading of the feedback',
                        'anonymize' => 'Whether to hide user information',
                        'editmode' => 'Whether or not the feedback context is 
in edit mode',
                        'useragent' => 'The User-Agent header of the browser',
diff --git a/MoodBar.i18n.php b/MoodBar.i18n.php
index e0400e6..1aef327 100644
--- a/MoodBar.i18n.php
+++ b/MoodBar.i18n.php
@@ -42,6 +42,7 @@
        'moodbar-respond-expanded' => '▼', // Ignore, do not translate. ▼
        'moodbar-respond-text' => 'Respond to this',
        'moodbar-response-add' => 'Add a response',
+       'moodbar-response-heading' => 'Heading (optional)',
        'moodbar-response-desc' => 'Response will reference original comment. 
Signature not required.',
        'moodbar-response-btn' => 'Send response',
        'moodbar-what-content' => 'This feature is designed to help the 
community understand the experience of people editing the site.
diff --git a/MoodBar.php b/MoodBar.php
index 0c528e5..d94f14a 100644
--- a/MoodBar.php
+++ b/MoodBar.php
@@ -218,6 +218,8 @@
                'moodbar-respond-collapsed',
                'moodbar-respond-expanded',
                'moodbar-response-add',
+               'moodbar-response-heading',
+               'moodbar-feedback-response-title',
                'moodbar-response-desc',
                'moodbar-response-btn',
                'moodbar-form-note-dynamic',
diff --git a/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js 
b/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
index 9113af5..bb22145 100644
--- a/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
+++ b/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js
@@ -445,6 +445,10 @@
        function showResponseForm( e ) {
                var termsLink, ula, inlineForm, $item, itemId;
 
+               // Get the feedbackItem
+               $item = $(this).closest( '.fbd-item' );
+               itemId = $item.data( 'mbccontinue' ).split( '|' )[1];
+
                if ( $(this).hasClass( 'responder-expanded' ) ) {
 
                        closeAllResponders();
@@ -465,6 +469,10 @@
                        // Build form
                        inlineForm = $( '<div>' ).attr( 'class', 
'fbd-response-form' )
                                .append(
+                                       $( '<b>' ).text( mw.msg( 
'moodbar-response-heading' ) )
+                               ).append(
+                                       $( '<textarea>' ).attr( { 
'class':'fbd-response-heading', 'name':'fbd-response-heading' } ).val( mw.msg( 
'moodbar-feedback-response-title' , 'Special:FeedbackDashboard/' + itemId ) )
+                               ).append(
                                        $( '<b>' ).text( mw.msg( 
'moodbar-response-add' ) )
                                ).append(
                                        $( '<small>' ).attr( 'class', 
'fbd-text-gray' ).text( ' (' + mw.msg( 'moodbar-response-desc' ) + ') ' )
@@ -501,9 +509,6 @@
                                ).append(
                                        $( '<div>' ).attr( 'style', 'clear: 
both;' )
                                );
-
-                       // Get the feedbackItem
-                       $item = $(this).closest( '.fbd-item' );
 
                        // Close any open responders prior to opening this one.
                        closeAllResponders();
@@ -563,16 +568,15 @@
                                .click (function () {
                                        //toggle preview
                                        $item = $(this).parent().parent();
-                                       $item.find( '.fbd-response-preview, 
.fbd-response-text' ).hide();
+                                       $item.find( '.fbd-response-preview, 
.fbd-response-text, .fbd-response-heading' ).hide();
                                        $item.find( '.fbd-response-submit, 
.fbd-response-preview-back, .ula' ).show();
-                                       var wikitext = $item.find( 
'.fbd-response-text' ).val();
+                                       var wikitext = '<h3>' +  $item.find( 
'.fbd-response-heading' ).val() + '</h3>' + $item.find( '.fbd-response-text' 
).val();
                                        wikitext = wikitext.replace( /~{3,5}/g, 
'' ) + "\n\n~~~~"; // Remove and add signature for
                                        parseWikiText( $item, wikitext );
                                });
 
                                //check for concurrency module.
                                if ( $.concurrency !== undefined ) {
-                                       itemId = $item.data( 'mbccontinue' 
).split( '|' )[1];
                                        //concurrency module is here, attempt 
checkout
                                        $.concurrency.check( {
                                                ccaction: 'checkout',
@@ -728,6 +732,7 @@
 
                $item = $(this).parent().parent();
                fbResponse = $item.find( '.fbd-response-text' ).val();
+               fbHeading = $item.find( '.fbd-response-heading' ).val();
                if ( fbResponse ) {
                        clientData = $.client.profile();
                        item_id = $item.data( 'mbccontinue' ).split( '|' )[1];
@@ -737,6 +742,7 @@
                                system: clientData.platform,
                                token: mw.user.tokens.get( 'editToken' ),
                                response: fbResponse,
+                               heading: fbHeading,
                                feedback: item_id,
                                format: 'json'
                        };

-- 
To view, visit https://gerrit.wikimedia.org/r/49471
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f8f24888771b1087b18acf3cd66542b1006140e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MoodBar
Gerrit-Branch: master
Gerrit-Owner: Nischayn22 <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to