mountain-goat 0.1.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +119 -48
- data/generators/mg/mg_generator.rb +17 -9
- data/generators/mg/templates/create_mountain_goat_tables.rb +61 -25
- data/generators/mg/templates/mg.rb +1 -0
- data/generators/mg/templates/mountain-goat.yml +22 -3
- data/generators/mg/templates/mountain_goat_reports.rake +17 -0
- data/generators/mg/templates/update_mountain_goat_tables.rb +104 -0
- data/lib/mountain-goat.rb +21 -12
- data/lib/mountain-goat/analytics.rb +134 -0
- data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_converts_controller.rb → mg/converts_controller.rb} +12 -11
- data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_metric_variants_controller.rb → mg/metric_variants_controller.rb} +6 -5
- data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_metrics_controller.rb → mg/metrics_controller.rb} +8 -6
- data/lib/mountain-goat/controllers/mg/mg.rb +47 -0
- data/lib/mountain-goat/controllers/{mountain_goat → mg}/mountain_goat_controller.rb +5 -42
- data/lib/mountain-goat/controllers/mg/playground_controller.rb +8 -0
- data/lib/mountain-goat/controllers/{mountain_goat/mountain_goat_rallies_controller.rb → mg/rallies_controller.rb} +4 -26
- data/lib/mountain-goat/controllers/mg/report_items_controller.rb +82 -0
- data/lib/mountain-goat/controllers/mg/reports_controller.rb +90 -0
- data/lib/mountain-goat/m_g.rb +64 -0
- data/lib/mountain-goat/metric_tracking.rb +192 -74
- data/lib/mountain-goat/models/mg/ci_meta.rb +10 -0
- data/lib/mountain-goat/models/mg/convert.rb +147 -0
- data/lib/mountain-goat/models/mg/convert_meta_type.rb +20 -0
- data/lib/mountain-goat/models/mg/cs_meta.rb +10 -0
- data/lib/mountain-goat/models/{metric.rb → mg/metric.rb} +3 -5
- data/lib/mountain-goat/models/mg/metric_variant.rb +25 -0
- data/lib/mountain-goat/models/mg/mountain_goat.rb +3 -0
- data/lib/mountain-goat/models/{rally.rb → mg/rally.rb} +4 -3
- data/lib/mountain-goat/models/mg/report.rb +11 -0
- data/lib/mountain-goat/models/mg/report_item.rb +24 -0
- data/lib/mountain-goat/models/mg/report_mailer.rb +18 -0
- data/lib/mountain-goat/public/g-bar-min.js +7 -0
- data/lib/mountain-goat/public/g-dot-min.js +7 -0
- data/lib/mountain-goat/public/g-line-min.js +7 -0
- data/lib/mountain-goat/public/g-pie-min.js +1 -0
- data/lib/mountain-goat/public/g-raphael-min.js +7 -0
- data/lib/mountain-goat/public/jqModel.css +41 -0
- data/lib/mountain-goat/public/jqModel.js +69 -0
- data/lib/mountain-goat/public/jquery.raphael.js +208 -0
- data/lib/mountain-goat/public/mg.css +135 -26
- data/lib/mountain-goat/public/mg.js +53 -1
- data/lib/mountain-goat/public/raphael-min.js +7 -0
- data/lib/mountain-goat/public/utils.js +520 -0
- data/lib/mountain-goat/switch_variant.rb +4 -4
- data/lib/mountain-goat/version.rb +1 -1
- data/lib/mountain-goat/views/mountain_goat/layouts/_pdf.html.erb +15 -0
- data/lib/mountain-goat/views/mountain_goat/layouts/mountain_goat.html.erb +17 -5
- data/lib/mountain-goat/views/mountain_goat/layouts/xhr.html.erb +2 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/.tmp_show.html.erb.4433~ +0 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/_convert_form.html.erb +0 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/_convert_meta_type_form.html.erb +0 -0
- data/lib/mountain-goat/views/mountain_goat/mg/converts/edit.html.erb +13 -0
- data/lib/mountain-goat/views/mountain_goat/mg/converts/index.html.erb +25 -0
- data/lib/mountain-goat/views/mountain_goat/mg/converts/new.html.erb +13 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_converts → mg/converts}/show.html.erb +3 -28
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metric_variants → mg/metric_variants}/_metric_variant_form.html.erb +0 -4
- data/lib/mountain-goat/views/mountain_goat/mg/metric_variants/edit.html.erb +13 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metric_variants → mg/metric_variants}/index.html.erb +3 -3
- data/lib/mountain-goat/views/mountain_goat/mg/metric_variants/new.html.erb +15 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metric_variants → mg/metric_variants}/show.html.erb +4 -5
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metrics → mg/metrics}/.tmp_show.html.erb.21270~ +0 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metrics → mg/metrics}/_metric_form.html.erb +0 -2
- data/lib/mountain-goat/views/mountain_goat/mg/metrics/edit.html.erb +13 -0
- data/lib/mountain-goat/views/mountain_goat/mg/metrics/index.html.erb +14 -0
- data/lib/mountain-goat/views/mountain_goat/mg/metrics/new.html.erb +14 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_metrics → mg/metrics}/show.html.erb +7 -8
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat → mg/mountain_goat}/login.html.erb +0 -0
- data/lib/mountain-goat/views/mountain_goat/mg/playground/test.html.erb +14 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/.tmp__rally.html.erb.40484~ +0 -0
- data/lib/mountain-goat/views/mountain_goat/mg/rallies/_rallies.html.erb +5 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/_rallies_form.html.erb +0 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/_rally.html.erb +0 -0
- data/lib/mountain-goat/views/mountain_goat/mg/rallies/edit.html.erb +13 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/index.html.erb +1 -1
- data/lib/mountain-goat/views/mountain_goat/mg/rallies/new.html.erb +13 -0
- data/lib/mountain-goat/views/mountain_goat/{mountain_goat_rallies → mg/rallies}/show.html.erb +1 -1
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/_chart.html.erb +18 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/_report_item_form.html.erb +10 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/_report_item_pivot_form.html.erb +14 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/_show.html.erb +29 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/_svg_chart.html.erb +4 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/edit.html.erb +19 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_items/new.html.erb +17 -0
- data/lib/mountain-goat/views/mountain_goat/mg/report_mailer/report.html.erb +27 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/_report.html.erb +22 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/_report_form.html.erb +21 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/_report_report_items.html.erb +5 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/edit.html.erb +36 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/index.html.erb +26 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/new.html.erb +17 -0
- data/lib/mountain-goat/views/mountain_goat/mg/reports/show.html.erb +21 -0
- data/test/fixtures/{ci_metas.yml → mg_ci_metas.yml} +0 -0
- data/test/fixtures/{convert_meta_types.yml → mg_convert_meta_types.yml} +0 -0
- data/test/fixtures/{converts.yml → mg_converts.yml} +5 -0
- data/test/fixtures/{cs_metas.yml → mg_cs_metas.yml} +0 -0
- data/test/fixtures/mg_deliveries.yml +9 -0
- data/test/fixtures/{metric_variants.yml → mg_metric_variants.yml} +0 -0
- data/test/fixtures/{metrics.yml → mg_metrics.yml} +2 -3
- data/test/fixtures/{rallies.yml → mg_rallies.yml} +6 -2
- data/test/fixtures/mg_report_items.yml +13 -0
- data/test/fixtures/mg_reports.yml +15 -0
- data/test/mg_convert_test.rb +32 -0
- data/test/mg_converts_controller_test.rb +47 -0
- data/test/mg_metric_variants_controller_test.rb +46 -0
- data/test/mg_metrics_controller_test.rb +52 -0
- data/test/mg_mountain_goat_controller_test.rb +45 -0
- data/test/mg_mountain_goat_test.rb +392 -0
- data/test/mg_playground_controller_test.rb +11 -0
- data/test/mg_rallies_controller_test.rb +36 -0
- data/test/mg_report_item_test.rb +7 -0
- data/test/mg_report_items_controller_test.rb +31 -0
- data/test/mg_report_test.rb +18 -0
- data/test/mg_reports_controller_test.rb +50 -0
- data/test/test_helper.rb +203 -0
- metadata +108 -55
- data/lib/mountain-goat/models/ci_meta.rb +0 -9
- data/lib/mountain-goat/models/convert.rb +0 -70
- data/lib/mountain-goat/models/convert_meta_type.rb +0 -19
- data/lib/mountain-goat/models/cs_meta.rb +0 -9
- data/lib/mountain-goat/models/metric_variant.rb +0 -22
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_converts/edit.html.erb +0 -13
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_converts/index.html.erb +0 -48
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_converts/new.html.erb +0 -13
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/edit.html.erb +0 -13
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_metric_variants/new.html.erb +0 -15
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/edit.html.erb +0 -13
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/index.html.erb +0 -14
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_metrics/new.html.erb +0 -14
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_rallies/_rallies.html.erb +0 -5
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_rallies/edit.html.erb +0 -13
- data/lib/mountain-goat/views/mountain_goat/mountain_goat_rallies/new.html.erb +0 -13
- data/test/ocelot_converts_controller_test.rb +0 -45
- data/test/ocelot_metric_variants_controller_test.rb +0 -45
- data/test/ocelot_metrics_controller_test.rb +0 -45
- data/test/ocelot_rallies_controller_test.rb +0 -8
@@ -1,70 +0,0 @@
|
|
1
|
-
class Convert < ActiveRecord::Base
|
2
|
-
|
3
|
-
has_many :metrics
|
4
|
-
has_many :rallies
|
5
|
-
has_many :convert_meta_types
|
6
|
-
has_many :ci_metas, :through => :convert_meta_types
|
7
|
-
has_many :cs_metas, :through => :convert_meta_types
|
8
|
-
|
9
|
-
validates_presence_of :name
|
10
|
-
validates_format_of :convert_type, :with => /[a-z0-9_]{3,50}/i, :message => "must be between 3 and 30 characters, alphanumeric with underscores"
|
11
|
-
validates_uniqueness_of :convert_type
|
12
|
-
|
13
|
-
accepts_nested_attributes_for :convert_meta_types, :reject_if => lambda { |a| a[:name].blank? || a[:var].blank? || a[:meta_type].blank? }, :allow_destroy => true
|
14
|
-
|
15
|
-
def self.by_type(s)
|
16
|
-
Convert.find( :first, :conditions => { :convert_type => s.to_s } )
|
17
|
-
end
|
18
|
-
|
19
|
-
def rallies_for_meta(var)
|
20
|
-
cmt = self.convert_meta_types.find_by_var( var.to_s )
|
21
|
-
return {} if cmt.nil?
|
22
|
-
cmt.meta.map { |m| { m.data => m.rally } }
|
23
|
-
end
|
24
|
-
|
25
|
-
def rallies_for_meta_val(var, data)
|
26
|
-
cmt = self.convert_meta_types.find_by_var( var.to_s )
|
27
|
-
return [] if cmt.nil?
|
28
|
-
cmt.meta.find(:all, :conditions => { :data => data } ).map { |m| m.rally }
|
29
|
-
end
|
30
|
-
|
31
|
-
def rallies_for_meta_val_pivot(var, data, pivot)
|
32
|
-
res = {}
|
33
|
-
cmt = self.convert_meta_types.find_by_var( var.to_s )
|
34
|
-
cmt_pivot = self.convert_meta_types.find_by_var( pivot.to_s )
|
35
|
-
return {} if cmt.nil? || cmt_pivot.nil?
|
36
|
-
cmt.meta.find(:all, :select => "`#{cmt.meta.table_name}`.created_at, cm.data AS pivot", :conditions => { :data => data }, :joins => "LEFT JOIN `#{cmt_pivot.meta.table_name}` cm ON cm.convert_meta_type_id = #{cmt_pivot.id} AND cm.rally_id = `#{cmt.meta.table_name}`.rally_id").each do |c|
|
37
|
-
if !res.include?(c.pivot)
|
38
|
-
res[c.pivot] = []
|
39
|
-
end
|
40
|
-
|
41
|
-
res[c.pivot].push c.created_at
|
42
|
-
end
|
43
|
-
|
44
|
-
res.each { |k,v| v.sort! }
|
45
|
-
res
|
46
|
-
end
|
47
|
-
|
48
|
-
def rallies_for_meta_val_pivot_item(var, data, pivot, item)
|
49
|
-
res = {}
|
50
|
-
cmt = self.convert_meta_types.find_by_var( var.to_s )
|
51
|
-
cmt_pivot = self.convert_meta_types.find_by_var( pivot.to_s )
|
52
|
-
cmt_item = self.convert_meta_types.find_by_var( item.to_s )
|
53
|
-
return {} if cmt.nil? || cmt_pivot.nil? || cmt_item.nil?
|
54
|
-
cmt.meta.find(:all, :select => "`#{cmt.meta.table_name}`.created_at, cm.data AS pivot, ci.data as item", :conditions => { :data => data }, :joins => "LEFT JOIN `#{cmt_pivot.meta.table_name}` cm ON cm.convert_meta_type_id = #{cmt_pivot.id} AND cm.rally_id = `#{cmt.meta.table_name}`.rally_id LEFT JOIN `#{cmt_item.meta.table_name}` ci ON ci.convert_meta_type_id = #{cmt_item.id} AND ci.rally_id = `#{cmt.meta.table_name}`.rally_id").each do |c|
|
55
|
-
if !res.include?(c.pivot)
|
56
|
-
res[c.pivot] = []
|
57
|
-
end
|
58
|
-
|
59
|
-
if cmt_item.meta_type == 'ci_meta'
|
60
|
-
c.item.to_i.times { res[c.pivot].push c.created_at }
|
61
|
-
else
|
62
|
-
res[c.pivot].push c.created_at if c.item == 'yes' #what else?
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
res.each { |k,v| v.sort! }
|
67
|
-
res.delete_if { |k,v| v.count == 0 }
|
68
|
-
res
|
69
|
-
end
|
70
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class ConvertMetaType < ActiveRecord::Base
|
2
|
-
|
3
|
-
belongs_to :convert
|
4
|
-
has_many :ci_metas, :class_name => 'CiMeta', :dependent => :destroy
|
5
|
-
has_many :cs_metas, :class_name => 'CsMeta', :dependent => :destroy
|
6
|
-
|
7
|
-
validates_presence_of :name
|
8
|
-
validates_presence_of :var
|
9
|
-
validates_presence_of :meta_type
|
10
|
-
|
11
|
-
def meta
|
12
|
-
case self.meta_type
|
13
|
-
when 'ci_meta'
|
14
|
-
return self.ci_metas
|
15
|
-
when 'cs_meta'
|
16
|
-
return self.cs_metas
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class MetricVariant < ActiveRecord::Base
|
2
|
-
|
3
|
-
belongs_to :metric
|
4
|
-
|
5
|
-
validates_presence_of :name
|
6
|
-
validates_presence_of :metric_id
|
7
|
-
|
8
|
-
def tally_serve(count = 1)
|
9
|
-
MetricVariant.update_counters(self.id, :served => count)
|
10
|
-
self.reload
|
11
|
-
end
|
12
|
-
|
13
|
-
def tally_convert(count = 1)
|
14
|
-
MetricVariant.update_counters(self.id, :conversions => count)
|
15
|
-
self.reload
|
16
|
-
end
|
17
|
-
|
18
|
-
def conversion_rate
|
19
|
-
return nil if self.served == 0
|
20
|
-
return self.conversions / self.served.to_f * 100
|
21
|
-
end
|
22
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div id="container-main" class="mt-converts">
|
4
|
-
<div class="mountain-goat-panel centered">
|
5
|
-
<h1>Edit <%=h @convert.name %></h1>
|
6
|
-
|
7
|
-
<% form_for :convert, @convert, :url => mountain_goat_convert_url(:id => @convert.id), :html => { :method => :put } do |f| %>
|
8
|
-
<%= f.error_messages %>
|
9
|
-
|
10
|
-
<%= render :partial => 'mountain_goat_converts/convert_form', :locals => { :f => f } %>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,48 +0,0 @@
|
|
1
|
-
|
2
|
-
<div id="container-main" class="mt-converts">
|
3
|
-
<div class="mountain-goat-panel centered">
|
4
|
-
|
5
|
-
<h1>Conversion Goals</h1>
|
6
|
-
|
7
|
-
<div class="conversions">
|
8
|
-
<div class="explanation">
|
9
|
-
<span class="inner">
|
10
|
-
Below are a list of conversion goals. Each goal has a set of metrics designed to achieve that goal. For each metric, there is a list of variants, each coupled with its conversation rate.</span>
|
11
|
-
</span>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<div class="converts">
|
15
|
-
<% @converts.each do |convert| %>
|
16
|
-
<h2><a href="<%= mountain_goat_convert_url :id => convert.id %>"><%=h convert.name %></a></h2>
|
17
|
-
<% convert.metrics.each do |metric| %>
|
18
|
-
<div class="metric-category">
|
19
|
-
<span class="metric"><a href="<%= mountain_goat_metric_url :id => metric.id %>"><%= metric.title %></a></span>
|
20
|
-
<% if metric.metric_variants.count == 0 %>
|
21
|
-
<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>
|
22
|
-
<% else %>
|
23
|
-
<% metric.metric_variants.each do |mv| %>
|
24
|
-
<div class="item rate">
|
25
|
-
<span class="rate-holder">
|
26
|
-
<span class="title"><a href="<%= mountain_goat_metric_variant_url mv %>"><%=h mv.name %></a></span>
|
27
|
-
<span class="rates" style="width:<%= number_to_percentage(mv.conversion_rate, :precision => 0) %>"></span>
|
28
|
-
</span>
|
29
|
-
|
30
|
-
<span class="percent-holder">
|
31
|
-
<span class="val"><%= number_to_percentage(mv.conversion_rate, :precision => 0) %></span>
|
32
|
-
(<span class="conversions"><%= mv.conversions %></span> /
|
33
|
-
<span class="served"><%= mv.served %></span>)
|
34
|
-
</span>
|
35
|
-
</div>
|
36
|
-
<% end %>
|
37
|
-
<% end %>
|
38
|
-
</div>
|
39
|
-
<% end %>
|
40
|
-
<% end %>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div class="actions">
|
45
|
-
<a class="button" href="<%= new_mountain_goat_convert_url %>">New Goal</a>
|
46
|
-
</div>
|
47
|
-
</div>
|
48
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div id="container-main" class="mt-converts">
|
4
|
-
<div class="mountain-goat-panel centered">
|
5
|
-
<h2>New convert</h2>
|
6
|
-
|
7
|
-
<% form_for :convert, @convert, :url => mountain_goat_converts_url do |f| %>
|
8
|
-
<%= f.error_messages %>
|
9
|
-
|
10
|
-
<%= render :partial => 'mountain_goat_converts/convert_form', :locals => { :f => f } %>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div id="container-main" class="mt-metric-variants">
|
4
|
-
<div class="mountain-goat-panel centered">
|
5
|
-
<h1>Edit <%=h @metric_variant.name %></h1>
|
6
|
-
|
7
|
-
<% form_for :metric_variant, @metric_variant, :url => mountain_goat_metric_variant_url(:id => @metric_variant.id), :html => { :method => :put } do |f| %>
|
8
|
-
<%= f.error_messages %>
|
9
|
-
|
10
|
-
<%= render :partial => 'mountain_goat_metric_variants/metric_variant_form', :locals => { :f => f } %>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div id="container-main" class="mt-metric-variants">
|
4
|
-
<div class="mountain-goat-panel cenetered">
|
5
|
-
<h1>New Variant for <%=h @metric.title %></h1>
|
6
|
-
|
7
|
-
<% form_for :metric_variant, @metric_variant, :url => mountain_goat_metric_variants_url do |f| %>
|
8
|
-
<%= f.error_messages %>
|
9
|
-
|
10
|
-
<%= render :partial => 'mountain_goat_metric_variants/metric_variant_form', :locals => { :f => f } %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<a href="<%= mountain_goat_metric_url :id => @metric.id %>">Back to <%=h @metric.title %></a>
|
14
|
-
</div>
|
15
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div id="container-main" class="mt-metrics">
|
4
|
-
<div class="mountain-goat-panel centered">
|
5
|
-
<h1>Edit <%= @metric.title %></h1>
|
6
|
-
|
7
|
-
<% form_for :metric, @metric, :url => mountain_goat_metric_url(:id => @metric.id), :html => { :method => :put } do |f| %>
|
8
|
-
<%= f.error_messages %>
|
9
|
-
|
10
|
-
<%= render :partial => 'mountain_goat_metrics/metric_form', :locals => { :f => f } %>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
<div id="container-main" class="mt-metrics">
|
3
|
-
<div class="mountain-goat-panel">
|
4
|
-
<h1>All metrics</h1>
|
5
|
-
|
6
|
-
<% @metrics.each do |metric| %>
|
7
|
-
<h2><a href="<%= mountain_goat_metric_url metric %>"><%=h metric.title %> </a> for <%=h metric.convert.name %></h2>
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
<span class="actions">
|
11
|
-
<a class="button" href="<%= new_mountain_goat_metric_url %>">New metric</a>
|
12
|
-
</span>
|
13
|
-
</div>
|
14
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<div id="container-main" class="mt-metrics">
|
4
|
-
<div class="mountain-goat-panel cenetered">
|
5
|
-
<h2>New metric for <%=h @convert.name %></h2>
|
6
|
-
|
7
|
-
<% form_for :metric, @metric, :url => mountain_goat_metrics_url do |f| %>
|
8
|
-
<%= f.error_messages %>
|
9
|
-
|
10
|
-
<%= render :partial => 'mountain_goat_metrics/metric_form', :locals => { :f => f } %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
</div>
|
14
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
<div id="container-main" class="mt-rallies">
|
3
|
-
<div class="mountain-goat-panel cenetered">
|
4
|
-
<h2>Edit rally</h2>
|
5
|
-
|
6
|
-
<% form_for :rally, @rally, :url => mountain_goat_rallies_url do |f| %>
|
7
|
-
<%= f.error_messages %>
|
8
|
-
|
9
|
-
<%= render :partial => 'mountain_goat_rallies/rallies_form', :locals => { :f => f } %>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
|
2
|
-
<div id="container-main" class="mt-rallies">
|
3
|
-
<div class="mountain-goat-panel cenetered">
|
4
|
-
<h2>New rally</h2>
|
5
|
-
|
6
|
-
<% form_for :rally, @rally, :url => mountain_goat_rallies_url do |f| %>
|
7
|
-
<%= f.error_messages %>
|
8
|
-
|
9
|
-
<%= render :partial => 'mountain_goat_rallies/rallies_form', :locals => { :f => f } %>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
</div>
|
13
|
-
</div>
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Ocelot::OcelotConvertsControllerTest < ActionController::TestCase
|
4
|
-
test "should get index" do
|
5
|
-
get :index, {}, admin_user
|
6
|
-
assert_response :success
|
7
|
-
assert_not_nil assigns(:converts)
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get new" do
|
11
|
-
get :new, {}, admin_user
|
12
|
-
assert_response :success
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should create convert" do
|
16
|
-
assert_difference('Convert.count') do
|
17
|
-
post :create, { :convert => { :name => 'my next convert', :convert_type => 'convert_type_3' } }, admin_user
|
18
|
-
end
|
19
|
-
|
20
|
-
assert_redirected_to ocelot_ocelot_convert_url assigns(:convert)
|
21
|
-
end
|
22
|
-
|
23
|
-
test "should show convert" do
|
24
|
-
get :show, { :id => converts(:one).to_param }, admin_user
|
25
|
-
assert_response :success
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should get edit" do
|
29
|
-
get :edit, { :id => converts(:one).to_param }, admin_user
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should update convert" do
|
34
|
-
put :update, { :id => converts(:one).to_param, :convert => { } }, admin_user
|
35
|
-
assert_redirected_to ocelot_ocelot_convert_url assigns(:convert)
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should destroy convert" do
|
39
|
-
assert_difference('Convert.count', -1) do
|
40
|
-
delete :destroy, { :id => converts(:one).to_param }, admin_user
|
41
|
-
end
|
42
|
-
|
43
|
-
assert_redirected_to ocelot_ocelot_converts_url
|
44
|
-
end
|
45
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Ocelot::OcelotMetricVariantsControllerTest < ActionController::TestCase
|
4
|
-
test "should get index" do
|
5
|
-
get :index, {}, admin_user
|
6
|
-
assert_response :success
|
7
|
-
assert_not_nil assigns(:metric_variants)
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get new" do
|
11
|
-
get :new, { :ocelot_metric_id => metrics(:two).id }, admin_user
|
12
|
-
assert_response :success
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should create metric_variant" do
|
16
|
-
assert_difference('MetricVariant.count') do
|
17
|
-
post :create, { :metric_variant => { :metric_id => metrics(:two).id, :name => 'var', :value => 'cool' } }, admin_user
|
18
|
-
end
|
19
|
-
|
20
|
-
assert_redirected_to ocelot_ocelot_metric_url metrics(:two)
|
21
|
-
end
|
22
|
-
|
23
|
-
test "should show metric_variant" do
|
24
|
-
get :show, { :id => metric_variants(:one).to_param }, admin_user
|
25
|
-
assert_response :success
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should get edit" do
|
29
|
-
get :edit, { :id => metric_variants(:one).to_param }, admin_user
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should update metric_variant" do
|
34
|
-
put :update, { :id => metric_variants(:one).to_param, :metric_variant => { } }, admin_user
|
35
|
-
assert_redirected_to ocelot_ocelot_metric_url assigns(:metric_variant).metric
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should destroy metric_variant" do
|
39
|
-
assert_difference('MetricVariant.count', -1) do
|
40
|
-
delete :destroy, { :id => metric_variants(:one).to_param }, admin_user
|
41
|
-
end
|
42
|
-
|
43
|
-
assert_redirected_to ocelot_ocelot_metric_variants_url
|
44
|
-
end
|
45
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class Ocelot::OcelotMetricsControllerTest < ActionController::TestCase
|
4
|
-
test "should get index" do
|
5
|
-
get :index, {}, admin_user
|
6
|
-
assert_response :success
|
7
|
-
assert_not_nil assigns(:metrics)
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get new" do
|
11
|
-
get :new, { :ocelot_convert_id => converts(:one).id }, admin_user
|
12
|
-
assert_response :success
|
13
|
-
end
|
14
|
-
|
15
|
-
test "should create metric" do
|
16
|
-
assert_difference('Metric.count') do
|
17
|
-
post :create, { :metric => { :metric_type => 'geoff', :title => 'hayes', :convert_id => converts(:two).id } }, admin_user
|
18
|
-
end
|
19
|
-
|
20
|
-
assert_redirected_to ocelot_ocelot_metric_url :id => assigns(:metric).id
|
21
|
-
end
|
22
|
-
|
23
|
-
test "should show metric" do
|
24
|
-
get :show, { :id => metrics(:one).to_param }, admin_user
|
25
|
-
assert_response :success
|
26
|
-
end
|
27
|
-
|
28
|
-
test "should get edit" do
|
29
|
-
get :edit, { :id => metrics(:one).to_param }, admin_user
|
30
|
-
assert_response :success
|
31
|
-
end
|
32
|
-
|
33
|
-
test "should update metric" do
|
34
|
-
put :update, { :id => metrics(:one).to_param, :metric => { } }, admin_user
|
35
|
-
assert_redirected_to ocelot_ocelot_metric_url :id => assigns(:metric).id
|
36
|
-
end
|
37
|
-
|
38
|
-
test "should destroy metric" do
|
39
|
-
assert_difference('Metric.count', -1) do
|
40
|
-
delete :destroy, { :id => metrics(:one).to_param }, admin_user
|
41
|
-
end
|
42
|
-
|
43
|
-
assert_redirected_to ocelot_ocelot_metrics_url
|
44
|
-
end
|
45
|
-
end
|