parent
d7fbfec01e
commit
8841e43c25
@ -0,0 +1,3 @@
|
||||
<component name="DependencyValidationManager">
|
||||
<scope name="NzbDrone" pattern="!file:JsLibraries//*" />
|
||||
</component>
|
@ -1,18 +1,17 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'sugar'
|
||||
], {
|
||||
register: function (handlebars) {
|
||||
handlebars.registerHelper('ShortDate', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
], function (Handlebars) {
|
||||
Handlebars.registerHelper('ShortDate', function (input) {
|
||||
if (!input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var date = Date.create(input);
|
||||
var result = '<span title="' + date.full() + '">' + date.short() + '</span>';
|
||||
var date = Date.create(input);
|
||||
var result = '<span title="' + date.full() + '">' + date.short() + '</span>';
|
||||
|
||||
return new handlebars.SafeString(result);
|
||||
});
|
||||
}
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'handlebars'
|
||||
], function (Handlebars) {
|
||||
Handlebars.registerHelper('defaultImg', function () {
|
||||
return new Handlebars.SafeString('onerror="this.src="/content/images/poster-dark.jpg";"');
|
||||
});
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Handlebars, FormatHelpers) {
|
||||
Handlebars.registerHelper('Bytes', function (size) {
|
||||
return new Handlebars.SafeString(FormatHelpers.Bytes(size));
|
||||
});
|
||||
});
|
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
define({
|
||||
register: function (Handlebars) {
|
||||
Handlebars.registerHelper("debug", function (optionalValue) {
|
||||
|
||||
console.group('Handlebar context');
|
||||
|
||||
console.log(this);
|
||||
if (optionalValue) {
|
||||
|
||||
console.group('optional values');
|
||||
console.log('optinal values');
|
||||
console.groupEnd();
|
||||
}
|
||||
console.groupEnd();
|
||||
});
|
||||
}
|
||||
});
|
@ -1,47 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
[
|
||||
'handlebars',
|
||||
'Shared/FormatHelpers'
|
||||
], function (Handlebars, FormatHelpers) {
|
||||
Handlebars.registerHelper('partial', function (templateName) {
|
||||
//TODO: We should be able to pass in the context, either an object or a property
|
||||
|
||||
var templateFunction = Marionette.TemplateCache.get(templateName);
|
||||
return new Handlebars.SafeString(templateFunction(this));
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('debug', function (optionalValue) {
|
||||
console.log('Current Context');
|
||||
console.log('====================');
|
||||
console.log(this);
|
||||
|
||||
if (optionalValue) {
|
||||
console.log('Value');
|
||||
console.log('====================');
|
||||
console.log(optionalValue);
|
||||
}
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('fileSize', function (size) {
|
||||
return new Handlebars.SafeString(FormatHelpers.FileSizeHelper(size));
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('date', function (date) {
|
||||
//TODO: show actual date in tooltip
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var shortDate = Date.create(date).short();
|
||||
var formattedDate = FormatHelpers.DateHelper(date);
|
||||
var result = '<span title="' + shortDate + '">' + formattedDate + '</span>';
|
||||
|
||||
return new Handlebars.SafeString(result);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('defaultImg', function () {
|
||||
return new Handlebars.SafeString('onerror="this.src="/content/images/poster-dark.jpg";"');
|
||||
});
|
||||
});
|
Loading…
Reference in new issue