File tree Expand file tree Collapse file tree 9 files changed +177
-0
lines changed Expand file tree Collapse file tree 9 files changed +177
-0
lines changed Original file line number Diff line number Diff line change 1+ import FormMixin from 'open-event-frontend/mixins/form' ;
2+ import ModalBase from 'open-event-frontend/components/modals/modal-base' ;
3+
4+ export default ModalBase . extend ( FormMixin , {
5+ actions : {
6+ submit ( ) {
7+ this . onValid ( ( ) => {
8+ this . sendAction ( 'transferEvent' ) ;
9+ } ) ;
10+ } ,
11+ close ( ) {
12+ if ( ! this . currentInvite . id ) {
13+ this . currentInvite . unloadRecord ( ) ;
14+ }
15+ this . set ( 'isOpen' , false ) ;
16+ }
17+ } ,
18+
19+ getValidationRules ( ) {
20+
21+ return {
22+ inline : true ,
23+ delay : false ,
24+ on : 'blur' ,
25+ fields : {
26+ newOwnerEmail : {
27+ identifier : 'user_email' ,
28+ rules : [
29+ {
30+ type : 'empty' ,
31+ prompt : this . l10n . t ( 'Please enter an email for new organizer' )
32+ } ,
33+ {
34+ type : 'email' ,
35+ prompt : this . l10n . t ( 'Please enter a valid email address for new organizer' )
36+ }
37+ ]
38+ }
39+ }
40+ } ;
41+ }
42+ } ) ;
Original file line number Diff line number Diff line change 1+ import { computed } from '@ember/object' ;
2+ import ModalBase from 'open-event-frontend/components/modals/modal-base' ;
3+
4+ export default ModalBase . extend ( {
5+ isSmall : true ,
6+ confirmEventName : '' ,
7+ isNameDifferent : computed ( 'confirmEventName' , 'eventName' , function ( ) {
8+ return this . eventName ? this . confirmEventName . toLowerCase ( ) !== this . eventName . toLowerCase ( ) : true ;
9+ } )
10+ } ) ;
Original file line number Diff line number Diff line change 1+ import Controller from '@ember/controller' ;
2+
3+ export default Controller . extend ( {
4+
5+ actions : {
6+ openEventTransferModal ( id , name ) {
7+ this . setProperties ( {
8+ 'isEventTransferModalOpen' : true ,
9+ 'confirmEventName' : '' ,
10+ 'eventId' : id ,
11+ 'eventName' : name
12+ } ) ;
13+ } ,
14+ openConfirmEventTransferModal ( ) {
15+ const currentInvite = this . model . roleInvites . createRecord ( { } ) ;
16+ let { roles } = this . model ;
17+ for ( const role of roles ? roles . toArray ( ) : [ ] ) {
18+ if ( role . name === 'owner' ) {
19+ currentInvite . set ( 'role' , role ) ;
20+ }
21+ }
22+ this . setProperties ( {
23+ 'isEventTransferModalOpen' : false ,
24+ 'isConfirmEventTransferModalOpen' : true ,
25+ 'checked' : false ,
26+ currentInvite
27+ } ) ;
28+ } ,
29+ async transferEvent ( ) {
30+ try {
31+ this . set ( 'isLoading' , true ) ;
32+ this . currentInvite . set ( 'roleName' , 'owner' ) ;
33+ await this . currentInvite . save ( ) ;
34+ this . setProperties ( {
35+ 'isConfirmEventTransferModalOpen' : false ,
36+ 'checked' : false
37+ } ) ;
38+ this . notify . success ( this . l10n . t ( 'Owner Role Invite sent successfully.' ) ) ;
39+ } catch ( error ) {
40+ this . notify . error ( this . l10n . t ( error . message ) ) ;
41+ }
42+ this . set ( 'isLoading' , false ) ;
43+ }
44+ }
45+ } ) ;
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ router.map(function() {
7171 this . route ( 'attendee' ) ;
7272 } ) ;
7373 this . route ( 'export' ) ;
74+ this . route ( 'settings' ) ;
7475 this . route ( 'sessions' , function ( ) {
7576 this . route ( 'list' , { path : '/:session_status' } ) ;
7677 this . route ( 'create' ) ;
Original file line number Diff line number Diff line change 1+ import Route from '@ember/routing/route' ;
2+
3+ export default Route . extend ( {
4+ titleToken ( ) {
5+ return this . l10n . t ( 'Settings' ) ;
6+ } ,
7+ async model ( ) {
8+ let eventDetails = this . modelFor ( 'events.view' ) ;
9+ return {
10+ event : await eventDetails ,
11+ roleInvites : await eventDetails . query ( 'roleInvites' , { } ) ,
12+ roles : await this . store . findAll ( 'role' )
13+ } ;
14+ }
15+ } ) ;
Original file line number Diff line number Diff line change 1+ <div class =" header" >
2+ {{ t ' You are transferring this event. This action cannot be undone.' }}
3+ <div class =" muted small text" >
4+ {{ t ' All the event rights will be transferred to another user' }}
5+ </div >
6+ </div >
7+ <div class =" content" >
8+ <form class =" ui {{ if isLoading ' loading' }} form" id =" eventTransferForm" autocomplete =" off" {{ action ' submit' on =' submit' preventDefault =true }} >
9+ <div class =" field" >
10+ <label class =" required" >
11+ {{ t ' User Email' }}
12+ </label >
13+ {{ input type =' text' name =' user_email' value =currentInvite.email }}
14+ </div >
15+ <div class =" field" >
16+ {{ ui-checkbox label = (t ' Please tick the box to agree and press TRANSFER' ) type =" checkbox" checked =checked onChange = (action (mut checked ))}}
17+ </div >
18+ </form >
19+ </div >
20+ <div class =" actions" >
21+ <button type =" button" class =" ui black button" {{ action ' close' }} >
22+ {{ t ' Cancel' }}
23+ </button >
24+ <button type =" submit" form =" eventTransferForm" class =" ui red button {{ if (not checked ) ' disabled' }} " >
25+ {{ t ' Transfer' }}
26+ </button >
27+ </div >
Original file line number Diff line number Diff line change 1+ <div class =" header" >
2+ {{ t ' Are you sure you would like to transfer this event?' }}
3+ <div class =" muted small text" >
4+ {{ t ' Transferring the event to another user will lead to you losing all the owner rights.' }}
5+ </div >
6+ </div >
7+ <div class =" content" >
8+ <div class =" ui {{ if isLoading ' loading' }} form" autocomplete =" off" >
9+ <div class =" field" >
10+ <div class =" label" >
11+ {{ t ' Please enter the event-name to confirm that you want to transfer the event' }}
12+ </div >
13+ {{ input type =' text' name =' confirm_name' value =confirmEventName required =true }}
14+ </div >
15+ </div >
16+ </div >
17+ <div class =" actions" >
18+ <button type =" button" class =" ui black button" {{ action ' close' }} >
19+ {{ t ' Cancel' }}
20+ </button >
21+ <button {{ action openConfirmEventTransferModal }} class =" ui red button {{ if isNameDifferent ' disabled' }} " >
22+ {{ t ' Proceed' }}
23+ </button >
24+ </div >
Original file line number Diff line number Diff line change 8181 {{ #link-to ' events.view.export' class =' item' }}
8282 {{ t ' Export' }}
8383 {{ /link-to }}
84+ {{ #link-to ' events.view.settings' class =' item' }}
85+ {{ t ' Settings' }}
86+ {{ /link-to }}
8487 {{ /tabbed-navigation }}
8588 </div >
8689 </div >
Original file line number Diff line number Diff line change 1+ <div class =" row" >
2+ <p >
3+ {{ t ' Transfer ownership of this event to another user. You\' ll lose all the owner rights once they accept the ownership.' }}
4+ </p >
5+ <button {{ action ' openEventTransferModal' model.event.id model.event.name }} class =' ui red button' >
6+ {{ t ' Transfer Ownership' }}
7+ </button >
8+ </div >
9+ {{ modals/event-transfer-modal isLoading =isLoading isOpen =isEventTransferModalOpen confirmEventName =confirmEventName eventName =eventName openConfirmEventTransferModal = (action ' openConfirmEventTransferModal' ) transferEvent = (action ' transferEvent' model )}}
10+ {{ modals/confirm-event-transfer-modal currentInvite =currentInvite isLoading =isLoading isOpen =isConfirmEventTransferModalOpen checked =checked transferEvent = (action ' transferEvent' )}}
You can’t perform that action at this time.
0 commit comments