cozy/cozy-mobile

View on GitHub
src/app/models/file.coffee

Summary

Maintainability
Test Coverage
module.exports = class File extends Backbone.Model

    idAttribute: "_id"

    defaults: ->
        incache: 'loading'
        version: false

    initialize: ->
        @isDeviceFolder = @isFolder() and
        @wholePath() is window.app.init.config.get 'deviceName'

    isFolder: ->
        @get('docType')?.toLowerCase() is 'folder'

    wholePath: ->
        name = @get('name')
        if path = @get('path') then "#{path.slice(1)}/#{name}"
        else name