Sha256: 865b17933d335c0f89eb9c51421021f0a0263eeb8042ff4c896eaf6d0461cb7f

Contents?: true

Size: 923 Bytes

Versions: 10

Compression:

Stored size: 923 Bytes

Contents

(function() {
  "use strict";
  
  App.Post = DS.Model.extend({
    bodyHtml:     DS.attr('string', { defaultValue: '' }),
    bodyMarkdown: DS.attr('string', { defaultValue: '' }),
    createdAt:    DS.attr('date'),
    publishedAt:  DS.attr('date'),
    summary:      DS.attr('string'),
    title:        DS.attr('string'),
    updatedAt:    DS.attr('date'),
    
    publishedAtFormatted: function() {
      var publishedAt = this.get('publishedAt');
      
      if (Ember.isNone(publishedAt)) {
        return "Unpublished";
      } else {
        return moment(publishedAt).format('MMMM D, YYYY');
      }
    }.property('publishedAt'),
    
    updatedAtFormatted: function() {
      var updatedAt = this.get('updatedAt');
      
      if (Ember.isNone(updatedAt)) {
        return "Never";
      } else {
        return moment(updatedAt).fromNow();
      }
    }.property('secondsPassed', 'updatedAt')
  });

})();

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
blogelator-0.2.3 app/assets/javascripts/blogelator/models/post.js
blogelator-0.2.2 app/assets/javascripts/blogelator/models/post.js
blogelator-0.2.1 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.6 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.5 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.4 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.3 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.2 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.1 app/assets/javascripts/blogelator/models/post.js
blogelator-0.1.0 app/assets/javascripts/blogelator/models/post.js