diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 0000000..5859406
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+2.2.3
diff --git a/.travis.yml b/.travis.yml
index c693a78..a18bd2e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,4 +4,4 @@ before_install:
- gem --version
- gem install bundler
rvm:
- - 2.1.2
+ - 2.2.2
diff --git a/Gemfile b/Gemfile
index d9eab27..94a4006 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,8 +1,8 @@
source 'https://rubygems.org'
-ruby '2.1.2'
+ruby '2.2.2'
# Rails
-gem 'rails', '4.0.0'
+gem 'rails', '4.2.1'
# Postgres
gem 'pg'
@@ -18,6 +18,9 @@ gem 'jquery-rails'
gem "oauth"
gem "omniauth-twitter"
+# Responders
+gem 'responders'
+
# Pagination
gem 'will_paginate', '3.0.4'
gem 'bootstrap-will_paginate', '0.0.9'
@@ -31,6 +34,9 @@ gem 'jbuilder', '~> 1.2'
# Giver user.show a friendly URL
gem 'friendly_id', "~> 5.0.0"
+# Display emoji
+gem 'gemoji'
+
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
diff --git a/Gemfile.lock b/Gemfile.lock
index 0a4e2ac..1472989 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,62 +1,71 @@
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.0.0)
- actionpack (= 4.0.0)
- mail (~> 2.5.3)
- actionpack (4.0.0)
- activesupport (= 4.0.0)
- builder (~> 3.1.0)
- erubis (~> 2.7.0)
- rack (~> 1.5.2)
+ actionmailer (4.2.1)
+ actionpack (= 4.2.1)
+ actionview (= 4.2.1)
+ activejob (= 4.2.1)
+ mail (~> 2.5, >= 2.5.4)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ actionpack (4.2.1)
+ actionview (= 4.2.1)
+ activesupport (= 4.2.1)
+ rack (~> 1.6)
rack-test (~> 0.6.2)
- activemodel (4.0.0)
- activesupport (= 4.0.0)
- builder (~> 3.1.0)
- activerecord (4.0.0)
- activemodel (= 4.0.0)
- activerecord-deprecated_finders (~> 1.0.2)
- activesupport (= 4.0.0)
- arel (~> 4.0.0)
- activerecord-deprecated_finders (1.0.3)
- activesupport (4.0.0)
- i18n (~> 0.6, >= 0.6.4)
- minitest (~> 4.2)
- multi_json (~> 1.3)
- thread_safe (~> 0.1)
- tzinfo (~> 0.3.37)
- arel (4.0.2)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
+ actionview (4.2.1)
+ activesupport (= 4.2.1)
+ builder (~> 3.1)
+ erubis (~> 2.7.0)
+ rails-dom-testing (~> 1.0, >= 1.0.5)
+ rails-html-sanitizer (~> 1.0, >= 1.0.1)
+ activejob (4.2.1)
+ activesupport (= 4.2.1)
+ globalid (>= 0.3.0)
+ activemodel (4.2.1)
+ activesupport (= 4.2.1)
+ builder (~> 3.1)
+ activerecord (4.2.1)
+ activemodel (= 4.2.1)
+ activesupport (= 4.2.1)
+ arel (~> 6.0)
+ activesupport (4.2.1)
+ i18n (~> 0.7)
+ json (~> 1.7, >= 1.7.7)
+ minitest (~> 5.1)
+ thread_safe (~> 0.3, >= 0.3.4)
+ tzinfo (~> 1.1)
+ arel (6.0.0)
bootstrap-sass (2.3.2.0)
sass (~> 3.2)
bootstrap-will_paginate (0.0.9)
will_paginate
- builder (3.1.4)
+ builder (3.2.2)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
- childprocess (0.5.3)
+ childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
- coffee-script (2.2.0)
+ coffee-script (2.4.1)
coffee-script-source
execjs
- coffee-script-source (1.7.0)
- database_cleaner (1.3.0)
+ coffee-script-source (1.9.1.1)
+ database_cleaner (1.4.1)
diff-lcs (1.2.5)
- docile (1.1.4)
- dotenv (0.11.1)
- dotenv-deployment (~> 0.0.2)
- dotenv-deployment (0.0.2)
- dotenv-rails (0.11.1)
- dotenv (= 0.11.1)
+ docile (1.1.5)
+ dotenv (2.0.1)
+ dotenv-rails (2.0.1)
+ dotenv (= 2.0.1)
erubis (2.7.0)
- execjs (2.2.0)
+ execjs (2.5.2)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
@@ -64,64 +73,80 @@ GEM
railties (>= 3.0.0)
faker (1.2.0)
i18n (~> 0.5)
- ffi (1.9.3)
- friendly_id (5.0.4)
+ ffi (1.9.8)
+ friendly_id (5.0.5)
activerecord (>= 4.0.0)
- hashie (2.1.2)
+ gemoji (2.1.0)
+ globalid (0.3.5)
+ activesupport (>= 4.1.0)
+ hashie (3.4.1)
hike (1.2.3)
- i18n (0.6.9)
+ i18n (0.7.0)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
- jquery-rails (3.1.0)
- railties (>= 3.0, < 5.0)
+ jquery-rails (4.0.3)
+ rails-dom-testing (~> 1.0)
+ railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
- json (1.8.1)
- mail (2.5.4)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
+ json (1.8.2)
+ loofah (2.0.1)
+ nokogiri (>= 1.5.9)
+ mail (2.6.3)
+ mime-types (>= 1.16, < 3)
method_source (0.8.2)
- mime-types (1.25.1)
- mini_portile (0.6.0)
- minitest (4.7.5)
- multi_json (1.10.1)
- nokogiri (1.6.2.1)
- mini_portile (= 0.6.0)
+ mime-types (2.5)
+ mini_portile (0.6.2)
+ minitest (5.6.1)
+ multi_json (1.11.0)
+ nokogiri (1.6.6.2)
+ mini_portile (~> 0.6.0)
oauth (0.4.7)
- omniauth (1.2.1)
- hashie (>= 1.2, < 3)
+ omniauth (1.2.2)
+ hashie (>= 1.2, < 4)
rack (~> 1.0)
- omniauth-oauth (1.0.1)
+ omniauth-oauth (1.1.0)
oauth
omniauth (~> 1.0)
- omniauth-twitter (1.0.1)
- multi_json (~> 1.3)
- omniauth-oauth (~> 1.0)
- pg (0.17.1)
- polyglot (0.3.5)
- pry (0.10.0)
+ omniauth-twitter (1.2.0)
+ json (~> 1.3)
+ omniauth-oauth (~> 1.1)
+ pg (0.18.1)
+ pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- rack (1.5.2)
- rack-test (0.6.2)
+ rack (1.6.0)
+ rack-test (0.6.3)
rack (>= 1.0)
- rails (4.0.0)
- actionmailer (= 4.0.0)
- actionpack (= 4.0.0)
- activerecord (= 4.0.0)
- activesupport (= 4.0.0)
+ rails (4.2.1)
+ actionmailer (= 4.2.1)
+ actionpack (= 4.2.1)
+ actionview (= 4.2.1)
+ activejob (= 4.2.1)
+ activemodel (= 4.2.1)
+ activerecord (= 4.2.1)
+ activesupport (= 4.2.1)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.0.0)
- sprockets-rails (~> 2.0.0)
- railties (4.0.0)
- actionpack (= 4.0.0)
- activesupport (= 4.0.0)
+ railties (= 4.2.1)
+ sprockets-rails
+ rails-deprecated_sanitizer (1.0.3)
+ activesupport (>= 4.2.0.alpha)
+ rails-dom-testing (1.0.6)
+ activesupport (>= 4.2.0.beta, < 5.0)
+ nokogiri (~> 1.6.0)
+ rails-deprecated_sanitizer (>= 1.0.1)
+ rails-html-sanitizer (1.0.2)
+ loofah (~> 2.0)
+ railties (4.2.1)
+ actionpack (= 4.2.1)
+ activesupport (= 4.2.1)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- rake (10.3.2)
- rdoc (4.1.1)
- json (~> 1.4)
+ rake (10.4.2)
+ rdoc (4.2.0)
+ responders (2.1.0)
+ railties (>= 4.2.0, < 5)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
@@ -136,44 +161,42 @@ GEM
rspec-mocks (~> 2.14.0)
rubyzip (0.9.9)
sass (3.2.19)
- sass-rails (4.0.3)
+ sass-rails (4.0.5)
railties (>= 4.0.0, < 5.0)
- sass (~> 3.2.0)
- sprockets (~> 2.8, <= 2.11.0)
+ sass (~> 3.2.2)
+ sprockets (~> 2.8, < 3.0)
sprockets-rails (~> 2.0)
- sdoc (0.4.0)
- json (~> 1.8)
- rdoc (~> 4.0, < 5.0)
+ sdoc (0.4.1)
+ json (~> 1.7, >= 1.7.7)
+ rdoc (~> 4.0)
selenium-webdriver (2.35.1)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip (< 1.0.0)
websocket (~> 1.0.4)
- simplecov (0.8.2)
+ simplecov (0.10.0)
docile (~> 1.1.0)
- multi_json
- simplecov-html (~> 0.8.0)
- simplecov-html (0.8.0)
- slop (3.5.0)
- sprockets (2.11.0)
+ json (~> 1.8)
+ simplecov-html (~> 0.10.0)
+ simplecov-html (0.10.0)
+ slop (3.6.0)
+ sprockets (2.12.3)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.0.1)
+ sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
- sprockets (~> 2.8)
+ sprockets (>= 2.8, < 4.0)
thor (0.19.1)
- thread_safe (0.3.4)
+ thread_safe (0.3.5)
tilt (1.4.1)
- treetop (1.4.15)
- polyglot
- polyglot (>= 0.3.1)
- turbolinks (2.2.2)
+ turbolinks (2.5.3)
coffee-rails
- tzinfo (0.3.39)
- uglifier (2.5.0)
+ tzinfo (1.2.2)
+ thread_safe (~> 0.1)
+ uglifier (2.7.1)
execjs (>= 0.3.0)
json (>= 1.8.0)
websocket (1.0.7)
@@ -194,14 +217,16 @@ DEPENDENCIES
factory_girl_rails (= 4.2.1)
faker (= 1.2.0)
friendly_id (~> 5.0.0)
+ gemoji
jbuilder (~> 1.2)
jquery-rails
oauth
omniauth-twitter
pg
pry
- rails (= 4.0.0)
+ rails (= 4.2.1)
rake
+ responders
rspec-rails (~> 2.14.0)
sass-rails (~> 4.0.0)
sdoc
diff --git a/README.md b/README.md
index c50f5e9..186acf3 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,6 @@ rake db:test:prepare
```bash
rake db:populate
```
-```
These commands do the following:
1. Install all of the necessary gems listed in the Gemfile
@@ -40,6 +39,12 @@ TWITTER_KEY=
TWITTER_SECRET=
```
+Copy images for emoji
+
+```
+rake emoji
+```
+
## Authors
* Melissa Holmes [@meltar](https://github.com/meltar)
* Kylie Stradley [@kstradley](https://github.com/kstradley)
diff --git a/Rakefile b/Rakefile
index d0ad5d6..ed2bc20 100644
--- a/Rakefile
+++ b/Rakefile
@@ -3,4 +3,7 @@
require File.expand_path('../config/application', __FILE__)
+load 'tasks/emoji.rake'
+
ChallegeMe::Application.load_tasks
+
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 384657b..bfbbe05 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -6,4 +6,8 @@ def current_user?(user)
false
end
end
+
+ def champion(user)
+ emojify ":#{user.champion.name.downcase.tr(" ", "_")}:"
+ end
end
diff --git a/app/helpers/emoji_helper.rb b/app/helpers/emoji_helper.rb
new file mode 100644
index 0000000..c8f00ac
--- /dev/null
+++ b/app/helpers/emoji_helper.rb
@@ -0,0 +1,11 @@
+module EmojiHelper
+ def emojify(content)
+ h(content).to_str.gsub(/:([\w+-]+):/) do |match|
+ if emoji = Emoji.find_by_alias($1)
+ %()
+ else
+ match
+ end
+ end.html_safe if content.present?
+ end
+end
diff --git a/app/models/user.rb b/app/models/user.rb
index ec160df..49d70ca 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -14,93 +14,4 @@ def self.search query
all
end
end
-
- def self.all_champions
- [
- 'Alarm clock',
- 'Doorknob',
- 'Toilet seat',
- 'Faucet',
- 'Towel',
- 'Toothbrush',
- 'Contact lens',
- 'Glasses ',
- 'Shaving Cream',
- 'Razor',
- 'Soap',
- 'Shampoo',
- 'Diaper',
- 'Kitchen Cabinet',
- 'Baby bottle',
- 'Bib',
- 'Baby food',
- 'Baby spoon',
- 'Sock',
- 'Shoe',
- 'Bottle of Dish soap',
- 'Keys',
- 'Wallet',
- 'Cell Phone',
- 'Headphones',
- 'Coffee Cup',
- 'Coffee Maker',
- 'Piece of Paper',
- 'Frying Pan',
- 'Cast Iron Pan',
- 'Bacon',
- 'Burrito',
- 'Taco',
- 'Cookie',
- 'Muffin',
- 'Marshmallow',
- 'Fork',
- 'Spoon',
- 'Spork',
- 'Butter Knife',
- 'Baby night light',
- 'Sunflower seed',
- 'Dental floss',
- 'Rock',
- 'scissors',
- 'diary',
- 'necklace',
- 'blender',
- 'Drum stick',
- 'guitar',
- 'banana',
- 'yarn',
- 'toenail',
- 'popsicle',
- 'Potted plant',
- 'Post card',
- 'Quill pen',
- 'Fountain pen',
- 'gum',
- 'Kitchen twine',
- 'sofa',
- 'couch',
- 'kiwi',
- 'cardboard box',
- 'pencil',
- 'paper clip',
- 'kumquat',
- 'toaster',
- 'strawberry',
- 'stapler',
- 'comb',
- 'toy boat',
- 'leaf',
- 'lightbulb',
- 'push pin',
- 'bike lock',
- 'apple',
- 'ice cream',
- 'ten gallon hat',
- 'vacuum cleaner',
- 'sundial',
- 'cookie',
- 'orange',
- 'pinecone',
- ]
- end
end
diff --git a/app/views/challenges/index.html.erb b/app/views/challenges/index.html.erb
index ac56326..7794074 100644
--- a/app/views/challenges/index.html.erb
+++ b/app/views/challenges/index.html.erb
@@ -1,4 +1,4 @@
-