Sha256: 3c4e8d1860fb8fd97d6344b4326afbd9581eb1883fdbbfee85148825dc59cba3

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 Bytes

Contents

class TentStatus.Models.Follower extends Backbone.Model
  model: 'follower'
  url: => "#{TentStatus.api_root}/followers#{ if @id then "/#{@id}" else ''}"

  initialize: ->
    @on 'sync', @updateProfile
    @updateProfile()

  updateProfile: =>
    profile = @get('profile')
    core_profile = {}
    basic_profile = {}
    for type, content of profile
      basic_profile = content if type.match(/types\/info\/basic/)
      core_profile = content if type.match(/types\/info\/core/)
    @set 'core_profile', core_profile
    @set 'basic_profile', basic_profile

  name: =>
    @get('basic_profile')['name'] || @get('core_profile')['entity']

  hasName: =>
    !!(@get('basic_profile')['name'])

  avatar: =>
    @get('basic_profile')['avatar_url']

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tent-status-0.0.1 assets/javascripts/models/follower.js.coffee