ifd_tools 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module IfdTools
2
2
  class Tracking::Event < ActiveRecord::Base
3
3
 
4
- set_table_name "ifd_tools_tracking_events"
4
+ self.table_name = "ifd_tools_tracking_events"
5
5
 
6
6
  belongs_to :customer
7
7
  belongs_to :trackable, polymorphic: true
@@ -1,47 +1,27 @@
1
1
  ActiveAdmin.register_page "Dashboard" do
2
2
 
3
- menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
3
+ menu priority: 1, label: proc { I18n.t("active_admin.dashboard") }
4
4
 
5
- content :title => proc{ I18n.t("active_admin.dashboard") } do
5
+ # Put any additional content that you want displayed after the tracking information here
6
+ # Optionally, comment out the include below to include Dashboard Tracking to skip that entirely
7
+ #
8
+ # content :title => proc { I18n.t("active_admin.dashboard") } do
6
9
 
7
- # First row of content
8
- columns do
9
- column do
10
- panel "Top Users" do
11
- div(id: :top_users_panel) { render "usa_map" }
12
- end
13
- end
14
-
15
- column do
16
- panel "Top Content" do
17
- div(id: :top_content_panel) { render "line_graph" }
18
- end
19
- end
20
- end
21
-
22
- # Second row of content
23
- columns do
24
- column do
25
- panel "Most Active Users" do
26
- table_for Customer.top_users.limit(25) do
27
- column(:name) { |c| link_to c.full_name, [:admin, c] }
28
- column(:email) { |c| mail_to c.email, c.email }
29
- column(:phone) { |c| number_to_phone c.phone, area_code: true }
30
- column(:activity) { |c| c.tracking_events.count }
31
- end
32
- end
33
- end
34
- column do
35
- panel "Most Active Content" do
36
- table_for IfdTools::Tracking::Event.top_content do
37
- column(:name) { |event| link_to event.trackable_title, [:admin, event.trackable_resource] }
38
- column(:type) { |event| event.trackable_type }
39
- column(:activity) { |event| event.trackable_activity }
40
- end
41
- end
42
- end
43
- end
10
+ # columns do
11
+ # column do
12
+ # panel "Top Users" do
13
+ # render "some_partial"
14
+ # end
15
+ # end
16
+ # end
44
17
 
45
- end
18
+ # end
19
+
20
+ # This provides 4 panels of dashboard analytics (heatmap, content line graph, top users & top content)
21
+ has_dashboard_tracking
22
+
23
+ # This provides a panel for most recent contact requests, in a new row on the dashboard
24
+ # If you want to add any additional content to this new row, pass a block to this method & do it in there
25
+ has_recent_contact_requests
46
26
 
47
27
  end
@@ -0,0 +1,9 @@
1
+ module IfdTools
2
+ module ActiveAdmin
3
+ module CanCan
4
+
5
+ autoload :ActionItems, 'ifd_tools/active_admin/can_can/action_items'
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,40 @@
1
+ module IfdTools
2
+ module ActiveAdmin
3
+ module Dashboard
4
+ module ContactRequests
5
+
6
+ def self.included(dsl)
7
+
8
+ index_page_presenter = dsl.config.get_page_presenter(:index) || ::ActiveAdmin::PagePresenter.new(title: proc { I18n.t("active_admin.dashboard") })
9
+
10
+ dsl.content(title: index_page_presenter[:title]) do
11
+
12
+ # Execute any code provided in the application dashboard itself
13
+ instance_exec &index_page_presenter.block if index_page_presenter.block.present?
14
+
15
+ # Another row of content
16
+ columns do
17
+
18
+ column do
19
+ panel "Top Users" do
20
+ table_for ::IfdTools::ContactRequest.unread.limit(20) do
21
+ column(:name) { |cr| link_to truncate(cr.to_s, length: 35), [:admin, cr] }
22
+ column(:email) { |cr| mail_to cr.email, cr.email }
23
+ column(:phone) { |cr| number_to_phone cr.phone, area_code: true }
24
+ end
25
+ end
26
+ end
27
+
28
+ # Execute any additional code in this same row
29
+ instance_exec &index_page_presenter[:additional_content] if index_page_presenter[:additional_content].present?
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,25 @@
1
+ module IfdTools
2
+ module ActiveAdmin
3
+ module Dashboard
4
+ module PageAdditions
5
+
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+
10
+ def has_dashboard_tracking
11
+ include IfdTools::ActiveAdmin::Dashboard::Tracking
12
+ end
13
+
14
+ def has_recent_contact_requests(&block)
15
+ presenter = config.get_page_presenter(:index) || ::ActiveAdmin::PagePresenter.new
16
+ presenter.instance_variable_get("@options")[:additional_content] = block
17
+ include IfdTools::ActiveAdmin::Dashboard::ContactRequests
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,60 @@
1
+ module IfdTools
2
+ module ActiveAdmin
3
+ module Dashboard
4
+ module Tracking
5
+
6
+ def self.included(dsl)
7
+
8
+ index_page_presenter = dsl.config.get_page_presenter(:index) || ::ActiveAdmin::PagePresenter.new(title: proc { I18n.t("active_admin.dashboard") })
9
+
10
+ dsl.content(title: index_page_presenter[:title]) do
11
+
12
+ # First row of content
13
+ columns do
14
+ column do
15
+ panel "Top Users" do
16
+ div(id: :top_users_panel) { render "usa_map" }
17
+ end
18
+ end
19
+
20
+ column do
21
+ panel "Top Content" do
22
+ div(id: :top_content_panel) { render "line_graph" }
23
+ end
24
+ end
25
+ end
26
+
27
+ # Second row of content
28
+ columns do
29
+ column do
30
+ panel "Most Active Users" do
31
+ table_for Customer.top_users.limit(25) do
32
+ column(:name) { |c| link_to c.full_name, [:admin, c] }
33
+ column(:email) { |c| mail_to c.email, c.email }
34
+ column(:phone) { |c| number_to_phone c.phone, area_code: true }
35
+ column(:activity) { |c| c.tracking_events.count }
36
+ end
37
+ end
38
+ end
39
+ column do
40
+ panel "Most Active Content" do
41
+ table_for IfdTools::Tracking::Event.top_content do
42
+ column(:name) { |event| link_to event.trackable_title, [:admin, event.trackable_resource] }
43
+ column(:type) { |event| event.trackable_type }
44
+ column(:activity) { |event| event.trackable_activity }
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ # Execute any code provided in the application dashboard itself
51
+ instance_exec &index_page_presenter.block if index_page_presenter.block.present?
52
+
53
+ end
54
+
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,11 @@
1
+ module IfdTools
2
+ module ActiveAdmin
3
+ module Dashboard
4
+
5
+ autoload :ContactRequests, 'ifd_tools/active_admin/dashboard/contact_requests'
6
+ autoload :PageAdditions, 'ifd_tools/active_admin/dashboard/page_additions'
7
+ autoload :Tracking, 'ifd_tools/active_admin/dashboard/tracking'
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module IfdTools
2
+ module ActiveAdmin
3
+
4
+ autoload :CanCan, 'ifd_tools/active_admin/can_can'
5
+ autoload :Dashboard, 'ifd_tools/active_admin/dashboard'
6
+
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module IfdTools
2
+ module Tracking
3
+
4
+ autoload :Trackable, 'ifd_tools/tracking/trackable'
5
+
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module IfdTools
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
data/lib/ifd_tools.rb CHANGED
@@ -14,15 +14,17 @@ require 'active_admin_relationship_filters'
14
14
 
15
15
  require "ifd_tools/engine"
16
16
  require 'ifd_tools/date_time_additions'
17
- require 'ifd_tools/active_admin/base'
18
17
  require 'ifd_tools/validations/phone'
19
- require 'ifd_tools/active_admin/can_can/action_items'
18
+ require 'ifd_tools/active_admin/base'
20
19
 
21
20
  module IfdTools
22
21
 
22
+ autoload :ActiveAdmin, 'ifd_tools/active_admin'
23
23
  autoload :ApiControllerExtensions, 'ifd_tools/api_controller_extensions'
24
24
  autoload :Configure, 'ifd_tools/configure'
25
25
  autoload :States, 'ifd_tools/states'
26
- autoload :Trackable, 'ifd_tools/tracking/trackable'
27
-
28
- end
26
+ autoload :Tracking, 'ifd_tools/tracking'
27
+
28
+ end
29
+
30
+ ::ActiveAdmin::PageDSL.send(:include, IfdTools::ActiveAdmin::Dashboard::PageAdditions)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ifd_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-16 00:00:00.000000000 Z
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -361,6 +361,12 @@ files:
361
361
  - lib/generators/ifd_tools/install/USAGE
362
362
  - lib/ifd_tools/active_admin/base.rb
363
363
  - lib/ifd_tools/active_admin/can_can/action_items.rb
364
+ - lib/ifd_tools/active_admin/can_can.rb
365
+ - lib/ifd_tools/active_admin/dashboard/contact_requests.rb
366
+ - lib/ifd_tools/active_admin/dashboard/page_additions.rb
367
+ - lib/ifd_tools/active_admin/dashboard/tracking.rb
368
+ - lib/ifd_tools/active_admin/dashboard.rb
369
+ - lib/ifd_tools/active_admin.rb
364
370
  - lib/ifd_tools/api_controller/contact_requests.rb
365
371
  - lib/ifd_tools/api_controller/customers.rb
366
372
  - lib/ifd_tools/api_controller/emergency_messages.rb
@@ -374,6 +380,7 @@ files:
374
380
  - lib/ifd_tools/states.rb
375
381
  - lib/ifd_tools/tracking/customer_tracking.rb
376
382
  - lib/ifd_tools/tracking/trackable.rb
383
+ - lib/ifd_tools/tracking.rb
377
384
  - lib/ifd_tools/validations/phone.rb
378
385
  - lib/ifd_tools/version.rb
379
386
  - lib/ifd_tools.rb