Advanced space-pen (view system) examples and doc



The package I’m building requires a lot of GUI work. The first version I have doesn’t leverage space-pen and the view system at all. The @content is basically and empty div and I add everything dynamically using jQuery. This seems to also be the approach used by the Markdown-Preview package view.

However there are some nice things about space-pen that I’d like to use (easy outlets, events). Since my view is generated dynamically after the view object is created I cannot seem to use @content to its full extent. Or is this right? I tried to add new DOM elements this way outside the @content method:

p = @raw '<br /><p>Some Text</p>'

But it doesn’t work and I get an error saying the view has no method @raw. Even in the space-pen examples they seem to be doing it this way:

class Spacecraft extends View
  @content: ->
    @div =>
      @h1 "Spacecraft"
      @ol outlet: "list", =>
        @li "Apollo"  
        @li "Soyuz"
        @li "Space Shuttle"    <------- Add element using @li

  addSpacecraft: (name) ->
    @list.append("<li>#{name}</li>")  <----- Same thing outside of @content and they use raw HTML instead. 

Can some help me out here? Do you have examples of packages that use the space-pen framework more heavily I could look at.

Any help is appreciated.