diff options
author | Taurie Davis, Simon Knox and Adam Niedzielski <awesome@gitlab.com> | 2017-05-24 13:25:44 +0300 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2017-06-01 18:37:21 +0300 |
commit | 26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb (patch) | |
tree | f0168cb9ad0be7c4bf8657a5321e5da0bda8e83b /app/helpers | |
parent | c72abcefe79dd906cbbf0088b442a8979e9fc746 (diff) |
Add Conversational Development Index page to admin panel
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/conversational_development_index_helper.rb | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 36d9090b3ae..f422c48329c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -275,8 +275,8 @@ module ApplicationHelper 'active' if condition end - def show_user_callout? - cookies[:user_callout_dismissed].nil? + def show_callout?(name) + cookies[name] != 'true' end def linkedin_url(user) diff --git a/app/helpers/conversational_development_index_helper.rb b/app/helpers/conversational_development_index_helper.rb new file mode 100644 index 00000000000..1ff54415811 --- /dev/null +++ b/app/helpers/conversational_development_index_helper.rb @@ -0,0 +1,16 @@ +module ConversationalDevelopmentIndexHelper + def score_level(score) + if score < 33.33 + 'low' + elsif score < 66.66 + 'average' + else + 'high' + end + end + + def format_score(score) + precision = score < 1 ? 2 : 1 + number_with_precision(score, precision: precision) + end +end |