Skip to content

feat: Adds event calendar support #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 66 commits into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
8ccbb2f
build(deps): Upgrade yarn
cbaudouinjr May 6, 2020
38a605c
build(deps): Upgrade gems
cbaudouinjr May 6, 2020
b19aa4f
build(deps): Remove obsolete gems
cbaudouinjr May 6, 2020
87f4245
v0.0.0
cbaudouinjr May 6, 2020
3543164
build(deps): Update semantic-release
cbaudouinjr May 6, 2020
dfc116f
feat(events): add upcoming events page
JeremyRudman May 24, 2020
f3e659d
feat(events): added page to make new events
JeremyRudman May 30, 2020
e3f9c4f
added gem.lock
JeremyRudman May 30, 2020
6539671
Merge branch '2.0' into issue-226
JeremyRudman May 30, 2020
c7de97f
functionally complete calendar
JeremyRudman Jun 6, 2020
ca0248b
feat(events):page to view and make upcoming events
JeremyRudman Jun 12, 2020
fc7f106
Merge branch '2.0' into issue-226
cbaudouinjr Jun 13, 2020
6706ee2
Merge branch '2.0' into issue-226
JeremyRudman Jul 3, 2020
6cf5144
fix: corrected formating errors and removed all day option
JeremyRudman Jul 4, 2020
1520b42
fix: removed left over allDay refernce
JeremyRudman Jul 4, 2020
122c209
fix: corrected houndci format suggestion
JeremyRudman Jul 4, 2020
ac9e1db
Merge branch '2.0' into issue-226
JeremyRudman Jul 18, 2020
c6caf7a
feat(event): added owners as a list of admins only
JeremyRudman Aug 8, 2020
826540f
Merge branch 'issue-226' of https://github.com/codeRIT/hackathon-mana…
JeremyRudman Aug 10, 2020
3618cdd
Merge branch '2.0' into issue-226
cbaudouinjr Aug 26, 2020
a97075a
Merge branch '2.0' into issue-226
JeremyRudman Sep 5, 2020
8b47528
fix(events): refactored to work with latest 2.0
JeremyRudman Sep 5, 2020
8bb09bc
Merge pull request #398 from codeRIT/master
cbaudouinjr Nov 9, 2020
d395543
Fixed issue on desktop
peterkos Nov 14, 2020
b5ab15a
feat(event): removed unneeded form options
JeremyRudman Nov 14, 2020
8ce39f1
Map overflow scroll
peterkos Nov 15, 2020
425f403
Fix scroll issue
peterkos Nov 15, 2020
85cad64
Fixed toggle button; fits screen, sidebar width
peterkos Nov 15, 2020
57098dc
Merge pull request #399 from codeRIT/hm-380
cbaudouinjr Nov 15, 2020
59bc706
fix: Allows optional assets to be unset
cbaudouinjr Nov 29, 2020
0b0adbc
fix(events):added basic testing
JeremyRudman Nov 29, 2020
e0ebdc5
Merge branch '2.1' into issue-226
JeremyRudman Nov 29, 2020
21e1c01
Fixes test
cbaudouinjr Nov 29, 2020
d6b8af3
fix(event): tweak test in attempt to get working
JeremyRudman Nov 29, 2020
b896471
fix(event): got testing to work
JeremyRudman Nov 29, 2020
43cdc53
fix(event): fix hound errors and db password error
JeremyRudman Nov 29, 2020
971906c
fix(event): fix houndci error i missed
JeremyRudman Nov 29, 2020
b6963e6
Merge pull request #406 from codeRIT/hm-405
cbaudouinjr Nov 29, 2020
f95f2ff
feat: Redesigns OAuth2 portal (#404)
cbaudouinjr Nov 29, 2020
0fd6e91
Adds Redis dump files to .gitignore
cbaudouinjr Nov 29, 2020
47f1eda
Merge branch '2.1' into issue-226
cbaudouinjr Nov 29, 2020
baac803
fix(event): fixed some of the pull request suggestions
JeremyRudman Nov 29, 2020
ac139a6
Shorten form :)
peterkos Nov 30, 2020
889a046
fix(forms): change size of all forms without textbox
JeremyRudman Nov 30, 2020
560f026
fix(event): implemented pull request changes
JeremyRudman Nov 30, 2020
e43618f
fix: Fixes MyMLH branding in config (#412)
cbaudouinjr Dec 1, 2020
5591a92
feat(settings): Simplifies Config (#409)
cbaudouinjr Dec 2, 2020
20f0a2d
feat: Adds support for digital-only hackathons (#395)
cbaudouinjr Dec 2, 2020
3b23092
event(fix): renamed events to schedule and reverted forms
JeremyRudman Dec 5, 2020
704432a
feat: Adds GitHub Action for releases (#426)
cbaudouinjr Dec 10, 2020
6386ccc
feat: Adds GitHub Action CI testing (#423)
cbaudouinjr Dec 10, 2020
383234f
Merge branch '2.1' into issue-226
cbaudouinjr Dec 10, 2020
4e36b05
fix(event): schedule now shows end time
JeremyRudman Dec 10, 2020
387333d
Merge branch 'issue-226' of https://github.com/codeRIT/hackathon-mana…
JeremyRudman Dec 10, 2020
9bf3f45
fix(event): fix houndci complaints
JeremyRudman Dec 10, 2020
6c37465
Merge branch '2.1.2' into issue-226
JeremyRudman Dec 17, 2020
1844eae
Merge branch '2.2' into issue-226
peterkos Jan 3, 2021
bd88847
bundle install
peterkos Jan 3, 2021
a12dc7d
Merge branch '2.2' into issue-226
cbaudouinjr Jan 3, 2021
b57fc75
Merge branch '2.2' into issue-226
JeremyRudman Jan 22, 2021
6abb189
fixed styling errors and added check for finish and start time
JeremyRudman Jan 23, 2021
f8c3141
Merge branch 'issue-226' of https://github.com/codeRIT/hackathon-mana…
JeremyRudman Jan 23, 2021
690d60c
made finish time optional and made css fixes
JeremyRudman Jan 23, 2021
d61c80f
fix houndci complaint
JeremyRudman Jan 23, 2021
8f90285
fix houndci complaint part 2
JeremyRudman Jan 23, 2021
8b75e16
removed finish time requirement in test
JeremyRudman Jan 23, 2021
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
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ gem 'jquery-ui-rails'
gem 'selectize-rails'
gem 'highcharts-rails', '~> 6.0'
gem 'bootstrap', '~> 4.3.1'
gem 'fullcalendar-rails'
gem 'momentjs-rails'

# Markdown parsing
gem 'redcarpet'
Expand Down
18 changes: 13 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ GEM
dotenv (= 2.7.5)
railties (>= 3.2, < 6.1)
errbase (0.2.0)
erubi (1.9.0)
erubi (1.10.0)
erubis (2.7.0)
et-orbi (1.2.4)
tzinfo
Expand All @@ -152,6 +152,10 @@ GEM
fugit (1.3.6)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.3)
fullcalendar-rails (3.9.0.0)
jquery-rails (>= 4.0.5, < 5.0.0)
jquery-ui-rails (>= 5.0.2)
momentjs-rails (>= 2.9.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
groupdate (5.0.0)
Expand Down Expand Up @@ -205,7 +209,7 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.7.0)
loofah (2.8.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.2.6)
Expand All @@ -226,14 +230,16 @@ GEM
builder
minitest (>= 5.0)
ruby-progressbar
momentjs-rails (2.20.1)
railties (>= 3.1)
msgpack (1.3.3)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
mustache (1.1.1)
mysql2 (0.5.3)
nenv (0.3.0)
nio4r (2.5.3)
nio4r (2.5.4)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
notiffany (0.1.3)
Expand Down Expand Up @@ -386,7 +392,7 @@ GEM
sprockets (4.0.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
Expand All @@ -402,7 +408,7 @@ GEM
turbolinks (5.2.1)
turbolinks-source (~> 5.2)
turbolinks-source (5.2.0)
tzinfo (1.2.7)
tzinfo (1.2.8)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
Expand Down Expand Up @@ -451,6 +457,7 @@ DEPENDENCIES
factory_bot_rails
file_validators
font-awesome-rails (~> 4.0)
fullcalendar-rails
groupdate
guard
guard-minitest
Expand All @@ -461,6 +468,7 @@ DEPENDENCIES
jquery-ui-rails
listen (>= 3.0.5, < 3.2)
minitest-reporters
momentjs-rails
mustache (~> 1.0)
mysql2 (>= 0.4.4, < 0.6.0)
omniauth-mlh (~> 0.4.1)
Expand Down
3 changes: 3 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@
//= require_directory .
//= require_directory ./channels
//= require ./vendor/simplemde.min.js
//= require moment
//= require fullcalendar
//= require fullcalendar/locale-all
38 changes: 38 additions & 0 deletions app/assets/javascripts/events.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function eventCalendar() {
return $('#calendar').fullCalendar({
defaultView: 'listYear',
buttonText: {
today: 'Today'
},
eventRender: function (event, element, view) {
var description = event.description ? event.description : '';
var location = event.location ? event.location : '';
element.find('.fc-event-dot').css('display','none');
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px">' + description + '</span>');
element.find('.fc-list-item-title').append('<div></div><span style="font-size: 12px">' + location + '</span>');
},
events: {
url: '/manage/events.json',
success: function(response) {
// due to "end" being a keyword in ruby and what fullcalender uses it is stored as finish and than it is
// converted to "end" when sending it to fullcalendar
response = JSON.parse(JSON.stringify(response).split('"finish":').join('"end":'));
return response;
}
},
eventClick: function (info) {
window.location = 'events/' + info.id;
},
height: 'auto',
});
}

function clearCalendar() {
$('#calendar').fullCalendar('delete');
$('#calendar').html('');
}

document.addEventListener('turbolinks:load', function () {
eventCalendar();
});
document.addEventListener('turbolinks:before-cache', clearCalendar);
6 changes: 6 additions & 0 deletions app/assets/stylesheets/manage.sass
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@import general/variables
@import general/css4
@import manage/autocomplete
@import manage/events

$grey-dark: #555
$grey-med: #999
Expand All @@ -15,6 +16,7 @@ $grey-med: #999
@import vendor/datatables.min
@import selectize
@import selectize.default
@import fullcalendar

.icon-space-r
margin-right: 0.5em
Expand Down Expand Up @@ -137,6 +139,10 @@ $grey-med: #999
height: calc(100vh - 2.25rem)
overflow: scroll

.calendar-list
width: 100%
min-width: 500px
margin: auto

/*
* Datatable changes
Expand Down
9 changes: 9 additions & 0 deletions app/assets/stylesheets/manage/events.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.fc-list-item
cursor: pointer !important

.event_start select:first-child, .event_finish select:first-child
margin-left: 0 !important

.event_start select:last-child, .event_finish select:last-child
margin-right: 0 !important

54 changes: 54 additions & 0 deletions app/controllers/manage/events_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Manage::EventsController < Manage::ApplicationController
before_action :require_director
respond_to :html, :json

def index
@start_date = HackathonConfig['event_start_date']
respond_to do |format|
format.html
format.json { render json: Event.all }
end
end

def new
@event = ::Event.new
end

def create
@event = ::Event.new(event_params)
if @event.save
redirect_to(manage_events_path)
else
render('new')
end
end

def show
@event = Event.find_by_id(params[:id])
respond_with(:manage, @event)
end

def update
@event = Event.find_by_id(params[:id])
if @event.update(event_params)
redirect_to(manage_events_path)
else
render('show')
end
end

def destroy
@event = Event.find_by_id(params[:id])
if @event.destroy
redirect_to(manage_events_path)
else
render('show')
end
end

def event_params
params.require(:event).permit(
:title, :description, :location, :public, :start, :finish, owner: []
)
end
end
12 changes: 12 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Event < ApplicationRecord
validates_presence_of :title, :start

validate :finish_before_start

def finish_before_start
return if finish.nil?
unless finish > start
errors.add(:finish, 'time must be after start time')
end
end
end
4 changes: 4 additions & 0 deletions app/views/layouts/manage/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@
= active_link_to manage_checkins_path, class: "nav-link" do
.fa.fa-drivers-license-o.fa-fw.icon-space-r-half
= t(:title, scope: 'pages.manage.check-in')
%li.nav-item
= active_link_to manage_events_path, class: "nav-link" do
.fa.fa-calendar.fa-fw.icon-space-r-half
= t(:title, scope: 'pages.manage.events')
%li.nav-item
= active_link_to manage_stats_path, class: "nav-link" do
.fa.fa-table.fa-fw.icon-space-r-half
Expand Down
10 changes: 4 additions & 6 deletions app/views/manage/data_exports/_form.html.haml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
.form-container
= bs_horizontal_simple_form_for @data_export, url: url_for(action: @data_export.new_record? ? "create" : "update", controller: "data_exports") do |f|
= f.error_notification

.form-inputs
= f.input :export_type, as: :select, collection: DataExport::POSSIBLE_TYPES.map { |x| [x.titleize, x] }, include_blank: false

.form-actions.mb-3.mt-3
= f.button :submit, class: 'btn-primary'
.form-inputs
= f.input :export_type, as: :select, collection: DataExport::POSSIBLE_TYPES.map { |x| [x.titleize, x] }, include_blank: false
.form-actions.mb-3.mt-3
= f.button :submit, class: 'btn-primary'

.mb-4
11 changes: 11 additions & 0 deletions app/views/manage/events/_form.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
= bs_horizontal_simple_form_for @event, url: url_for(action: @event.new_record? ? "create" : "update", controller: "events") do |f|
= f.error_notification
.form-inputs
= f.input :title
= f.input :description
= f.input :location
= f.input :start
= f.input :finish, include_blank: true
.center
//TODO figure out why you need to add save and it doesn't work automatically like other forms
= f.button :submit, 'Save', value: ( @event.new_record? ? 'Create' : 'Save' ), class: 'btn-primary'
4 changes: 4 additions & 0 deletions app/views/manage/events/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= render "layouts/manage/page_title", title: t(:title, scope: 'pages.manage.events') do
= link_to "Add Event", new_manage_event_path, class: "btn btn-sm btn-outline-secondary"

.calendar-list#calendar
4 changes: 4 additions & 0 deletions app/views/manage/events/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= render "layouts/manage/page_title", title: "New Event"

.form-container
= render "form"
6 changes: 6 additions & 0 deletions app/views/manage/events/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= render "layouts/manage/page_title", title: "Edit Event", subtitle: @event.title do
.btn-group
= link_to 'Cancel', manage_events_path, class: 'btn btn-sm btn-outline-secondary'
= link_to 'Delete', manage_event_path(@event), method: :delete, data: { confirm: 'Are you sure? This action is irreversible.' }, class: 'btn btn-sm btn-outline-secondary'

= render "form"
4 changes: 3 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ en:
title: Statistics
trackable-tags:
title: Trackable Tags
events:
title: Schedule
bus-lists:
title: Bus Lists
schools:
title: Schools
users:
users:
title: Users & Staff
users: All Users
staff: "%{hackathon_name} Staff"
Expand Down
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
resources :checkins do
post :datatable, on: :collection
end
resources :events do
end
resources :messages do
get :preview, on: :member
get :live_preview, on: :collection
Expand Down
13 changes: 13 additions & 0 deletions db/migrate/20200529142141_create_events.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class CreateEvents < ActiveRecord::Migration[5.2]
def change
create_table :events do |t|
t.string :title
t.string :description
t.string :location
t.datetime :start
t.datetime :finish

t.timestamps
end
end
end
10 changes: 10 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@
t.datetime "updated_at", null: false
end

create_table "events", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "title"
t.string "description"
t.string "location"
t.datetime "start"
t.datetime "finish"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "fips", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "fips_code"
t.string "city"
Expand Down
Loading