Commit 1148912d authored by Bianca Tarun's avatar Bianca Tarun

edited devise views and pages/index.html.erb and added columns to User

parent 8855477e
...@@ -48,3 +48,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] ...@@ -48,3 +48,4 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'simple_form' gem 'simple_form'
gem 'devise' gem 'devise'
...@@ -2,4 +2,6 @@ class ApplicationController < ActionController::Base ...@@ -2,4 +2,6 @@ class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception. # Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead. # For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception protect_from_forgery with: :exception
end end
...@@ -4,21 +4,18 @@ ...@@ -4,21 +4,18 @@
<%= f.error_notification %> <%= f.error_notification %>
<div class="form-inputs"> <div class="form-inputs">
<%= f.input :first_name, required:true %>
<%= f.input :last_name, required:true %>
<%= f.input :birthday, required:true %>
<%= f.input :email, required: true, autofocus: true %> <%= f.input :email, required: true, autofocus: true %>
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %> <%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, required: true %> <%= f.input :password_confirmation, required: true %>
<%= f.input :first_name, required:true %> <%= f.input :gender, as: :select, collection: ["Male", "Female"], required: true %>
<%= f.input :last_name, required:true %>
<%= f.input :birthday, :as => :date_picker,
input_html: {data: {date_options: {defaultDate: Time.now}}} %>
<%= f.input :gender, collection: ["Male", "Female"], include_blank: false %>
</div> </div>
<div class="form-actions"> <div class="form-actions">
<%= f.button :submit, "Sign up" %> <%= f.button :submit, "Sign up", :class => "btn btn-success" %>
</div> </div>
<% end %> <% end %>
<%= render "devise/shared/links" %> <%= render "devise/shared/links" %>
...@@ -2,9 +2,13 @@ ...@@ -2,9 +2,13 @@
<% if user_signed_in? %> <% if user_signed_in? %>
<h2>Please take a look at our candidates!</h2> <h2>Please take a look at our candidates!</h2>
<hr> <hr>
<% if current_user.email == "admin_email@yahoo.com" %>
<%= link_to "Manage Candidates", admin_candidates_path %> || <%= link_to "Manage Candidates", admin_candidates_path %> ||
<%= link_to "Manage Positions", admin_positions_path %> || <%= link_to "Manage Positions", admin_positions_path %> ||
<%= link_to "Vote", votes_path %> <%= link_to "Vote", votes_path %>
<% else %>
<%= link_to "Vote", votes_path %>
<% end %>
<hr> <hr>
<% @positions.each do |p| %> <% @positions.each do |p| %>
<h2><%= p.name %></h2> <h2><%= p.name %></h2>
......
class AddFirstNameToUsers < ActiveRecord::Migration
def change
add_column :users, :first_name, :string
end
end
class AddLastNameToUsers < ActiveRecord::Migration
def change
add_column :users, :last_name, :string
end
end
class AddGenderToUsers < ActiveRecord::Migration
def change
add_column :users, :gender, :string
end
end
class RemoveBirthdayFromUsers < ActiveRecord::Migration
def change
remove_column :users, :birthday, :string
end
end
class AddBirthdayToUsers < ActiveRecord::Migration
def change
add_column :users, :birthday, :date
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160720021955) do ActiveRecord::Schema.define(version: 20160720053151) do
create_table "candidates", force: :cascade do |t| create_table "candidates", force: :cascade do |t|
t.string "first_name" t.string "first_name"
...@@ -45,6 +45,10 @@ ActiveRecord::Schema.define(version: 20160720021955) do ...@@ -45,6 +45,10 @@ ActiveRecord::Schema.define(version: 20160720021955) do
t.string "last_sign_in_ip" t.string "last_sign_in_ip"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "first_name"
t.string "last_name"
t.string "gender"
t.date "birthday"
end end
add_index "users", ["email"], name: "index_users_on_email", unique: true add_index "users", ["email"], name: "index_users_on_email", unique: true
......
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