trailguide 0.4.3 → 0.4.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.
- checksums.yaml +4 -4
- data/app/controllers/trail_guide/admin/application_controller.rb +14 -8
- data/app/views/layouts/trail_guide/admin/_header.html.erb +1 -1
- data/config/initializers/admin.rb +14 -1
- data/lib/trail_guide/admin/config.rb +21 -0
- data/lib/trail_guide/admin.rb +10 -1
- data/lib/trail_guide/helper/experiment_proxy.rb +1 -1
- data/lib/trail_guide/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c099d61bcdf95cc843e70c0f6d29181e98a0b406223c9da34f58c5acbc512275
|
4
|
+
data.tar.gz: 86d169432b3f218fd174b52b0b1bb8e16134dbfbac3e4d8b16064f5b077e1926
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6ded8b6d09c96fa94238274675b4450163cd71d83a6c8275d590a2dede66435b5e89aacf95afc91d78f1a04a26dae4763a78c432455b9d9de3e015433760458
|
7
|
+
data.tar.gz: 1819ff2788259221bdd5e4942df7d3b5f99320b3dc2319602fd5174b3922bcf72248e65fc715e685590e3aa4676c704fb3e8f99256e7457c3316660925daf341
|
@@ -17,6 +17,13 @@ module TrailGuide
|
|
17
17
|
end
|
18
18
|
helper_method :preview_url
|
19
19
|
|
20
|
+
def subtitle(context=self)
|
21
|
+
subtitle = TrailGuide::Admin.configuration.subtitle
|
22
|
+
subtitle = context.instance_exec(&subtitle) if subtitle.respond_to?(:call)
|
23
|
+
subtitle
|
24
|
+
end
|
25
|
+
helper_method :subtitle
|
26
|
+
|
20
27
|
def experiment_peekable?(experiment)
|
21
28
|
return false unless TrailGuide::Admin.configuration.peek_parameter
|
22
29
|
return false unless experiment.started? && !experiment.stopped? && !experiment.winner?
|
@@ -100,17 +107,16 @@ module TrailGuide
|
|
100
107
|
end
|
101
108
|
helper_method :experiment_color
|
102
109
|
|
103
|
-
def time_zone
|
104
|
-
zone = TrailGuide::Admin.configuration.time_zone || ActiveSupport::TimeZone['UTC']
|
105
|
-
zone = zone.call if zone.respond_to?(:call)
|
106
|
-
zone = ActiveSupport::TimeZone[zone] unless zone.is_a?(ActiveSupport::TimeZone)
|
107
|
-
zone
|
108
|
-
end
|
109
|
-
|
110
110
|
def format_time(time, format=TrailGuide::Admin.configuration.date_format)
|
111
|
-
ActiveSupport::TimeWithZone.new(time.utc, time_zone).strftime(format)
|
111
|
+
ActiveSupport::TimeWithZone.new(time.utc, TrailGuide::Admin.configuration.time_zone).strftime(format)
|
112
112
|
end
|
113
113
|
helper_method :format_time
|
114
|
+
|
115
|
+
if TrailGuide::Admin.configuration.experiment_user.present?
|
116
|
+
def trailguide_user
|
117
|
+
send TrailGuide::Admin.configuration.experiment_user.to_sym
|
118
|
+
end
|
119
|
+
end
|
114
120
|
end
|
115
121
|
end
|
116
122
|
end
|
@@ -123,7 +123,7 @@
|
|
123
123
|
<span class="fas fa-calculator"></span>
|
124
124
|
</button>
|
125
125
|
</div>
|
126
|
-
<span class="navbar-brand d-none d-md-inline-block"
|
126
|
+
<span class="navbar-brand d-none d-md-inline-block"><%= raw subtitle(self) %></span>
|
127
127
|
</nav>
|
128
128
|
|
129
129
|
<%= render partial: 'layouts/trail_guide/admin/calculator' %>
|
@@ -7,7 +7,20 @@ TrailGuide::Admin.configure do |config|
|
|
7
7
|
|
8
8
|
# display subtitle for admin UI
|
9
9
|
#
|
10
|
-
|
10
|
+
# can be a string or a block, and may contain raw html.
|
11
|
+
#
|
12
|
+
# if a block is given, it will be executed within the view context, so you can use
|
13
|
+
# all available helpers, route helpers, etc.
|
14
|
+
#
|
15
|
+
config.subtitle = '<small class="text-muted">Experiments and A/B Tests</small>'
|
16
|
+
|
17
|
+
# specify a custom method to call when looking for a trailguide user/participant
|
18
|
+
# within the admin UI.
|
19
|
+
#
|
20
|
+
# this can be useful if you have separate admin and application user models, and
|
21
|
+
# allows you to specify the application user who will be enrolled on behalf of the
|
22
|
+
# admin user within the admin UI, to more easily facilitate enrollment and testing
|
23
|
+
config.experiment_user = nil
|
11
24
|
|
12
25
|
# request parameter can be used to "peek" at results even before an
|
13
26
|
# experiment's target_sample_size has been hit if one is configured
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TrailGuide
|
2
|
+
module Admin
|
3
|
+
class Config < Canfig::Config
|
4
|
+
DEFAULT_KEYS = [
|
5
|
+
:title, :subtitle, :experiment_user, :peek_parameter, :date_format, :time_zone
|
6
|
+
].freeze
|
7
|
+
|
8
|
+
def initialize(*args, **opts, &block)
|
9
|
+
args = args.concat(DEFAULT_KEYS)
|
10
|
+
super(*args, **opts, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def time_zone
|
14
|
+
self[:time_zone] ||= 'UTC'
|
15
|
+
self[:time_zone] = self[:time_zone].call if self[:time_zone].respond_to?(:call)
|
16
|
+
self[:time_zone] = ActiveSupport::TimeZone[self[:time_zone]] unless self[:time_zone].is_a?(ActiveSupport::TimeZone)
|
17
|
+
self[:time_zone]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/trail_guide/admin.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
|
+
require "trail_guide/admin/config"
|
1
2
|
require "trail_guide/admin/engine"
|
2
3
|
|
3
4
|
module TrailGuide
|
4
5
|
module Admin
|
5
|
-
|
6
|
+
class << self
|
7
|
+
def configuration
|
8
|
+
@configuration ||= Admin::Config.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def configure(*args, &block)
|
12
|
+
configuration.configure(*args, &block)
|
13
|
+
end
|
14
|
+
end
|
6
15
|
end
|
7
16
|
end
|
@@ -115,7 +115,7 @@ module TrailGuide
|
|
115
115
|
end
|
116
116
|
rescue NoExperimentsError => e
|
117
117
|
unless TrailGuide.configuration.ignore_orphaned_groups?
|
118
|
-
trace = e.backtrace.find { |t| !t.match?(Regexp.new(__FILE__)) }
|
118
|
+
trace = e.backtrace.find { |t| !t.match?(Regexp.new(File.dirname(__FILE__))) }
|
119
119
|
.to_s.split(Rails.root.to_s).last
|
120
120
|
.split(':').first(2).join(':')
|
121
121
|
TrailGuide.catalog.orphaned(key, trace)
|
data/lib/trail_guide/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailguide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rebec
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- lib/trail_guide/adapters/variants.rb
|
249
249
|
- lib/trail_guide/adapters/variants/redis.rb
|
250
250
|
- lib/trail_guide/admin.rb
|
251
|
+
- lib/trail_guide/admin/config.rb
|
251
252
|
- lib/trail_guide/admin/engine.rb
|
252
253
|
- lib/trail_guide/algorithms.rb
|
253
254
|
- lib/trail_guide/algorithms/algorithm.rb
|