File tree Expand file tree Collapse file tree
scss/frontend/learning-area/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export interface FileUploaderProps {
1515 maxSize ?: number ; // in bytes
1616 onFileSelect ?: ( files : ( File | WPMedia | string ) [ ] ) => void ;
1717 onError ?: ( error : string ) => void ;
18+ onFileRemove ?: ( file : File | WPMedia | string ) => void ;
1819 disabled ?: boolean ;
1920 variant ?: FileUploaderVariant ;
2021 value ?: File | WPMedia | string | ( File | WPMedia | string ) [ ] | null ;
@@ -273,6 +274,10 @@ export const fileUploader = (props: FileUploaderProps = defaultProps) => ({
273274 } ,
274275
275276 removeFile ( index ?: number ) {
277+ if ( props . onFileRemove && typeof index === 'number' ) {
278+ props . onFileRemove ( this . selectedFiles [ index ] ) ;
279+ }
280+
276281 if ( this . multiple && typeof index === 'number' ) {
277282 this . selectedFiles = this . selectedFiles . filter ( ( _ , i ) => i !== index ) ;
278283 } else {
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ const endpoints = {
111111 GET_ASSIGNMENT_DETAILS : 'tutor_assignment_details' ,
112112 SAVE_ASSIGNMENT : 'tutor_assignment_save' ,
113113 ASSIGNMENT_SUBMIT : 'tutor_assignment_submit' ,
114+ REMOVE_ATTACHMENT : 'tutor_remove_assignment_attachment' ,
114115
115116 // TAX SETTINGS
116117 GET_TAX_SETTINGS : 'tutor_get_tax_settings' ,
Original file line number Diff line number Diff line change 150150 thead {
151151 th {
152152 @include tutor-typography (' tiny' , ' regular' );
153- width : 20 % ;
153+ width : 14.3 % ;
154154
155155 & :first-of-type {
156156 width : 42.5% ;
157157 }
158+
159+ & :nth-child (4 ) {
160+ width : 18% ;
161+ }
158162 }
159163 }
160164
161165 tbody {
162166 tr {
167+ height : $tutor-spacing-13 ;
163168 & :hover {
164169 td {
165170 .attempt-list-badge {
166171 .tutor-badge {
167172 display : none ;
168173 }
169174 }
170- .attempt_details_button {
175+ button {
171176 display : block ;
172177 }
173178 }
174179 }
175180 }
176181 td {
177- position : relative ;
178182 @include tutor-typography (' small' , ' regular' , ' secondary' );
179183 width : 14.3% ;
180184
181185 & :first-of-type {
182186 color : $tutor-text-brand ;
183187 font-weight : $tutor-font-weight-medium ;
184- width : 42.8% ;
188+ width : 42.5% ;
189+ }
190+
191+ & :nth-child (4 ) {
192+ width : 18% ;
185193 }
186194
187- a .attempt_details_button {
188- position : absolute ;
189- right : 0 ;
190- top : 50% ;
191- transform : translate (-50% , -50% );
195+ button {
192196 display : none ;
193197 }
194198 }
Original file line number Diff line number Diff line change @@ -539,6 +539,7 @@ public function get(): string {
539539 $ button_text = ! empty ( $ this ->uploader_button_text ) ? $ this ->uploader_button_text : __ ( 'Select Files ' , 'tutor ' );
540540 $ on_file_select = $ this ->attributes ['onFileSelect ' ] ?? 'null ' ;
541541 $ on_error = $ this ->attributes ['onError ' ] ?? 'null ' ;
542+ $ on_file_remove = $ this ->attributes ['onFileRemove ' ] ?? 'null ' ;
542543 $ variant = $ this ->variant ;
543544 $ uploader_attributes = $ this ->attributes ;
544545
@@ -558,6 +559,7 @@ class="tutor-file-uploader-wrapper"
558559 accept: '<?php echo esc_attr ( $ accept ); ?> ',
559560 maxSize: <?php echo (int ) $ max_size ; ?> ,
560561 onFileSelect: <?php echo esc_js ( $ on_file_select ); ?> ,
562+ onFileRemove: <?php echo esc_js ( $ on_file_remove ); ?> ,
561563 onError: <?php echo esc_js ( $ on_error ); ?> ,
562564 variant: '<?php echo esc_attr ( $ variant ); ?> ',
563565 value: values.<?php echo esc_attr ( $ this ->name ); ?> ,
You can’t perform that action at this time.
0 commit comments