mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2024-11-05 09:56:22 +00:00
Introduce {{dateRange}} and {{camelCase}} helpers.
This commit is contained in:
parent
d658a069cd
commit
6a61989eb4
@ -29,6 +29,26 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
return moment ? moment( datetime ).format( format ) : datetime;
|
||||
},
|
||||
|
||||
/**
|
||||
Format a from/to date range.
|
||||
@method dateRange
|
||||
*/
|
||||
dateRange: function( obj, fmt, sep, options ) {
|
||||
fmt = (fmt && String.is(fmt) && fmt) || 'YYYY-MM';
|
||||
sep = (sep && String.is(sep) && sep) || ' — ';
|
||||
if( obj.safe ) {
|
||||
var dateA = (obj.safe.start && obj.safe.start.format(fmt)) || '';
|
||||
var dateB = (obj.safe.end && obj.safe.end.format(fmt)) || '';
|
||||
if( obj.safe.start && obj.safe.end ) {
|
||||
return dateA + sep + dateB ;
|
||||
}
|
||||
else if( obj.safe.start || obj.safe.end ) {
|
||||
return dateA || dateB;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
/**
|
||||
Return true if the section is present on the resume and has at least one
|
||||
element.
|
||||
@ -47,6 +67,15 @@ Generic template helper definitions for HackMyResume / FluentCV.
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
Capitalize the first letter of the word.
|
||||
@method section
|
||||
*/
|
||||
camelCase: function(val) {
|
||||
val = (val && val.trim()) || '';
|
||||
return val ? (val.charAt(0).toUpperCase() + val.slice(1)) : val;
|
||||
},
|
||||
|
||||
/**
|
||||
Return true if the context has the property or subpropery.
|
||||
@method has
|
||||
|
Loading…
Reference in New Issue
Block a user