Move facebox configuration into the initialization of the Backbone app

Facebox is already called from some Backbone views very early, making its icons 404 otherwise.
This commit is contained in:
Jonne Haß 2013-07-29 12:20:05 +02:00
parent 3627f46b2d
commit cdc29e449d
3 changed files with 24 additions and 17 deletions

View file

@ -13,6 +13,7 @@
* Fix pagination for people list on the tag stream page [#4245](https://github.com/diaspora/diaspora/pull/4245)
* Fix missing timeago tooltip in conversations [#4257](https://github.com/diaspora/diaspora/issues/4257)
* Fix link to background image [#4289](https://github.com/diaspora/diaspora/pull/4289)
* Fix Facebox icons 404s when called from Backbone
## Features
* Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252)

View file

@ -40,25 +40,17 @@ var app = {
app.currentUser = app.user(window.gon.user) || new app.models.User();
if(app.currentUser.authenticated()){
this.setupFacebox();
this.setupHovercards();
if(app.currentUser.authenticated()) {
app.header = new app.views.Header();
$("header").prepend(app.header.el);
app.header.render();
}
Backbone.history.start({pushState: true});
// there's probably a better way to do this...
$("a[rel=backbone]").live("click", function(evt){
evt.preventDefault();
var link = $(this);
$(".stream_title").text(link.text())
app.router.navigate(link.attr("href").substring(1) ,true)
});
app.hovercard = new app.views.Hovercard();
app.aspectMemberships = new app.views.AspectMembership();
},
@ -80,6 +72,25 @@ var app = {
return(preload)
},
setupFacebox: function() {
$.facebox.settings.closeImage = app.baseImageUrl()+'facebox/closelabel.png';
$.facebox.settings.loadingImage = app.baseImageUrl()+'facebox/loading.gif';
$.facebox.settings.opacity = 0.75;
},
setupHovercards: function() {
// there's probably a better way to do this...
$("a[rel=backbone]").live("click", function(evt){
evt.preventDefault();
var link = $(this);
$(".stream_title").text(link.text())
app.router.navigate(link.attr("href").substring(1) ,true)
});
app.hovercard = new app.views.Hovercard();
},
/* mixpanel wrapper function */
instrument : function(type, name, object, callback) {
if(!window.mixpanel) { return }

View file

@ -63,11 +63,6 @@ var View = {
$(document.body).click(this.dropdowns.removeFocus);
/* facebox */
$.facebox.settings.closeImage = app.baseImageUrl()+'facebox/closelabel.png';
$.facebox.settings.loadingImage = app.baseImageUrl()+'facebox/loading.gif';
$.facebox.settings.opacity = 0.75;
$('a[rel*=facebox]').facebox();
$(document).bind('reveal.facebox', function() {
Diaspora.page.directionDetector.updateBinds();