saw 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -9
- data/examples/active_admin/saw.rb +23 -15
- data/lib/saw/controller.rb +2 -1
- data/lib/saw/version.rb +1 -1
- data/lib/saw/visit.rb +1 -1
- data/test/models/visit.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b24e7857a6b04db861aa6a2d7619eb49aa32f650
|
4
|
+
data.tar.gz: f1eb037fbf8a252336b49a19fe6f370f95400893
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0f15a0c4da218986cf43bd8c94f61c461ce765d654f43b9f22785d30e16a4774fb9c806481e6a0225a47122a7c2961c38eefa3a29eee861505da7b0f828a492
|
7
|
+
data.tar.gz: 1a219ea218250fdc53349bcbad50ef99c8b88dbe35b5bb29600bd9e8ee035a92e1db86fb3317326ae7381905006c3e50c9d3545d387471f03b5854bc8fae0a33
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Saw
|
2
2
|
|
3
|
-
|
3
|
+
As a developer/admin, I saw user coming to registration page, with parameters. I saw user clking on "Connect".
|
4
|
+
|
5
|
+
`What the user might have done?` this is a common question developers do have while debugging any issue, going through the logs checking for particular log statement or request param, and then after spending an hour coming with a decision that user must have done this. Saw saves this hour, time spent on debugging and answering this question `What user might have done?`.
|
6
|
+
|
7
|
+
This is one more simply way to track what user is doing.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -10,20 +14,62 @@ Add this line to your application's Gemfile:
|
|
10
14
|
|
11
15
|
And then execute:
|
12
16
|
|
13
|
-
$ bundle
|
17
|
+
$ bundle install
|
14
18
|
|
15
19
|
Or install it yourself as:
|
16
20
|
|
17
21
|
$ gem install saw
|
18
22
|
|
23
|
+
And then install
|
24
|
+
|
25
|
+
$ rails generate saw install
|
26
|
+
|
27
|
+
Next
|
28
|
+
|
29
|
+
$ rake db:migrate
|
30
|
+
|
19
31
|
## Usage
|
20
32
|
|
21
|
-
|
33
|
+
before_filter :saw
|
34
|
+
|
35
|
+
Or
|
36
|
+
|
37
|
+
saw 'visiting details page', { :extra => 'something' }
|
38
|
+
|
39
|
+
Or
|
40
|
+
|
41
|
+
# in views
|
42
|
+
|
43
|
+
<button id="button-retry" onclick="open_pop_up_form();" class="mybutton medium green">
|
44
|
+
Connect to your Device
|
45
|
+
</button>
|
46
|
+
|
47
|
+
<script type="text/javascript">
|
48
|
+
function open_pop_up_form(){
|
49
|
+
$.post("/visits", { doing: "clicked on 'Connect to your Device' " } );
|
50
|
+
....
|
51
|
+
|
52
|
+
Access users' visits as
|
53
|
+
|
54
|
+
visit = @user.visits.sample
|
55
|
+
visit.user_agent
|
56
|
+
visit.remote_host
|
57
|
+
visit.hits.map(&:note)
|
58
|
+
visit.lasts # => 00:12:45
|
59
|
+
visit.title # => 00:12:45 on Apr 14, 2013
|
60
|
+
visit.summary
|
61
|
+
|
62
|
+
hit = visit.hits.sample
|
63
|
+
hit.note
|
64
|
+
hit.url
|
65
|
+
hit.http_method
|
66
|
+
hit.action
|
67
|
+
hit.json_data
|
68
|
+
hit.created_at
|
69
|
+
|
70
|
+
A visit is not a single request made to the server but a session. Similalry a hit is not necessary to be a request hit.
|
71
|
+
|
72
|
+
## Testing (TBD)
|
22
73
|
|
23
|
-
|
74
|
+
ruby test/saw_test.rb
|
24
75
|
|
25
|
-
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
@@ -2,17 +2,18 @@ ActiveAdmin.register Visit do
|
|
2
2
|
menu :parent => "Users"
|
3
3
|
belongs_to :user, :optional => true
|
4
4
|
|
5
|
-
actions :
|
5
|
+
actions :index, :show, :destroy
|
6
6
|
|
7
7
|
index do
|
8
8
|
selectable_column
|
9
9
|
|
10
|
-
column
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
column :note do |resource|
|
11
|
+
resource.hits.first.note.html_safe
|
12
|
+
end
|
13
|
+
|
14
|
+
column :user
|
15
|
+
column :hits do |resource|
|
16
|
+
link_to("#{resource.hits.count}", admin_visit_hits_path(resource))
|
16
17
|
end
|
17
18
|
|
18
19
|
column :user_agent
|
@@ -27,22 +28,29 @@ ActiveAdmin.register Visit do
|
|
27
28
|
|
28
29
|
default_actions
|
29
30
|
end
|
31
|
+
|
32
|
+
filter :user_username, :as => :string
|
33
|
+
filter :user_agent
|
34
|
+
filter :remote_host
|
35
|
+
filter :created_at
|
30
36
|
end
|
31
37
|
|
32
38
|
ActiveAdmin.register Hit do
|
33
|
-
menu
|
39
|
+
menu false
|
40
|
+
|
34
41
|
belongs_to :visit, :optional => true
|
35
42
|
|
36
|
-
actions :
|
43
|
+
actions :index, :show, :destroy
|
37
44
|
|
38
45
|
index do
|
39
46
|
selectable_column
|
40
|
-
column :
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
column "Time", :sortable => :created_at do |resource|
|
48
|
+
resource.created_at.strftime('%T %Z')
|
49
|
+
end
|
50
|
+
column :note do |resource|
|
51
|
+
resource.note.html_safe
|
52
|
+
end
|
53
|
+
|
46
54
|
default_actions
|
47
55
|
end
|
48
56
|
end
|
data/lib/saw/controller.rb
CHANGED
data/lib/saw/version.rb
CHANGED
data/lib/saw/visit.rb
CHANGED
data/test/models/visit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amol Pujari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|