This seems like a trivial question where I’m likely stumped on the syntax.
Basically, I would like a FancyBox to load a BB View that I have when a link is clicked.
Previously, it would load a BB route, and redirect to a page with the desired view and everything else :
$('.edit_list').show().attr('href', '#lists/' + list.id + '/edit')
my current view
app.views.GlobalListEdit = Backbone.View.extend({
tagName: "div",
className: "global_list_edit list_view",
title: 'Edit - ',
template: _.template('<div class="error"></div>' +
'<label for="global_list_edit_name">Group Name</label>' +
... truncated ...
my current jquery
$('.edit_list')
.on('click', function(){
// $.fancybox({ href: '#' + '#lists/' + list.id + '/edit' });
// ^ bad idea #1 . This loads the whole other page sans the actual edit form..
// $.fancybox({ new app.views.GlobalListEdit({el: $('body')}).render() });
// ^ This psuedo code is more or less what I want. To load a new instant of the BB View.
return false;
});
So I’m lookin to..
- answer how to pass the dynamic
list.idto that edit call. - how to render that view.
Thanks!
You can hand
$.fancyboxa jQuery object and views have an$elso you could do this:Demo: http://jsfiddle.net/ambiguous/ncmd7/
Or you could hand
$.fancyboxthe DOM element:Demo: http://jsfiddle.net/ambiguous/t7Sbj/