Space pen outlet error


I have the following markup in my code…

class LogView extends View
    @content: ->
        @div class: 'log native-key-bindings', tabindex: -1, =>
            @subview 'main_panel', new MainPanelView
            @subview 'info_panel', new InfoPanelView

    constructor: ->

class MainPanelView extends ScrollView
        @div class: 'main panels', =>
                @subview 'graph', new ColumnView('Graph', 'graph')
                @div class: 'table', outlet: 'table', =>
                    @subview 'comments', new ColumnView('Description', 'comments', true)
                    @subview 'cmm', new ColumnView('Cmit', 'commit', true)
                    @subview 'dte', new ColumnView('te', 'da', true)
                    @subview 'hor', new ColumnView('hor', 'au')

class InfoPanelView extends ScrollView
    @content: ->
        @div class: 'info panels', =>
            @div class:'resize-handle-hor'
            @div class: 'info-data', outlet: 'info_data'
            @div class: 'info-image', outlet: 'info_image'
            @div class:'info-file', outlet: 'info_file', =>
                @subview 'image', new ColumnView('asd', 'first-col')
                @subview 'named', new ColumnView('Filename', 'aafile')
                @subview 'path', new ColumnView('Path', 'path')
                @subview 'addition', new ColumnView('Addition', 'add')
                @subview 'deletion', new ColumnView('Deletion', 'del')

    add_content: (head, content) ->
        @info_data.append $$ ->
            @h2 =>
                @text head
                @span content

class ColumnView extends View
    @content: (title, class_name, resizable) ->
        @div class: 'column ' + class_name, =>
            @div class: 'list-head', =>
                @h2 title
                @div class:'resize-handle' if resizable
            @div class: 'list', outlet: 'list'

    add_content: (content) ->
        @list.append $$ ->
            @p =>
                @span content

So when i try to access the ColumnView class in InfoPanelView like this.info_panel.info_file.image i am getting a undefined error.

But i am able to access until info_file

Is there any mistake i am overlooking


I edited your post so that it could be syntax highlighted. I find it makes code much easier to read. If you use backtick-fenced code blocks, you can declare the language and then it will be syntax highlighted for you :grinning:


@leedohm Thank you …will do that next time


@leedohm Any idea where i am making a mistake


Sorry, no. I haven’t done much with Space Pen. I also haven’t tried to get access to an outlet from outside the class in which the outlet was declared. It also looks like a Law of Demeter violation. I’d look at something like the settings-view package to see how they handle complex Space Pen views.


Found the mistake … i should have done this.info_panel.image


Thanks for adding the fix you found. Will be helpful for others, I’m sure.