File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ $ rake db:migrate
53
53
54
54
5 . Include where to show the heatmap:
55
55
``` erb
56
- <%= show_heatmap(request.path) %>
56
+ <%= show_heatmap %>
57
57
```
58
58
6 . Before adding headmap.js in the application install ** jquery-rails** gem and require it in application.js file
59
59
``` js
@@ -68,14 +68,14 @@ $ rake db:migrate
68
68
## Viewing Heat Maps
69
69
Use the helper
70
70
``` erb
71
- <%= show_heatmap(request.path) %>
71
+ <%= show_heatmap %>
72
72
```
73
73
The argument is the path of current page. This way the helper will only display the respective heatmap.
74
74
The viewing can be done in multiple ways, for example if you want only the admin users to view heatmap, you can do something like:
75
75
76
76
``` erb
77
77
<% if admin_user_signed_in? %>
78
- <%= show_heatmap(request.path) %>
78
+ <%= show_heatmap %>
79
79
<% end %>
80
80
```
81
81
@@ -89,7 +89,7 @@ You can use:
89
89
90
90
``` erb
91
91
<% if request.query_parameters.include?("see_heatmap") %>
92
- <%= show_heatmap(request.path) %>
92
+ <%= show_heatmap %>
93
93
<% end %>
94
94
```
95
95
Original file line number Diff line number Diff line change @@ -240,11 +240,8 @@ def show_heatmap(type = false)
240
240
heatmapInstance.addData(data_xpath);
241
241
var scroll = JSON.parse('#{ raw ( @scroll_data . to_json . html_safe ) } ');
242
242
var scroll_data = scroll.map(function(element){
243
- var element = getElement(element.xpath);
244
- if (!element)
245
- return;
246
- width = element.getBoundingClientRect().width;
247
- height = element.getBoundingClientRect().height;
243
+ width = getElement(element.xpath).getBoundingClientRect().width;
244
+ height = getElement(element.xpath).getBoundingClientRect().height;
248
245
dot = document.createElement('div');
249
246
dot.className = "dot";
250
247
dot.style.left = (getOffset(element.xpath).x+ (width * element.offset_x)) + "px";
Original file line number Diff line number Diff line change 1
1
module Heatmap
2
2
module Rails
3
- VERSION = "0.1.4 "
3
+ VERSION = "0.2.0 "
4
4
end
5
5
end
You can’t perform that action at this time.
0 commit comments