From d9b9fb1f6da39f45eee62ec13b806847fd23cfb9 Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 18:14:40 -0500 Subject: the users helper wasnt being push --- app/helpers/users_helper.rb | 2 ++ app/views/sessions/new.html.erb | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 app/helpers/users_helper.rb create mode 100644 app/views/sessions/new.html.erb (limited to 'app') diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb new file mode 100644 index 0000000..2310a24 --- /dev/null +++ b/app/helpers/users_helper.rb @@ -0,0 +1,2 @@ +module UsersHelper +end diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000..f942cf6 --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,18 @@ +

Sign in

+ +
+
+ <%= form_for(:session, url: sessions_path) do |f| %> + + <%= f.label :email %> + <%= f.text_field :email %> + + <%= f.label :password %> + <%= f.password_field :password %> + + <%= f.submit "Sign in", class: "btn btn-large btn-primary" %> + <% end %> + +

New user? <%= link_to "Sign up now!", signup_path %>

+
+
-- cgit v1.2.3-2-g168b From 931c352e516adfac175eec5eafee9ea8e3311556 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Sun, 2 Mar 2014 18:38:11 -0500 Subject: Made the button on the homepage redirect to the signup page. --- app/views/static/homepage.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/views/static/homepage.html.erb b/app/views/static/homepage.html.erb index 760e087..4d52e5b 100644 --- a/app/views/static/homepage.html.erb +++ b/app/views/static/homepage.html.erb @@ -4,7 +4,7 @@

Welcome to Leaguer

This is a tournment management system designed to be used for any team sport. Our peer review system ensures that the best players move on to the next round! Try creating a new tournament and having people sign up for it.

-

<%= link_to 'Log In / Sign Up', "#", :class => "btn btn-warning btn-lg", :role => "button" %> <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %>

+

<%= link_to 'Log In / Sign Up', "signup", :class => "btn btn-warning btn-lg", :role => "button" %> <%= link_to 'See Ongoing Tournaments', tournaments_path, :class => "btn btn-warning btn-lg", :role => "button" %>

- \ No newline at end of file + -- cgit v1.2.3-2-g168b From e6b2993ad072d0cad2e52997c7957aae0a03415c Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 20:06:40 -0500 Subject: I changed the user controller --- app/controllers/sessions_controller.rb | 8 ++------ app/controllers/users_controller.rb | 9 ++++++++- app/models/user.rb | 1 + app/views/users/new.html.erb | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'app') diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 8a9de56..722b8c2 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -7,19 +7,15 @@ class SessionsController < ApplicationController user = User.find_by(email: params[:session][:email].downcase) if user && user.authenticate(params[:session][:password]) sign_in user - #redirect goes here + redirect_to root_path else render 'new' end end def destroy - sign_out - - #I dont know where to redirect to so yeah - # redirect_to sign_in - + redirect_to root_path end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 74ab72c..2abc93e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,13 +1,14 @@ class UsersController < ApplicationController def new + @user = User.new end def create @user = User.new(user_params) if @user.save sign_in @user - #redirect_to @user + #redirect_to root_path else render 'new' end @@ -16,4 +17,10 @@ class UsersController < ApplicationController def show @user = User.find(param[:id]) end + + private + + def user_params + params.require(:user).permit(:name, :email, :user_name, :password, :password_confirmation) + end end diff --git a/app/models/user.rb b/app/models/user.rb index 6765822..f302baf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,6 +7,7 @@ before_save { self.user_name = user_name.downcase } Rails looks for the create_remember_token and runs it before anything else + =end before_create :create_remember_token diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 418f2e2..331abd4 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -19,7 +19,7 @@

<%= f.label :password_confirm %>
- <%= f.text_field :password_confirm %> + <%= f.text_field :password_confirmation %>

<%= f.submit %> -- cgit v1.2.3-2-g168b From fc052b7743aa3d5bebe9f6c4216c7515a2174aa7 Mon Sep 17 00:00:00 2001 From: DavisLWebb Date: Sun, 2 Mar 2014 21:33:55 -0500 Subject: Users work 1000000000000% but there is a path issue with the html --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2abc93e..6436e4e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -8,7 +8,7 @@ class UsersController < ApplicationController @user = User.new(user_params) if @user.save sign_in @user - #redirect_to root_path + redirect_to root_path else render 'new' end -- cgit v1.2.3-2-g168b From 3e01db11def43419dd42727485e4005f78687c08 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Sun, 2 Mar 2014 22:12:09 -0500 Subject: Since I don't know how to do stuff with forms, I edited the actual HTML to fix where the form submits to. Tomer should help correct it. --- app/views/users/new.html.erb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'app') diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 331abd4..715d40e 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -1,5 +1,6 @@

Sign Up

+<% if false %> <%= form_for :user do |f| %>

<%= f.label :name %>
@@ -25,3 +26,32 @@ <%= f.submit %>

<% end %> + + +<% end %> + +
+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+

+
+ +

+

+ +

+
\ No newline at end of file -- cgit v1.2.3-2-g168b From d220b5f8e86d1c8b4503948c09f2497d11710d98 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 3 Mar 2014 11:40:05 -0500 Subject: Some of the stuff I forgot to commit last night. Updated and cleaned up some pages as well as getting the gameType listing to work. --- app/assets/javascripts/ajax.js | 14 ++++++++++++++ app/views/layouts/application.html.erb | 1 + app/views/tournaments/index.html.erb | 8 ++++---- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 app/assets/javascripts/ajax.js (limited to 'app') diff --git a/app/assets/javascripts/ajax.js b/app/assets/javascripts/ajax.js new file mode 100644 index 0000000..2b2bb3e --- /dev/null +++ b/app/assets/javascripts/ajax.js @@ -0,0 +1,14 @@ +function populate() { + //populate optionArray + //make a form element + var e = document.getElementById("tournament_id"); + var gameType = e.options[e.selectedIndex].text; + if (gameType != "") { + //populate optionArray + + for(var option in optionArray){ + //identify the number of + ; + } + }; +} \ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 8a81c0a..3910cf6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,6 +5,7 @@ <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %> <%= javascript_include_tag "application", "data-turbolinks-track" => true %> <%= csrf_meta_tags %> + <%= yield :head %>