From 48161a437fee91f05a5c01b3042b1c0d69524beb Mon Sep 17 00:00:00 2001 From: Matthew Tilley Date: Sat, 2 Dec 2017 19:52:46 +0000 Subject: [PATCH 1/4] Class start 12/2 --- Gemfile | 4 +- Gemfile.lock | 9 +- app/controllers/activities_controller.rb | 81 +++++++++++++ app/controllers/application_controller.rb | 1 + app/controllers/categories_controller.rb | 67 +++++++++++ app/controllers/groups_controller.rb | 67 +++++++++++ app/controllers/invites_controller.rb | 69 +++++++++++ app/controllers/memberships_controller.rb | 67 +++++++++++ app/models/activity.rb | 30 +++++ app/models/category.rb | 18 +++ app/models/group.rb | 22 ++++ app/models/invite.rb | 20 ++++ app/models/membership.rb | 19 +++ app/models/user.rb | 42 +++++++ app/views/activities/edit.html.erb | 100 ++++++++++++++++ app/views/activities/index.html.erb | 42 +++++++ app/views/activities/new.html.erb | 110 ++++++++++++++++++ app/views/activities/show.html.erb | 46 ++++++++ app/views/categories/edit.html.erb | 46 ++++++++ app/views/categories/index.html.erb | 30 +++++ app/views/categories/new.html.erb | 46 ++++++++ app/views/categories/show.html.erb | 28 +++++ app/views/devise/confirmations/new.html.erb | 16 +++ .../mailer/confirmation_instructions.html.erb | 5 + .../devise/mailer/email_changed.html.erb | 7 ++ .../devise/mailer/password_change.html.erb | 3 + .../reset_password_instructions.html.erb | 8 ++ .../mailer/unlock_instructions.html.erb | 7 ++ app/views/devise/passwords/edit.html.erb | 25 ++++ app/views/devise/passwords/new.html.erb | 16 +++ app/views/devise/registrations/edit.html.erb | 43 +++++++ app/views/devise/registrations/new.html.erb | 29 +++++ app/views/devise/sessions/new.html.erb | 26 +++++ app/views/devise/shared/_links.html.erb | 25 ++++ app/views/devise/unlocks/new.html.erb | 16 +++ app/views/groups/edit.html.erb | 46 ++++++++ app/views/groups/index.html.erb | 30 +++++ app/views/groups/new.html.erb | 46 ++++++++ app/views/groups/show.html.erb | 28 +++++ app/views/invites/edit.html.erb | 55 +++++++++ app/views/invites/index.html.erb | 32 +++++ app/views/invites/new.html.erb | 55 +++++++++ app/views/invites/show.html.erb | 31 +++++ app/views/layouts/application.html.erb | 58 +++++++++ app/views/memberships/edit.html.erb | 46 ++++++++ app/views/memberships/index.html.erb | 30 +++++ app/views/memberships/new.html.erb | 46 ++++++++ app/views/memberships/show.html.erb | 28 +++++ config/initializers/devise.rb | 4 +- config/routes.rb | 90 ++++++++++++++ .../20171201042932_create_activities.rb | 17 +++ .../20171201043426_create_categories.rb | 11 ++ .../20171201045110_devise_create_users.rb | 42 +++++++ db/migrate/20171201045356_create_invites.rb | 12 ++ db/migrate/20171201045448_create_groups.rb | 11 ++ .../20171201045603_create_memberships.rb | 11 ++ db/schema.rb | 61 +++++++++- 57 files changed, 1975 insertions(+), 5 deletions(-) create mode 100644 app/controllers/activities_controller.rb create mode 100644 app/controllers/categories_controller.rb create mode 100644 app/controllers/groups_controller.rb create mode 100644 app/controllers/invites_controller.rb create mode 100644 app/controllers/memberships_controller.rb create mode 100644 app/models/activity.rb create mode 100644 app/models/category.rb create mode 100644 app/models/group.rb create mode 100644 app/models/invite.rb create mode 100644 app/models/membership.rb create mode 100644 app/models/user.rb create mode 100644 app/views/activities/edit.html.erb create mode 100644 app/views/activities/index.html.erb create mode 100644 app/views/activities/new.html.erb create mode 100644 app/views/activities/show.html.erb create mode 100644 app/views/categories/edit.html.erb create mode 100644 app/views/categories/index.html.erb create mode 100644 app/views/categories/new.html.erb create mode 100644 app/views/categories/show.html.erb create mode 100644 app/views/devise/confirmations/new.html.erb create mode 100644 app/views/devise/mailer/confirmation_instructions.html.erb create mode 100644 app/views/devise/mailer/email_changed.html.erb create mode 100644 app/views/devise/mailer/password_change.html.erb create mode 100644 app/views/devise/mailer/reset_password_instructions.html.erb create mode 100644 app/views/devise/mailer/unlock_instructions.html.erb create mode 100644 app/views/devise/passwords/edit.html.erb create mode 100644 app/views/devise/passwords/new.html.erb create mode 100644 app/views/devise/registrations/edit.html.erb create mode 100644 app/views/devise/registrations/new.html.erb create mode 100644 app/views/devise/sessions/new.html.erb create mode 100644 app/views/devise/shared/_links.html.erb create mode 100644 app/views/devise/unlocks/new.html.erb create mode 100644 app/views/groups/edit.html.erb create mode 100644 app/views/groups/index.html.erb create mode 100644 app/views/groups/new.html.erb create mode 100644 app/views/groups/show.html.erb create mode 100644 app/views/invites/edit.html.erb create mode 100644 app/views/invites/index.html.erb create mode 100644 app/views/invites/new.html.erb create mode 100644 app/views/invites/show.html.erb create mode 100644 app/views/memberships/edit.html.erb create mode 100644 app/views/memberships/index.html.erb create mode 100644 app/views/memberships/new.html.erb create mode 100644 app/views/memberships/show.html.erb create mode 100644 db/migrate/20171201042932_create_activities.rb create mode 100644 db/migrate/20171201043426_create_categories.rb create mode 100644 db/migrate/20171201045110_devise_create_users.rb create mode 100644 db/migrate/20171201045356_create_invites.rb create mode 100644 db/migrate/20171201045448_create_groups.rb create mode 100644 db/migrate/20171201045603_create_memberships.rb diff --git a/Gemfile b/Gemfile index 518307a..c233f96 100644 --- a/Gemfile +++ b/Gemfile @@ -72,4 +72,6 @@ end gem 'activeadmin', github: 'activeadmin/activeadmin' gem 'devise', github: 'plataformatec/devise' -gem 'jquery-rails' \ No newline at end of file +gem 'jquery-rails' + +gem "starter_generators", :git => "https://github.com/raghubetina/starter_generators" diff --git a/Gemfile.lock b/Gemfile.lock index 3a608e1..753b5d3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,6 +58,12 @@ GIT responders warden (~> 1.2.3) +GIT + remote: https://github.com/raghubetina/starter_generators + revision: c38d341cecde6ff086d8e7882f781f82c2870ffd + specs: + starter_generators (0.9.6) + GEM remote: https://rubygems.org/ specs: @@ -375,6 +381,7 @@ DEPENDENCIES spring spring-watcher-listen (~> 2.0.0) sqlite3 + starter_generators! tzinfo-data uglifier (>= 1.3.0) wdm @@ -383,4 +390,4 @@ DEPENDENCIES webmock BUNDLED WITH - 1.14.6 + 1.15.4 diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb new file mode 100644 index 0000000..4753c58 --- /dev/null +++ b/app/controllers/activities_controller.rb @@ -0,0 +1,81 @@ +class ActivitiesController < ApplicationController + def index + @activities = Activity.all + @categories = Category.all + + render("activities/index.html.erb") + end + + def show + @activity = Activity.find(params[:id]) + + render("activities/show.html.erb") + end + + def new + @activity = Activity.new + @categories = Category.all + + render("activities/new.html.erb") + end + + def create + @activity = Activity.new + + @activity.name = params[:name] + @activity.address = params[:address] + @activity.category_id = params[:category_id] + @activity.meet_time = params[:meet_time] + @activity.proposer_id = params[:proposer_id] + @activity.visual = params[:visual] + @activity.duration = params[:duration] + @activity.cost_level = params[:cost_level] + + save_status = @activity.save + + if save_status == true + redirect_to("/activities/#{@activity.id}", :notice => "Activity created successfully.") + else + render("activities/new.html.erb") + end + end + + def edit + @activity = Activity.find(params[:id]) + + render("activities/edit.html.erb") + end + + def update + @activity = Activity.find(params[:id]) + + @activity.name = params[:name] + @activity.address = params[:address] + @activity.category_id = params[:category_id] + @activity.meet_time = params[:meet_time] + @activity.proposer_id = params[:proposer_id] + @activity.visual = params[:visual] + @activity.duration = params[:duration] + @activity.cost_level = params[:cost_level] + + save_status = @activity.save + + if save_status == true + redirect_to("/activities/#{@activity.id}", :notice => "Activity updated successfully.") + else + render("activities/edit.html.erb") + end + end + + def destroy + @activity = Activity.find(params[:id]) + + @activity.destroy + + if URI(request.referer).path == "/activities/#{@activity.id}" + redirect_to("/", :notice => "Activity deleted.") + else + redirect_back(:fallback_location => "/", :notice => "Activity deleted.") + end + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4355099..bd09e96 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ class ApplicationController < ActionController::Base # protect_from_forgery with: :exception + #before_action :authenticate_user! end diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb new file mode 100644 index 0000000..7155901 --- /dev/null +++ b/app/controllers/categories_controller.rb @@ -0,0 +1,67 @@ +class CategoriesController < ApplicationController + def index + @categories = Category.all + + render("categories/index.html.erb") + end + + def show + @category = Category.find(params[:id]) + + render("categories/show.html.erb") + end + + def new + @category = Category.new + + render("categories/new.html.erb") + end + + def create + @category = Category.new + + @category.name = params[:name] + @category.icon = params[:icon] + + save_status = @category.save + + if save_status == true + redirect_to("/categories/#{@category.id}", :notice => "Category created successfully.") + else + render("categories/new.html.erb") + end + end + + def edit + @category = Category.find(params[:id]) + + render("categories/edit.html.erb") + end + + def update + @category = Category.find(params[:id]) + + @category.name = params[:name] + @category.icon = params[:icon] + + save_status = @category.save + + if save_status == true + redirect_to("/categories/#{@category.id}", :notice => "Category updated successfully.") + else + render("categories/edit.html.erb") + end + end + + def destroy + @category = Category.find(params[:id]) + + @category.destroy + + if URI(request.referer).path == "/categories/#{@category.id}" + redirect_to("/", :notice => "Category deleted.") + else + redirect_back(:fallback_location => "/", :notice => "Category deleted.") + end + end +end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb new file mode 100644 index 0000000..264f0c0 --- /dev/null +++ b/app/controllers/groups_controller.rb @@ -0,0 +1,67 @@ +class GroupsController < ApplicationController + def index + @groups = Group.all + + render("groups/index.html.erb") + end + + def show + @group = Group.find(params[:id]) + + render("groups/show.html.erb") + end + + def new + @group = Group.new + + render("groups/new.html.erb") + end + + def create + @group = Group.new + + @group.creator_id = params[:creator_id] + @group.name = params[:name] + + save_status = @group.save + + if save_status == true + redirect_to("/groups/#{@group.id}", :notice => "Group created successfully.") + else + render("groups/new.html.erb") + end + end + + def edit + @group = Group.find(params[:id]) + + render("groups/edit.html.erb") + end + + def update + @group = Group.find(params[:id]) + + @group.creator_id = params[:creator_id] + @group.name = params[:name] + + save_status = @group.save + + if save_status == true + redirect_to("/groups/#{@group.id}", :notice => "Group updated successfully.") + else + render("groups/edit.html.erb") + end + end + + def destroy + @group = Group.find(params[:id]) + + @group.destroy + + if URI(request.referer).path == "/groups/#{@group.id}" + redirect_to("/", :notice => "Group deleted.") + else + redirect_back(:fallback_location => "/", :notice => "Group deleted.") + end + end +end diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb new file mode 100644 index 0000000..690e762 --- /dev/null +++ b/app/controllers/invites_controller.rb @@ -0,0 +1,69 @@ +class InvitesController < ApplicationController + def index + @invites = Invite.all + + render("invites/index.html.erb") + end + + def show + @invite = Invite.find(params[:id]) + + render("invites/show.html.erb") + end + + def new + @invite = Invite.new + + render("invites/new.html.erb") + end + + def create + @invite = Invite.new + + @invite.activity_id = params[:activity_id] + @invite.invitee_id = params[:invitee_id] + @invite.attend_status = params[:attend_status] + + save_status = @invite.save + + if save_status == true + redirect_to("/invites/#{@invite.id}", :notice => "Invite created successfully.") + else + render("invites/new.html.erb") + end + end + + def edit + @invite = Invite.find(params[:id]) + + render("invites/edit.html.erb") + end + + def update + @invite = Invite.find(params[:id]) + + @invite.activity_id = params[:activity_id] + @invite.invitee_id = params[:invitee_id] + @invite.attend_status = params[:attend_status] + + save_status = @invite.save + + if save_status == true + redirect_to("/invites/#{@invite.id}", :notice => "Invite updated successfully.") + else + render("invites/edit.html.erb") + end + end + + def destroy + @invite = Invite.find(params[:id]) + + @invite.destroy + + if URI(request.referer).path == "/invites/#{@invite.id}" + redirect_to("/", :notice => "Invite deleted.") + else + redirect_back(:fallback_location => "/", :notice => "Invite deleted.") + end + end +end diff --git a/app/controllers/memberships_controller.rb b/app/controllers/memberships_controller.rb new file mode 100644 index 0000000..96edabb --- /dev/null +++ b/app/controllers/memberships_controller.rb @@ -0,0 +1,67 @@ +class MembershipsController < ApplicationController + def index + @memberships = Membership.all + + render("memberships/index.html.erb") + end + + def show + @membership = Membership.find(params[:id]) + + render("memberships/show.html.erb") + end + + def new + @membership = Membership.new + + render("memberships/new.html.erb") + end + + def create + @membership = Membership.new + + @membership.group_id = params[:group_id] + @membership.member_id = params[:member_id] + + save_status = @membership.save + + if save_status == true + redirect_to("/memberships/#{@membership.id}", :notice => "Membership created successfully.") + else + render("memberships/new.html.erb") + end + end + + def edit + @membership = Membership.find(params[:id]) + + render("memberships/edit.html.erb") + end + + def update + @membership = Membership.find(params[:id]) + + @membership.group_id = params[:group_id] + @membership.member_id = params[:member_id] + + save_status = @membership.save + + if save_status == true + redirect_to("/memberships/#{@membership.id}", :notice => "Membership updated successfully.") + else + render("memberships/edit.html.erb") + end + end + + def destroy + @membership = Membership.find(params[:id]) + + @membership.destroy + + if URI(request.referer).path == "/memberships/#{@membership.id}" + redirect_to("/", :notice => "Membership deleted.") + else + redirect_back(:fallback_location => "/", :notice => "Membership deleted.") + end + end +end diff --git a/app/models/activity.rb b/app/models/activity.rb new file mode 100644 index 0000000..de5f570 --- /dev/null +++ b/app/models/activity.rb @@ -0,0 +1,30 @@ +# == Schema Information +# +# Table name: activities +# +# id :integer not null, primary key +# name :string +# address :string +# category_id :integer +# meet_time :time +# proposer_id :integer +# visual :string +# duration :integer +# cost_level :string +# created_at :datetime not null +# updated_at :datetime not null +# + +class Activity < ApplicationRecord + +# From first draft + # Direct Associations + has_many :invites, :dependent => :destroy + belongs_to :category + belongs_to :proposer, :class_name => "User" + + # Indirect Associations + has_many :invitees, :through => :invites, :source => :invitee + + +end diff --git a/app/models/category.rb b/app/models/category.rb new file mode 100644 index 0000000..ea46921 --- /dev/null +++ b/app/models/category.rb @@ -0,0 +1,18 @@ +# == Schema Information +# +# Table name: categories +# +# id :integer not null, primary key +# name :string +# icon :string +# created_at :datetime not null +# updated_at :datetime not null +# + +class Category < ApplicationRecord + +# From first draft + # Direct Associations + has_many :activities + +end diff --git a/app/models/group.rb b/app/models/group.rb new file mode 100644 index 0000000..a77a7bf --- /dev/null +++ b/app/models/group.rb @@ -0,0 +1,22 @@ +# == Schema Information +# +# Table name: groups +# +# id :integer not null, primary key +# creator_id :integer +# name :string +# created_at :datetime not null +# updated_at :datetime not null +# + +class Group < ApplicationRecord + +# From first draft + # Direct Associations + belongs_to :user, :foreign_key => "creator_id" + has_many :memberships, :dependent => :destroy + + #Indirect Associations + has_many :members, :through => :memberships, :source => :member + +end diff --git a/app/models/invite.rb b/app/models/invite.rb new file mode 100644 index 0000000..f3ad3ee --- /dev/null +++ b/app/models/invite.rb @@ -0,0 +1,20 @@ +# == Schema Information +# +# Table name: invites +# +# id :integer not null, primary key +# activity_id :integer +# invitee_id :integer +# attend_status :string +# created_at :datetime not null +# updated_at :datetime not null +# + +class Invite < ApplicationRecord + +# From first draft + # Direct Associations + belongs_to :activity + belongs_to :invitee, :class_name => "User" + +end diff --git a/app/models/membership.rb b/app/models/membership.rb new file mode 100644 index 0000000..ccef6a1 --- /dev/null +++ b/app/models/membership.rb @@ -0,0 +1,19 @@ +# == Schema Information +# +# Table name: memberships +# +# id :integer not null, primary key +# group_id :integer +# member_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# + +class Membership < ApplicationRecord + +# From first draft + # Direct Associations + belongs_to :member, :class_name => "User" + belongs_to :group + +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..c75e0ca --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,42 @@ +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# email :string default(""), not null +# encrypted_password :string default(""), not null +# reset_password_token :string +# reset_password_sent_at :datetime +# remember_created_at :datetime +# sign_in_count :integer default(0), not null +# current_sign_in_at :datetime +# last_sign_in_at :datetime +# current_sign_in_ip :string +# last_sign_in_ip :string +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_reset_password_token (reset_password_token) UNIQUE +# + +class User < ApplicationRecord + # Include default devise modules. Others available are: + # :confirmable, :lockable, :timeoutable and :omniauthable + devise :database_authenticatable, :registerable, + :recoverable, :rememberable, :trackable, :validatable + +# From first draft + # Direct Associations + has_many :activities, :foreign_key => "proposer_id", :dependent => :destroy + has_many :invites, :foreign_key => "invitee_id", :dependent => :destroy + has_many :groups, :foreign_key => "creator_id", :dependent => :destroy + has_many :memberships, :foreign_key => "member_id", :dependent => :destroy + + # Indirect Associations + has_many :activity_invites, :through => :invites, :source => :activity + has_many :group_memberships, :through => :memberships, :source => :group + +end diff --git a/app/views/activities/edit.html.erb b/app/views/activities/edit.html.erb new file mode 100644 index 0000000..7fd3e08 --- /dev/null +++ b/app/views/activities/edit.html.erb @@ -0,0 +1,100 @@ + +<% if @activity.errors.any? %> + <% @activity.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb new file mode 100644 index 0000000..a659869 --- /dev/null +++ b/app/views/activities/index.html.erb @@ -0,0 +1,42 @@ + + +
+
+ + + + + + + + + + + + + + <% @activities.each do |activity| %> + + + + + + + + + + + + <% end %> +
NameAddressCategoryMeet timeProposerVisualDurationCost levelActions
<%= activity.name %><%= activity.address %><%= activity.category_id %><%= activity.meet_time %><%= activity.proposer_id %><%= activity.visual %><%= activity.duration %><%= activity.cost_level %> + Show + Edit + Delete +
+
+
diff --git a/app/views/activities/new.html.erb b/app/views/activities/new.html.erb new file mode 100644 index 0000000..12c9c47 --- /dev/null +++ b/app/views/activities/new.html.erb @@ -0,0 +1,110 @@ + +<% if @activity.errors.any? %> + <% @activity.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + + +
+ <% @categories.each do |category| %> + + + <% end %> +
+ + +
+ +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/activities/show.html.erb b/app/views/activities/show.html.erb new file mode 100644 index 0000000..daf853c --- /dev/null +++ b/app/views/activities/show.html.erb @@ -0,0 +1,46 @@ + + +
+
+
+
Name
+
<%= @activity.name %>
+ +
Address
+
<%= @activity.address %>
+ +
Category
+
<%= @activity.category_id %>
+ +
Meet time
+
<%= @activity.meet_time %>
+ +
Proposer
+
<%= @activity.proposer_id %>
+ +
Visual
+
<%= @activity.visual %>
+ +
Duration
+
<%= @activity.duration %>
+ +
Cost level
+
<%= @activity.cost_level %>
+ +
+ + +
+
diff --git a/app/views/categories/edit.html.erb b/app/views/categories/edit.html.erb new file mode 100644 index 0000000..dc938e6 --- /dev/null +++ b/app/views/categories/edit.html.erb @@ -0,0 +1,46 @@ + +<% if @category.errors.any? %> + <% @category.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb new file mode 100644 index 0000000..e1ba846 --- /dev/null +++ b/app/views/categories/index.html.erb @@ -0,0 +1,30 @@ + + +
+
+ + + + + + + + <% @categories.each do |category| %> + + + + + + <% end %> +
NameIconActions
<%= category.name %> + Show + Edit + Delete +
+
+
diff --git a/app/views/categories/new.html.erb b/app/views/categories/new.html.erb new file mode 100644 index 0000000..864da10 --- /dev/null +++ b/app/views/categories/new.html.erb @@ -0,0 +1,46 @@ + +<% if @category.errors.any? %> + <% @category.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/categories/show.html.erb b/app/views/categories/show.html.erb new file mode 100644 index 0000000..d0d5cef --- /dev/null +++ b/app/views/categories/show.html.erb @@ -0,0 +1,28 @@ + + +
+
+
+
Name
+
<%= @category.name %>
+ +
Icon
+
+ +
+ + +
+
diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb new file mode 100644 index 0000000..2dc668f --- /dev/null +++ b/app/views/devise/confirmations/new.html.erb @@ -0,0 +1,16 @@ +

Resend confirmation instructions

+ +<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> +
+ +
+ <%= f.submit "Resend confirmation instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb new file mode 100644 index 0000000..dc55f64 --- /dev/null +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -0,0 +1,5 @@ +

Welcome <%= @email %>!

+ +

You can confirm your account email through the link below:

+ +

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/email_changed.html.erb b/app/views/devise/mailer/email_changed.html.erb new file mode 100644 index 0000000..32f4ba8 --- /dev/null +++ b/app/views/devise/mailer/email_changed.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @email %>!

+ +<% if @resource.try(:unconfirmed_email?) %> +

We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

+<% else %> +

We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

+<% end %> diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb new file mode 100644 index 0000000..b41daf4 --- /dev/null +++ b/app/views/devise/mailer/password_change.html.erb @@ -0,0 +1,3 @@ +

Hello <%= @resource.email %>!

+ +

We're contacting you to notify you that your password has been changed.

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb new file mode 100644 index 0000000..f667dc1 --- /dev/null +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -0,0 +1,8 @@ +

Hello <%= @resource.email %>!

+ +

Someone has requested a link to change your password. You can do this through the link below.

+ +

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+ +

If you didn't request this, please ignore this email.

+

Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb new file mode 100644 index 0000000..41e148b --- /dev/null +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -0,0 +1,7 @@ +

Hello <%= @resource.email %>!

+ +

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

+ +

Click the link below to unlock your account:

+ +

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb new file mode 100644 index 0000000..6a796b0 --- /dev/null +++ b/app/views/devise/passwords/edit.html.erb @@ -0,0 +1,25 @@ +

Change your password

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> + <%= devise_error_messages! %> + <%= f.hidden_field :reset_password_token %> + +
+ <%= f.label :password, "New password" %>
+ <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum)
+ <% end %> + <%= f.password_field :password, autofocus: true, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation, "Confirm new password" %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.submit "Change my password" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb new file mode 100644 index 0000000..3d6d11a --- /dev/null +++ b/app/views/devise/passwords/new.html.erb @@ -0,0 +1,16 @@ +

Forgot your password?

+ +<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.submit "Send me reset password instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb new file mode 100644 index 0000000..1e66f3d --- /dev/null +++ b/app/views/devise/registrations/edit.html.erb @@ -0,0 +1,43 @@ +

Edit <%= resource_name.to_s.humanize %>

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ + <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> +
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %> + +
+ <%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, autocomplete: "off" %> + <% if @minimum_password_length %> +
+ <%= @minimum_password_length %> characters minimum + <% end %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password, autocomplete: "off" %> +
+ +
+ <%= f.submit "Update" %> +
+<% end %> + +

Cancel my account

+ +

Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

+ +<%= link_to "Back", :back %> diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb new file mode 100644 index 0000000..5a238ce --- /dev/null +++ b/app/views/devise/registrations/new.html.erb @@ -0,0 +1,29 @@ +

Sign up

+ +<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.label :password %> + <% if @minimum_password_length %> + (<%= @minimum_password_length %> characters minimum) + <% end %>
+ <%= f.password_field :password, autocomplete: "off" %> +
+ +
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "off" %> +
+ +
+ <%= f.submit "Sign up" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..b261cfd --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,26 @@ +

Log in

+ +<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.label :password %>
+ <%= f.password_field :password, autocomplete: "off" %> +
+ + <% if devise_mapping.rememberable? -%> +
+ <%= f.check_box :remember_me %> + <%= f.label :remember_me %> +
+ <% end -%> + +
+ <%= f.submit "Log in" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb new file mode 100644 index 0000000..e6a3e41 --- /dev/null +++ b/app/views/devise/shared/_links.html.erb @@ -0,0 +1,25 @@ +<%- if controller_name != 'sessions' %> + <%= link_to "Log in", new_session_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.registerable? && controller_name != 'registrations' %> + <%= link_to "Sign up", new_registration_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to "Forgot your password?", new_password_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> + <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> + <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
+<% end -%> + +<%- if devise_mapping.omniauthable? %> + <%- resource_class.omniauth_providers.each do |provider| %> + <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
+ <% end -%> +<% end -%> diff --git a/app/views/devise/unlocks/new.html.erb b/app/views/devise/unlocks/new.html.erb new file mode 100644 index 0000000..16586bc --- /dev/null +++ b/app/views/devise/unlocks/new.html.erb @@ -0,0 +1,16 @@ +

Resend unlock instructions

+ +<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> + <%= devise_error_messages! %> + +
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true %> +
+ +
+ <%= f.submit "Resend unlock instructions" %> +
+<% end %> + +<%= render "devise/shared/links" %> diff --git a/app/views/groups/edit.html.erb b/app/views/groups/edit.html.erb new file mode 100644 index 0000000..7a57b95 --- /dev/null +++ b/app/views/groups/edit.html.erb @@ -0,0 +1,46 @@ + +<% if @group.errors.any? %> + <% @group.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/groups/index.html.erb b/app/views/groups/index.html.erb new file mode 100644 index 0000000..8e0cf35 --- /dev/null +++ b/app/views/groups/index.html.erb @@ -0,0 +1,30 @@ + + +
+
+ + + + + + + + <% @groups.each do |group| %> + + + + + + <% end %> +
CreatorNameActions
<%= group.creator_id %><%= group.name %> + Show + Edit + Delete +
+
+
diff --git a/app/views/groups/new.html.erb b/app/views/groups/new.html.erb new file mode 100644 index 0000000..0a975f0 --- /dev/null +++ b/app/views/groups/new.html.erb @@ -0,0 +1,46 @@ + +<% if @group.errors.any? %> + <% @group.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/groups/show.html.erb b/app/views/groups/show.html.erb new file mode 100644 index 0000000..77c3afb --- /dev/null +++ b/app/views/groups/show.html.erb @@ -0,0 +1,28 @@ + + +
+
+
+
Creator
+
<%= @group.creator_id %>
+ +
Name
+
<%= @group.name %>
+ +
+ + +
+
diff --git a/app/views/invites/edit.html.erb b/app/views/invites/edit.html.erb new file mode 100644 index 0000000..aa8dd80 --- /dev/null +++ b/app/views/invites/edit.html.erb @@ -0,0 +1,55 @@ + +<% if @invite.errors.any? %> + <% @invite.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/invites/index.html.erb b/app/views/invites/index.html.erb new file mode 100644 index 0000000..322ff93 --- /dev/null +++ b/app/views/invites/index.html.erb @@ -0,0 +1,32 @@ + + +
+
+ + + + + + + + + <% @invites.each do |invite| %> + + + + + + + <% end %> +
ActivityInviteeAttend statusActions
<%= invite.activity_id %><%= invite.invitee_id %><%= invite.attend_status %> + Show + Edit + Delete +
+
+
diff --git a/app/views/invites/new.html.erb b/app/views/invites/new.html.erb new file mode 100644 index 0000000..562b536 --- /dev/null +++ b/app/views/invites/new.html.erb @@ -0,0 +1,55 @@ + +<% if @invite.errors.any? %> + <% @invite.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/invites/show.html.erb b/app/views/invites/show.html.erb new file mode 100644 index 0000000..cc7858c --- /dev/null +++ b/app/views/invites/show.html.erb @@ -0,0 +1,31 @@ + + +
+
+
+
Activity
+
<%= @invite.activity_id %>
+ +
Invitee
+
<%= @invite.invitee_id %>
+ +
Attend status
+
<%= @invite.attend_status %>
+ +
+ + +
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 03c1b7c..36400e6 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,12 +3,70 @@ FinalProject <%= csrf_meta_tags %> + <%= stylesheet_link_tag 'application', media: 'all' %> <%= javascript_include_tag 'application' %> + + + + + + + <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> + + + + + + + +

<%= notice %>

+

<%= alert %>

+ + + <%= yield %> diff --git a/app/views/memberships/edit.html.erb b/app/views/memberships/edit.html.erb new file mode 100644 index 0000000..2e88e7a --- /dev/null +++ b/app/views/memberships/edit.html.erb @@ -0,0 +1,46 @@ + +<% if @membership.errors.any? %> + <% @membership.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/memberships/index.html.erb b/app/views/memberships/index.html.erb new file mode 100644 index 0000000..44fe93f --- /dev/null +++ b/app/views/memberships/index.html.erb @@ -0,0 +1,30 @@ + + +
+
+ + + + + + + + <% @memberships.each do |membership| %> + + + + + + <% end %> +
GroupMemberActions
<%= membership.group_id %><%= membership.member_id %> + Show + Edit + Delete +
+
+
diff --git a/app/views/memberships/new.html.erb b/app/views/memberships/new.html.erb new file mode 100644 index 0000000..a2b8f35 --- /dev/null +++ b/app/views/memberships/new.html.erb @@ -0,0 +1,46 @@ + +<% if @membership.errors.any? %> + <% @membership.errors.full_messages.each do |message| %> +
+ + <%= message %> +
+ <% end %> +<% end %> + + + +
+
+
+ + + + +
+ + + +
+ + +
+ + + +
+ + + or + Cancel +
+
+
diff --git a/app/views/memberships/show.html.erb b/app/views/memberships/show.html.erb new file mode 100644 index 0000000..7b399b2 --- /dev/null +++ b/app/views/memberships/show.html.erb @@ -0,0 +1,28 @@ + + +
+
+
+
Group
+
<%= @membership.group_id %>
+ +
Member
+
<%= @membership.member_id %>
+ +
+ + +
+
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5dd0b00..dbc2237 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -6,7 +6,7 @@ # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` as its `secret_key` # by default. You can change it below and use your own secret key. - # config.secret_key = 'a4cc31977a2eca8b61542930df7dd22ce5a767f5e9483f78765641442ffdae2f20e2eec4e94772087b9d9c38b0aefd8ee7b61e582ac5e1b3262b7357402adf17' + # config.secret_key = 'c4fcbfaddc0b057a71daad71e4fbf1640c464d93fdac6960dbdbe3de02feb36295858463e3ae4d5e8741eb7fa4e330d3f0a28ea40bdc2cf2817909f521f45dec' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, @@ -108,7 +108,7 @@ config.stretches = Rails.env.test? ? 1 : 11 # Set up a pepper to generate the hashed password. - # config.pepper = '5ff7b2f6b89a203f4237133b0e3be24d34bc42e7410c326030d6928f86e8c9831b36e170f0e2d3acb7b47476b70b3b509ca886b120d9b22180cd5e83bf58936d' + # config.pepper = '0ee58575525a9397642e24bbb9ec9c4882f3d692d44828587c6e5bac98e9108fc7b40a6ecb1a9c18eb1b14bce8ea3e1ebf76ed25bae98364e649156435888dda' # Send a notification to the original email when the user's email is changed. # config.send_email_changed_notification = false diff --git a/config/routes.rb b/config/routes.rb index bcfcb87..861815c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,94 @@ Rails.application.routes.draw do + + # Routes for the Membership resource: + # CREATE + get "/memberships/new", :controller => "memberships", :action => "new" + post "/create_membership", :controller => "memberships", :action => "create" + + # READ + get "/memberships", :controller => "memberships", :action => "index" + get "/memberships/:id", :controller => "memberships", :action => "show" + + # UPDATE + get "/memberships/:id/edit", :controller => "memberships", :action => "edit" + post "/update_membership/:id", :controller => "memberships", :action => "update" + + # DELETE + get "/delete_membership/:id", :controller => "memberships", :action => "destroy" + #------------------------------ + + # Routes for the Group resource: + # CREATE + get "/groups/new", :controller => "groups", :action => "new" + post "/create_group", :controller => "groups", :action => "create" + + # READ + get "/groups", :controller => "groups", :action => "index" + get "/groups/:id", :controller => "groups", :action => "show" + + # UPDATE + get "/groups/:id/edit", :controller => "groups", :action => "edit" + post "/update_group/:id", :controller => "groups", :action => "update" + + # DELETE + get "/delete_group/:id", :controller => "groups", :action => "destroy" + #------------------------------ + + # Routes for the Invite resource: + # CREATE + get "/invites/new", :controller => "invites", :action => "new" + post "/create_invite", :controller => "invites", :action => "create" + + # READ + get "/invites", :controller => "invites", :action => "index" + get "/invites/:id", :controller => "invites", :action => "show" + + # UPDATE + get "/invites/:id/edit", :controller => "invites", :action => "edit" + post "/update_invite/:id", :controller => "invites", :action => "update" + + # DELETE + get "/delete_invite/:id", :controller => "invites", :action => "destroy" + #------------------------------ + + devise_for :users + # Home index + root "invites#index" + + # Routes for the Category resource: + # CREATE + get "/categories/new", :controller => "categories", :action => "new" + post "/create_category", :controller => "categories", :action => "create" + + # READ + get "/categories", :controller => "categories", :action => "index" + get "/categories/:id", :controller => "categories", :action => "show" + + # UPDATE + get "/categories/:id/edit", :controller => "categories", :action => "edit" + post "/update_category/:id", :controller => "categories", :action => "update" + + # DELETE + get "/delete_category/:id", :controller => "categories", :action => "destroy" + #------------------------------ + + # Routes for the Activity resource: + # CREATE + get "/activities/new", :controller => "activities", :action => "new" + post "/create_activity", :controller => "activities", :action => "create" + + # READ + get "/activities", :controller => "activities", :action => "index" + get "/activities/:id", :controller => "activities", :action => "show" + + # UPDATE + get "/activities/:id/edit", :controller => "activities", :action => "edit" + post "/update_activity/:id", :controller => "activities", :action => "update" + + # DELETE + get "/delete_activity/:id", :controller => "activities", :action => "destroy" + #------------------------------ + devise_for :admin_users, ActiveAdmin::Devise.config ActiveAdmin.routes(self) # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html diff --git a/db/migrate/20171201042932_create_activities.rb b/db/migrate/20171201042932_create_activities.rb new file mode 100644 index 0000000..65c998b --- /dev/null +++ b/db/migrate/20171201042932_create_activities.rb @@ -0,0 +1,17 @@ +class CreateActivities < ActiveRecord::Migration[5.0] + def change + create_table :activities do |t| + t.string :name + t.string :address + t.integer :category_id + t.time :meet_time + t.integer :proposer_id + t.string :visual + t.integer :duration + t.string :cost_level + + t.timestamps + + end + end +end diff --git a/db/migrate/20171201043426_create_categories.rb b/db/migrate/20171201043426_create_categories.rb new file mode 100644 index 0000000..becd1dd --- /dev/null +++ b/db/migrate/20171201043426_create_categories.rb @@ -0,0 +1,11 @@ +class CreateCategories < ActiveRecord::Migration[5.0] + def change + create_table :categories do |t| + t.string :name + t.string :icon + + t.timestamps + + end + end +end diff --git a/db/migrate/20171201045110_devise_create_users.rb b/db/migrate/20171201045110_devise_create_users.rb new file mode 100644 index 0000000..060217e --- /dev/null +++ b/db/migrate/20171201045110_devise_create_users.rb @@ -0,0 +1,42 @@ +class DeviseCreateUsers < ActiveRecord::Migration[5.1] + def change + create_table :users do |t| + ## Database authenticatable + t.string :email, null: false, default: "" + t.string :encrypted_password, null: false, default: "" + + ## Recoverable + t.string :reset_password_token + t.datetime :reset_password_sent_at + + ## Rememberable + t.datetime :remember_created_at + + ## Trackable + t.integer :sign_in_count, default: 0, null: false + t.datetime :current_sign_in_at + t.datetime :last_sign_in_at + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + ## Confirmable + # t.string :confirmation_token + # t.datetime :confirmed_at + # t.datetime :confirmation_sent_at + # t.string :unconfirmed_email # Only if using reconfirmable + + ## Lockable + # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts + # t.string :unlock_token # Only if unlock strategy is :email or :both + # t.datetime :locked_at + + + t.timestamps null: false + end + + add_index :users, :email, unique: true + add_index :users, :reset_password_token, unique: true + # add_index :users, :confirmation_token, unique: true + # add_index :users, :unlock_token, unique: true + end +end diff --git a/db/migrate/20171201045356_create_invites.rb b/db/migrate/20171201045356_create_invites.rb new file mode 100644 index 0000000..d4ea8ab --- /dev/null +++ b/db/migrate/20171201045356_create_invites.rb @@ -0,0 +1,12 @@ +class CreateInvites < ActiveRecord::Migration[5.0] + def change + create_table :invites do |t| + t.integer :activity_id + t.integer :invitee_id + t.string :attend_status + + t.timestamps + + end + end +end diff --git a/db/migrate/20171201045448_create_groups.rb b/db/migrate/20171201045448_create_groups.rb new file mode 100644 index 0000000..524a8db --- /dev/null +++ b/db/migrate/20171201045448_create_groups.rb @@ -0,0 +1,11 @@ +class CreateGroups < ActiveRecord::Migration[5.0] + def change + create_table :groups do |t| + t.integer :creator_id + t.string :name + + t.timestamps + + end + end +end diff --git a/db/migrate/20171201045603_create_memberships.rb b/db/migrate/20171201045603_create_memberships.rb new file mode 100644 index 0000000..97f827c --- /dev/null +++ b/db/migrate/20171201045603_create_memberships.rb @@ -0,0 +1,11 @@ +class CreateMemberships < ActiveRecord::Migration[5.0] + def change + create_table :memberships do |t| + t.integer :group_id + t.integer :member_id + + t.timestamps + + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 28ed294..1450df3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171117194713) do +ActiveRecord::Schema.define(version: 20171201045603) do create_table "active_admin_comments", force: :cascade do |t| t.string "namespace" @@ -26,6 +26,19 @@ t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" end + create_table "activities", force: :cascade do |t| + t.string "name" + t.string "address" + t.integer "category_id" + t.time "meet_time" + t.integer "proposer_id" + t.string "visual" + t.integer "duration" + t.string "cost_level" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "admin_users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -43,4 +56,50 @@ t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true end + create_table "categories", force: :cascade do |t| + t.string "name" + t.string "icon" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "groups", force: :cascade do |t| + t.integer "creator_id" + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "invites", force: :cascade do |t| + t.integer "activity_id" + t.integer "invitee_id" + t.string "attend_status" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "memberships", force: :cascade do |t| + t.integer "group_id" + t.integer "member_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "users", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.integer "sign_in_count", default: 0, null: false + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + end + end From 1359a0c6ee2ae5d07e6b570258fa6de38a2ba2d7 Mon Sep 17 00:00:00 2001 From: Matthew Tilley Date: Mon, 4 Dec 2017 06:08:41 +0000 Subject: [PATCH 2/4] Added functionality and format to new activity form --- app/models/activity.rb | 1 + app/views/activities/new.html.erb | 89 ++++++++++++------ app/views/devise/confirmations/new.html.erb | 16 ---- .../mailer/confirmation_instructions.html.erb | 5 - .../devise/mailer/email_changed.html.erb | 7 -- .../devise/mailer/password_change.html.erb | 3 - .../reset_password_instructions.html.erb | 8 -- .../mailer/unlock_instructions.html.erb | 7 -- app/views/devise/passwords/edit.html.erb | 25 ----- app/views/devise/passwords/new.html.erb | 16 ---- app/views/devise/registrations/edit.html.erb | 43 --------- app/views/devise/registrations/new.html.erb | 29 ------ app/views/devise/sessions/new.html.erb | 26 ----- app/views/devise/shared/_links.html.erb | 25 ----- app/views/devise/unlocks/new.html.erb | 16 ---- app/views/layouts/application.html.erb | 9 ++ .../20171202220617_add_date_to_activities.rb | 5 + db/schema.rb | 3 +- public/Dollar signs for tilley-01.jpg | Bin 0 -> 78698 bytes public/Dollar signs for tilley-02.jpg | Bin 0 -> 132689 bytes public/Dollar signs for tilley-03.jpg | Bin 0 -> 185261 bytes 21 files changed, 76 insertions(+), 257 deletions(-) delete mode 100644 app/views/devise/confirmations/new.html.erb delete mode 100644 app/views/devise/mailer/confirmation_instructions.html.erb delete mode 100644 app/views/devise/mailer/email_changed.html.erb delete mode 100644 app/views/devise/mailer/password_change.html.erb delete mode 100644 app/views/devise/mailer/reset_password_instructions.html.erb delete mode 100644 app/views/devise/mailer/unlock_instructions.html.erb delete mode 100644 app/views/devise/passwords/edit.html.erb delete mode 100644 app/views/devise/passwords/new.html.erb delete mode 100644 app/views/devise/registrations/edit.html.erb delete mode 100644 app/views/devise/registrations/new.html.erb delete mode 100644 app/views/devise/sessions/new.html.erb delete mode 100644 app/views/devise/shared/_links.html.erb delete mode 100644 app/views/devise/unlocks/new.html.erb create mode 100644 db/migrate/20171202220617_add_date_to_activities.rb create mode 100644 public/Dollar signs for tilley-01.jpg create mode 100644 public/Dollar signs for tilley-02.jpg create mode 100644 public/Dollar signs for tilley-03.jpg diff --git a/app/models/activity.rb b/app/models/activity.rb index de5f570..e12c52f 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -13,6 +13,7 @@ # cost_level :string # created_at :datetime not null # updated_at :datetime not null +# date :string # class Activity < ApplicationRecord diff --git a/app/views/activities/new.html.erb b/app/views/activities/new.html.erb index 12c9c47..578ff92 100644 --- a/app/views/activities/new.html.erb +++ b/app/views/activities/new.html.erb @@ -27,16 +27,16 @@
- <% @categories.each do |category| %> - - - <% end %> + <% @categories.each do |category| %> + + + <% end %>
- -
+ - <%= dev_tools if Rails.env.development? %> +
+ <% if notice.present? %> +
+ + <%= notice %> +
+ <% end %> + + <% if alert.present? %> +
+ + <%= alert %> +
+ <% end %> + + <%= yield %> +