@@ -48,6 +48,7 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
4848 rowElements : ( HTMLElement | DeputyContributionSurveyRow ) [ ] ;
4949 closingCheckbox : OO . ui . CheckboxInputWidget ;
5050 closingComments : OO . ui . TextInputWidget ;
51+ closingCommentsSign : OO . ui . CheckboxInputWidget ;
5152 closeButton : OO . ui . ButtonWidget ;
5253 reviewButton : OO . ui . ButtonWidget ;
5354 saveButton : OO . ui . ButtonWidget ;
@@ -160,15 +161,24 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
160161 }
161162
162163 if ( this . closed ) {
163- final . splice ( 1 , 0 , msgEval (
164- window . deputy . wikiConfig . cci . collapseTop . get ( ) ,
165- ( ( this . comments ?? '' ) + ' ~~~~' ) . trim ( )
166- ) . plain ( ) ) ;
164+ if ( this . _section . originallyClosed ) {
165+ // TODO: Fix when not broken
166+ } else {
167+ let closingComments = ( this . comments ?? '' ) . trim ( ) ;
168+ if ( this . closingCommentsSign . isSelected ( ) ) {
169+ closingComments += ' ~~~~' ;
170+ }
171+
172+ final . splice ( 1 , 0 , msgEval (
173+ window . deputy . wikiConfig . cci . collapseTop . get ( ) ,
174+ closingComments
175+ ) . plain ( ) ) ;
167176
168- if ( final [ final . length - 1 ] . trim ( ) . length === 0 ) {
169- final . pop ( ) ;
177+ if ( final [ final . length - 1 ] . trim ( ) . length === 0 ) {
178+ final . pop ( ) ;
179+ }
180+ final . push ( window . deputy . wikiConfig . cci . collapseBottom . get ( ) ) ;
170181 }
171- final . push ( window . deputy . wikiConfig . cci . collapseBottom . get ( ) ) ;
172182 }
173183
174184 return final . join ( '\n' ) ;
@@ -456,14 +466,17 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
456466 }
457467
458468 /**
459- * Toggles the closing comments input box. This will disable the input box AND
460- * hide the element from view.
469+ * Toggles the closing comments input box and signature checkbox.
470+ * This will disable the input box AND hide the element from view.
461471 *
462472 * @param show
463473 */
464- toggleClosingComments ( show : boolean ) {
474+ toggleClosingElements ( show : boolean ) {
465475 this . closingComments . setDisabled ( ! show ) ;
466476 this . closingComments . toggle ( show ) ;
477+
478+ this . closingCommentsSign . setDisabled ( ! show ) ;
479+ this . closingCommentsSign . toggle ( show ) ;
467480 }
468481
469482 /**
@@ -477,6 +490,7 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
477490 this . saveButton ?. setDisabled ( disabled ) ;
478491 this . closingCheckbox ?. setDisabled ( disabled ) ;
479492 this . closingComments ?. setDisabled ( disabled ) ;
493+ this . closingCommentsSign ?. setDisabled ( disabled ) ;
480494 this . rows ?. forEach ( ( row ) => row . setDisabled ( disabled ) ) ;
481495
482496 this . disabled = disabled ;
@@ -557,6 +571,10 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
557571 placeholder : mw . msg ( 'deputy.session.section.closeComments' ) ,
558572 disabled : true
559573 } ) ;
574+ this . closingCommentsSign = new OO . ui . CheckboxInputWidget ( {
575+ selected : window . deputy . config . cci . signSectionArchive . get ( ) ,
576+ disabled : true
577+ } ) ;
560578 this . closeButton = new OO . ui . ButtonWidget ( {
561579 label : mw . msg ( 'deputy.session.section.stop' )
562580 } ) ;
@@ -674,6 +692,8 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
674692 this . setDisabled ( false ) ;
675693 } ) ;
676694
695+ // Section closing (archive/ctop) elements
696+
677697 const closingWarning = DeputyMessageWidget ( {
678698 classes : [ 'dp-cs-section-unfinishedWarning' ] ,
679699 type : 'error' ,
@@ -688,23 +708,30 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
688708
689709 const closingCommentsField = new OO . ui . FieldLayout ( this . closingComments , {
690710 align : 'top' ,
691- label : 'Closing comments' ,
711+ label : mw . msg ( 'deputy.session.section.closeComments' ) ,
692712 invisibleLabel : true ,
693- help : mw . msg ( 'deputy.session.section.closeHelp' ) ,
694713 helpInline : true ,
695714 classes : [ 'dp-cs-section-closingCommentsField' ]
696715 } ) ;
697- // Hide by default.
698- closingCommentsField . toggle ( false ) ;
699- closingCommentsField . on ( 'change' , ( v : string ) => {
700- this . comments = v ;
716+
717+ const closingCommentsSignField = new OO . ui . FieldLayout ( this . closingCommentsSign , {
718+ align : 'inline' ,
719+ label : mw . msg ( 'deputy.session.section.closeCommentsSign' )
701720 } ) ;
702721
703- this . toggleClosingComments ( false ) ;
722+ const closingFields = < div
723+ class = "dp-cs-section-closing"
724+ style = { { display : 'none' } }
725+ >
726+ { unwrapWidget ( closingCommentsField ) }
727+ { unwrapWidget ( closingCommentsSignField ) }
728+ </ div > ;
729+
730+ this . toggleClosingElements ( false ) ;
704731 this . closingCheckbox . on ( 'change' , ( v : boolean ) => {
705732 this . closed = v ;
706- closingCommentsField . toggle ( v ) ;
707- this . toggleClosingComments ( v ) ;
733+ closingFields . style . display = v ? '' : 'none' ;
734+ this . toggleClosingElements ( v ) ;
708735
709736 if ( v ) {
710737 updateClosingWarning ( ) ;
@@ -734,15 +761,14 @@ export default class DeputyContributionSurveySection implements DeputyUIElement
734761 < div style = { {
735762 flex : '1' ,
736763 display : 'flex' ,
737- flexDirection : 'column' ,
738- justifyContent : 'center'
764+ flexDirection : 'column'
739765 } } >
740766 { unwrapWidget ( new OO . ui . FieldLayout ( this . closingCheckbox , {
741767 align : 'inline' ,
742768 label : mw . msg ( 'deputy.session.section.close' )
743769 } ) ) }
744770 { unwrapWidget ( closingWarning ) }
745- { unwrapWidget ( closingCommentsField ) }
771+ { closingFields }
746772 </ div >
747773 < div style = { { display : 'flex' , alignItems : 'end' } } >
748774 { unwrapWidget ( this . closeButton ) }
0 commit comments