@@ -36,6 +36,7 @@ import Analytics from '../mixins/analytics';
3636 * @class preprint-form-authors
3737 */
3838export default CpPanelBodyComponent . extend ( Analytics , {
39+ i18n : Ember . inject . service ( ) ,
3940 valid : Ember . computed . alias ( 'newContributorId' ) ,
4041 authorModification : false ,
4142 currentPage : 1 ,
@@ -94,9 +95,10 @@ export default CpPanelBodyComponent.extend(Analytics, {
9495 this . attrs . addContributor ( user . id , 'write' , true , this . get ( 'sendEmail' ) , undefined , undefined , true ) . then ( ( res ) => {
9596 this . toggleAuthorModification ( ) ;
9697 this . get ( 'contributors' ) . pushObject ( res ) ;
98+ this . get ( 'toast' ) . success ( this . get ( 'i18n' ) . t ( 'submit.preprint_author_added' ) ) ;
9799 this . highlightSuccessOrFailure ( res . id , this , 'success' ) ;
98100 } , ( ) => {
99- this . get ( 'toast' ) . error ( 'Could not add contributor.' ) ;
101+ this . get ( 'toast' ) . error ( this . get ( 'i18n' ) . t ( 'submit.error_adding_author' ) ) ;
100102 this . highlightSuccessOrFailure ( user . id , this , 'error' ) ;
101103 user . rollbackAttributes ( ) ;
102104 } ) ;
@@ -142,12 +144,13 @@ export default CpPanelBodyComponent.extend(Analytics, {
142144 this . set ( 'addState' , 'searchView' ) ;
143145 this . set ( 'fullName' , '' ) ;
144146 this . set ( 'email' , '' ) ;
147+ this . get ( 'toast' ) . success ( this . get ( 'i18n' ) . t ( 'submit.preprint_unregistered_author_added' ) ) ;
145148 this . highlightSuccessOrFailure ( contributor . id , this , 'success' ) ;
146149 } , ( error ) => {
147150 if ( error . errors [ 0 ] && error . errors [ 0 ] . detail && error . errors [ 0 ] . detail . indexOf ( 'is already a contributor' ) > - 1 ) {
148151 this . get ( 'toast' ) . error ( error . errors [ 0 ] . detail ) ;
149152 } else {
150- this . get ( 'toast' ) . error ( 'Could not add unregistered contributor.' ) ;
153+ this . get ( 'toast' ) . error ( this . get ( 'i18n' ) . t ( 'submit.error_adding_unregistered_author' ) ) ;
151154 }
152155 this . highlightSuccessOrFailure ( 'add-unregistered-contributor-form' , this , 'error' ) ;
153156 } ) ;
@@ -178,8 +181,9 @@ export default CpPanelBodyComponent.extend(Analytics, {
178181 this . toggleAuthorModification ( ) ;
179182 this . removedSelfAsAdmin ( contrib , contrib . get ( 'permission' ) ) ;
180183 this . get ( 'contributors' ) . removeObject ( contrib ) ;
184+ this . get ( 'toast' ) . success ( this . get ( 'i18n' ) . t ( 'submit.preprint_author_removed' ) ) ;
181185 } , ( ) => {
182- this . get ( 'toast' ) . error ( 'Could not remove author' ) ;
186+ this . get ( 'toast' ) . error ( this . get ( 'i18n' ) . t ( 'submit.error_adding_author' ) ) ;
183187 this . highlightSuccessOrFailure ( contrib . id , this , 'error' ) ;
184188 contrib . rollbackAttributes ( ) ;
185189 } ) ;
0 commit comments