diff --git a/app/app/modules/Portfolio.coffee b/app/app/modules/Portfolio.coffee index 942299e3..ee3d988d 100644 --- a/app/app/modules/Portfolio.coffee +++ b/app/app/modules/Portfolio.coffee @@ -26,7 +26,7 @@ define [ template: 'packery-list-item' serialize: () -> data = if @.model then @.model.toJSON() else {} - data.Persons = _.sortBy json.Persons, (person) -> + data.Persons = _.sortBy data.Persons, (person) -> return person.Surname data.LinkTo = @.options.linkTo @@ -81,17 +81,20 @@ define [ out += ' & ' out - Handlebars.registerHelper 'niceDate', (model) -> + Handlebars.registerHelper 'niceDate', (model, forceYear) -> return false unless model.DateRangeNice or model.FrontendDate out = '' if model.DateRangeNice out += model.DateRangeNice else if model.FrontendDate - out += model.FrontendDate + if not forceYear + out += model.FrontendDate + else + out += model.FrontendDate.split(' ')[1] out Handlebars.registerHelper 'teaserMeta', -> - niceDate = Handlebars.helpers.niceDate @ + niceDate = Handlebars.helpers.niceDate @, true if @.ClassName is 'Project' nameSummary = Handlebars.helpers.nameSummary @.Persons return "#{nameSummary} // #{niceDate}" diff --git a/app/app/modules/Portfolio.js b/app/app/modules/Portfolio.js index 60f4921b..3dc2972a 100644 --- a/app/app/modules/Portfolio.js +++ b/app/app/modules/Portfolio.js @@ -34,7 +34,7 @@ define(['app', 'modules/JJPackery'], function(app, JJPackery) { var data; data = this.model ? this.model.toJSON() : {}; - data.Persons = _.sortBy(json.Persons, function(person) { + data.Persons = _.sortBy(data.Persons, function(person) { return person.Surname; }); data.LinkTo = this.options.linkTo; @@ -100,7 +100,7 @@ define(['app', 'modules/JJPackery'], function(app, JJPackery) { }); return out; }); - Handlebars.registerHelper('niceDate', function(model) { + Handlebars.registerHelper('niceDate', function(model, forceYear) { var out; if (!(model.DateRangeNice || model.FrontendDate)) { @@ -110,14 +110,18 @@ define(['app', 'modules/JJPackery'], function(app, JJPackery) { if (model.DateRangeNice) { out += model.DateRangeNice; } else if (model.FrontendDate) { - out += model.FrontendDate; + if (!forceYear) { + out += model.FrontendDate; + } else { + out += model.FrontendDate.split(' ')[1]; + } } return out; }); Handlebars.registerHelper('teaserMeta', function() { var nameSummary, niceDate; - niceDate = Handlebars.helpers.niceDate(this); + niceDate = Handlebars.helpers.niceDate(this, true); if (this.ClassName === 'Project') { nameSummary = Handlebars.helpers.nameSummary(this.Persons); return "" + nameSummary + " // " + niceDate; diff --git a/app/app/templates/portfolio-detail.html b/app/app/templates/portfolio-detail.html index 32db6dd2..48ffadfb 100644 --- a/app/app/templates/portfolio-detail.html +++ b/app/app/templates/portfolio-detail.html @@ -4,7 +4,7 @@

{{Title}}

{{{nameSummary Persons}}}

-

{{niceDate this}}

+

{{niceDate this true}}

{{#if Websites}}

{{{commaSeparatedWebsites Websites}}}

{{/if}}