Sha256: e5ad6afb4837b1b8f3def9ff595acf849178448d5d7cc8987560e1aa54188f9a
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
#= require ../shared/asset_picker_view Locomotive.Views.ThemeAssets ||= {} class Locomotive.Views.ThemeAssets.ImagePickerView extends Locomotive.Views.Shared.AssetPickerView events: 'click ul.list a': 'select_asset' initialize: -> @collection ||= new Locomotive.Models.ThemeAssetsCollection() super template: -> ich.theme_image_picker fetch_assets: -> @collection.fetch data: { content_type: 'image' } build_uploader: (el, link) -> link.bind 'click', (event) -> event.stopPropagation() & event.preventDefault() el.click() el.bind 'change', (event) => _.each event.target.files, (file) => asset = new Locomotive.Models.ThemeAsset(source: file) asset.save {}, headers: { 'X-Flash': true } success: (model) => @collection.add(model) error: => @shake() select_asset: (event) -> event.stopPropagation() & event.preventDefault() if @options.on_select @options.on_select($(event.target).html()) add_asset: (asset) -> @$('ul.list').append(ich.theme_asset(asset.toJSON())) @_refresh()
Version data entries
6 entries across 6 versions & 1 rubygems