Sha256: 9fd3d979bd9fc77c81acc96d2e38460147e735e154934e5cf9235fd1445ea732
Contents?: true
Size: 1.5 KB
Versions: 24
Compression:
Stored size: 1.5 KB
Contents
FORGE.features.fileSelectWidget = { init: function () { var self = FORGE.features.fileSelectWidget; $(document) .on('click', 'a.select-asset', self.selectAsset) .on('click', 'a.upload-file', self.uploadFile) .on('click', 'a.attach-to-object', self.attachToObject); }, selectAsset: function (event) { event.preventDefault(); var self = FORGE.features.fileSelectWidget, $this = $(this); FORGE.assetDrawer.asset_id_container = $this.closest('div').find('.file-widget-asset-id').attr('id') FORGE.assetDrawer.asset_url_container = $this.closest('div').find('.file-widget-asset-url').attr('id') FORGE.assetDrawer.load(null, '/forge/assets/drawer?single=true'); }, uploadFile: function (event) { event.preventDefault(); var self = FORGE.features.fileSelectWidget, $this = $(this); FORGE.assetDrawer.asset_id_container = $this.closest('div').find('.file-widget-asset-id').attr('id'); FORGE.assetDrawer.asset_url_container = $this.closest('div').find('.file-widget-asset-url').attr('id'); FORGE.features.assets.dialog.showNew('#new-asset-dialog', '/forge/assets/new?single=true&for_model=true'); }, attachToObject: function (event) { event.preventDefault(); var self = FORGE.features.fileSelectWidget, $this = $(this); var id = $(this).closest('li').attr('id').replace('asset_', ''), url = $(this).closest('li').find('img').attr('src'); FORGE.assetDrawer.attachToObject(id, url); }, };
Version data entries
24 entries across 24 versions & 1 rubygems