Crap, we can't use Ember.Handlebars because some places don't use Ember (such as autocomplete.js)
This commit is contained in:
parent
3fdc59b1d9
commit
f544e1d4f7
|
@ -6,7 +6,7 @@
|
||||||
@method breakUp
|
@method breakUp
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('breakUp', function(property, options) {
|
Handlebars.registerHelper('breakUp', function(property, options) {
|
||||||
var prop, result, tokens;
|
var prop, result, tokens;
|
||||||
prop = Ember.Handlebars.get(this, property, options);
|
prop = Ember.Handlebars.get(this, property, options);
|
||||||
if (!prop) return "";
|
if (!prop) return "";
|
||||||
|
@ -30,7 +30,7 @@ Ember.Handlebars.registerHelper('breakUp', function(property, options) {
|
||||||
@method shorten
|
@method shorten
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('shorten', function(property, options) {
|
Handlebars.registerHelper('shorten', function(property, options) {
|
||||||
return Ember.Handlebars.get(this, property, options).truncate(35);
|
return Ember.Handlebars.get(this, property, options).truncate(35);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ Ember.Handlebars.registerHelper('shorten', function(property, options) {
|
||||||
@method topicLink
|
@method topicLink
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('topicLink', function(property, options) {
|
Handlebars.registerHelper('topicLink', function(property, options) {
|
||||||
var title, topic;
|
var title, topic;
|
||||||
topic = Ember.Handlebars.get(this, property, options);
|
topic = Ember.Handlebars.get(this, property, options);
|
||||||
title = topic.get('fancy_title') || topic.get('title');
|
title = topic.get('fancy_title') || topic.get('title');
|
||||||
|
@ -53,7 +53,7 @@ Ember.Handlebars.registerHelper('topicLink', function(property, options) {
|
||||||
@method categoryLink
|
@method categoryLink
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('categoryLink', function(property, options) {
|
Handlebars.registerHelper('categoryLink', function(property, options) {
|
||||||
var category = Ember.Handlebars.get(this, property, options);
|
var category = Ember.Handlebars.get(this, property, options);
|
||||||
return new Handlebars.SafeString(Discourse.Utilities.categoryLink(category));
|
return new Handlebars.SafeString(Discourse.Utilities.categoryLink(category));
|
||||||
});
|
});
|
||||||
|
@ -74,7 +74,7 @@ Ember.Handlebars.registerBoundHelper('boundCategoryLink', function(category) {
|
||||||
@method titledLinkTo
|
@method titledLinkTo
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('titledLinkTo', function(name, object) {
|
Handlebars.registerHelper('titledLinkTo', function(name, object) {
|
||||||
var options;
|
var options;
|
||||||
options = [].slice.call(arguments, -1)[0];
|
options = [].slice.call(arguments, -1)[0];
|
||||||
if (options.hash.titleKey) {
|
if (options.hash.titleKey) {
|
||||||
|
@ -93,7 +93,7 @@ Ember.Handlebars.registerHelper('titledLinkTo', function(name, object) {
|
||||||
@method shortenUrl
|
@method shortenUrl
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('shortenUrl', function(property, options) {
|
Handlebars.registerHelper('shortenUrl', function(property, options) {
|
||||||
var url;
|
var url;
|
||||||
url = Ember.Handlebars.get(this, property, options);
|
url = Ember.Handlebars.get(this, property, options);
|
||||||
// Remove trailing slash if it's a top level URL
|
// Remove trailing slash if it's a top level URL
|
||||||
|
@ -111,7 +111,7 @@ Ember.Handlebars.registerHelper('shortenUrl', function(property, options) {
|
||||||
@method lower
|
@method lower
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('lower', function(property, options) {
|
Handlebars.registerHelper('lower', function(property, options) {
|
||||||
var o;
|
var o;
|
||||||
o = Ember.Handlebars.get(this, property, options);
|
o = Ember.Handlebars.get(this, property, options);
|
||||||
if (o && typeof o === 'string') {
|
if (o && typeof o === 'string') {
|
||||||
|
@ -127,7 +127,7 @@ Ember.Handlebars.registerHelper('lower', function(property, options) {
|
||||||
@method avatar
|
@method avatar
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('avatar', function(user, options) {
|
Handlebars.registerHelper('avatar', function(user, options) {
|
||||||
|
|
||||||
if (typeof user === 'string') {
|
if (typeof user === 'string') {
|
||||||
user = Ember.Handlebars.get(this, user, options);
|
user = Ember.Handlebars.get(this, user, options);
|
||||||
|
@ -159,7 +159,7 @@ Ember.Handlebars.registerHelper('avatar', function(user, options) {
|
||||||
@method unboundDate
|
@method unboundDate
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('unboundDate', function(property, options) {
|
Handlebars.registerHelper('unboundDate', function(property, options) {
|
||||||
var dt;
|
var dt;
|
||||||
dt = new Date(Ember.Handlebars.get(this, property, options));
|
dt = new Date(Ember.Handlebars.get(this, property, options));
|
||||||
return dt.format("{d} {Mon}, {yyyy} {hh}:{mm}");
|
return dt.format("{d} {Mon}, {yyyy} {hh}:{mm}");
|
||||||
|
@ -171,7 +171,7 @@ Ember.Handlebars.registerHelper('unboundDate', function(property, options) {
|
||||||
@method editDate
|
@method editDate
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('editDate', function(property, options) {
|
Handlebars.registerHelper('editDate', function(property, options) {
|
||||||
var dt, yesterday;
|
var dt, yesterday;
|
||||||
dt = Date.create(Ember.Handlebars.get(this, property, options));
|
dt = Date.create(Ember.Handlebars.get(this, property, options));
|
||||||
yesterday = new Date() - (60 * 60 * 24 * 1000);
|
yesterday = new Date() - (60 * 60 * 24 * 1000);
|
||||||
|
@ -188,7 +188,7 @@ Ember.Handlebars.registerHelper('editDate', function(property, options) {
|
||||||
@method number
|
@method number
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('number', function(property, options) {
|
Handlebars.registerHelper('number', function(property, options) {
|
||||||
var n, orig, title;
|
var n, orig, title;
|
||||||
orig = parseInt(Ember.Handlebars.get(this, property, options), 10);
|
orig = parseInt(Ember.Handlebars.get(this, property, options), 10);
|
||||||
if (isNaN(orig)) {
|
if (isNaN(orig)) {
|
||||||
|
@ -214,7 +214,7 @@ Ember.Handlebars.registerHelper('number', function(property, options) {
|
||||||
@method date
|
@method date
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('date', function(property, options) {
|
Handlebars.registerHelper('date', function(property, options) {
|
||||||
var displayDate, dt, fiveDaysAgo, fullReadable, humanized, leaveAgo, val;
|
var displayDate, dt, fiveDaysAgo, fullReadable, humanized, leaveAgo, val;
|
||||||
if (property.hash) {
|
if (property.hash) {
|
||||||
if (property.hash.leaveAgo) {
|
if (property.hash.leaveAgo) {
|
||||||
|
@ -257,7 +257,7 @@ Ember.Handlebars.registerHelper('date', function(property, options) {
|
||||||
@method personalizedName
|
@method personalizedName
|
||||||
@for Handlebars
|
@for Handlebars
|
||||||
**/
|
**/
|
||||||
Ember.Handlebars.registerHelper('personalizedName', function(property, options) {
|
Handlebars.registerHelper('personalizedName', function(property, options) {
|
||||||
var name, username;
|
var name, username;
|
||||||
name = Ember.Handlebars.get(this, property, options);
|
name = Ember.Handlebars.get(this, property, options);
|
||||||
if (options.hash.usernamePath) {
|
if (options.hash.usernamePath) {
|
||||||
|
|
Loading…
Reference in New Issue