mountain-goat 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +2 -0
  2. data/README.md +5 -4
  3. data/generators/mg/mg_generator.rb +2 -2
  4. data/generators/mg/templates/update_mountain_goat_tables_v2.rb +73 -0
  5. data/lib/mountain-goat/controllers/mg/choices_controller.rb +81 -0
  6. data/lib/mountain-goat/controllers/mg/goals_controller.rb +136 -0
  7. data/lib/mountain-goat/controllers/mg/records_controller.rb +46 -0
  8. data/lib/mountain-goat/controllers/mg/tests_controller.rb +139 -0
  9. data/lib/mountain-goat/mg_core.rb +403 -0
  10. data/lib/mountain-goat/models/mg/choice.rb +50 -0
  11. data/lib/mountain-goat/models/mg/gi_meta.rb +10 -0
  12. data/lib/mountain-goat/models/mg/goal.rb +183 -0
  13. data/lib/mountain-goat/models/mg/goal_meta_type.rb +20 -0
  14. data/lib/mountain-goat/models/mg/gs_meta.rb +10 -0
  15. data/lib/mountain-goat/models/mg/record.rb +59 -0
  16. data/lib/mountain-goat/models/mg/test.rb +31 -0
  17. data/lib/mountain-goat/public/g-funnel.js +168 -0
  18. data/lib/mountain-goat/switch_choice.rb +32 -0
  19. data/lib/mountain-goat/version.rb +1 -1
  20. data/lib/mountain-goat/views/mountain_goat/layouts/.tmp_mountain_goat.html.erb.50680~ +76 -0
  21. data/lib/mountain-goat/views/mountain_goat/mg/choices/_choice_form.html.erb +37 -0
  22. data/lib/mountain-goat/views/mountain_goat/mg/choices/edit.html.erb +13 -0
  23. data/lib/mountain-goat/views/mountain_goat/mg/choices/index.html.erb +34 -0
  24. data/lib/mountain-goat/views/mountain_goat/mg/choices/new.html.erb +15 -0
  25. data/lib/mountain-goat/views/mountain_goat/mg/choices/show.html.erb +30 -0
  26. data/lib/mountain-goat/views/mountain_goat/mg/goals/.tmp__goal_form.html.erb.5027~ +0 -0
  27. data/lib/mountain-goat/views/mountain_goat/mg/goals/.tmp__goal_meta_type_form.html.erb.39992~ +0 -0
  28. data/lib/mountain-goat/views/mountain_goat/mg/goals/.tmp_edit.html.erb.55874~ +0 -0
  29. data/lib/mountain-goat/views/mountain_goat/mg/goals/.tmp_index.html.erb.97274~ +36 -0
  30. data/lib/mountain-goat/views/mountain_goat/mg/goals/_goal_form.html.erb +28 -0
  31. data/lib/mountain-goat/views/mountain_goat/mg/goals/_goal_meta_type_form.html.erb +34 -0
  32. data/lib/mountain-goat/views/mountain_goat/mg/goals/edit.html.erb +12 -0
  33. data/lib/mountain-goat/views/mountain_goat/mg/goals/index.html.erb +37 -0
  34. data/lib/mountain-goat/views/mountain_goat/mg/goals/new.html.erb +12 -0
  35. data/lib/mountain-goat/views/mountain_goat/mg/goals/show.html.erb +32 -0
  36. data/lib/mountain-goat/views/mountain_goat/mg/records/_record.html.erb +16 -0
  37. data/lib/mountain-goat/views/mountain_goat/mg/records/_records.html.erb +5 -0
  38. data/lib/mountain-goat/views/mountain_goat/mg/records/_records_form.html.erb +21 -0
  39. data/lib/mountain-goat/views/mountain_goat/mg/records/edit.html.erb +13 -0
  40. data/lib/mountain-goat/views/mountain_goat/mg/records/index.html.erb +17 -0
  41. data/lib/mountain-goat/views/mountain_goat/mg/records/new.html.erb +13 -0
  42. data/lib/mountain-goat/views/mountain_goat/mg/records/show.html.erb +14 -0
  43. data/lib/mountain-goat/views/mountain_goat/mg/report_items/.tmp__chart.html.erb.13419~ +18 -0
  44. data/lib/mountain-goat/views/mountain_goat/mg/report_items/.tmp__funnel.html.erb.60493~ +18 -0
  45. data/lib/mountain-goat/views/mountain_goat/mg/report_items/.tmp__report_item_form.html.erb.87420~ +10 -0
  46. data/lib/mountain-goat/views/mountain_goat/mg/report_items/.tmp__report_item_pivot_form.html.erb.77056~ +14 -0
  47. data/lib/mountain-goat/views/mountain_goat/mg/report_items/.tmp_edit.html.erb.31048~ +19 -0
  48. data/lib/mountain-goat/views/mountain_goat/mg/report_items/.tmp_new.html.erb.36371~ +17 -0
  49. data/lib/mountain-goat/views/mountain_goat/mg/report_items/_funnel.html.erb +13 -0
  50. data/lib/mountain-goat/views/mountain_goat/mg/reports/.tmp__report_form.html.erb.76535~ +21 -0
  51. data/lib/mountain-goat/views/mountain_goat/mg/reports/.tmp__report_report_items.html.erb.26030~ +5 -0
  52. data/lib/mountain-goat/views/mountain_goat/mg/reports/.tmp_edit.html.erb.78064~ +36 -0
  53. data/lib/mountain-goat/views/mountain_goat/mg/reports/.tmp_index.html.erb.74591~ +23 -0
  54. data/lib/mountain-goat/views/mountain_goat/mg/reports/.tmp_show.html.erb.58427~ +21 -0
  55. data/lib/mountain-goat/views/mountain_goat/mg/tests/_test_form.html.erb +25 -0
  56. data/lib/mountain-goat/views/mountain_goat/mg/tests/edit.html.erb +12 -0
  57. data/lib/mountain-goat/views/mountain_goat/mg/tests/index.html.erb +48 -0
  58. data/lib/mountain-goat/views/mountain_goat/mg/tests/new.html.erb +12 -0
  59. data/lib/mountain-goat/views/mountain_goat/mg/tests/show.html.erb +63 -0
  60. metadata +69 -6
  61. data/lib/mountain-goat/metric_tracking.rb +0 -401
  62. data/lib/mountain-goat/switch_variant.rb +0 -32
@@ -0,0 +1,32 @@
1
+
2
+ class SwitchChoice
3
+ def initialize(logger, test, chosen_choice)
4
+ @chosen_choice = chosen_choice
5
+ @test = test
6
+ @logger = logger
7
+ raise ArgumentError, "Test type must be switch-type" if !@test.is_switch
8
+ end
9
+
10
+ def method_missing(sym, *args, &block)
11
+ #priority = ( args.first || 1.0 ).to_f
12
+
13
+ if @chosen_choice.nil?
14
+ #If we have not chosen a choice, we are going to look through
15
+ # each option and make sure we have a back-end entry in choices
16
+ # for the type
17
+ @logger.warn "Looking at option #{sym.to_s}"
18
+ if @test.choices.find( :first, :conditions => { :switch_type => sym.to_s } ).nil?
19
+ @logger.warn "Creating switch-type choice #{sym.to_s}"
20
+ @test.choices.create!( :name => sym.to_s, :switch_type => sym.to_s, :value => nil )
21
+ end
22
+ else
23
+ if @chosen_choice.switch_type.to_s == sym.to_s
24
+ @logger.warn "Executing option #{sym.to_s}"
25
+ yield
26
+ else
27
+ @logger.warn "Bypassing option #{sym.to_s}"
28
+ end
29
+ end
30
+ end
31
+
32
+ end
@@ -1,3 +1,3 @@
1
1
  class MountainGoat
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+
3
+ <% is_mobile = false if local_assigns[:is_mobile].nil? %>
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml">
6
+
7
+ <head>
8
+ <title>Mountain Goat <% if @title %> - <%=h @title %><% end %></title>
9
+
10
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11
+
12
+ <%# These are mobile specific settings. We are disabling zooming and fixing the width. %>
13
+ <meta content='True' name='HandheldFriendly' />
14
+ <!--<meta content='width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' name='viewport' />-->
15
+ <meta name="viewport" content="width=device-width" />
16
+
17
+ <link rel="stylesheet" href="/mg/public/mg_css" type="text/css" />
18
+ <link rel="stylesheet" href="/mg/public/jqModel_css" type="text/css" />
19
+
20
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
21
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js" type="text/javascript"></script>
22
+ <script src="/mg/public/jqModel_js" type="text/javascript"></script>
23
+ <script src="/mg/public/raphael-min_js" type="text/javascript"></script>
24
+ <script src="/mg/public/g-raphael-min_js" type="text/javascript"></script>
25
+ <script src="/mg/public/g-bar-min_js" type="text/javascript"></script>
26
+ <script src="/mg/public/g-dot-min_js" type="text/javascript"></script>
27
+ <script src="/mg/public/g-line-min_js" type="text/javascript"></script>
28
+ <script src="/mg/public/g-pie-min_js" type="text/javascript"></script>
29
+ <script src="/mg/public/jquery_flot_js" type="text/javascript"></script>
30
+ <script src="/mg/public/jquery_timeago_js" type="text/javascript"></script>
31
+ <script src="/mg/public/jquery_raphael_js" type="text/javascript"></script>
32
+ <script src="/mg/public/mg_js" type="text/javascript"></script>
33
+ <script src="/mg/public/utils_js" type="text/javascript"></script>
34
+
35
+ </head>
36
+
37
+ <body>
38
+ <div class="mg-header structure">
39
+ <div class="container-center">
40
+ <div class="header">
41
+ <a href="/mg" class="logo">
42
+ <img src="/mg/public/mg_png" />
43
+ </a>
44
+ <ul class="nav">
45
+ <li><a href="<%= mg_goals_url %>">Goals</a></li>
46
+ <li><a href="<%= mg_tests_url %>">Tests</a></li>
47
+ <li><a href="<%= mg_records_url %>">Records</a></li>
48
+ <li><a href="<%= mg_reports_url %>">Reports</a></li>
49
+ <li><a href="/">Exit</a></li>
50
+ </ul>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ <div class="mg-content structure">
56
+ <div class="container-center">
57
+ <% if !flash[:notice].blank? || !flash[:error].blank? %>
58
+ <div class="flash">
59
+ <% if !flash[:error].blank? %>
60
+ <div class="error"><%= flash[:error] %></div>
61
+ <% end %>
62
+ <% if !flash[:notice].blank? %>
63
+ <div class="notice"><%= flash[:notice] %></div>
64
+ <% end %>
65
+ </div>
66
+ <% end %>
67
+ <%= yield %>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="mg-footer structure">
72
+
73
+ </div>
74
+ </body>
75
+
76
+ </html>
@@ -0,0 +1,37 @@
1
+ <%# locals => f %>
2
+
3
+ <%= f.hidden_field :mg_test_id %>
4
+
5
+ <% if f.object.mg_test.is_switch %>
6
+ <span class="switch-type"><%=h f.object.switch_type %></span>
7
+ <% end %>
8
+
9
+ <div class="item name">
10
+ <%= f.label :name, 'Name (whatever you want)' %>
11
+ <%= f.text_field :name %>
12
+ </div>
13
+
14
+ <% if !f.object.mg_test.is_switch %>
15
+ <div class="item value">
16
+ <%= f.label :value, 'What\'s displayed' %>
17
+ <%= f.text_area :value %>
18
+ </div>
19
+
20
+ <input type='checkbox' id="my_slider" class='slider' data-slider='.options' />
21
+ <label for="my_slider">Add optional variants</label>
22
+ <div class="options" style="display:none;">
23
+ <div class="item opt1">
24
+ <%= f.label :opt1, 'Option 1' %>
25
+ <%= f.text_area :opt1 %>
26
+ </div>
27
+
28
+ <div class="item opt2">
29
+ <%= f.label :opt2, 'Option 2' %>
30
+ <%= f.text_area :opt2 %>
31
+ </div>
32
+ </div>
33
+ <% end %>
34
+
35
+ <div class="item submit">
36
+ <%= f.submit 'Submit' %>
37
+ </div>
@@ -0,0 +1,13 @@
1
+
2
+
3
+ <div id="container-main" class="mg-choices">
4
+ <div class="mountain-goat-panel centered">
5
+ <h1>Edit <%=h @choice.name %></h1>
6
+
7
+ <% form_for :choice, @choice, :url => mg_choice_url(:id => @choice.id), :html => { :method => :put } do |f| %>
8
+ <%= f.error_messages %>
9
+
10
+ <%= render 'choice_form', :f => f %>
11
+ <% end %>
12
+ </div>
13
+ </div>
@@ -0,0 +1,34 @@
1
+
2
+ <div id="container-main" class="mg-choices">
3
+ <div class="mountain-goat-panel cenetered">
4
+ <h1>Listing Choices</h1>
5
+
6
+ <table>
7
+ <tr>
8
+ <th>Metric</th>
9
+ <th>Value</th>
10
+ <th>Opt1</th>
11
+ <th>Opt2</th>
12
+ <th>Served</th>
13
+ <th>Conversions</th>
14
+ </tr>
15
+
16
+ <% @choices.each do |choice| %>
17
+ <tr>
18
+ <td><%=h choice.mg_test_id %></td>
19
+ <td><%=h choice.value %></td>
20
+ <td><%=h choice.opt1 %></td>
21
+ <td><%=h choice.opt2 %></td>
22
+ <td><%=h choice.served %></td>
23
+ <td><%=h choice.conversions %></td>
24
+ <td><a href="<%= mg_choice_url choice %>">Show</a></td>
25
+ <td><a href="<%= edit_mg_choice_url choice %>">Edit</a></td>
26
+ </tr>
27
+ <% end %>
28
+ </table>
29
+
30
+ <br />
31
+
32
+ <%= link_to 'New Choice', new_mg_choice_url %>
33
+ </div>
34
+ </div>
@@ -0,0 +1,15 @@
1
+
2
+
3
+ <div id="container-main" class="mg-choices">
4
+ <div class="mountain-goat-panel cenetered">
5
+ <h1>New Choice for <%=h @test.title %></h1>
6
+
7
+ <% form_for :choice, @choice, :url => mg_choices_url do |f| %>
8
+ <%= f.error_messages %>
9
+
10
+ <%= render 'choice_form', :f => f %>
11
+ <% end %>
12
+
13
+ <a href="<%= mg_test_url :id => @test.id %>">Back to <%=h @test.title %></a>
14
+ </div>
15
+ </div>
@@ -0,0 +1,30 @@
1
+
2
+ <div id="container-main" class="mg-choices">
3
+ <div class="mountain-goat-panel cenetered">
4
+ <ul class="nav">
5
+ <li><a href="<%= mg_goals_url %>">Goals</a></li>
6
+ <li><a href="<%= mg_test_url :id => @choice.mg_test.id %>"><%=h @choice.mg_test.title %></a></li>
7
+ </ul>
8
+
9
+ <h1><%=h @choice.name %></h1>
10
+
11
+ <div class="test-category">
12
+ <div class="item rate">
13
+ <span class="rate-holder">
14
+ <span class="title"><a href="<%= mg_choice_url @choice %>"><%=h @choice.name %></a></span>
15
+ <span class="rates" style="width:<%= number_to_percentage(@choice.conversion_rate, :precision => 0) %>"></span>
16
+ </span>
17
+
18
+ <span class="percent-holder">
19
+ <span class="val"><%= number_to_percentage(@choice.conversion_rate, :precision => 0) %></span>
20
+ (<span class="conversions"><%= @choice.conversions %></span> /
21
+ <span class="served"><%= @choice.served %></span>)
22
+ </span>
23
+ </div>
24
+ </div>
25
+
26
+ <div class="actions">
27
+ <a class="button" href="<%= edit_mg_choice_url :id => @choice.id %>">Edit</a>
28
+ </div>
29
+ </div>
30
+ </div>
@@ -0,0 +1,36 @@
1
+ <div id="container-main" class="mg-goals">
2
+ <h1>Your Goals</h1>
3
+ <div class="container-content">
4
+ <div class="title-bar">
5
+ <span class="category name">Goal</span>
6
+ <span class="category hit-total">Total</span>
7
+ <span class="category hit-recent">Recent</span>
8
+ <span class="category hit-points">Points</span>
9
+ <span class="category actions">Actions</span>
10
+ </div>
11
+ <ul class="listed">
12
+ <% @goals.each do |goal| %>
13
+ <li class="conversion-goal">
14
+ <span class="category name"><%=h goal.name %></span>
15
+ <span class="category hit-total"><%=h goal.mg_records.count %></span>
16
+ <span class="category hit-recent"><%=h goal.recent_records(1.week).count %></span>
17
+ <span class="category hit-points"><%=h goal.rewards_total || "None" %></span>
18
+ <span class="category actions">
19
+ <a href="<%= mg_goal_url :id => goal.id %>">View</a>
20
+ <a href="<%= hide_mg_goal_url :id => goal.id %>">Hide</a>
21
+ </span>
22
+ </li>
23
+ <% end %>
24
+ </ul>
25
+ <div class="action-bar">
26
+ <a class="button" href="<%= new_mg_goal_url %>">New Goal</a>
27
+ </div>
28
+ </div>
29
+
30
+ <div class="hidden-goals">
31
+ <% @hidden_goals.each do |goal| %>
32
+ <span class="name"><%=h goal.name %></span>
33
+ <span class="unhide"><a href="<%= unhide_mg_goal_url :id => goal.id %>">Restore</a></span>
34
+ <% end %>
35
+ </div>
36
+ </div>
@@ -0,0 +1,28 @@
1
+ <%# locals => f %>
2
+
3
+ <% if f.object.new_record? %>
4
+ <div class="item type">
5
+ <%= f.text_field :goal_type %>
6
+ <%= f.label :goal_type, 'Type (this is technical)' %>
7
+ </div>
8
+ <% else %>
9
+ <div class="item goal">
10
+ <h2><%= f.object.goal_type %></h2>
11
+ <label>Goal Name</label>
12
+ </div>
13
+ <% end %>
14
+
15
+ <div class="item name">
16
+ <%= f.text_field :name %>
17
+ <%= f.label :name, 'Goal title' %>
18
+ </div>
19
+
20
+ <div class="metas">
21
+ <% f.fields_for :mg_goal_meta_types do |builder| %>
22
+ <%= render "goal_meta_type_form", :gmt_f => builder %>
23
+ <% end %>
24
+ </div>
25
+
26
+ <div class="item submit">
27
+ <%= f.submit 'Submit' %>
28
+ </div>
@@ -0,0 +1,34 @@
1
+ <%# locals => gmt_f %>
2
+
3
+ <div class="meta">
4
+
5
+ <div class="item meta-name">
6
+ <%= gmt_f.text_field :name %>
7
+ <%= gmt_f.label :name, 'Meta Name' %>
8
+ </div>
9
+
10
+ <% if gmt_f.object.new_record? %>
11
+ <div class="item meta-var">
12
+ <%= gmt_f.text_field :var %>
13
+ <%= gmt_f.label :var, 'Var' %>
14
+ </div>
15
+ <% end %>
16
+
17
+ <div class="item meta-meta-type">
18
+ <%= gmt_f.select :meta_type, [ [ "Integer", "gi_meta" ], [ "String", "gs_meta" ] ] %>
19
+ <% if gmt_f.object.new_record? %>
20
+ <%= gmt_f.label :meta_type, 'Meta Type' %>
21
+ <% else %>
22
+ <%= gmt_f.label :meta_type, "#{gmt_f.object.var} Type" %>
23
+ <% end %>
24
+ </div>
25
+
26
+ <div class="item meta-destroy">
27
+ <%= gmt_f.check_box :_destroy %>
28
+ <% if gmt_f.object.new_record? %>
29
+ <%= gmt_f.label :_destroy, "Remove Meta" %>
30
+ <% else %>
31
+ <%= gmt_f.label :_destroy, "Remove #{gmt_f.object.var}" %>
32
+ <% end %>
33
+ </div>
34
+ </div>
@@ -0,0 +1,12 @@
1
+ <div id="container-main" class="mg-goal-edit">
2
+ <h1>Edit <%=h @goal.name.capitalize %></h1>
3
+ <div class="container-content">
4
+ <div class="edit-form">
5
+ <% form_for :goal, @goal, :url => mg_goal_url(:id => @goal.id), :html => { :method => :put } do |f| %>
6
+ <%= f.error_messages %>
7
+
8
+ <%= render :partial => 'mg/goals/goal_form', :locals => { :f => f } %>
9
+ <% end %>
10
+ </div>
11
+ </div>
12
+ </div>
@@ -0,0 +1,37 @@
1
+ <div id="container-main" class="mg-goals">
2
+ <h1>Your Goals</h1>
3
+ <div class="container-content">
4
+ <div class="title-bar">
5
+ <span class="category name">Goal</span>
6
+ <span class="category hit-total">Total</span>
7
+ <span class="category hit-recent">Recent</span>
8
+ <span class="category hit-points">Points</span>
9
+ <span class="category actions">Actions</span>
10
+ </div>
11
+ <ul class="listed">
12
+ <% @goals.each do |goal| %>
13
+ <li class="conversion-goal">
14
+ <span class="category name"><%=h goal.name %></span>
15
+ <span class="category hit-total"><%=h goal.mg_records.count %></span>
16
+ <span class="category hit-recent"><%=h goal.recent_records(1.week).count %></span>
17
+ <span class="category hit-points"><%=h goal.rewards_total || "None" %></span>
18
+ <span class="category actions">
19
+ <a href="<%= mg_goal_url :id => goal.id %>">View</a>
20
+ <a href="<%= edit_mg_goal_url :id => goal.id %>">Edit</a>
21
+ <a href="<%= hide_mg_goal_url :id => goal.id %>">Hide</a>
22
+ </span>
23
+ </li>
24
+ <% end %>
25
+ </ul>
26
+ <div class="action-bar">
27
+ <a class="button" href="<%= new_mg_goal_url %>">New Goal</a>
28
+ </div>
29
+ </div>
30
+
31
+ <div class="hidden-goals">
32
+ <% @hidden_goals.each do |goal| %>
33
+ <span class="name"><%=h goal.name %></span>
34
+ <span class="unhide"><a href="<%= unhide_mg_goal_url :id => goal.id %>">Restore</a></span>
35
+ <% end %>
36
+ </div>
37
+ </div>
@@ -0,0 +1,12 @@
1
+ <div id="container-main" class="mg-goal-new">
2
+ <h1>Create New Goal</h1>
3
+ <div class="container-content">
4
+ <div class="edit-form">
5
+ <% form_for :goal, @goal, :url => mg_goals_url do |f| %>
6
+ <%= f.error_messages %>
7
+
8
+ <%= render :partial => 'mg/goals/goal_form', :locals => { :f => f } %>
9
+ <% end %>
10
+ </div>
11
+ </div>
12
+ </div>
@@ -0,0 +1,32 @@
1
+ <div id="container-main" class="mg-goals show">
2
+ <h1><%=h @goal.name.capitalize %></h1>
3
+ <div class="container-content">
4
+ <div class="statboard">
5
+ <div class="flyer-analysis statpad">
6
+ <div class="title">Records by Day</div>
7
+ <div class="statbody">
8
+ <%= mg_chart("analysis_graph#{@goal.id}",
9
+ { "Conversions" => { :collection => @results_per_day, :x => :date, :y => :val } },
10
+ { :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 => "records(s)") %>
11
+ </div>
12
+ </div>
13
+
14
+ <% @goal.mg_goal_meta_types.each do |gmt| %>
15
+ <div class="flyer-analysis statpad">
16
+ <div class="title">Records by <%=h gmt.name %></div>
17
+ <div class="statbody">
18
+ <% if gmt.meta_type == 'ci_meta' || gmt.meta_type == 'gi_meta' %>
19
+ <%= mg_chart("analysis_graph#{gmt.id}",
20
+ { "Records" => { :collection => @results_by_gmt[gmt.id], :x => :name, :y => :val } },
21
+ { :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 => "records(s)") %>
22
+ <% elsif gmt.meta_type == 'cs_meta' || gmt.meta_type == 'gs_meta' %>
23
+ <%= mg_chart("analysis_graph#{gmt.id}",
24
+ { "Conversions" => { :collection => @results_by_gmt[gmt.id], :x => :name, :y => :val } },
25
+ { :xaxis => {:autoscaleMargin => 0.1, :ticks => @results_by_gmt_titles[gmt.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 => "records(s)") %>
26
+ <% end %>
27
+ </div>
28
+ </div>
29
+ <% end %>
30
+ </div>
31
+ </div>
32
+ </div>