Commit 1d537e20 by tady

mypage

parent 280d2049
...@@ -10,43 +10,41 @@ GIT ...@@ -10,43 +10,41 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.0.3) actionmailer (4.0.4)
actionpack (= 4.0.3) actionpack (= 4.0.4)
mail (~> 2.5.4) mail (~> 2.5.4)
actionpack (4.0.3) actionpack (4.0.4)
activesupport (= 4.0.3) activesupport (= 4.0.4)
builder (~> 3.1.0) builder (~> 3.1.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rack (~> 1.5.2) rack (~> 1.5.2)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
activemodel (4.0.3) activemodel (4.0.4)
activesupport (= 4.0.3) activesupport (= 4.0.4)
builder (~> 3.1.0) builder (~> 3.1.0)
activerecord (4.0.3) activerecord (4.0.4)
activemodel (= 4.0.3) activemodel (= 4.0.4)
activerecord-deprecated_finders (~> 1.0.2) activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.3) activesupport (= 4.0.4)
arel (~> 4.0.0) arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3) activerecord-deprecated_finders (1.0.3)
activesupport (4.0.3) activesupport (4.0.4)
i18n (~> 0.6, >= 0.6.4) i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2) minitest (~> 4.2)
multi_json (~> 1.3) multi_json (~> 1.3)
thread_safe (~> 0.1) thread_safe (~> 0.1)
tzinfo (~> 0.3.37) tzinfo (~> 0.3.37)
addressable (2.3.5) addressable (2.3.6)
ancestry (2.0.0) ancestry (2.0.0)
activerecord (>= 3.0.0) activerecord (>= 3.0.0)
arel (4.0.2) arel (4.0.2)
ast (1.1.0) ast (1.1.0)
atomic (1.1.15) atomic (1.1.16)
aws-sdk (1.36.1) aws-sdk (1.38.0)
json (~> 1.4) json (~> 1.4)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
uuidtools (~> 2.1) uuidtools (~> 2.1)
bcrypt (3.1.7) bcrypt (3.1.7)
bcrypt-ruby (3.1.5)
bcrypt (>= 3.1.3)
better_errors (1.1.0) better_errors (1.1.0)
coderay (>= 1.0.0) coderay (>= 1.0.0)
erubis (>= 2.6.6) erubis (>= 2.6.6)
...@@ -99,15 +97,15 @@ GEM ...@@ -99,15 +97,15 @@ GEM
daemons (1.1.9) daemons (1.1.9)
database_rewinder (0.0.3) database_rewinder (0.0.3)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.2.3) devise (3.2.4)
bcrypt-ruby (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.2.5) diff-lcs (1.2.5)
docile (1.1.3) docile (1.1.3)
domain_name (0.5.16) domain_name (0.5.18)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
draper (1.3.0) draper (1.3.0)
actionpack (>= 3.0) actionpack (>= 3.0)
...@@ -128,12 +126,12 @@ GEM ...@@ -128,12 +126,12 @@ GEM
formatador (0.2.4) formatador (0.2.4)
gherkin (2.12.2) gherkin (2.12.2)
multi_json (~> 1.3) multi_json (~> 1.3)
github-markdown (0.6.4) github-markdown (0.6.5)
gmail_xoauth (0.4.1) gmail_xoauth (0.4.1)
oauth (>= 0.3.6) oauth (>= 0.3.6)
guard (2.5.1) guard (2.6.0)
formatador (>= 0.2.4) formatador (>= 0.2.4)
listen (~> 2.6) listen (~> 2.7)
lumberjack (~> 1.0) lumberjack (~> 1.0)
pry (>= 0.9.12) pry (>= 0.9.12)
thor (>= 0.18.1) thor (>= 0.18.1)
...@@ -152,7 +150,7 @@ GEM ...@@ -152,7 +150,7 @@ GEM
i18n_generators (1.2.1) i18n_generators (1.2.1)
mechanize mechanize
rails (>= 3.0.0) rails (>= 3.0.0)
jbuilder (2.0.4) jbuilder (2.0.5)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
multi_json (>= 1.2.0) multi_json (>= 1.2.0)
jquery-rails (3.1.0) jquery-rails (3.1.0)
...@@ -164,12 +162,12 @@ GEM ...@@ -164,12 +162,12 @@ GEM
launchy (2.4.2) launchy (2.4.2)
addressable (~> 2.3) addressable (~> 2.3)
libv8 (3.16.14.3) libv8 (3.16.14.3)
listen (2.7.0) listen (2.7.1)
celluloid (>= 0.15.2) celluloid (>= 0.15.2)
celluloid-io (>= 0.15.0) celluloid-io (>= 0.15.0)
rb-fsevent (>= 0.9.3) rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9) rb-inotify (>= 0.9)
lumberjack (1.0.4) lumberjack (1.0.5)
mail (2.5.4) mail (2.5.4)
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
...@@ -184,9 +182,9 @@ GEM ...@@ -184,9 +182,9 @@ GEM
webrobots (>= 0.0.9, < 0.2) webrobots (>= 0.0.9, < 0.2)
method_source (0.8.2) method_source (0.8.2)
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.5.2) mini_portile (0.5.3)
minitest (4.7.5) minitest (4.7.5)
multi_json (1.9.0) multi_json (1.9.2)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
mysql2 (0.3.15) mysql2 (0.3.15)
...@@ -219,7 +217,7 @@ GEM ...@@ -219,7 +217,7 @@ GEM
oauth2 (~> 0.9.3) oauth2 (~> 0.9.3)
omniauth (~> 1.2) omniauth (~> 1.2)
orm_adapter (0.5.0) orm_adapter (0.5.0)
paper_trail (3.0.0) paper_trail (3.0.1)
activerecord (>= 3.0, < 5.0) activerecord (>= 3.0, < 5.0)
activesupport (>= 3.0, < 5.0) activesupport (>= 3.0, < 5.0)
parser (2.1.7) parser (2.1.7)
...@@ -232,7 +230,7 @@ GEM ...@@ -232,7 +230,7 @@ GEM
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
polyglot (0.3.4) polyglot (0.3.4)
powerpack (0.0.9) powerpack (0.0.9)
premailer (1.8.1) premailer (1.8.2)
css_parser (>= 1.3.5) css_parser (>= 1.3.5)
htmlentities (>= 4.0.0) htmlentities (>= 4.0.0)
pry (0.9.12.6) pry (0.9.12.6)
...@@ -244,21 +242,21 @@ GEM ...@@ -244,21 +242,21 @@ GEM
rack (1.5.2) rack (1.5.2)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.0.3) rails (4.0.4)
actionmailer (= 4.0.3) actionmailer (= 4.0.4)
actionpack (= 4.0.3) actionpack (= 4.0.4)
activerecord (= 4.0.3) activerecord (= 4.0.4)
activesupport (= 4.0.3) activesupport (= 4.0.4)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.0.3) railties (= 4.0.4)
sprockets-rails (~> 2.0.0) sprockets-rails (~> 2.0.0)
railties (4.0.3) railties (4.0.4)
actionpack (= 4.0.3) actionpack (= 4.0.4)
activesupport (= 4.0.3) activesupport (= 4.0.4)
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)
rake (10.1.1) rake (10.2.1)
rb-fsevent (0.9.4) rb-fsevent (0.9.4)
rb-inotify (0.9.3) rb-inotify (0.9.3)
ffi (>= 0.5.0) ffi (>= 0.5.0)
...@@ -276,7 +274,7 @@ GEM ...@@ -276,7 +274,7 @@ GEM
rspec-expectations (2.14.5) rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0) diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.6) rspec-mocks (2.14.6)
rspec-rails (2.14.1) rspec-rails (2.14.2)
actionpack (>= 3.0) actionpack (>= 3.0)
activemodel (>= 3.0) activemodel (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
...@@ -284,12 +282,14 @@ GEM ...@@ -284,12 +282,14 @@ GEM
rspec-core (~> 2.14.0) rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0) rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0) rspec-mocks (~> 2.14.0)
rubocop (0.18.1) rubocop (0.19.1)
json (>= 1.7.7, < 2) json (>= 1.7.7, < 2)
parser (~> 2.1.3) parser (~> 2.1.7)
powerpack (~> 0.0.6) powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
sass (3.3.2) ruby-progressbar (~> 1.4)
ruby-progressbar (1.4.2)
sass (3.3.4)
sass-rails (4.0.1) sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10) sass (>= 3.1.10)
...@@ -307,7 +307,7 @@ GEM ...@@ -307,7 +307,7 @@ GEM
temple (~> 0.6.6) temple (~> 0.6.6)
tilt (>= 1.3.3, < 2.1) tilt (>= 1.3.3, < 2.1)
slop (3.5.0) slop (3.5.0)
sprockets (2.11.0) sprockets (2.12.0)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
...@@ -330,12 +330,12 @@ GEM ...@@ -330,12 +330,12 @@ GEM
daemons (>= 1.0.9) daemons (>= 1.0.9)
eventmachine (>= 1.0.0) eventmachine (>= 1.0.0)
rack (>= 1.0.0) rack (>= 1.0.0)
thor (0.18.1) thor (0.19.1)
thread_safe (0.2.0) thread_safe (0.3.1)
atomic (>= 1.1.7, < 2) atomic (>= 1.1.7, < 2)
tilt (1.4.1) tilt (1.4.1)
timers (1.1.0) timers (1.1.0)
tins (1.0.0) tins (1.0.1)
treetop (1.4.15) treetop (1.4.15)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
...@@ -343,7 +343,7 @@ GEM ...@@ -343,7 +343,7 @@ GEM
gherkin (>= 2.5) gherkin (>= 2.5)
rspec (>= 2.0, < 4.0) rspec (>= 2.0, < 4.0)
tzinfo (0.3.39) tzinfo (0.3.39)
uglifier (2.4.0) uglifier (2.5.0)
execjs (>= 0.3.0) execjs (>= 0.3.0)
json (>= 1.8.0) json (>= 1.8.0)
unf (0.1.3) unf (0.1.3)
......
...@@ -9,6 +9,6 @@ class SearchController < ApplicationController ...@@ -9,6 +9,6 @@ class SearchController < ApplicationController
end end
@count = scope.count @count = scope.count
@posts = scope.limit(10).decorate @posts = scope.limit(100).decorate
end end
end end
...@@ -9,10 +9,10 @@ class PostsDecorator < Draper::CollectionDecorator ...@@ -9,10 +9,10 @@ class PostsDecorator < Draper::CollectionDecorator
end end
def related_authors def related_authors
_authors = self.map do |_post| self.map do |_post|
_post.author _post.author
end.flatten.uniq end.flatten.uniq.map do |_author|
_author.decorate
UserDecorator.decorate_collection(_authors) end
end end
end end
...@@ -16,7 +16,7 @@ class Post < ActiveRecord::Base ...@@ -16,7 +16,7 @@ class Post < ActiveRecord::Base
# Named scope # Named scope
###################################################################### ######################################################################
scope :search, (lambda do |query| scope :search, (lambda do |query|
_where_list = includes(:author, :tags) _where_list = includes(:author, :tags).order(updated_at: :desc)
# Convert spaces to one space. # Convert spaces to one space.
query_list = query.split(/[\s ]+/) query_list = query.split(/[\s ]+/)
...@@ -30,7 +30,7 @@ class Post < ActiveRecord::Base ...@@ -30,7 +30,7 @@ class Post < ActiveRecord::Base
when /\Abody:(.+)/ when /\Abody:(.+)/
_where_list = _where_list.where('posts.body LIKE ?', "%#{Regexp.last_match[1]}%") _where_list = _where_list.where('posts.body LIKE ?', "%#{Regexp.last_match[1]}%")
when /\A@(.+)/ when /\A@(.+)/
_where_list = _where_list.where(users: { name: Regexp.last_match[1] }) _where_list = _where_list.where(users: { nickname: Regexp.last_match[1] })
when /\A#(.+)/ when /\A#(.+)/
_where_list = _where_list.where(tags: { name: Regexp.last_match[1] }) _where_list = _where_list.where(tags: { name: Regexp.last_match[1] })
when /\Adate:(\d+)-(\d+)-(\d+)/ when /\Adate:(\d+)-(\d+)-(\d+)/
......
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
h2.panel-title 最近投稿したユーザー(調整中) h2.panel-title 最近投稿したユーザー(調整中)
.panel-body.list-group .panel-body.list-group
- User.post_recently.limit(10).each_with_index do |author, i| - User.post_recently.limit(10).each_with_index do |author, i|
a.list-group-item.post-list data-author-id=author.id href="#" = author.name a.list-group-item.post-list data-author-id=author.id href=search_path(q: "@#{author.nickname}") = author.name
...@@ -33,7 +33,7 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation" ...@@ -33,7 +33,7 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation"
b.caret b.caret
ul.dropdown-menu ul.dropdown-menu
li li
a href=search_path(q: "@#{current_user.name} draft:1") a href=search_path(q: "@#{current_user.nickname} draft:1")
| 下書き | 下書き
span.badge.pull-right = current_user.decorate.draft_count span.badge.pull-right = current_user.decorate.draft_count
li li
......
...@@ -24,6 +24,6 @@ ...@@ -24,6 +24,6 @@
h2.panel-title "#{params[:q]}"に関連するユーザー h2.panel-title "#{params[:q]}"に関連するユーザー
.panel-body.list-group .panel-body.list-group
- @posts.related_authors.each do |_author| - @posts.related_authors.each do |_author|
a.list-group-item href=search_path(q: "@#{_author.name}") = _author.name a.list-group-item href=search_path(q: "@#{_author.nickname}") = _author.name
...@@ -21,8 +21,11 @@ Rendezvous::Application.routes.draw do ...@@ -21,8 +21,11 @@ Rendezvous::Application.routes.draw do
post 'tags/:name/move_to/:move_to_name' => 'tags#move_to', as: 'move_to_tag' post 'tags/:name/move_to/:move_to_name' => 'tags#move_to', as: 'move_to_tag'
resources :tags, :param => :name resources :tags, :param => :name
devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
resources :users, :only => [:edit, :update] resources :users, :only => [:edit, :update]
devise_for :users , controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
# get 'users/edit' => 'users#edit', as: 'edit_user'
# post 'users/update' => 'users#update', as: 'update_user'
# The priority is based upon order of creation: first created -> highest priority. # The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes". # See how all your routes lay out with "rake routes".
......
...@@ -21,21 +21,21 @@ Feature: アクセス制限 ...@@ -21,21 +21,21 @@ Feature: アクセス制限
# Then response code is 200 # Then response code is 200
# Then response includes '<!--view:welcome/login-->' # Then response includes '<!--view:welcome/login-->'
Scenario: ログイン --> TOPページ # Scenario: ログイン --> TOPページ
Given login # Given login
When visit '/' # When visit '/'
Then response code is 200 # Then response code is 200
Then response includes '<!--view:flow/show-->' # Then response includes '<!--view:flow/show-->'
Scenario: ログイン --> flowページ # Scenario: ログイン --> flowページ
Given login # Given login
When visit '/flow' # When visit '/flow'
Then response code is 200 # Then response code is 200
Then response includes '<!--view:flow/show-->' # Then response includes '<!--view:flow/show-->'
Scenario: ログイン --> ログアウト # Scenario: ログイン --> ログアウト
Given login # Given login
When logout # When logout
Then response code is 200 # Then response code is 200
Then response includes '<!--view:welcome/login-->' # Then response includes '<!--view:welcome/login-->'
...@@ -3,17 +3,19 @@ require 'spec_helper' ...@@ -3,17 +3,19 @@ require 'spec_helper'
describe UsersController do describe UsersController do
describe "GET 'edit'" do describe "GET 'edit'" do
it "returns http success" do pending
get 'edit' # it "returns http success" do
response.should be_success # get :edit
end # response.should be_success
# end
end end
describe "GET 'update'" do describe "GET 'update'" do
it "returns http success" do pending
get 'update' # it "returns http success" do
response.should be_success # put :update
end # response.should be_success
# end
end end
end end
...@@ -2,6 +2,7 @@ FactoryGirl.define do ...@@ -2,6 +2,7 @@ FactoryGirl.define do
factory :alice, class: User do factory :alice, class: User do
name 'Alice' name 'Alice'
email 'alice@mail.com' email 'alice@mail.com'
nickname 'alice'
password Devise.friendly_token[0, 20] password Devise.friendly_token[0, 20]
google_token_expires_at Time.now + 30.minutes google_token_expires_at Time.now + 30.minutes
end end
...@@ -9,6 +10,7 @@ FactoryGirl.define do ...@@ -9,6 +10,7 @@ FactoryGirl.define do
factory :bob, class: User do factory :bob, class: User do
name 'Bob' name 'Bob'
email 'bob@mail.com' email 'bob@mail.com'
nickname 'bob'
password Devise.friendly_token[0, 20] password Devise.friendly_token[0, 20]
google_token_expires_at Time.now - 1.hour google_token_expires_at Time.now - 1.hour
end end
...@@ -16,6 +18,7 @@ FactoryGirl.define do ...@@ -16,6 +18,7 @@ FactoryGirl.define do
factory :login_user_1, class: User do factory :login_user_1, class: User do
name 'Test User' name 'Test User'
email 'example@example.com' email 'example@example.com'
nickname 'testuser'
password 'changeme' password 'changeme'
password_confirmation 'changeme' password_confirmation 'changeme'
# required if the Devise Confirmable module is used # required if the Devise Confirmable module is used
......
...@@ -25,6 +25,7 @@ describe User do ...@@ -25,6 +25,7 @@ describe User do
@attr = { @attr = {
name: 'Example User', name: 'Example User',
email: 'user@example.com', email: 'user@example.com',
nickname: 'testnick',
password: 'changeme', password: 'changeme',
password_confirmation: 'changeme' password_confirmation: 'changeme'
} }
......
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