Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ end

gem 'activeadmin', github: 'activeadmin/activeadmin'
gem 'devise', github: 'plataformatec/devise'
gem 'jquery-rails'
gem 'jquery-rails'

gem "starter_generators", :git => "https://github.com/raghubetina/starter_generators"
9 changes: 8 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -375,6 +381,7 @@ DEPENDENCIES
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
starter_generators!
tzinfo-data
uglifier (>= 1.3.0)
wdm
Expand All @@ -383,4 +390,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
1.14.6
1.15.4
3 changes: 3 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@charset "utf-8";

@import "bootstrap-4-spacers";
95 changes: 95 additions & 0 deletions app/assets/stylesheets/bootstrap-4-spacers.scss
Original file line number Diff line number Diff line change
@@ -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;
}
83 changes: 83 additions & 0 deletions app/controllers/activities_controller.rb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -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
67 changes: 67 additions & 0 deletions app/controllers/categories_controller.rb
Original file line number Diff line number Diff line change
@@ -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
67 changes: 67 additions & 0 deletions app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Loading