Sha256: 6661b27787eedf37e17cc237c4572afa8abccf2389f806bdbe67d48d34c49c66
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
@MediabrowserInspector = do -> inspectorSelector: '.editing-mediabrowser-inspector' contentSelector: '.inspector-content' inspector: undefined objectId: undefined _initializeBindings: -> @modal.on 'click', 'li.mediabrowser-item', (event) => @_onInspect(event) @inspector = @modal.find(@inspectorSelector) @inspector.hide() _onInspect: (event) -> if $(event.target).hasClass('editing-mediabrowser-inspect') currentTarget = $(event.currentTarget) id = currentTarget.data('id') if id @open(id) @_highlightItem(currentTarget) _renderLoading: -> @inspector.html(@_loadingTemplate()) _loadingTemplate: -> icon = $('<i></i>') .addClass('editing-icon editing-icon-refresh') $('<div></div>') .addClass('editing-mediabrowser-loading') .html(icon) _highlightItem: (element) -> @modal.find('li.mediabrowser-item.active').removeClass('active') element.addClass('active') init: (modal) -> @modal = modal @_initializeBindings() # Opens the inspector section in the mediabrowser for the given object ID and displays its edit # view. open: (objectId) -> @objectId = objectId @inspector.show() @_renderLoading() $.ajax url: '/mediabrowser/inspector' dataType: 'json' data: id: @objectId success: (json) => @inspector.html(json.content) scrivito.trigger('new_content', @inspector) error: => @inspector.empty() # Closes the inspector section of the mediabrowser. close: -> @inspector.empty() @inspector.hide()
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scrivito_editors-0.0.9 | app/assets/javascripts/mediabrowser/inspector.js.coffee |
scrivito_editors-0.0.8 | app/assets/javascripts/mediabrowser/inspector.js.coffee |