Skip to content

Commit

Permalink
betakamo
Browse files Browse the repository at this point in the history
  • Loading branch information
Homiez committed Dec 4, 2011
1 parent bb55193 commit 88b4f6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
11 changes: 8 additions & 3 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,23 @@ def create

@client = Twitter::Client.new

botPhrases = ["勉強会に行くのはいかがでしょう?","登山に行くとかどうでしょう?", "多分、人が急遽足りなくなって、合コンに誘われる気がしますヨ。", "一風堂はお好きですか? 夕飯は一風堂がいいです"].sort_by{|i| rand }


sentence = ""
sentence.concat(user.name)
sentence.concat("さん")
sentence.concat(user.hima_day.strftime("%Y/%m/%d"))
sentence.concat(" まだひま?")
sentence.concat("さん ")
sentence.concat(user.hima_day.strftime("%Y月%m日%d"))
sentence.concat("は、")
sentence.concat(botPhrases[0])
sentence.concat(Time.now.to_s)
@client.update(sentence)
#render :text => sentence
redirect_to root_url, :notice => 'Signed in!'
end

def destroy
User.all.where(:id => session[:user_id]).destroy
reset_session

redirect_to root_url, :notice => 'Signed out!'
Expand Down
12 changes: 8 additions & 4 deletions app/views/home/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

- @dates.each do |d|
= p d[:day].strftime("%Y/%m/%d")
#{link_to "登録", {:controller => "sessions", :action => "new", :hima_day => d[:day]}}
- if user_signed_in?
- if current_user.hima_day == d[:day]
#{link_to "解除", {:controller => "sessions", :action => "destroy"}}
- else
#{link_to "変更", {:controller => "sessions", :action => "new", :hima_day => d[:day]}}
- else
#{link_to "登録", {:controller => "sessions", :action => "new", :hima_day => d[:day]}}
- d[:users].each do |u|
= p u.name
= image_tag("https://api.twitter.com/1/users/profile_image?user_id=" + u.uid)
- if user_signed_in?
- if u.uid == current_user.uid
#{link_to "解除", {:controller => "sessions", :action => "destroy"}}

%br
9 changes: 1 addition & 8 deletions app/views/shared/_navigation.html.haml
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
- if user_signed_in?
%li
Logged in as #{current_user.name}
%li
= link_to('Logout', signout_path)
- else
%li
= link_to('Login', signin_path)

0 comments on commit 88b4f6e

Please sign in to comment.