forked from OpenNeo/impress
i18n for outfits/edit.js sharing urls
This commit is contained in:
parent
addc41ddc9
commit
c92bf4fc7a
2 changed files with 46 additions and 11 deletions
|
@ -115,12 +115,20 @@
|
|||
%div
|
||||
%dt= search_query_with_helper '.search.examples.type'
|
||||
%dd= search_query_description '.search.examples.type'
|
||||
#preview-search-form-loading= '.search.loading'
|
||||
#preview-search-form-loading= t '.search.loading'
|
||||
#preview-search-form-error.possible-error
|
||||
#preview-search-form-no-results
|
||||
= t '.search.no_results_html', :query => content_tag(:span)
|
||||
%ul
|
||||
#no-assets-full-message= t '.sidebar.closet.no_data.description'
|
||||
%script#sharing-html-image-template{:type => 'text/x-jquery-tmpl'}
|
||||
= link_to image_tag('${image_url}'), '${permalink}'
|
||||
%script#sharing-html-text-template{:type => 'text/x-jquery-tmpl'}
|
||||
= link_to t('app_name'), '${permalink}'
|
||||
%script#sharing-bbcode-image-template{:type => 'text/x-jquery-tmpl'}
|
||||
[URL=${permalink}][IMG]${image_url}[/IMG][/URL]
|
||||
%script#sharing-bbcode-text-template{:type => 'text/x-jquery-tmpl'}
|
||||
[URL=${permalink}]#{t('app_name')}[/URL]
|
||||
%script#outfit-template{:type => 'text/x-jquery-tmpl'}
|
||||
<li class="outfit-${id}{{if starred}} starred{{/if}}">
|
||||
%header
|
||||
|
|
|
@ -715,26 +715,53 @@ View.Outfits = function (wardrobe) {
|
|||
};
|
||||
var format_selector_els = $('#preview-sharing-url-formats li');
|
||||
var thumbnail_el = $('#preview-sharing-thumbnail');
|
||||
var templates = {
|
||||
html: {
|
||||
image: $('#sharing-html-image-template'),
|
||||
text: $('#sharing-html-text-template')
|
||||
},
|
||||
bbcode: {
|
||||
image: $('#sharing-bbcode-image-template'),
|
||||
text: $('#sharing-bbcode-text-template')
|
||||
}
|
||||
}
|
||||
|
||||
function templateHTML(template, options) {
|
||||
var contents = template.tmpl(options);
|
||||
var contentsHTML = contents.clone().wrap('<div>').parent().html();
|
||||
return contentsHTML;
|
||||
}
|
||||
|
||||
// The HTML and BBCode formats could probably be handled more dynamic-like.
|
||||
var formats = {
|
||||
plain: {
|
||||
image: function (url) { return url },
|
||||
text: function (url) { return url }
|
||||
image: function (image_url) { return image_url },
|
||||
text: function (permalink) { return permalink }
|
||||
},
|
||||
html: {
|
||||
image: function (url, permalink) {
|
||||
return '<a href="' + permalink + '"><img src="' + url + '" /></a>';
|
||||
image: function (image_url, permalink) {
|
||||
return templateHTML(templates.html.image, {
|
||||
image_url: image_url,
|
||||
permalink: permalink
|
||||
});
|
||||
},
|
||||
text: function (url) {
|
||||
return '<a href="' + url + '">Dress to Impress</a>';
|
||||
text: function (permalink) {
|
||||
return templateHTML(templates.html.text, {
|
||||
permalink: permalink
|
||||
});
|
||||
}
|
||||
},
|
||||
bbcode: {
|
||||
image: function (url, permalink) {
|
||||
return '[URL=' + permalink + '][IMG]' + url + '[/IMG][/URL]';
|
||||
image: function (image_url, permalink) {
|
||||
return templateHTML(templates.bbcode.image, {
|
||||
image_url: image_url,
|
||||
permalink: permalink
|
||||
});
|
||||
},
|
||||
text: function (url) {
|
||||
return '[URL=' + url + ']Dress to Impress[/URL]';
|
||||
text: function (permalink) {
|
||||
return templateHTML(templates.bbcode.text, {
|
||||
permalink: permalink
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue