Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/seit/Adjusche into seit-m…
Browse files Browse the repository at this point in the history
…aster

Conflicts:
	db/schema.rb
  • Loading branch information
yohhatu committed Feb 20, 2012
2 parents 4577641 + 2a2ea7a commit 34e2f39
Show file tree
Hide file tree
Showing 20 changed files with 120 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ db/*.sqlite3
log/*.log
tmp/
.sass-cache/
*.swp
*.swo
*.swn
3 changes: 3 additions & 0 deletions app/assets/javascripts/login.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 changes: 3 additions & 0 deletions app/assets/javascripts/logins.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/login.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the login controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/logins.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the logins controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Binary file added app/controllers/.users_controller.rb.swn
Binary file not shown.
2 changes: 2 additions & 0 deletions app/controllers/login_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class LoginController < ApplicationController
end
24 changes: 24 additions & 0 deletions app/controllers/logins_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class LoginsController < ApplicationController
def index

end

def login
begin
login_user = User.find_by_user_name_and_user_pass!( params[:post][:name] , params[:post][:pass] )
rescue ActiveRecord::RecordNotFound
#redirect_to :controller => "logins", :action => "index"
redirect_to :back
end

session[:user_info] = login_user
#@events = Event.where(:user_id => User.find_by_user_name(session[:user_info] )[:id])

@user_name = login_user.user_name

luid = login_user.id
@events = Event.where(:user_id => luid )

redirect_to :controller => "events", :action => "index"
end
end
28 changes: 0 additions & 28 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,8 @@ def index
@hoge = "おはようございます"
end

def login
@user = User.new

end

def menu
@user = User.new

end

def create
#login_user = params[ :u ]

begin
login_user = User.find_by_user_name_and_user_pass!( params[:post][:name] , params[:post][:pass] )
rescue ActiveRecord::RecordNotFound
redirect_to :back
end

session[:user_info] = login_user
#@events = Event.where(:user_id => User.find_by_user_name(session[:user_info] )[:id])

@user_name = login_user.user_name

luid = login_user.id
@events = Event.where(:user_id => luid )

#@events = Event.where(:user_id => 1)
redirect_to :controller => "events", :action => "index"

end

end
2 changes: 2 additions & 0 deletions app/helpers/login_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module LoginHelper
end
2 changes: 2 additions & 0 deletions app/helpers/logins_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module LoginsHelper
end
Binary file modified app/views/.DS_Store
Binary file not shown.
Binary file added app/views/login/.index.html.erb.swp
Binary file not shown.
14 changes: 14 additions & 0 deletions app/views/logins/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h1>ロ グ イ ン 画 面 </h1>

<%= form_tag :action => :login do %>
<fieldset>
<ul>
<li><%= label_tag :name, "ユ ー ザ ー 名 " %>
<%= text_field_tag 'post[name]' %></li>
<li><%= label_tag :pass, "パ ス ワ ー ド " %>
<%= password_field_tag 'post[pass]' %></li>
</ul>
</br>
<%= submit_tag "ロ グ イ ン " %>
</fieldset>
<% end %>
9 changes: 6 additions & 3 deletions config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Adjusche::Application.routes.draw do
root :to => "users#new"
#resources :users
root :to => "logins#index"

resources :users do
get :login, :on => :member
get :menu, :on => :member
end

resources :logins do
post :login, :on => :collection
end

resources :events do
resources :users
end
Expand Down
33 changes: 33 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
Expand Down Expand Up @@ -29,3 +30,35 @@
end

end
=======
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120123233459) do

create_table "events", :force => true do |t|
t.string "name"
t.text "description"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end

create_table "users", :force => true do |t|
t.string "user_name"
t.string "user_pass"
t.datetime "created_at"
t.datetime "updated_at"
end

end
>>>>>>> 2a2ea7af87a0eb42f77bb047eeeaa1e1de7f5c3f
7 changes: 7 additions & 0 deletions test/functional/login_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class LoginControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
7 changes: 7 additions & 0 deletions test/functional/logins_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class LoginsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
4 changes: 4 additions & 0 deletions test/unit/helpers/login_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'test_helper'

class LoginHelperTest < ActionView::TestCase
end
4 changes: 4 additions & 0 deletions test/unit/helpers/logins_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'test_helper'

class LoginsHelperTest < ActionView::TestCase
end

0 comments on commit 34e2f39

Please sign in to comment.