add code and design for submit functionality

This commit is contained in:
theopolisme 2014-02-22 18:10:50 -06:00
parent baa7686d5a
commit 4d42a6f845
2 changed files with 42 additions and 4 deletions

View File

@ -556,7 +556,7 @@
var submitBtn = $( '#afchSubmitForm' ); var submitBtn = $( '#afchSubmitForm' );
// Empty the content area except for the button... // Empty the content area except for the button...
$( '#afchContent' ).children().not( '#afchSubmitForm' ).remove(); $( '#afchContent' ).contents().not( submitBtn ).remove();
// ...and set up the status log in its place // ...and set up the status log in its place
AFCH.status.init( '#afchContent' ); AFCH.status.init( '#afchContent' );
@ -712,7 +712,35 @@
} }
function handleSubmit ( data ) { function handleSubmit ( data ) {
return; var text = data.afchText,
submitter = $.Deferred(),
submitType = data.submitType;
if ( submitType === 'other' ) {
submitter.resolve( data.submitterName );
} else if ( submitType === 'self' ) {
submitter.resolve( AFCH.consts.user );
} else if ( submitType === 'creator' ) {
afchPage.getCreator().done( function ( user ) {
submitter.resolve( user );
} );
} else {
// Custom selected submitter
submitter.resolve( data.submitType );
}
submitter.done( function ( submitter ) {
afchSubmission.setStatus( '', { u: submitter } );
text.updateAfcTemplates( afchSubmission.makeWikicode() );
afchPage.edit( {
contents: text.get(),
summary: 'Submitting'
} );
} );
} }
function handleG13 ( data ) { function handleG13 ( data ) {

View File

@ -68,10 +68,20 @@
<!-- submit --> <!-- submit -->
<div id="afchReviewPanel" class="submit"> <div id="afchReviewPanel" class="submit">
<div id="afchHeader" class="header">Submitting...</div> <div id="afchHeader" class="header">Submitting...</div>
<div id="afchContent" class="content"> <div id="afchContent" class="content centered">
Submit as&nbsp;
<select id="submitType" class="afch-input">
{{#customSubmitters}}
<option value="{{name}}" {{#selected}}selected{{/selected}}>{{description}}</option>
{{/customSubmitters}}
<option value="creator">Page creator</option>
<option value="self">Yourself</option>
<option value="other">Someone else</option>
</select>
<input id="submitterName" type="text" class="afch-input hidden" placeholder="Username" />
<div id="afchSubmitForm" data-running="Submitting..." data-done="Submitted" <div id="afchSubmitForm" data-running="Submitting..." data-done="Submitted"
class="gradient-button submit">Submit</div> class="gradient-button submit button-centered">Submit</div>
</div> </div>
</div> </div>