Skip to content

Instantly share code, notes, and snippets.

@rsoares
Last active January 3, 2016 05:39

Revisions

  1. rsoares revised this gist Jan 14, 2014. 2 changed files with 19 additions and 1 deletion.
    19 changes: 19 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    var MyView = Backbone.View.extend({
    // ...

    /* Override insert function. */
    insert: function(root, child) {
    var $lastView = root.find( ".foo" ).last(),
    $lastBar = root.find( ".foo.bar" ).last();

    if( $lastView.length ) {
    child.insertAfter( $lastView );
    } else if( $lastBar.length ) {
    child.insertAfter( $lastBar );
    } else {
    root.append( child );
    }
    }

    // ...
    })
    1 change: 0 additions & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    h1 Insert nested views into specific positions
  2. rsoares created this gist Jan 14, 2014.
    1 change: 1 addition & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    h1 Insert nested views into specific positions