Sha256: 2b4bd2ec4574731d996822a7ea130a6ecaf840709a908635c96b08445ed77e6d
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
@ResourcebrowserInspector = do -> inspectorSelector: '.scrivito-resourcebrowser-inspector' contentSelector: '.inspector-content' inspector: undefined objectId: undefined _initializeBindings: -> @modal.on 'click', 'li.resourcebrowser-item', (event) => @_onInspect(event) @inspector = @modal.find(@inspectorSelector) @inspector.hide() _onInspect: (event) -> if $(event.target).hasClass('scrivito-resourcebrowser-inspect') currentTarget = $(event.currentTarget) id = currentTarget.data('id') if id @open(id) @_highlightItem(currentTarget) _renderLoading: -> @inspector.html(@_loadingTemplate()) _loadingTemplate: -> icon = $('<i></i>') .addClass('scrivito-resourcebrowser-icon scrivito-resourcebrowser-icon-refresh') $('<div></div>') .addClass('scrivito-resourcebrowser-loading') .html(icon) _highlightItem: (element) -> @modal.find('li.resourcebrowser-item.active').removeClass('active') element.addClass('active') init: (modal) -> @modal = modal @_initializeBindings() # Opens the inspector section in the resourcebrowser for the given object ID and displays its edit # view. open: (objectId) -> @objectId = objectId @inspector.show() @_renderLoading() $.ajax url: '/resourcebrowser/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 resourcebrowser. close: -> @inspector.empty() @inspector.hide()
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scrivito_resourcebrowser-0.0.6 | app/assets/javascripts/scrivito_resourcebrowser/inspector.js.coffee |