Skip to content
Extraits de code Groupes Projets
Valider f5c8ebcb rédigé par Sri Vishnu Totakura's avatar Sri Vishnu Totakura Validation de Jonne Haß
Parcourir les fichiers

publisher closes when clicked anywhere outside its division after opening

fixed app.publisher undefined error

app view removed and click event binder added in the publisher view initializer.

removed unwanted console log

attempted to fix this.el undefined error
parent 77c94bf4
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -20,7 +20,7 @@ var app = {
views: {},
pages: {},
forms: {},
user: function(userAttrs) {
if(userAttrs) { return this._user = new app.models.User(userAttrs) }
return this._user || false
......
......@@ -65,6 +65,15 @@ app.views.Publisher = Backbone.View.extend(_.extend(
// textchange event won't be called in Backbone...
this.el_input.bind('textchange', $.noop);
var _this = this
$('body').on('click', function(event){
// if the click event is happened outside the publisher view, then try to close the box
if( _this.el && $(event.target).closest('#publisher').attr('id') != _this.el.id){
_this.tryClose()
}
});
return this;
},
......@@ -249,6 +258,13 @@ app.views.Publisher = Backbone.View.extend(_.extend(
return this;
},
tryClose : function(){
// if it is not submittable, close it.
if( !this._submittable() ){
this.close()
}
},
open : function() {
// visually 'open' the publisher
this.$el.removeClass('closed');
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter