Commit fa1ee731 authored by danielgrippi's avatar danielgrippi

DG MS; made an imageUrl handlebars helper for assets served through handlebars templates.

parent 48941fba
......@@ -87,6 +87,9 @@
Diaspora.I18n.loadLocale(#{get_javascript_strings_for(I18n.locale).to_json}, "#{I18n.locale}");
Diaspora.Page = "#{params[:controller].camelcase}#{params[:action].camelcase}";
:javascript
app.baseImageUrl("#{ENV['ASSET_HOST']}")
- if current_user
:javascript
app.user(
......
......@@ -2,7 +2,7 @@
<!-- need access to post -->
{{#if ownComment}}
<a href="#" class="delete comment_delete" title="{{t "delete"}}">
<img alt="Deletelabel" src="/images/deletelabel.png" />
<img alt="Deletelabel" src="{{imageUrl "/images/deletelabel.png"}}" />
<a/>
{{/if}}
</div>
......
<div class="container" style="position:relative;">
<a href="/stream">
<img alt="Logo_small" class="diaspora_header_logo" height="38px" width="65px" src="/images/header-logo.png" />
<img alt="Logo_small" class="diaspora_header_logo" height="38px" width="65px" src="{{imageUrl "/images/header-logo.png"}}" />
</a>
<div id="global_search">
......@@ -13,13 +13,13 @@
<div id="nav_badges">
<div class="badge" id="home_badge">
<a href="/stream" title="{{t "header.home"}}"><img alt="Home" src="/images/icons/home_grey.png">
<a href="/stream" title="{{t "header.home"}}"><img alt="Home" src="{{imageUrl "/images/icons/home_grey.png"}}" />
</a>
</div>
<div class="badge" id="notification_badge">
<a href="/notifications" title="{{t "header.notifications"}}">
<img alt="{{t "header.notifications"}}" id="notification-flag" src="/images/icons/notifications_grey.png">
<img alt="{{t "header.notifications"}}" id="notification-flag" src="{{imageUrl "/images/icons/notifications_grey.png"}}" />
<div class="badge_count {{#unless current_user.notifications_count}} hidden {{/unless}}">
{{current_user.notifications_count}}
</div>
......@@ -28,7 +28,7 @@
<div class="badge" id="message_inbox_badge">
<a href="/conversations" title="{{t "header.messages"}}">
<img alt="{{t "header.messages"}}" src="/images/icons/mail_grey.png">
<img alt="{{t "header.messages"}}" src="{{imageUrl "/images/icons/mail_grey.png"}}" />
<div class="badge_count {{#unless current_user.unread_messages_count}} hidden {{/unless}}">
{{current_user.unread_messages_count}}
</div>
......@@ -55,7 +55,7 @@
<div class="notifications">
<div class="ajax_loader">
<img alt="Ajax-loader" src="/images/ajax-loader.gif">
<img alt="Ajax-loader" src="{{imageUrl "/images/ajax-loader.gif"}}">
</div>
</div>
</div>
......
......@@ -9,6 +9,11 @@ var app = {
return this._user || false
},
baseImageUrl: function(baseUrl){
if(baseUrl) { return this._baseImageUrl = baseUrl }
return this._baseImageUrl || ""
},
initialize: function() {
app.router = new app.Router();
......@@ -32,8 +37,14 @@ var app = {
};
$(function() {
Handlebars.registerHelper('t', function(){
return Diaspora.I18n.t(arguments[0], jQuery.parseJSON(arguments[1]))
})
Handlebars.registerHelper('imageUrl', function(path){
return app.baseImageUrl() + path;
})
app.initialize();
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment