Sha256: b6c9dd73e064f94a3e650ef0222f982c917ee3051eb7cf487d266a33e5a7ff6c
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
## # AssetHost # Models for AssetHost API interaction # class outpost.AssetHost @Asset: Backbone.Model.extend urlRoot: "#{assethost.SERVER}/api/assets/" #---------- # simpleJSON is an object of just the attributes # we care about for SCPRv4. Everything else is # pulled from the AssetHost API. # # This should be kept in sync with ContentAsset#simple_json simpleJSON: -> { id: @get 'id' caption: @get 'caption' position: @get 'ORDER' } #-------------- url: -> url = if @isNew() then @urlRoot else @urlRoot + encodeURIComponent(@id) if assethost.TOKEN token = $.param(auth_token:assethost.TOKEN) url += "?#{token}" url #---------- @Assets: Backbone.Collection.extend model: @Asset # If we have an ORDER attribute, sort by that. # Otherwise, sort by just the asset ID. comparator: (asset) -> asset.get("ORDER") || -Number(asset.get("id")) #---------- # An array of assets turned into simpleJSON. See # Asset#simpleJSON for more. simpleJSON: -> assets = [] @each (asset) -> assets.push(asset.simpleJSON()) assets #----------
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
outpost-asset_host-1.1.1 | lib/assets/javascripts/outpost/asset_host/assets.js.coffee |
outpost-asset_host-1.1.0 | lib/assets/javascripts/outpost/asset_host/assets.js.coffee |