Skip to content

Instantly share code, notes, and snippets.

@jszmajda
Created October 30, 2012 20:44
Show Gist options
  • Save jszmajda/3982909 to your computer and use it in GitHub Desktop.
Save jszmajda/3982909 to your computer and use it in GitHub Desktop.
def index
if params[:client_id].present? && params[:listing_group_id].present?
@deltas = some lookup...
respond_with @deltas, ajax: { partial: render_to_string(partial: 'histories', locals: {deltas: @deltas}) }
else
data_table_request(catalog_item_deltas_table) # or whatever
end
end
= @catalog_items_table
%div{style: 'display: none'}
#deltas
:javascript
function loadHistories(client_id, listing_group_id){
$.ajax({
type: 'GET',
url: '/client/'+client_id+'/listing_group/'+listing_group_id+'/catalog_item_deltas.ajax',
success: function(data){
$('#deltas').html(data.partial);
$.fancybox($('#deltas'));
},
error: function(errors){
alert("Got error");
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment