historiqueux 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +47 -0
- data/Rakefile +23 -0
- data/app/assets/javascripts/historiqueux/application.js.coffee +0 -0
- data/app/assets/javascripts/historiqueux/history.js.coffee +100 -0
- data/app/controllers/historiqueux/application_controller.rb +3 -0
- data/app/controllers/historiqueux/history_controller.rb +96 -0
- data/app/helpers/historiqueux/application_helper.rb +4 -0
- data/app/views/historiqueux/history/index.html.erb +78 -0
- data/app/views/historiqueux/history/index_relations.html.erb +102 -0
- data/app/views/historiqueux/history/show.html.erb +120 -0
- data/config/cucumber.yml +8 -0
- data/config/routes.rb +7 -0
- data/lib/historiqueux/engine.rb +10 -0
- data/lib/historiqueux/version.rb +3 -0
- data/lib/historiqueux.rb +4 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/historiqueux_tasks.rake +4 -0
- metadata +105 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cbe92507e7b4b7f4f4eb8b5e74025aa28dedebe6
|
4
|
+
data.tar.gz: 798587382d643e7aad24a2c7505dd4712f9131e3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a530d9731f4e85b46f34741dfb545bcfdfe2f5ef7612977c3820ee950b5ba0260902f3f980ccce38e89628557a69aa088d86b91e6588695f09313ffa8cee6742
|
7
|
+
data.tar.gz: 094b3780f5009f849ee9b9118688eaa6fab72697d9dfb621fb61aee1cb106f702bb778483b525c4b9759aaea5c38f363a9775453a5f3b14ef2a36847f9b799ec
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
= Historiqueux
|
2
|
+
|
3
|
+
This is a mountable gem that add a bootstrap presentation layer to paper_trail.
|
4
|
+
|
5
|
+
Inject some routes in your app that provides screens that help visualize any ressource versions, values and differences.
|
6
|
+
Provide the ability no navigate related entities versions details."
|
7
|
+
|
8
|
+
|
9
|
+
== Installation :
|
10
|
+
|
11
|
+
Add the following line to your Gemfile
|
12
|
+
|
13
|
+
=== Rails 4
|
14
|
+
|
15
|
+
gem 'historiqueux'
|
16
|
+
|
17
|
+
== Usage
|
18
|
+
|
19
|
+
Mount the historiqueux gem in your routes:
|
20
|
+
|
21
|
+
mount Historiqueux::Engine => "/"
|
22
|
+
|
23
|
+
The routes that will be available are :
|
24
|
+
|
25
|
+
get '/historiqueux/:resource/:resource_id', to: 'history#index'
|
26
|
+
get '/historiqueux/:resource/:resource_id/relations/:relation_resource', to: 'history#index_relations'
|
27
|
+
get '/historiqueux/:resource/:resource_id/:version_id', to: 'history#show'
|
28
|
+
|
29
|
+
where :resource is the name of your model (you can use namespace)
|
30
|
+
|
31
|
+
|
32
|
+
====Include the needed javascript file in your application.js or application.js.coffee
|
33
|
+
|
34
|
+
==== Javascript
|
35
|
+
//= require historiqueux/history
|
36
|
+
==== CoffeeScript
|
37
|
+
#= require historiqueux/history
|
38
|
+
|
39
|
+
== Contributors
|
40
|
+
|
41
|
+
{Serge Savoie}[http://github.com/seurdge]
|
42
|
+
|
43
|
+
{Rémi Gagnon}[http://github.com/rgagnon]
|
44
|
+
|
45
|
+
== More
|
46
|
+
|
47
|
+
http://www.groupefungo.ca
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Historiqueux'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
File without changes
|
@@ -0,0 +1,100 @@
|
|
1
|
+
$ () ->
|
2
|
+
$(document).delegate '.event_open_relation', 'click', (e) ->
|
3
|
+
console.log('event_open_relation')
|
4
|
+
event.stopPropagation()
|
5
|
+
event.preventDefault()
|
6
|
+
parent = $(@).data('parent')
|
7
|
+
resource = $(@).data('resource')
|
8
|
+
id = $(@).data('id')
|
9
|
+
relation = $(@).data('relation')
|
10
|
+
console.log('parent_div = ' + parent)
|
11
|
+
console.log('resource = ' + resource)
|
12
|
+
console.log('resource_id = ' + id)
|
13
|
+
console.log('relation = ' + relation)
|
14
|
+
$.ajax
|
15
|
+
url: '/historiqueux/' + resource + '/' + id + '/relations/' + relation
|
16
|
+
type: "get"
|
17
|
+
dataType: "html"
|
18
|
+
data:
|
19
|
+
"parent_div": parent
|
20
|
+
success: (returnData) ->
|
21
|
+
console.log('success')
|
22
|
+
console.log("#" + parent)
|
23
|
+
console.log(returnData)
|
24
|
+
if parent
|
25
|
+
$("#" + parent).html(returnData)
|
26
|
+
else
|
27
|
+
console.log('no parent')
|
28
|
+
$('body').html(returnData)
|
29
|
+
@
|
30
|
+
error: (e) ->
|
31
|
+
alert(e)
|
32
|
+
@
|
33
|
+
@
|
34
|
+
|
35
|
+
$(document).delegate '#event_back', 'click', (e) ->
|
36
|
+
console.log('event_back click')
|
37
|
+
event.stopPropagation()
|
38
|
+
event.preventDefault()
|
39
|
+
parent = $(@).data('parent')
|
40
|
+
resource = $(@).data('resource')
|
41
|
+
id = $(@).data('id')
|
42
|
+
console.log('parent_div = ' + parent)
|
43
|
+
console.log('resource = ' + resource)
|
44
|
+
console.log('resource_id = ' + id)
|
45
|
+
$.ajax
|
46
|
+
url: "/historiqueux/" + resource + "/" + id + "?parent_div=" + parent
|
47
|
+
type: "get"
|
48
|
+
dataType: "html"
|
49
|
+
data:
|
50
|
+
"parent_div": parent
|
51
|
+
success: (returnData) ->
|
52
|
+
console.log('success')
|
53
|
+
console.log("#" + parent)
|
54
|
+
console.log(returnData)
|
55
|
+
if parent
|
56
|
+
$("#" + parent).html(returnData)
|
57
|
+
else
|
58
|
+
console.log('no parent')
|
59
|
+
$('body').html(returnData)
|
60
|
+
@
|
61
|
+
error: (e) ->
|
62
|
+
alert(e)
|
63
|
+
@
|
64
|
+
@
|
65
|
+
|
66
|
+
$(document).delegate '.event_open_details', 'click', (e) ->
|
67
|
+
console.log('event_open_details click')
|
68
|
+
event.stopPropagation()
|
69
|
+
event.preventDefault()
|
70
|
+
event_id = $(@).data('event-id')
|
71
|
+
console.log('event-id = ' + event_id)
|
72
|
+
parent = $(@).data('parent-div')
|
73
|
+
resource = $(@).data('resource')
|
74
|
+
id = $(@).data('resource-id')
|
75
|
+
console.log('parent_div = ' + parent)
|
76
|
+
console.log('resource = ' + resource)
|
77
|
+
console.log('resource_id = ' + id)
|
78
|
+
console.log('url = ' + "/historiqueux/" + resource + "/" + id + "/" + event_id)
|
79
|
+
$.ajax
|
80
|
+
url: "/historiqueux/" + resource + "/" + id + "/" + event_id
|
81
|
+
type: "get"
|
82
|
+
dataType: "html"
|
83
|
+
data:
|
84
|
+
"parent_div": parent
|
85
|
+
success: (returnData) ->
|
86
|
+
console.log('success')
|
87
|
+
console.log("#" + parent)
|
88
|
+
console.log(returnData)
|
89
|
+
if parent
|
90
|
+
$("#" + parent).html(returnData)
|
91
|
+
else
|
92
|
+
console.log('no parent')
|
93
|
+
$('body').html(returnData)
|
94
|
+
@
|
95
|
+
error: (e) ->
|
96
|
+
alert(e)
|
97
|
+
@
|
98
|
+
@
|
99
|
+
|
100
|
+
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require_dependency "historiqueux/application_controller"
|
2
|
+
|
3
|
+
module Historiqueux
|
4
|
+
class HistoryController < ApplicationController
|
5
|
+
|
6
|
+
def index
|
7
|
+
|
8
|
+
resource = fetch_resource
|
9
|
+
if resource.respond_to?('versions')
|
10
|
+
@history = resource.versions
|
11
|
+
@parent_div = params[:parent_div]
|
12
|
+
|
13
|
+
@relations = @resourceKlass.reflect_on_all_associations.map { |r| "#{r.name}" }.reject { |i| i=='versions' }
|
14
|
+
end
|
15
|
+
|
16
|
+
if request.xhr?
|
17
|
+
render :layout => false
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def index_relations
|
23
|
+
|
24
|
+
resource = fetch_resource
|
25
|
+
if resource.respond_to?('versions')
|
26
|
+
@history = resource.versions
|
27
|
+
@parent_div = params[:parent_div]
|
28
|
+
|
29
|
+
fetch_relation_resource(params[:relation_resource], resource)
|
30
|
+
|
31
|
+
if @relation_resourceKlass
|
32
|
+
|
33
|
+
@relations = @relation_resourceKlass.reflect_on_all_associations.map { |r| "#{r.name}" }.reject { |i| i=='versions' }
|
34
|
+
|
35
|
+
@history_relations = {}
|
36
|
+
@relation_resource_list.each do |rr|
|
37
|
+
@history_relations.store(rr.id, rr.versions)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
if request.xhr?
|
44
|
+
render :layout => false
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def show
|
51
|
+
|
52
|
+
@parent_div = params[:parent_div]
|
53
|
+
@model_instance = fetch_resource
|
54
|
+
version_id = params[:version_id]
|
55
|
+
@preceding_version = @model_instance.versions.where(:id => version_id).first
|
56
|
+
@version = @preceding_version.next
|
57
|
+
|
58
|
+
if request.xhr?
|
59
|
+
render :layout => false
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def fetch_resource
|
65
|
+
@resource = params[:resource]
|
66
|
+
@class_name = classify_namespace(params[:resource])
|
67
|
+
@resourceKlass = eval(@class_name)
|
68
|
+
@resource_id = params[:resource_id]
|
69
|
+
@resourceKlass.find(@resource_id)
|
70
|
+
end
|
71
|
+
|
72
|
+
def fetch_relation_resource(relation_resource, resource)
|
73
|
+
@relation_resource = relation_resource
|
74
|
+
@relation_resource_list = resource.send(@relation_resource)
|
75
|
+
if @relation_resource_list.first.respond_to?('versions')
|
76
|
+
namespaced_class_name = @relation_resource_list.first.versions.first.item_type
|
77
|
+
@relation_class_name = classify_namespace(namespaced_class_name)
|
78
|
+
@relation_resourceKlass = eval(@relation_class_name)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def classify_namespace(const)
|
83
|
+
const = const.classify
|
84
|
+
if const.include?('::')
|
85
|
+
new_const = ''
|
86
|
+
splitted = const.split('::')
|
87
|
+
for str in splitted do
|
88
|
+
new_const = new_const + str.classify + '::'
|
89
|
+
end
|
90
|
+
const = new_const[0..(new_const.length - 3)]
|
91
|
+
end
|
92
|
+
const
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<div class="container">
|
2
|
+
|
3
|
+
<div class="row">
|
4
|
+
|
5
|
+
<div class="col-md-2">
|
6
|
+
<h3><%= @resource %> no <%= @resource_id %></h3>
|
7
|
+
</div>
|
8
|
+
<div class="col-md-2">
|
9
|
+
|
10
|
+
<div class="box_content">
|
11
|
+
|
12
|
+
<div>
|
13
|
+
<a role="button" id="toggler" href="#" data-toggle="collapse" class="btn btn-primary btn-xs" data-target="#demo">
|
14
|
+
Relations
|
15
|
+
</a>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div id="demo" class="collapse">
|
19
|
+
<% @relations.each do |relation| %>
|
20
|
+
<ul class="nav nav-list">
|
21
|
+
|
22
|
+
<%= link_to relation, "#", :class => 'event_open_relation',
|
23
|
+
:data => {:parent => @parent_div,
|
24
|
+
:resource => @resource.downcase,
|
25
|
+
:id => @resource_id,
|
26
|
+
:relation => relation} %>
|
27
|
+
|
28
|
+
|
29
|
+
</ul>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
</div>
|
34
|
+
|
35
|
+
</div>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<table class="table table-hover">
|
40
|
+
<thead>
|
41
|
+
<tr>
|
42
|
+
<th>Évènement</th>
|
43
|
+
<th>Type d'élément</th>
|
44
|
+
<th>Fait par</th>
|
45
|
+
<th class="col-md-4">Date</th>
|
46
|
+
<th></th>
|
47
|
+
</tr>
|
48
|
+
</thead>
|
49
|
+
|
50
|
+
<% @history.each_with_index do |event, idx| %>
|
51
|
+
|
52
|
+
|
53
|
+
<tr class="event_open_details"
|
54
|
+
id="row<%= idx + 1 %>"
|
55
|
+
data-event-id="<%= event.id %>"
|
56
|
+
data-parent-div="<%= @parent_div %>"
|
57
|
+
data-resource="<%= @resource.downcase %>"
|
58
|
+
data-resource-id="<%= @resource_id %>">
|
59
|
+
|
60
|
+
<td>
|
61
|
+
<%= event.event %>
|
62
|
+
</td>
|
63
|
+
<td>
|
64
|
+
<%= event.item_type %>
|
65
|
+
</td>
|
66
|
+
<td>
|
67
|
+
<%= event.whodunnit %>
|
68
|
+
</td>
|
69
|
+
<td>
|
70
|
+
<%= event.created_at.in_time_zone('Eastern Time (US & Canada)').strftime("%Y-%m-%d %H:%M:%S") %>
|
71
|
+
</td>
|
72
|
+
|
73
|
+
</tr>
|
74
|
+
<% end %>
|
75
|
+
</table>
|
76
|
+
<br/>
|
77
|
+
|
78
|
+
</div>
|
@@ -0,0 +1,102 @@
|
|
1
|
+
<div class="container">
|
2
|
+
|
3
|
+
<h2>Liste des <%= @relation_resource %> liés au <%= @resource %> no <%= @resource_id %></h2>
|
4
|
+
<br/>
|
5
|
+
<% @relation_resource_list.each_with_index do |relation_resource, idx| %>
|
6
|
+
|
7
|
+
<div class="row">
|
8
|
+
<div class="col-md-2">
|
9
|
+
<h3><%= @relation_resource %> no <%= relation_resource.id %></h3>
|
10
|
+
</div>
|
11
|
+
<div class="col-md-2">
|
12
|
+
|
13
|
+
<div>
|
14
|
+
<a role="button" id="toggler" href="#" data-toggle="collapse" class="btn btn-primary btn-xs" data-target="#demo<%= idx %>">
|
15
|
+
Relations
|
16
|
+
</a>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<% if @relations %>
|
20
|
+
<div id="demo<%= idx %>" class="collapse">
|
21
|
+
<% @relations.each do |relation| %>
|
22
|
+
<ul class="nav nav-list">
|
23
|
+
|
24
|
+
<%= link_to relation, "#", :id => "event_open_relation", :class => '',
|
25
|
+
:data => {:parent => @parent_div,
|
26
|
+
:resource => @resource.downcase,
|
27
|
+
:id => @resource_id,
|
28
|
+
:relation => relation} %>
|
29
|
+
|
30
|
+
|
31
|
+
</ul>
|
32
|
+
<% end %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<% if @history_relations %>
|
41
|
+
|
42
|
+
<div class="box_content">
|
43
|
+
|
44
|
+
<table class="table table-hover">
|
45
|
+
<thead>
|
46
|
+
<tr>
|
47
|
+
<th>Évènement</th>
|
48
|
+
<th>Type d'élément</th>
|
49
|
+
<th>Fait par</th>
|
50
|
+
<th>Date</th>
|
51
|
+
</tr>
|
52
|
+
</thead>
|
53
|
+
|
54
|
+
<% @history_relations[relation_resource.id].each_with_index do |event, idx| %>
|
55
|
+
|
56
|
+
|
57
|
+
<tr id="row<%= idx + 1 %>"
|
58
|
+
data-event-id="<%= event.id %>"
|
59
|
+
data-parent-div="<%= @parent_div %>"
|
60
|
+
data-resource="<%= @resource.downcase %>"
|
61
|
+
data-resource-id="<%= @resource_id %>">
|
62
|
+
|
63
|
+
<td>
|
64
|
+
<%= event.event %>
|
65
|
+
</td>
|
66
|
+
<td>
|
67
|
+
<%= event.item_type %>
|
68
|
+
</td>
|
69
|
+
<td>
|
70
|
+
<%= event.whodunnit %>
|
71
|
+
</td>
|
72
|
+
<td>
|
73
|
+
<%= event.created_at.in_time_zone('Eastern Time (US & Canada)').strftime("%Y-%m-%d %H:%M:%S") %>
|
74
|
+
</td>
|
75
|
+
</tr>
|
76
|
+
<% end %>
|
77
|
+
</table>
|
78
|
+
|
79
|
+
</div>
|
80
|
+
|
81
|
+
<% else %>
|
82
|
+
ENTITÉ NON VERSIONNÉE
|
83
|
+
<% end %>
|
84
|
+
|
85
|
+
<br/>
|
86
|
+
|
87
|
+
<% end %>
|
88
|
+
|
89
|
+
<div class="form-actions form-actions-padding-sm">
|
90
|
+
<div class="row">
|
91
|
+
<div class="col-md-10 col-md-offset-5">
|
92
|
+
|
93
|
+
<%= link_to "Retour", "#", :id => "event_back", :class => 'btn btn-primary',
|
94
|
+
:data => {:parent => @parent_div,
|
95
|
+
:resource => @resource.downcase,
|
96
|
+
:id => @resource_id} %>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
@@ -0,0 +1,120 @@
|
|
1
|
+
<div class="container">
|
2
|
+
|
3
|
+
<div class="col-sm-12">
|
4
|
+
<div class="box">
|
5
|
+
|
6
|
+
<h3 id="event">Évènement : <%= @preceding_version.event %></h3>
|
7
|
+
|
8
|
+
<h3>Quand : <%= @preceding_version.created_at.in_time_zone('Eastern Time (US & Canada)').strftime("%Y-%m-%d %H:%M:%S") %></h3>
|
9
|
+
|
10
|
+
<h3>Fait par : <%= @preceding_version.whodunnit %></h3>
|
11
|
+
|
12
|
+
<h3 id="item_type">Élément : <%= @preceding_version.item_type %></h3>
|
13
|
+
|
14
|
+
<br/>
|
15
|
+
|
16
|
+
<div class="col-sm-10">
|
17
|
+
|
18
|
+
<div class="panel-group" id="accordion">
|
19
|
+
<div class="panel panel-default">
|
20
|
+
<div class="panel-heading">
|
21
|
+
|
22
|
+
<h4 class="panel-title">
|
23
|
+
<a data-toggle="collapse" data-parent="" href="#collapseOne">Valeurs de cette version</a>
|
24
|
+
</h4>
|
25
|
+
</div>
|
26
|
+
<div id="collapseOne" class="panel-collapse collapse">
|
27
|
+
<div class="panel-body">
|
28
|
+
<p id="current_version_values">
|
29
|
+
|
30
|
+
<% unless @version.blank? %>
|
31
|
+
<% if @version and @version.reify %>
|
32
|
+
<% @version.reify.attributes.each do |attribute| %>
|
33
|
+
<br/>
|
34
|
+
<%= attribute %>
|
35
|
+
<% end %>
|
36
|
+
<% else %>
|
37
|
+
Aucune valeur
|
38
|
+
<% end %>
|
39
|
+
<% else %>
|
40
|
+
<% @model_instance.attributes.each do |attribute| %>
|
41
|
+
<br/>
|
42
|
+
<%= attribute %>
|
43
|
+
<% end %>
|
44
|
+
|
45
|
+
<% end %>
|
46
|
+
|
47
|
+
|
48
|
+
</p>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
<div class="panel panel-default">
|
53
|
+
<div class="panel-heading">
|
54
|
+
<h4 class="panel-title">
|
55
|
+
<a data-toggle="collapse" data-parent="" href="#collapseTwo">Valeurs de la version
|
56
|
+
précédente</a>
|
57
|
+
</h4>
|
58
|
+
</div>
|
59
|
+
<div id="collapseTwo" class="panel-collapse collapse">
|
60
|
+
<div class="panel-body">
|
61
|
+
<p id="preceding_version_values">
|
62
|
+
|
63
|
+
<% if @preceding_version and @preceding_version.reify %>
|
64
|
+
<% @preceding_version.reify.attributes.each do |attribute| %>
|
65
|
+
<br/>
|
66
|
+
<%= attribute %>
|
67
|
+
<% end %>
|
68
|
+
<% else %>
|
69
|
+
Aucune valeur
|
70
|
+
<% end %>
|
71
|
+
|
72
|
+
</p>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
<div class="panel panel-default">
|
77
|
+
<div class="panel-heading">
|
78
|
+
<h4 class="panel-title">
|
79
|
+
<a data-toggle="collapse" data-parent="" href="#collapseThree">Différence(s)</a>
|
80
|
+
</h4>
|
81
|
+
</div>
|
82
|
+
<div id="collapseThree" class="panel-collapse collapse">
|
83
|
+
<div class="panel-body">
|
84
|
+
<p id="differences">
|
85
|
+
|
86
|
+
<% if @preceding_version and @preceding_version.respond_to?(:changeset) and @preceding_version.event != 'create' %>
|
87
|
+
<% @preceding_version.changeset.each do |attribute| %>
|
88
|
+
<br/>
|
89
|
+
<%= attribute %>
|
90
|
+
<% end %>
|
91
|
+
<% else %>
|
92
|
+
Aucune valeur
|
93
|
+
<% end %>
|
94
|
+
|
95
|
+
</p>
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div class="form-actions form-actions-padding-sm">
|
102
|
+
<div class="row">
|
103
|
+
<div class="col-md-10 col-md-offset-5">
|
104
|
+
|
105
|
+
<%= link_to "Retour", "#", :id => "event_back", :class => 'btn btn-primary',
|
106
|
+
:data => {:parent => @parent_div,
|
107
|
+
:resource => @resource.downcase,
|
108
|
+
:id => @resource_id} %>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
</div>
|
data/config/cucumber.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
default: <%= std_opts %> features
|
7
|
+
wip: --tags @wip:3 --wip features
|
8
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
data/config/routes.rb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Historiqueux::Engine.routes.draw do
|
2
|
+
|
3
|
+
get '/historiqueux/:resource/:resource_id', to: 'history#index'
|
4
|
+
get '/historiqueux/:resource/:resource_id/relations/:relation_resource', to: 'history#index_relations'
|
5
|
+
get '/historiqueux/:resource/:resource_id/:version_id', to: 'history#show'
|
6
|
+
|
7
|
+
end
|
data/lib/historiqueux.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
|
8
|
+
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
9
|
+
|
10
|
+
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
11
|
+
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'cucumber/rake/task'
|
15
|
+
|
16
|
+
namespace :cucumber do
|
17
|
+
Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
|
18
|
+
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
19
|
+
t.fork = true # You may get faster startup if you set this to false
|
20
|
+
t.profile = 'default'
|
21
|
+
end
|
22
|
+
|
23
|
+
Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
|
24
|
+
t.binary = vendored_cucumber_bin
|
25
|
+
t.fork = true # You may get faster startup if you set this to false
|
26
|
+
t.profile = 'wip'
|
27
|
+
end
|
28
|
+
|
29
|
+
Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
30
|
+
t.binary = vendored_cucumber_bin
|
31
|
+
t.fork = true # You may get faster startup if you set this to false
|
32
|
+
t.profile = 'rerun'
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Run all features'
|
36
|
+
task :all => [:ok, :wip]
|
37
|
+
|
38
|
+
task :statsetup do
|
39
|
+
require 'rails/code_statistics'
|
40
|
+
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
|
41
|
+
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
desc 'Alias for cucumber:ok'
|
45
|
+
task :cucumber => 'cucumber:ok'
|
46
|
+
|
47
|
+
task :default => :cucumber
|
48
|
+
|
49
|
+
task :features => :cucumber do
|
50
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
51
|
+
end
|
52
|
+
|
53
|
+
# In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
|
54
|
+
task 'test:prepare' do
|
55
|
+
end
|
56
|
+
|
57
|
+
task :stats => 'cucumber:statsetup'
|
58
|
+
rescue LoadError
|
59
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
60
|
+
task :cucumber do
|
61
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
metadata
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: historiqueux
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Groupe Fungo inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rspec-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: paper_trail
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Inject some routes in your app that provides screens that help visualize
|
56
|
+
any ressource versions, values and differences. Provide the ability no navigate
|
57
|
+
related entities versions details.
|
58
|
+
email:
|
59
|
+
- ssavoie@fungo.ca
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- MIT-LICENSE
|
65
|
+
- README.rdoc
|
66
|
+
- Rakefile
|
67
|
+
- app/assets/javascripts/historiqueux/application.js.coffee
|
68
|
+
- app/assets/javascripts/historiqueux/history.js.coffee
|
69
|
+
- app/controllers/historiqueux/application_controller.rb
|
70
|
+
- app/controllers/historiqueux/history_controller.rb
|
71
|
+
- app/helpers/historiqueux/application_helper.rb
|
72
|
+
- app/views/historiqueux/history/index.html.erb
|
73
|
+
- app/views/historiqueux/history/index_relations.html.erb
|
74
|
+
- app/views/historiqueux/history/show.html.erb
|
75
|
+
- config/cucumber.yml
|
76
|
+
- config/routes.rb
|
77
|
+
- lib/historiqueux.rb
|
78
|
+
- lib/historiqueux/engine.rb
|
79
|
+
- lib/historiqueux/version.rb
|
80
|
+
- lib/tasks/cucumber.rake
|
81
|
+
- lib/tasks/historiqueux_tasks.rake
|
82
|
+
homepage: https://github.com/groupefungo/historiqueux
|
83
|
+
licenses: []
|
84
|
+
metadata: {}
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
requirements: []
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 2.2.2
|
102
|
+
signing_key:
|
103
|
+
specification_version: 4
|
104
|
+
summary: Add a bootstrap presentation layer to paper_trail
|
105
|
+
test_files: []
|