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/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss new file mode 100644 index 0000000..5cb5922 --- /dev/null +++ b/app/assets/stylesheets/application.scss @@ -0,0 +1,3 @@ +@charset "utf-8"; + +@import "bootstrap-4-spacers"; diff --git a/app/assets/stylesheets/bootstrap-4-spacers.scss b/app/assets/stylesheets/bootstrap-4-spacers.scss new file mode 100644 index 0000000..a4b8c35 --- /dev/null +++ b/app/assets/stylesheets/bootstrap-4-spacers.scss @@ -0,0 +1,95 @@ +.pt-0 { + padding-top: 0; +} + +.pt-1 { + padding-top: 1rem; +} + +.pt-2 { + padding-top: 2rem; +} + +.pt-3 { + padding-top: 3rem; +} + +.pt-4 { + padding-top: 5rem; +} + +.pt-5 { + padding-top: 8rem; +} + +.pb-0 { + padding-bottom: 0; +} + +.pb-1 { + padding-bottom: 1rem; +} + +.pb-2 { + padding-bottom: 2rem; +} + +.pb-3 { + padding-bottom: 3rem; +} + +.pb-4 { + padding-bottom: 5rem; +} + +.pb-5 { + padding-bottom: 8rem; +} + +.mt-0 { + margin-top: 0; +} + +.mt-1 { + margin-top: 1rem; +} + +.mt-2 { + margin-top: 2rem; +} + +.mt-3 { + margin-top: 3rem; +} + +.mt-4 { + margin-top: 5rem; +} + +.mt-5 { + margin-top: 8rem; +} + +.mb-0 { + margin-bottom: 0; +} + +.mb-1 { + margin-bottom: 1rem; +} + +.mb-2 { + margin-bottom: 2rem; +} + +.mb-3 { + margin-bottom: 3rem; +} + +.mb-4 { + margin-bottom: 5rem; +} + +.mb-5 { + margin-bottom: 8rem; +} diff --git a/app/controllers/activities_controller.rb b/app/controllers/activities_controller.rb new file mode 100644 index 0000000..51ca49f --- /dev/null +++ b/app/controllers/activities_controller.rb @@ -0,0 +1,83 @@ +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 + @categories = Category.all + + @activity.name = params[:name] + @activity.address = params[:address] + @activity.category_id = params[:category_id] + @activity.date = params[:date] + @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..4d1db83 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,14 @@ class ApplicationController < ActionController::Base # protect_from_forgery with: :exception + before_action :authenticate_user! + + before_action :configure_permitted_parameters, if: :devise_controller? + + protected + + def configure_permitted_parameters + devise_parameter_sanitizer.permit(:sign_up, :keys => [:username, :avatar_url]) + + devise_parameter_sanitizer.permit(:account_update, :keys => [:avatar_url]) + end 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..e12c52f --- /dev/null +++ b/app/models/activity.rb @@ -0,0 +1,31 @@ +# == 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 +# date :string +# + +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..d1d7a6d --- /dev/null +++ b/app/views/activities/new.html.erb @@ -0,0 +1,137 @@ + +<% 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/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..def1a19 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -1,17 +1,87 @@ - - - FinalProject - <%= csrf_meta_tags %> + + + + Friender - <%= stylesheet_link_tag 'application', media: 'all' %> - <%= javascript_include_tag 'application' %> - + + - - <%= yield %> + + + <%= stylesheet_link_tag "application", :media => "all" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> + + + + + + + + + + + + + + + + + + +
+ <% if notice.present? %> +
+ + <%= notice %> +
+ <% end %> + + <% if alert.present? %> +
+ + <%= alert %> +
+ <% end %> + + <%= 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/migrate/20171202220617_add_date_to_activities.rb b/db/migrate/20171202220617_add_date_to_activities.rb new file mode 100644 index 0000000..f56ed2f --- /dev/null +++ b/db/migrate/20171202220617_add_date_to_activities.rb @@ -0,0 +1,5 @@ +class AddDateToActivities < ActiveRecord::Migration[5.1] + def change + add_column :activities, :date, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 28ed294..1d6f003 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: 20171202220617) do create_table "active_admin_comments", force: :cascade do |t| t.string "namespace" @@ -26,6 +26,20 @@ 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 + t.string "date" + end + create_table "admin_users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -43,4 +57,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 diff --git a/public/Dollar signs for tilley-01.jpg b/public/Dollar signs for tilley-01.jpg new file mode 100644 index 0000000..451fe96 Binary files /dev/null and b/public/Dollar signs for tilley-01.jpg differ diff --git a/public/Dollar signs for tilley-02.jpg b/public/Dollar signs for tilley-02.jpg new file mode 100644 index 0000000..f878436 Binary files /dev/null and b/public/Dollar signs for tilley-02.jpg differ diff --git a/public/Dollar signs for tilley-03.jpg b/public/Dollar signs for tilley-03.jpg new file mode 100644 index 0000000..6671ce7 Binary files /dev/null and b/public/Dollar signs for tilley-03.jpg differ