Skip to:
Content

BuddyPress.org

Changeset 10049


Ignore:
Timestamp:
08/14/2015 08:37:22 AM (9 years ago)
Author:
imath
Message:

BuddyPress Uploader: avoid duplicate ids in warnings

The BuddyPress Uploader is displaying some warnings to inform the user when something went not great while trying to upload a file (eg: file is too big).
In case of multi uploads, we need to make sure these warnings are not using the same id, and to remove them all when a new upload starts.

Fixes #6590

Location:
trunk/src/bp-core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/css/avatar-rtl.css

    r9826 r10049  
    5050}
    5151
    52 #bp-uploader-warning, #bp-webcam-message p.warning {
     52#buddypress p.warning {
    5353    background-color: #ffd;
    5454    border: 1px solid #cb2;
  • trunk/src/bp-core/css/avatar.css

    r9826 r10049  
    5050}
    5151
    52 #bp-uploader-warning, #bp-webcam-message p.warning {
     52#buddypress p.warning {
    5353    background-color: #ffd;
    5454    border: 1px solid #cb2;
  • trunk/src/bp-core/js/bp-plupload.js

    r10033 r10049  
    304304
    305305        initialize: function() {
    306             this.warning = null;
    307             this.model = new Backbone.Model( this.defaults );
     306            this.warnings = [];
     307            this.model    = new Backbone.Model( this.defaults );
    308308            this.on( 'ready', this.initUploader );
    309309        },
     
    320320            }
    321321
    322             this.warning = new bp.Views.uploaderWarning( {
     322            var warning = new bp.Views.uploaderWarning( {
    323323                value: message
    324324            } ).render();
    325325
    326             this.$el.after( this.warning.el );
     326            this.warnings.push( warning );
     327
     328            this.$el.after( warning.el );
    327329        },
    328330
    329331        resetWarning: function() {
    330             if ( _.isNull( this.warning ) ) {
     332            if ( 0 === this.warnings.length ) {
    331333                return;
    332334            }
    333335
    334             this.warning.remove();
    335             this.warning = null;
     336            // Remove all warning views
     337            _.each( this.warnings, function( view ) {
     338                view.remove();
     339            } );
     340
     341            // Reset Warnings
     342            this.warnings = [];
    336343        }
    337344    } );
     
    341348        tagName: 'p',
    342349        className: 'warning',
    343         id: 'bp-uploader-warning',
    344350
    345351        initialize: function() {
Note: See TracChangeset for help on using the changeset viewer.