o_O NOW YOU CAN DECLINE SUBMISSIONS o_O
jquery.chosen for a slick menu, lots of options, custom rationales, and so much more. YAY!
This commit is contained in:
parent
a80fd80684
commit
826ac1a4e1
27
src/afch.css
27
src/afch.css
@ -8,6 +8,15 @@
|
||||
.centered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#afch-open {
|
||||
font-size: 0.5em;
|
||||
padding-left: 5px;
|
||||
@ -78,6 +87,10 @@
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
select .afch-input {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.afch-textfield {
|
||||
-webkit-appearance: none;
|
||||
border: 1px solid rgb(217, 217, 217);
|
||||
@ -90,6 +103,8 @@
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
vertical-align: middle;
|
||||
width: 30%;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.afch-textfield:focus {
|
||||
@ -97,6 +112,14 @@
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.afch-textarea {
|
||||
height: 150px;
|
||||
width: 50%;
|
||||
margin-top: 5px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.afch-label {
|
||||
font-size: 0.75em;
|
||||
padding: 5px;
|
||||
@ -199,6 +222,10 @@ div.disabled-button {
|
||||
border-color: #FF4136;
|
||||
}
|
||||
|
||||
#declineInputWrapper {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
/* COMMENT */
|
||||
|
||||
.comment {
|
||||
|
@ -731,7 +731,92 @@
|
||||
}
|
||||
|
||||
function showDeclineOptions () {
|
||||
loadView( 'decline', {} );
|
||||
loadView( 'decline', {}, function () {
|
||||
var pristineState = $( '#declineInputWrapper' ).html();
|
||||
|
||||
function updateTextfield( newPrompt, newPlaceholder ) {
|
||||
var wrapper = $( '#textfieldWrapper' );
|
||||
|
||||
// Update label and placeholder
|
||||
wrapper.find( 'label' ).text( newPrompt );
|
||||
wrapper.find( 'input' ).attr( 'placeholder', newPlaceholder );
|
||||
|
||||
// And finally show the textfield
|
||||
wrapper.removeClass( 'hidden' );
|
||||
}
|
||||
|
||||
// Set up jquery.chosen for the decline reason
|
||||
$( '#declineReason' ).chosen( {
|
||||
placeholder_text_single: 'Select a decline reason...',
|
||||
no_results_text: 'Whoops, no reasons matched your search. Type "custom" to add a custom rationale instead.',
|
||||
search_contains: true,
|
||||
inherit_select_classes: true
|
||||
} );
|
||||
|
||||
// And now add the handlers for when a specific decline reason is selected
|
||||
$( '#declineReason' ).change( function () {
|
||||
var reason = $( '#declineReason' ).val(),
|
||||
declineHandlers = {
|
||||
cv: function () {
|
||||
updateTextfield( 'Original URL', 'http://example.com/cake' );
|
||||
},
|
||||
|
||||
dup: function () {
|
||||
updateTextfield( 'Title of duplicate submission (no namespace)', 'Articles for creation/Fudge' );
|
||||
},
|
||||
|
||||
mergeto: function () {
|
||||
updateTextfield( 'Article which submission should be merged into', 'Milkshake' );
|
||||
},
|
||||
|
||||
lang: function () {
|
||||
updateTextfield( 'Language of the submission if known', 'German' );
|
||||
},
|
||||
|
||||
exists: function () {
|
||||
updateTextfield( 'Title of existing article', 'Chocolate chip cookie' );
|
||||
},
|
||||
|
||||
plot: function () {
|
||||
updateTextfield( 'Title of existing related article, if one exists', 'Charlie and the Chocolate Factory' );
|
||||
},
|
||||
|
||||
van: function () {
|
||||
$( '#blankWrapper' ).add( '#csdWrapper' )
|
||||
.removeClass( 'hidden' )
|
||||
.children( 'input' ).prop( 'checked', true );
|
||||
},
|
||||
|
||||
blp: function () {
|
||||
$( '#blankWrapper' )
|
||||
.removeClass( 'hidden' )
|
||||
.children( 'input' ).prop( 'checked', true );
|
||||
},
|
||||
|
||||
// Custom decline rationale
|
||||
reason: function () {
|
||||
$( '#declineTextarea' )
|
||||
.attr( 'placeholder', 'Enter your decline reason here; be clear and supportive. Use wikicode syntax ' +
|
||||
'and link to relevant policies or pages with additional information.' );
|
||||
}
|
||||
};
|
||||
|
||||
// Reset to a pristine state :)
|
||||
$( '#declineInputWrapper' ).html( pristineState );
|
||||
|
||||
// If there are special options to be displayed for this
|
||||
// particular decline reason, load them now
|
||||
if ( declineHandlers[reason] ) {
|
||||
declineHandlers[reason]();
|
||||
}
|
||||
|
||||
// If a reason has been specified, show the textarea, notify
|
||||
// option, and the submit form button
|
||||
$( '#declineTextarea' ).add( '#notifyWrapper' ).add( '#afchSubmitForm' )
|
||||
.toggleClass( 'hidden', !reason );
|
||||
} );
|
||||
} );
|
||||
|
||||
addFormSubmitHandler( handleDecline );
|
||||
}
|
||||
|
||||
@ -799,15 +884,49 @@
|
||||
}
|
||||
|
||||
function handleDecline ( data ) {
|
||||
var text = data.afchText;
|
||||
var text = data.afchText,
|
||||
declineReason = data.declineReason,
|
||||
newParams = {
|
||||
'2': declineReason,
|
||||
decliner: AFCH.consts.user,
|
||||
declinets: '{{subst:REVISIONTIMESTAMP}}'
|
||||
};
|
||||
|
||||
// If this is a custom decline, we include the declineTextarea in the {{AFC submission}} template
|
||||
if ( declineReason === 'reason' ) {
|
||||
newParams['3'] = data.declineTextarea;
|
||||
// But otherwise if addtional text has been entered we just add it as a new comment
|
||||
} else if ( data.declineTextarea ) {
|
||||
afchSubmission.addNewComment( { text: data.declineTextarea } );
|
||||
}
|
||||
|
||||
// If a user has entered something in the declineTextfield (for example, a URL or an
|
||||
// associated page), pass that as the third parameter
|
||||
if ( data.declineTextfield ) {
|
||||
newParams['3'] = data.declineTextfield;
|
||||
}
|
||||
|
||||
// Now update the submission status
|
||||
afchSubmission.setStatus( 'd', newParams );
|
||||
|
||||
afchSubmission.setStatus( 'd', {} ); // FIXME: include decliner params/etc
|
||||
text.updateAfcTemplates( afchSubmission.makeWikicode() );
|
||||
|
||||
afchPage.edit( {
|
||||
contents: text.get(),
|
||||
summary: 'Declining submission'
|
||||
} );
|
||||
|
||||
if ( data.notifyUser ) {
|
||||
afchSubmission.getSubmitter().done( function ( submitter ) {
|
||||
AFCH.actions.notifyUser( submitter, {
|
||||
message: AFCH.msg.get( 'declined-submission', {
|
||||
'$1': AFCH.consts.pagename,
|
||||
'$2': declineReason === 'cv' ? 'yes' : 'no'
|
||||
} ),
|
||||
summary: "Notification: Your [[" + AFCH.consts.pagename + "|Articles for Creation submission]] has been declined"
|
||||
} );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
function handleComment ( data ) {
|
||||
|
@ -35,10 +35,89 @@
|
||||
<!-- decline -->
|
||||
<div id="afchReviewPanel" class="decline">
|
||||
<div id="afchHeader" class="header">Declining...</div>
|
||||
<div id="afchContent" class="content">
|
||||
<div id="afchContent" class="content centered">
|
||||
|
||||
<div id="declineReasonWrapper">
|
||||
<select id="declineReason" class="afch-input text-left">
|
||||
<option value=""></option>
|
||||
<optgroup label="Common">
|
||||
<option value="v">v - Submission is improperly sourced</option>
|
||||
<option value="cv">cv - Submission is a copyright violation</option>
|
||||
<option value="reason">custom - Enter decline reason in the box below</option>
|
||||
</optgroup>
|
||||
<optgroup label="Notability">
|
||||
<option value="neo">neo - Submission is about a neologisim that does not meet notability guidelines</option>
|
||||
<option value="web">web - Submission is about web content does not meet notability guidelines</option>
|
||||
<option value="prof">prof - Submission is about a professor does not meet notability guidelines</option>
|
||||
<option value="athlete">athlete - Submission is about an athlete does not meet notability guidelines</option>
|
||||
<option value="music">music - Submission is about a musician or musical work does not meet notability guidelines</option>
|
||||
<option value="film">film - Submission is about a film does not meet notability guidelines</option>
|
||||
<option value="corp">corp - Submission is about a company or organization does not meet notability guidelines</option>
|
||||
<option value="bio">bio - Submission is about a person does not meet notability guidelines</option>
|
||||
<option value="nn">nn - Submission does not meet general notability guidelines (be more specific if possible)</option>
|
||||
</optgroup>
|
||||
<optgroup label="Invalid submissions">
|
||||
<option value="blank">blank - Submission is blank</option>
|
||||
<option value="lang">lang - Submission is not in English</option>
|
||||
<option value="test">test - Submission appears to be a test edit</option>
|
||||
<option value="redirect">redirect - Submission is a redirect request</option>
|
||||
</optgroup>
|
||||
<optgroup label="BLP & vandalism">
|
||||
<option value="van">van - Submission is vandalism, a negative unsourced BLP, or an attack page</option>
|
||||
<option value="ilc">ilc - Submission is a BLP that does not meet minimum inline citation requirements</option>
|
||||
<option value="blp">blp - BLP contains unsourced, possibly defamatory claims (AGF and wait for sources)</option>
|
||||
</optgroup>
|
||||
<optgroup label="Submission content">
|
||||
<option value="not">not - Submission fails [[Wikipedia:What Wikipedia is not]]</option>
|
||||
<option value="news">news - Submission appears to be a news story of a single event</option>
|
||||
<option value="dict">dict - Submission is a dictionary definition</option>
|
||||
<option value="plot">plot - Submission consists mostly of a plot summary</option>
|
||||
<option value="joke">joke - Submission appears to be a joke or hoax</option>
|
||||
</optgroup>
|
||||
<optgroup label="Prose issues">
|
||||
<option value="essay">essay - Submission reads like an essay</option>
|
||||
<option value="npov">npov - Submission is not written in a formal, neutral encyclopedic tone</option>
|
||||
<option value="adv">adv - Submission reads like an advertisement</option>
|
||||
</optgroup>
|
||||
<optgroup label="Duplicate articles">
|
||||
<option value="exists">exists - Submission is duplicated by another article already in mainspace</option>
|
||||
<option value="dup">dup - Submission is a duplicate of another existing submission</option>
|
||||
</optgroup>
|
||||
<optgroup label="Other">
|
||||
<option value="context">context - Submission provides insufficient context</option>
|
||||
<option value="mergeto">mergeto - Submission should be merged into an existing article</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="declineInputWrapper">
|
||||
<div id="textfieldWrapper" class="afch-option hidden">
|
||||
<label for="declineTextfield" class="afch-label"></label>
|
||||
<input id="declineTextfield" type="text" class="afch-input afch-textfield" placeholder="" />
|
||||
</div>
|
||||
|
||||
<textarea id="declineTextarea" class="afch-input afch-textfield afch-textarea hidden"
|
||||
placeholder="Elaborate on your decline reason here. Provide additional suggestions to the submitter using wikicode syntax and a clear, supportive tone -- you are the voice of Wikipedia!"
|
||||
cols="100" rows="5"></textarea>
|
||||
|
||||
<div id="blankWrapper" class="afch-option hidden">
|
||||
<input type="checkbox" id="blankSubmission" class="afch-input"/>
|
||||
<label for="blankSubmission" class="afch-label">Blank the submission</label>
|
||||
</div>
|
||||
|
||||
<div id="csdWrapper" class="afch-option hidden">
|
||||
<input type="checkbox" id="blankSubmission" class="afch-input"/>
|
||||
<label for="csdSubmission" class="afch-label">Nominate the submission for speedy deletion</label>
|
||||
</div>
|
||||
|
||||
<div id="notifyWrapper" class="afch-option hidden">
|
||||
<input type="checkbox" id="notifyUser" class="afch-input" checked/>
|
||||
<label for="notifyUser" class="afch-label">Notify submitter</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="afchSubmitForm" data-running="Decling submission..." data-done="Submission declined"
|
||||
class="gradient-button decline">Decline submission</div>
|
||||
class="gradient-button button-centered decline hidden">Decline submission</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user