Skip to content

Latest commit

 

History

History
65 lines (37 loc) · 1.76 KB

File metadata and controls

65 lines (37 loc) · 1.76 KB

This is a mountable gem that add a bootstrap presentation layer to paper_trail.

Inject some routes in your app that provides screens to help visualize any ressource versions, values and differences. Provide the ability no navigate related entities versions details.

Add the following line to your Gemfile

gem 'historiqueux'

Mount the historiqueux gem in your routes:

mount Historiqueux::Engine => "/"

The routes that will be available are :

get '/historiqueux/:resource/:resource_id', to: 'history#index'
get '/historiqueux/:resource/:resource_id/relations/:relation_resource', to: 'history#index_relations'
get '/historiqueux/:resource/:resource_id/:version_id', to: 'history#show'

where :resource is the name of your model (you can use namespace)

//= require historiqueux/history
#= require historiqueux/history

Call url of historiqueux screens, for exemple, like that:

<%= link_to "<i class='icon-time text-blue'></i> Historique".html_safe,
    "/historiqueux/client::customer/#{@customer.id}?parent_div=ajax_target",
    :id => "history_tab", :data => {:remote => true} %>

With a binding like that in your application.js.coffee

$(document).delegate '#history_tab', 'ajax:success', (e, data, status, xhr) ->
  $('.tab_header').removeClass('active')
  $('#history_tab_header').addClass('active')
  $('#ajax_target').html(xhr.responseText)

Andy Stewart - The creator of papertrail.

Serge Savoie

Rémi Gagnon

www.groupefungo.ca