mountain-goat 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/init.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join([File.dirname(__FILE__), 'lib/flotilla'])
2
+ require File.join([File.dirname(__FILE__), 'lib/mgflotilla'])
3
3
  require File.join([File.dirname(__FILE__), 'lib/mountain-goat'])
4
4
 
5
5
  #ActionView::Helpers
@@ -1,10 +1,10 @@
1
- begin
2
- require 'json'
3
- rescue LoadError
4
- p "Flotilla will not work without the 'json' gem"
5
- end
1
+ #begin
2
+ # require 'json'
3
+ #rescue LoadError
4
+ # p "Flotilla will not work without the 'json' gem"
5
+ #end
6
6
 
7
- module Flotilla
7
+ module MGFlotilla
8
8
  module Helpers
9
9
 
10
10
  # Insert a flot chart into the page. <tt>placeholder</tt> should be the
@@ -24,7 +24,7 @@ module Flotilla
24
24
  # :js_tags - wraps resulting javascript in javascript tags if true. Defaults to true.
25
25
  # :placeholder_tag - appends a placeholder div for graph
26
26
  # :placeholder_size - specifys the size of the placeholder div
27
- def chart(placeholder, series, options = {}, html_options = {})
27
+ def mg_chart(placeholder, series, options = {}, html_options = {})
28
28
  html_options.reverse_merge!({ :js_includes => true, :js_tags => true, :placeholder_tag => true, :placeholder_size => "800x300", :pie_hover => false, :pie_hover_absolute => false })
29
29
  width, height = html_options[:placeholder_size].split("x") if html_options[:placeholder_size].respond_to?(:split)
30
30
  additional_js = get_additional_js(placeholder, html_options)
@@ -166,5 +166,5 @@ module Flotilla
166
166
  end
167
167
 
168
168
  class ActionView::Base
169
- include Flotilla::Helpers
169
+ include MGFlotilla::Helpers
170
170
  end
@@ -1,3 +1,3 @@
1
1
  class MountainGoat
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -0,0 +1,69 @@
1
+
2
+ <div id="container-main" class="mt-converts show">
3
+ <div class="mountain-goat-panel centered">
4
+ <ul class="nav">
5
+ <li><a href="<%= mountain_goat_converts_url %>">Goals</a></li>
6
+ <li><a href="<%= mountain_goat_convert_url @convert.id %>"><%=h @convert.name %> Goal</a></li>
7
+ </ul>
8
+
9
+ <h1><%=h @convert.name %></h1>
10
+
11
+ <div class="statpads">
12
+ <div class="flyer-analysis statpad">
13
+ <div class="title">Conversions by Day</div>
14
+ <div class="statbody">
15
+ <%= chart("analysis_graph#{@convert.id}",
16
+ { "Conversions" => { :collection => @results_per_day, :x => :date, :y => :val } },
17
+ { :xaxis => {:mode => 'time', :timeformat => "%b %d" }, :yaxis => { :min => 0, :minTickSize => 1 }, :lines => { :show => true }, :legend => { :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
18
+ </div>
19
+ </div>
20
+
21
+ <% @convert.convert_meta_types.each do |cmt| %>
22
+ <div class="flyer-analysis statpad">
23
+ <div class="title">Conversions by <%=h cmt.name %></div>
24
+ <div class="statbody">
25
+ <% if cmt.meta_type == 'ci_meta' %>
26
+ <%= chart("analysis_graph#{cmt.id}",
27
+ { "Conversions" => { :collection => @results_by_cmt[cmt.id], :x => :name, :y => :val } },
28
+ { :xaxis => {:autoscaleMargin => 1, :minTickSize => 1 }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true, :align => 'center', :barWidth => 1 }, :legend => { :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
29
+ <% elsif cmt.meta_type == 'cs_meta' %>
30
+ <%= chart("analysis_graph#{cmt.id}",
31
+ { "Conversions" => { :collection => @results_by_cmt[cmt.id], :x => :name, :y => :val } },
32
+ { :xaxis => {:autoscaleMargin => 0.1, :ticks => @results_by_cmt_titles[cmt.id].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
33
+ <% end %>
34
+ </div>
35
+ </div>
36
+ <% end %>
37
+ </div>
38
+
39
+ <% @convert.metrics.each do |metric| %>
40
+ <div class="metric-category">
41
+ <span class="metric"><a href="<%= mountain_goat_metric_url :id => metric.id %>"><%= metric.title %></a></span>
42
+ <% if metric.metric_variants.count == 0 %>
43
+ <span class="none">No metric variants [<a href="<%= new_mountain_goat_metric_mountain_goat_metric_variant_url :mountain_goat_metric_id => metric.id %>">Add one</a>]</span>
44
+ <% else %>
45
+ <% metric.metric_variants.each do |mv| %>
46
+ <div class="item rate">
47
+ <span class="rate-holder">
48
+ <span class="title"><a href="<%= mountain_goat_metric_variant_url mv %>"><%=h mv.name %></a></span>
49
+ <span class="rates" style="width:<%= number_to_percentage(mv.conversion_rate, :precision => 0) %>"></span>
50
+ </span>
51
+
52
+ <span class="percent-holder">
53
+ <span class="val"><%= number_to_percentage(mv.conversion_rate, :precision => 0) %></span>
54
+ (<span class="conversions"><%= mv.conversions %></span> /
55
+ <span class="served"><%= mv.served %></span>)
56
+ </span>
57
+ </div>
58
+ <% end %>
59
+ <% end %>
60
+ </div>
61
+ <% end %>
62
+
63
+ <div class="actions">
64
+ <a class="button" href="<%= edit_mountain_goat_convert_url :id => @convert.id %>">Edit</a>
65
+ <a class="button" href="<%= new_mountain_goat_convert_mountain_goat_metric_url :mountain_goat_convert_id => @convert.id %>">New Metric</a>
66
+ </div>
67
+
68
+ </div>
69
+ </div>
@@ -12,7 +12,7 @@
12
12
  <div class="flyer-analysis statpad">
13
13
  <div class="title">Conversions by Day</div>
14
14
  <div class="statbody">
15
- <%= chart("analysis_graph#{@convert.id}",
15
+ <%= mg_chart("analysis_graph#{@convert.id}",
16
16
  { "Conversions" => { :collection => @results_per_day, :x => :date, :y => :val } },
17
17
  { :xaxis => {:mode => 'time', :timeformat => "%b %d" }, :yaxis => { :min => 0, :minTickSize => 1 }, :lines => { :show => true }, :legend => { :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
18
18
  </div>
@@ -23,11 +23,11 @@
23
23
  <div class="title">Conversions by <%=h cmt.name %></div>
24
24
  <div class="statbody">
25
25
  <% if cmt.meta_type == 'ci_meta' %>
26
- <%= chart("analysis_graph#{cmt.id}",
26
+ <%= mg_chart("analysis_graph#{cmt.id}",
27
27
  { "Conversions" => { :collection => @results_by_cmt[cmt.id], :x => :name, :y => :val } },
28
28
  { :xaxis => {:autoscaleMargin => 1, :minTickSize => 1 }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true, :align => 'center', :barWidth => 1 }, :legend => { :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
29
29
  <% elsif cmt.meta_type == 'cs_meta' %>
30
- <%= chart("analysis_graph#{cmt.id}",
30
+ <%= mg_chart("analysis_graph#{cmt.id}",
31
31
  { "Conversions" => { :collection => @results_by_cmt[cmt.id], :x => :name, :y => :val } },
32
32
  { :xaxis => {:autoscaleMargin => 0.1, :ticks => @results_by_cmt_titles[cmt.id].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
33
33
  <% end %>
@@ -0,0 +1,68 @@
1
+
2
+ <div id="container-main" class="mt-metrics">
3
+ <div class="mountain-goat-panel cenetered">
4
+ <ul class="nav">
5
+ <li><a href="<%= mountain_goat_converts_url %>">Goals</a></li>
6
+ <li><a href="<%= mountain_goat_convert_url :id => @metric.convert.id %>"><%=h @metric.convert.name %> Goal</a></li>
7
+ <li><a href="<%= mountain_goat_metric_url :id => @metric.id %>"><%=h @metric.title %></a></li>
8
+ </ul>
9
+
10
+ <h1><%=h @metric.title %> Metric</h1>
11
+
12
+ <div class="variants">
13
+ <% if @metric.metric_variants.count == 0 %>
14
+ <span class="none">No metric variants</span>
15
+ <% else %>
16
+ <div class="statpads">
17
+ <div class="flyer-analysis statpad">
18
+ <div class="title">Conversions</div>
19
+ <div class="statbody">
20
+ <%= chart("analysis_graph#{@metric.id}",
21
+ { "Served" => { :collection => @rates[:served], :x => :variant_type, :y => :value },
22
+ "Conversions" => { :collection => @rates[:conversions], :x => :variant_type, :y => :value } },
23
+ { :xaxis => { :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :show => false, :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
24
+
25
+ </div>
26
+ </div>
27
+ <div class="flyer-analysis statpad">
28
+ <div class="title">Conversion Rates</div>
29
+ <div class="statbody">
30
+ <%= chart("analysis_conv_graph#{@metric.id}",
31
+ { "Conversion Rate (%)" => { :collection => @rates[:conversion_rates], :x => :variant_type, :y => :value } },
32
+ { :xaxis => { :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :show => false, :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "%") %>
33
+
34
+ </div>
35
+ </div>
36
+ </div>
37
+
38
+
39
+ <div class="metric-category">
40
+ <span class="metric"><a href="<%= mountain_goat_metric_url :id => @metric.id %>"><%= @metric.title %></a></span>
41
+ <% if @metric.metric_variants.count == 0 %>
42
+ <span class="none">No metric variants [<a href="<%= new_mountain_goat_metric_mountain_goat_metric_variant_url :mountain_goat_metric_id => @metric.id %>">Add one</a>]</span>
43
+ <% else %>
44
+ <% @metric.metric_variants.each do |mv| %>
45
+ <div class="item rate">
46
+ <span class="rate-holder">
47
+ <span class="title"><a href="<%= mountain_goat_metric_variant_url mv %>"><%=h mv.name %></a></span>
48
+ <span class="rates" style="width:<%= number_to_percentage(mv.conversion_rate, :precision => 0) %>"></span>
49
+ </span>
50
+
51
+ <span class="percent-holder">
52
+ <span class="val"><%= number_to_percentage(mv.conversion_rate, :precision => 0) %></span>
53
+ (<span class="conversions"><%= mv.conversions %></span> /
54
+ <span class="served"><%= mv.served %></span>)
55
+ </span>
56
+ </div>
57
+ <% end %>
58
+ <% end %>
59
+ </div>
60
+ <% end %>
61
+ </div>
62
+
63
+ <div class="actions">
64
+ <a class="button" href="<%= edit_mountain_goat_metric_url :id => @metric %>">Edit Metric</a>
65
+ <a class="button" href="<%= new_mountain_goat_metric_mountain_goat_metric_variant_url :mountain_goat_metric_id => @metric.id %>">New Variant</a>
66
+ </div>
67
+ </div>
68
+ </div>
@@ -17,7 +17,7 @@
17
17
  <div class="flyer-analysis statpad">
18
18
  <div class="title">Conversions</div>
19
19
  <div class="statbody">
20
- <%= chart("analysis_graph#{@metric.id}",
20
+ <%= mg_chart("analysis_graph#{@metric.id}",
21
21
  { "Served" => { :collection => @rates[:served], :x => :variant_type, :y => :value },
22
22
  "Conversions" => { :collection => @rates[:conversions], :x => :variant_type, :y => :value } },
23
23
  { :xaxis => { :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :show => false, :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "view(s)") %>
@@ -27,7 +27,7 @@
27
27
  <div class="flyer-analysis statpad">
28
28
  <div class="title">Conversion Rates</div>
29
29
  <div class="statbody">
30
- <%= chart("analysis_conv_graph#{@metric.id}",
30
+ <%= mg_chart("analysis_conv_graph#{@metric.id}",
31
31
  { "Conversion Rate (%)" => { :collection => @rates[:conversion_rates], :x => :variant_type, :y => :value } },
32
32
  { :xaxis => { :ticks => @rates[:titles].map { |i,t| [i + 0.5, t] }.sort }, :yaxis => { :min => 0, :minTickSize => 1 }, :bars => { :show => true }, :legend => { :show => false, :position => "ne" }, :grid => { :hoverable => true, :clickable => true }, :inline => false }, :placeholder_size => "420x260", :pie_hover => true, :line_hover_absolute => true, :item_title => "%") %>
33
33
 
data/lib/mountain-goat.rb CHANGED
@@ -4,6 +4,8 @@ require 'active_support'
4
4
  require 'action_controller'
5
5
  require 'action_controller/routing'
6
6
 
7
+ require File.join([File.dirname(__FILE__), 'mgflotilla'])
8
+
7
9
  require File.join([File.dirname(__FILE__), 'mountain-goat/controllers/mountain_goat/mountain_goat_controller'])
8
10
  require File.join([File.dirname(__FILE__), 'mountain-goat/controllers/mountain_goat/mountain_goat_metrics_controller'])
9
11
  require File.join([File.dirname(__FILE__), 'mountain-goat/controllers/mountain_goat/mountain_goat_metric_variants_controller'])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mountain-goat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Geoffrey Hayes
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-07-25 00:00:00 -05:00
19
+ date: 2011-07-26 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -74,7 +74,7 @@ files:
74
74
  - generators/mg/templates/mountain-goat.yml
75
75
  - init.rb
76
76
  - install.rb
77
- - lib/flotilla.rb
77
+ - lib/mgflotilla.rb
78
78
  - lib/mountain-goat.rb
79
79
  - lib/mountain-goat/controllers/mountain_goat/mountain_goat_controller.rb
80
80
  - lib/mountain-goat/controllers/mountain_goat/mountain_goat_converts_controller.rb
@@ -103,6 +103,7 @@ files:
103
103
  - lib/mountain-goat/version.rb
104
104
  - lib/mountain-goat/views/mountain_goat/layouts/mountain_goat.html.erb
105
105
  - lib/mountain-goat/views/mountain_goat/mountain_goat/login.html.erb
106
+ - lib/mountain-goat/views/mountain_goat/mountain_goat_converts/.tmp_show.html.erb.4433~
106
107
  - lib/mountain-goat/views/mountain_goat/mountain_goat_converts/_convert_form.html.erb
107
108
  - lib/mountain-goat/views/mountain_goat/mountain_goat_converts/_convert_meta_type_form.html.erb
108
109
  - lib/mountain-goat/views/mountain_goat/mountain_goat_converts/edit.html.erb
@@ -114,6 +115,7 @@ files:
114
115
  - lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/index.html.erb
115
116
  - lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/new.html.erb
116
117
  - lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/show.html.erb
118
+ - lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/.tmp_show.html.erb.21270~
117
119
  - lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/_metric_form.html.erb
118
120
  - lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/edit.html.erb
119
121
  - lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/index.html.erb