@@ -284,7 +284,11 @@ function performLfmRequest(url, parameter, type) {
284284}
285285
286286function displayErrorResponse ( jqXHR ) {
287- notify ( '<div style="max-height:50vh;overflow: scroll;">' + jqXHR . responseText + '</div>' ) ;
287+ var message = JSON . parse ( jqXHR . responseText )
288+ if ( Array . isArray ( message ) ) {
289+ message = message . join ( '<br>' )
290+ }
291+ notify ( '<div style="max-height:50vh;overflow: auto;">' + message + '</div>' ) ;
288292}
289293
290294var refreshFoldersAndItems = function ( data ) {
@@ -540,7 +544,7 @@ function rename(item) {
540544}
541545
542546function trash ( items ) {
543- notify ( lang [ 'message-delete' ] , function ( ) {
547+ confirm ( lang [ 'message-delete' ] , function ( ) {
544548 performLfmRequest ( 'delete' , {
545549 items : items . map ( function ( item ) { return item . name ; } )
546550 } ) . done ( refreshFoldersAndItems )
@@ -794,12 +798,16 @@ function notImp() {
794798 notify ( 'Not yet implemented!' ) ;
795799}
796800
797- function notify ( body , callback ) {
798- $ ( '#notify' ) . find ( '.btn-primary' ) . toggle ( callback !== undefined ) ;
799- $ ( '#notify' ) . find ( '.btn-primary' ) . unbind ( ) . click ( callback ) ;
801+ function notify ( body ) {
800802 $ ( '#notify' ) . modal ( 'show' ) . find ( '.modal-body' ) . html ( body ) ;
801803}
802804
805+ function confirm ( body , callback ) {
806+ $ ( '#confirm' ) . find ( '.btn-primary' ) . toggle ( callback !== undefined ) ;
807+ $ ( '#confirm' ) . find ( '.btn-primary' ) . click ( callback ) ;
808+ $ ( '#confirm' ) . modal ( 'show' ) . find ( '.modal-body' ) . html ( body ) ;
809+ }
810+
803811function dialog ( title , value , callback ) {
804812 $ ( '#dialog' ) . find ( 'input' ) . val ( value ) ;
805813 $ ( '#dialog' ) . on ( 'shown.bs.modal' , function ( ) {
0 commit comments