Commit 7b54d117 by tady

.

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