Sha256: fba064cf58041baf53ff4a87c9bb17128a4cd8053c54c5d71c054b633307aa8e
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outpost-asset_host-1.0.0 | lib/assets/javascripts/outpost/asset_host/assets.js.coffee |