added a conditional that checks if the logo_url setting is empty. In that case, the logoHTML function returns a header tag with the site_title as its content

This commit is contained in:
Cezar 2013-06-20 12:27:09 -03:00
parent 9f3d5b9f1e
commit 132b0498ed
1 changed files with 10 additions and 5 deletions

View File

@ -87,20 +87,25 @@ Discourse.HeaderView = Discourse.View.extend({
/**
Display the correct logo in the header, showing a custom small icon if it exists.
In case the logo_url setting is empty, shows the site title as the logo.
@property logoHTML
**/
logoHTML: function() {
var result = "<div class='title'><a href='" + Discourse.getURL("/") + "'>";
if (this.get('controller.showExtraInfo')) {
var logo = Discourse.SiteSettings.logo_small_url;
if (logo && logo.length > 1) {
result += "<img class='logo-small' src='" + logo + "' width='33' height='33'>";
var logoSmall = Discourse.SiteSettings.logo_small_url;
if (logoSmall && logoSmall.length > 1) {
result += "<img class='logo-small' src='" + logoSmall + "' width='33' height='33'>";
} else {
result += "<i class='icon-home'></i>";
}
} else {
result += "<img class='logo-big' src=\"" + Discourse.SiteSettings.logo_url + "\" alt=\"" + Discourse.SiteSettings.title + "\" id='site-logo'>";
var logo = Discourse.SiteSettings.logo_url;
if(logo && logo.length > 1) {
result += "<img class='logo-big' src=\"" + logo + "\" alt=\"" + Discourse.SiteSettings.title + "\" id='site-logo'>";
} else {
result += "<h2 class='text-logo' id='site-text-logo'>" + Discourse.SiteSettings.title + "</h2>"
}
}
result += "</a></div>";
return new Handlebars.SafeString(result);