Changeset 9826
- Timestamp:
- 04/30/2015 07:57:11 PM (10 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-attachments.php
r9819 r9826 99 99 'crunching' => __( 'Crunching…', 'buddypress' ), 100 100 'unique_file_warning' => __( 'Make sure to upload a unique file', 'buddypress' ), 101 'error_uploading' => __( '“%s” has failed to upload.', 'buddypress' ) 101 'error_uploading' => __( '“%s” has failed to upload.', 'buddypress' ), 102 'has_avatar_warning' => __( 'If you'd like to delete the existing profile photo but not upload a new one, please use the delete tab.', 'buddypress' ) 102 103 ) ); 103 104 } -
trunk/src/bp-core/bp-core-avatars.php
r9819 r9826 948 948 } 949 949 950 // Init the feedback message 951 $feedback_message = false; 952 953 if ( ! empty( $bp->template_message ) ) { 954 $feedback_message = $bp->template_message; 955 956 // Remove template message. 957 $bp->template_message = false; 958 $bp->template_message_type = false; 959 @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH ); 960 @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH ); 961 } 962 950 963 if ( empty( $avatar ) ) { 951 964 // Default upload error 952 $message = array(); 953 954 // Intercept the template message and remove it 955 if ( ! empty( $bp->template_message ) ) { 956 // Set the feedback message 957 $message = array( 958 'type' => 'upload_error', 959 'message' => $bp->template_message, 960 ); 961 962 // Remove template message. 963 $bp->template_message = false; 964 $bp->template_message_type = false; 965 @setcookie( 'bp-message', false, time() - 1000, COOKIEPATH ); 966 @setcookie( 'bp-message-type', false, time() - 1000, COOKIEPATH ); 967 } 968 969 bp_attachments_json_response( false, $is_html4, $message ); 965 $message = __( 'Upload failed.', 'buddypress' ); 966 967 // Use the template message if set 968 if ( ! empty( $feedback_message ) ) { 969 $message = $feedback_message; 970 } 971 972 // Upload error reply 973 bp_attachments_json_response( false, $is_html4, array( 974 'type' => 'upload_error', 975 'message' => $message, 976 ) ); 970 977 } 971 978 … … 991 998 'width' => $uploaded_image[0], 992 999 'height' => $uploaded_image[1], 1000 'feedback' => $feedback_message, 993 1001 ) ); 994 1002 } -
trunk/src/bp-core/css/avatar-rtl.css
r9819 r9826 51 51 52 52 #bp-uploader-warning, #bp-webcam-message p.warning { 53 background-color: #ff ec8b;54 border: 1px solid # fc0;53 background-color: #ffd; 54 border: 1px solid #cb2; 55 55 color: #440; 56 56 display: block; … … 282 282 } 283 283 284 .bp-avatar .item { 285 overflow:hidden; 286 } 287 284 288 .bp-avatar .avatar-crop-management.adjust { 285 289 float: right; -
trunk/src/bp-core/css/avatar.css
r9819 r9826 51 51 52 52 #bp-uploader-warning, #bp-webcam-message p.warning { 53 background-color: #ff ec8b;54 border: 1px solid # fc0;53 background-color: #ffd; 54 border: 1px solid #cb2; 55 55 color: #440; 56 56 display: block; … … 282 282 } 283 283 284 .bp-avatar .item { 285 overflow:hidden; 286 } 287 284 288 .bp-avatar .avatar-crop-management.adjust { 285 289 float: left; -
trunk/src/bp-core/js/avatar.js
r9808 r9826 27 27 this.views = new Backbone.Collection(); 28 28 this.jcropapi = {}; 29 this.warning = null; 29 30 30 31 // Set up nav … … 350 351 avatarStatus.inject( '.bp-avatar-status' ); 351 352 } ); 353 }, 354 355 removeWarning: function() { 356 if ( ! _.isNull( this.warning ) ) { 357 this.warning.remove(); 358 } 359 }, 360 361 displayWarning: function( message ) { 362 this.removeWarning(); 363 364 this.warning = new bp.Views.uploaderWarning( { 365 value: message 366 } ); 367 368 this.warning.inject( '.bp-avatar-status' ); 352 369 } 353 370 }; … … 363 380 364 381 initialize: function() { 382 var hasAvatar = _.findWhere( this.collection.models, { id: 'delete' } ); 383 384 // Display a message to inform about the delete tab 385 if ( 1 !== hasAvatar.get( 'hide' ) ) { 386 bp.Avatar.displayWarning( BP_Uploader.strings.has_avatar_warning ); 387 } 388 365 389 _.each( this.collection.models, this.addNavItem, this ); 366 390 this.collection.on( 'change:hide', this.showHideNavItem, this ); … … 406 430 event.preventDefault(); 407 431 432 // First make sure to remove all warnings 433 bp.Avatar.removeWarning(); 434 408 435 var active = $( event.target ).data( 'nav' ); 409 436 … … 488 515 aspectRatio : 1 489 516 } ); 517 518 // Display a warning if the image is smaller than minimum advised 519 if ( false !== this.model.get( 'feedback' ) ) { 520 bp.Avatar.displayWarning( this.model.get( 'feedback' ) ); 521 } 490 522 491 523 this.on( 'ready', this.initCropper );
Note: See TracChangeset
for help on using the changeset viewer.