Commit 7b54d117 by tady

.

parent 164dd6e1
GIT GIT
remote: git://github.com/amatsuda/kaminari.git remote: git://github.com/amatsuda/kaminari.git
revision: b206d89922378dcf6f1f7a6247ce1d5f6f1534ad revision: 8247c79943cf98ce521b79403dd829317d19fa7f
specs: specs:
kaminari (1.0.0.alpha) kaminari (1.0.0.alpha)
actionpack (>= 3.0.0) actionpack (>= 3.0.0)
...@@ -17,38 +17,38 @@ GIT ...@@ -17,38 +17,38 @@ GIT
GIT GIT
remote: git://github.com/rails/sass-rails.git remote: git://github.com/rails/sass-rails.git
revision: 80e15690b66131edc1b8ccb4ab7dbbd5bf567042 revision: 404cd9ba2bf2618fe14b1ba2f27c861ba48980f2
specs: specs:
sass-rails (5.0.0.beta1) sass-rails (5.0.0.beta1)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (~> 3.2, >= 3.2.2) sass (~> 3.2, >= 3.2.2)
sprockets (~> 2.12) sprockets (~> 2.8, < 3.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.1.7) actionmailer (4.1.8)
actionpack (= 4.1.7) actionpack (= 4.1.8)
actionview (= 4.1.7) actionview (= 4.1.8)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
actionpack (4.1.7) actionpack (4.1.8)
actionview (= 4.1.7) actionview (= 4.1.8)
activesupport (= 4.1.7) activesupport (= 4.1.8)
rack (~> 1.5.2) rack (~> 1.5.2)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
actionview (4.1.7) actionview (4.1.8)
activesupport (= 4.1.7) activesupport (= 4.1.8)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
activemodel (4.1.7) activemodel (4.1.8)
activesupport (= 4.1.7) activesupport (= 4.1.8)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.1.7) activerecord (4.1.8)
activemodel (= 4.1.7) activemodel (= 4.1.8)
activesupport (= 4.1.7) activesupport (= 4.1.8)
arel (~> 5.0.0) arel (~> 5.0.0)
activesupport (4.1.7) activesupport (4.1.8)
i18n (~> 0.6, >= 0.6.9) i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
...@@ -67,7 +67,7 @@ GEM ...@@ -67,7 +67,7 @@ GEM
aws-sdk (1.39.0) aws-sdk (1.39.0)
json (~> 1.4) json (~> 1.4)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
backports (3.6.3) backports (3.6.4)
bcrypt (3.1.9) bcrypt (3.1.9)
better_errors (2.0.0) better_errors (2.0.0)
coderay (>= 1.0.0) coderay (>= 1.0.0)
...@@ -207,7 +207,7 @@ GEM ...@@ -207,7 +207,7 @@ GEM
i18n_generators (1.2.1) i18n_generators (1.2.1)
mechanize mechanize
rails (>= 3.0.0) rails (>= 3.0.0)
jbuilder (2.2.4) jbuilder (2.2.5)
activesupport (>= 3.0.0, < 5) activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (3.1.2) jquery-rails (3.1.2)
...@@ -220,7 +220,7 @@ GEM ...@@ -220,7 +220,7 @@ GEM
launchy (2.4.3) launchy (2.4.3)
addressable (~> 2.3) addressable (~> 2.3)
libv8 (3.16.14.7) libv8 (3.16.14.7)
listen (2.7.11) listen (2.8.1)
celluloid (>= 0.15.2) celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
...@@ -241,11 +241,11 @@ GEM ...@@ -241,11 +241,11 @@ GEM
method_source (0.8.2) method_source (0.8.2)
mime-types (2.4.3) mime-types (2.4.3)
mini_portile (0.6.1) mini_portile (0.6.1)
minitest (5.4.2) minitest (5.4.3)
multi_json (1.10.1) multi_json (1.10.1)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
mysql2 (0.3.16) mysql2 (0.3.17)
net-http-digest_auth (1.4) net-http-digest_auth (1.4)
net-http-persistent (2.9.4) net-http-persistent (2.9.4)
net-http-pipeline (1.0.1) net-http-pipeline (1.0.1)
...@@ -253,7 +253,7 @@ GEM ...@@ -253,7 +253,7 @@ GEM
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (2.9.1) net-ssh (2.9.1)
netrc (0.8.0) netrc (0.8.0)
newrelic_rpm (3.9.6.257) newrelic_rpm (3.9.7.266)
nokogiri (1.6.4.1) nokogiri (1.6.4.1)
mini_portile (~> 0.6.0) mini_portile (~> 0.6.0)
ntlm-http (0.1.1) ntlm-http (0.1.1)
...@@ -279,7 +279,7 @@ GEM ...@@ -279,7 +279,7 @@ GEM
paper_trail (3.0.6) paper_trail (3.0.6)
activerecord (>= 3.0, < 5.0) activerecord (>= 3.0, < 5.0)
activesupport (>= 3.0, < 5.0) activesupport (>= 3.0, < 5.0)
parser (2.2.0.pre.7) parser (2.2.0.pre.8)
ast (>= 1.1, < 3.0) ast (>= 1.1, < 3.0)
slop (~> 3.4, >= 3.4.5) slop (~> 3.4, >= 3.4.5)
poltergeist (1.5.1) poltergeist (1.5.1)
...@@ -309,24 +309,24 @@ GEM ...@@ -309,24 +309,24 @@ GEM
rack (>= 1.1.3) rack (>= 1.1.3)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.1.7) rails (4.1.8)
actionmailer (= 4.1.7) actionmailer (= 4.1.8)
actionpack (= 4.1.7) actionpack (= 4.1.8)
actionview (= 4.1.7) actionview (= 4.1.8)
activemodel (= 4.1.7) activemodel (= 4.1.8)
activerecord (= 4.1.7) activerecord (= 4.1.8)
activesupport (= 4.1.7) activesupport (= 4.1.8)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.1.7) railties (= 4.1.8)
sprockets-rails (~> 2.0) sprockets-rails (~> 2.0)
rails_12factor (0.0.3) rails_12factor (0.0.3)
rails_serve_static_assets rails_serve_static_assets
rails_stdout_logging rails_stdout_logging
rails_serve_static_assets (0.0.2) rails_serve_static_assets (0.0.2)
rails_stdout_logging (0.0.3) rails_stdout_logging (0.0.3)
railties (4.1.7) railties (4.1.8)
actionpack (= 4.1.7) actionpack (= 4.1.8)
activesupport (= 4.1.7) activesupport (= 4.1.8)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.0.0) rainbow (2.0.0)
...@@ -372,7 +372,7 @@ GEM ...@@ -372,7 +372,7 @@ GEM
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
ruby-progressbar (1.7.0) ruby-progressbar (1.7.0)
sass (3.4.7) sass (3.4.8)
sdoc (0.4.1) sdoc (0.4.1)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0) rdoc (~> 4.0)
...@@ -391,7 +391,7 @@ GEM ...@@ -391,7 +391,7 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.2.0) sprockets-rails (2.2.1)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
......
...@@ -36,14 +36,14 @@ module RV::Mailer ...@@ -36,14 +36,14 @@ module RV::Mailer
end end
def generate_html_mail(post) def generate_html_mail(post)
path = File.expand_path(File.dirname(__FILE__) + '/mail-template.html') path = File.expand_path(File.dirname(__FILE__) + '/mail-template2.html')
template = File.open(path).read template = File.open(path).read
html_body = template html_body = template
.sub('__POST_URL__', Settings.rendezvous.app_host + post.decorate.show_path) .gsub('__POST_URL__', Settings.rendezvous.app_host + post.decorate.show_path)
.sub('__HTML_TITLE__', MarkdownRenderer.new(post.title).render) .gsub('__HTML_TITLE__', MarkdownRenderer.new(post.title).render)
.sub('__HTML_BODY__', MarkdownRenderer.new(post.body).render) .gsub('__HTML_BODY__', MarkdownRenderer.new(post.body).render)
.sub('__RV_URL__', Settings.rendezvous.app_host + '/') .gsub('__RV_URL__', Settings.rendezvous.app_host + '/')
premailer = Premailer.new(html_body, with_html_string: true, adapter: :nokogiri) premailer = Premailer.new(html_body, with_html_string: true, adapter: :nokogiri)
premailer.to_inline_css premailer.to_inline_css
......
...@@ -36,7 +36,7 @@ class PostsController < ApplicationController ...@@ -36,7 +36,7 @@ class PostsController < ApplicationController
@post = set_post @post = set_post
# refresh google oauth token if expired # refresh google oauth token if expired
current_user.google_oauth_token_refresh! if current_user.google_oauth_token_expired? # current_user.google_oauth_token_refresh! if current_user.google_oauth_token_expired?
compose_mail(@post, user: current_user, to: mail_params[:to]).deliver compose_mail(@post, user: current_user, to: mail_params[:to]).deliver
gflash success: 'Mail has been sent!' gflash success: 'Mail has been sent!'
......
...@@ -77,11 +77,10 @@ class User < ActiveRecord::Base ...@@ -77,11 +77,10 @@ class User < ActiveRecord::Base
u.nickname = (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle[0..4].join u.nickname = (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle[0..4].join
end end
user.update( user.google_auth_token = access_token.credentials['token'] if access_token.credentials['token']
google_auth_token: access_token.credentials['token'], user.google_refresh_token = access_token.credentials['refresh_token'] if access_token.credentials['refresh_token']
google_refresh_token: access_token.credentials['refresh_token'], user.google_token_expires_at = Time.at(access_token.credentials['expires_at']) if access_token.credentials['expires_at']
google_token_expires_at: Time.at(access_token.credentials['expires_at']) user.save!
)
user user
end end
......
...@@ -3,9 +3,10 @@ Rails.application.config.middleware.use OmniAuth::Builder do ...@@ -3,9 +3,10 @@ Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, Settings.google_api.client_id, Settings.google_api.secret, provider :google_oauth2, Settings.google_api.client_id, Settings.google_api.secret,
name: 'google_oauth2', name: 'google_oauth2',
scope: 'https://mail.google.com/, userinfo.email, userinfo.profile', scope: 'https://mail.google.com/, userinfo.email, userinfo.profile',
access_type: 'offline', access_type: 'online',
prompt: 'select_account consent', # prompt: 'select_account consent',
image_aspect_ratio: 'square', approval_prompt: 'auto'
image_size: 50 # image_aspect_ratio: 'square',
# image_size: 50
end end
...@@ -13,117 +13,117 @@ ...@@ -13,117 +13,117 @@
ActiveRecord::Schema.define(version: 20140719145016) do ActiveRecord::Schema.define(version: 20140719145016) do
create_table 'comments', force: true do |t| create_table "comments", force: true do |t|
t.integer 'author_id' t.integer "author_id"
t.integer 'post_id' t.integer "post_id"
t.text 'body' t.text "body"
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
end end
add_index 'comments', ['author_id', 'updated_at'], name: 'index_comments_on_author_id_and_updated_at', using: :btree add_index "comments", ["author_id", "updated_at"], name: "index_comments_on_author_id_and_updated_at", using: :btree
add_index 'comments', ['post_id', 'updated_at'], name: 'index_comments_on_post_id_and_updated_at', using: :btree add_index "comments", ["post_id", "updated_at"], name: "index_comments_on_post_id_and_updated_at", using: :btree
create_table 'footprints', force: true do |t| create_table "footprints", force: true do |t|
t.integer 'user_id', null: false t.integer "user_id", null: false
t.integer 'post_id', null: false t.integer "post_id", null: false
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
end end
add_index 'footprints', ['post_id'], name: 'index_footprints_on_post_id', using: :btree add_index "footprints", ["post_id"], name: "index_footprints_on_post_id", using: :btree
add_index 'footprints', ['user_id', 'post_id'], name: 'index_footprints_on_user_id_and_post_id', using: :btree add_index "footprints", ["user_id", "post_id"], name: "index_footprints_on_user_id_and_post_id", using: :btree
create_table 'notifications', force: true do |t| create_table "notifications", force: true do |t|
t.integer 'user_id' t.integer "user_id"
t.datetime 'read_at' t.datetime "read_at"
t.boolean 'is_read', default: false, null: false t.boolean "is_read", default: false, null: false
t.string 'detail_path' t.string "detail_path"
t.text 'body' t.text "body"
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
end end
add_index 'notifications', ['user_id', 'is_read', 'read_at'], name: 'index_notifications_on_user_id_and_is_read_and_read_at', using: :btree add_index "notifications", ["user_id", "is_read", "read_at"], name: "index_notifications_on_user_id_and_is_read_and_read_at", using: :btree
create_table 'post_tags', force: true do |t| create_table "post_tags", force: true do |t|
t.integer 'post_id', null: false t.integer "post_id", null: false
t.integer 'tag_id', null: false t.integer "tag_id", null: false
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
end end
add_index 'post_tags', ['post_id'], name: 'index_post_tags_on_post_id', using: :btree add_index "post_tags", ["post_id"], name: "index_post_tags_on_post_id", using: :btree
add_index 'post_tags', ['tag_id'], name: 'index_post_tags_on_tag_id', using: :btree add_index "post_tags", ["tag_id"], name: "index_post_tags_on_tag_id", using: :btree
create_table 'posts', force: true do |t| create_table "posts", force: true do |t|
t.string 'title' t.string "title"
t.text 'body' t.text "body"
t.integer 'author_id' t.integer "author_id"
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
t.boolean 'is_draft', default: false t.boolean "is_draft", default: false
t.date 'specified_date' t.date "specified_date"
end end
add_index 'posts', ['is_draft'], name: 'index_posts_on_is_draft', using: :btree add_index "posts", ["is_draft"], name: "index_posts_on_is_draft", using: :btree
create_table 'tags', force: true do |t| create_table "tags", force: true do |t|
t.string 'name' t.string "name"
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
t.string 'ancestry' t.string "ancestry"
t.text 'body' t.text "body"
t.integer 'posts_count', default: 0, null: false t.integer "posts_count", default: 0, null: false
end end
add_index 'tags', ['ancestry'], name: 'index_tags_on_ancestry', using: :btree add_index "tags", ["ancestry"], name: "index_tags_on_ancestry", using: :btree
create_table 'users', force: true do |t| create_table "users", force: true do |t|
t.string 'name' t.string "name"
t.string 'image_url' t.string "image_url"
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
t.string 'email', default: '', null: false t.string "email", default: "", null: false
t.string 'encrypted_password', default: '', null: false t.string "encrypted_password", default: "", null: false
t.string 'reset_password_token' t.string "reset_password_token"
t.datetime 'reset_password_sent_at' t.datetime "reset_password_sent_at"
t.datetime 'remember_created_at' t.datetime "remember_created_at"
t.integer 'sign_in_count', default: 0, null: false t.integer "sign_in_count", default: 0, null: false
t.datetime 'current_sign_in_at' t.datetime "current_sign_in_at"
t.datetime 'last_sign_in_at' t.datetime "last_sign_in_at"
t.string 'current_sign_in_ip' t.string "current_sign_in_ip"
t.string 'last_sign_in_ip' t.string "last_sign_in_ip"
t.string 'google_auth_token' t.string "google_auth_token"
t.string 'google_refresh_token' t.string "google_refresh_token"
t.datetime 'google_token_expires_at' t.datetime "google_token_expires_at"
t.string 'nickname', default: '', null: false t.string "nickname", default: "", null: false
end end
add_index 'users', ['email'], name: 'index_users_on_email', unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index 'users', ['nickname'], name: 'index_users_on_nickname', using: :btree add_index "users", ["nickname"], name: "index_users_on_nickname", using: :btree
add_index 'users', ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true, using: :btree add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
create_table 'versions', force: true do |t| create_table "versions", force: true do |t|
t.string 'item_type', null: false t.string "item_type", null: false
t.integer 'item_id', null: false t.integer "item_id", null: false
t.string 'event', null: false t.string "event", null: false
t.string 'whodunnit' t.string "whodunnit"
t.text 'object' t.text "object"
t.datetime 'created_at' t.datetime "created_at"
end end
add_index 'versions', ['item_type', 'item_id'], name: 'index_versions_on_item_type_and_item_id', using: :btree add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
create_table 'watches', force: true do |t| create_table "watches", force: true do |t|
t.integer 'watcher_id', null: false t.integer "watcher_id", null: false
t.string 'watchable_type', null: false t.string "watchable_type", null: false
t.integer 'watchable_id', null: false t.integer "watchable_id", null: false
t.datetime 'created_at' t.datetime "created_at"
t.datetime 'updated_at' t.datetime "updated_at"
end end
add_index 'watches', ['watchable_type', 'watchable_id'], name: 'index_watches_on_watchable_type_and_watchable_id', using: :btree add_index "watches", ["watchable_type", "watchable_id"], name: "index_watches_on_watchable_type_and_watchable_id", using: :btree
add_index 'watches', ['watcher_id', 'watchable_type', 'watchable_id'], name: 'index_watches_on_watcher_id_and_watchable_type_and_watchable_id', unique: true, using: :btree add_index "watches", ["watcher_id", "watchable_type", "watchable_id"], name: "index_watches_on_watcher_id_and_watchable_type_and_watchable_id", unique: true, using: :btree
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment