Handle click-to-deselect selected snipt
parent
17d30a2c35
commit
26e03692e3
|
@ -7,8 +7,9 @@
|
|||
|
||||
initialize: function(opts) {
|
||||
|
||||
this.$search_query = $('input#search-query', this.el);
|
||||
this.$snipts = $('section#snipts article.snipt', this.el);
|
||||
this.$el = $(this.el);
|
||||
this.$search_query = $('input#search-query', this.$el);
|
||||
this.$snipts = $('section#snipts article.snipt', this.$el);
|
||||
|
||||
this.keyboardShortcuts();
|
||||
this.inFieldLabels();
|
||||
|
@ -17,6 +18,12 @@
|
|||
if (this.$snipts.length) {
|
||||
SniptListView = Snipt.Views.SniptListView;
|
||||
SniptList = new SniptListView({ 'snipts': this.$snipts });
|
||||
|
||||
$('body').click(function() {
|
||||
if (window.$selected) {
|
||||
window.$selected.trigger('deselect');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Search
|
||||
|
@ -45,12 +52,11 @@
|
|||
});
|
||||
},
|
||||
inFieldLabels: function () {
|
||||
$('div.infield label', this.el).inFieldLabels({
|
||||
$('div.infield label', this.$el).inFieldLabels({
|
||||
fadeDuration: 200
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Site.Views = {
|
||||
'SiteView': SiteView
|
||||
};
|
||||
|
|
|
@ -88,8 +88,9 @@
|
|||
|
||||
window.$selected = this.$el;
|
||||
},
|
||||
selectFromClick: function() {
|
||||
selectFromClick: function(e) {
|
||||
this.select(true);
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
SniptListView = Backbone.View.extend({
|
||||
|
@ -103,6 +104,7 @@
|
|||
|
||||
this.keyboardShortcuts();
|
||||
},
|
||||
|
||||
addSnipt: function() {
|
||||
model = new SniptView({ el: this });
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue