Sha256: c364cb8f222195ec87abb980579a35332ffdb1a3089cc3207ec36d8d10ae321f
Contents?: true
Size: 958 Bytes
Versions: 1
Compression:
Stored size: 958 Bytes
Contents
class TentStatus.Models.Post extends Backbone.Model model: 'post' url: => "#{TentStatus.api_root}/posts#{ if @id then "/#{@id}" else ''}" isRepost: => !!(@get('type') || '').match(/repost/) entity: => return TentStatus.Models.profile if TentStatus.Models.profile.entity() == @get('entity') (TentStatus.Collections.followings.find (following) => following.get('entity') == @get('entity')) || (TentStatus.Collections.followers.find (follower) => follower.get('entity') == @get('entity')) name: => @entity()?.name() || @get('entity') hasName: => !!(@entity()?.hasName()) avatar: => @entity()?.avatar() validate: (attrs) => errors = [] if attrs.text and attrs.text.match /^[\s\r]*$/ errors.push { text: 'Status must not be empty' } if attrs.text and attrs.text.length > 140 errors.push { text: 'Status must be no more than 140 characters' } return errors if errors.length null
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tent-status-0.0.1 | assets/javascripts/models/post.js.coffee |