Skip to content

Commit 1be9409

Browse files
committed
Adds react, webpacker and Schedule component
1 parent b2a6e02 commit 1be9409

40 files changed

+6602
-52
lines changed

Diff for: .browserslistrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
defaults

Diff for: .gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,10 @@ scratch.md
99
.ruby-version
1010
.ruby-gemset
1111
.rvmrc
12+
13+
/public/packs
14+
/public/packs-test
15+
/node_modules
16+
/yarn-error.log
17+
yarn-debug.log*
18+
.yarn-integrity

Diff for: Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ gem 'actionview-encoded_mail_to'
3737
gem 'nokogiri', '~> 1.8.1'
3838
gem 'bootsnap', require: false
3939

40+
gem 'webpacker'
41+
gem 'react-rails'
42+
4043
group :production do
4144
gem 'rails_12factor'
4245
gem 'rack-timeout', '~> 0.5'

Diff for: Gemfile.lock

+19
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ GEM
6464
arel (9.0.0)
6565
autoprefixer-rails (9.3.1)
6666
execjs
67+
babel-source (5.8.35)
68+
babel-transpiler (0.7.0)
69+
babel-source (>= 4.0, < 6)
70+
execjs (~> 2.0)
6771
bcrypt (3.1.12)
6872
better_errors (2.5.0)
6973
coderay (>= 1.0.0)
@@ -97,6 +101,7 @@ GEM
97101
nokogiri (~> 1.8)
98102
coderay (1.1.2)
99103
concurrent-ruby (1.1.3)
104+
connection_pool (2.2.2)
100105
countries (0.9.3)
101106
currencies (~> 0.4.2)
102107
country_select (1.3.1)
@@ -270,6 +275,8 @@ GEM
270275
rack (2.0.6)
271276
rack-mini-profiler (1.0.0)
272277
rack (>= 1.2.0)
278+
rack-proxy (0.6.5)
279+
rack
273280
rack-test (1.1.0)
274281
rack (>= 1.0, < 3)
275282
rack-timeout (0.5.1)
@@ -311,6 +318,12 @@ GEM
311318
rb-fsevent (0.10.3)
312319
rb-inotify (0.9.10)
313320
ffi (>= 0.5.0, < 2)
321+
react-rails (2.5.0)
322+
babel-transpiler (>= 0.7.0)
323+
connection_pool
324+
execjs
325+
railties (>= 3.2)
326+
tilt
314327
redcarpet (3.4.0)
315328
request_store (1.4.1)
316329
rack (>= 1.4)
@@ -400,6 +413,10 @@ GEM
400413
activemodel (>= 5.0)
401414
bindex (>= 0.4.0)
402415
railties (>= 5.0)
416+
webpacker (4.0.2)
417+
activesupport (>= 4.2)
418+
rack-proxy (>= 0.6.1)
419+
railties (>= 4.2)
403420
websocket-driver (0.7.0)
404421
websocket-extensions (>= 0.1.0)
405422
websocket-extensions (0.1.3)
@@ -457,6 +474,7 @@ DEPENDENCIES
457474
rails-assets-momentjs!
458475
rails-controller-testing
459476
rails_12factor
477+
react-rails
460478
redcarpet (~> 3.4.0)
461479
responders (~> 2.4.0)
462480
rspec
@@ -471,6 +489,7 @@ DEPENDENCIES
471489
uglifier (>= 1.3.0)
472490
underscore-rails
473491
web-console
492+
webpacker
474493

475494
RUBY VERSION
476495
ruby 2.4.4p296

Diff for: app/javascript/components/.keep

Whitespace-only changes.

Diff for: app/javascript/components/Schedule.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import React from "react"
2+
import PropTypes from "prop-types"
3+
4+
class Schedule extends React.Component {
5+
render () {
6+
console.log('here!')
7+
return (
8+
<div>
9+
<h1>New Schedule</h1>
10+
<section>
11+
<h2>Schedule:</h2>
12+
<div>{JSON.stringify(this.props.schedule, null, 2)}</div>
13+
</section>
14+
<section>
15+
<h2>Sessions:</h2>
16+
<div>{JSON.stringify(this.props.sessions, null, 2)}</div>
17+
</section>
18+
<section>
19+
<h2>Counts:</h2>
20+
<div>{JSON.stringify(this.props.counts, null, 2)}</div>
21+
</section>
22+
<section>
23+
<h2>Unscheduled Sessions:</h2>
24+
<div>{JSON.stringify(this.props.unscheduledSessions, null, 2)}</div>
25+
</section>
26+
</div>
27+
);
28+
}
29+
}
30+
31+
Schedule.propTypes = {
32+
schedule: PropTypes.object,
33+
sessions: PropTypes.array,
34+
counts: PropTypes.object,
35+
unscheduledSessions: PropTypes.array,
36+
};
37+
export default Schedule

Diff for: app/javascript/packs/application.js

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* eslint no-console:0 */
2+
// This file is automatically compiled by Webpack, along with any other files
3+
// present in this directory. You're encouraged to place your actual application logic in
4+
// a relevant structure within app/javascript and only use these pack files to reference
5+
// that code so it'll be compiled.
6+
//
7+
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8+
// layout file, like app/views/layouts/application.html.erb
9+
10+
11+
// Uncomment to copy all static images under ../images to the output folder and reference
12+
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
13+
// or the `imagePath` JavaScript helper below.
14+
//
15+
// const images = require.context('../images', true)
16+
// const imagePath = (name) => images(name, true)
17+
18+
console.log('Hello World from Webpacker')
19+
// Support component names relative to this directory:
20+
var componentRequireContext = require.context("components", true);
21+
var ReactRailsUJS = require("react_ujs");
22+
ReactRailsUJS.useContext(componentRequireContext);

Diff for: app/javascript/packs/hello_react.jsx

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
2+
// like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
3+
// of the page.
4+
5+
import React from 'react'
6+
import ReactDOM from 'react-dom'
7+
import PropTypes from 'prop-types'
8+
9+
const Hello = props => (
10+
<div>Hello {props.name}!</div>
11+
)
12+
13+
Hello.defaultProps = {
14+
name: 'David'
15+
}
16+
17+
Hello.propTypes = {
18+
name: PropTypes.string
19+
}
20+
21+
document.addEventListener('DOMContentLoaded', () => {
22+
ReactDOM.render(
23+
<Hello name="React" />,
24+
document.body.appendChild(document.createElement('div')),
25+
)
26+
})

Diff for: app/javascript/packs/server_rendering.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// By default, this pack is loaded for server-side rendering.
2+
// It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
3+
var componentRequireContext = require.context("components", true);
4+
var ReactRailsUJS = require("react_ujs");
5+
ReactRailsUJS.useContext(componentRequireContext);

Diff for: app/models/comment.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ def public?
1616
#
1717
# Table name: comments
1818
#
19-
# id :integer not null, primary key
20-
# proposal_id :integer
21-
# user_id :integer
19+
# id :bigint(8) not null, primary key
20+
# proposal_id :bigint(8)
21+
# user_id :bigint(8)
2222
# parent_id :integer
2323
# body :text
2424
# type :string

Diff for: app/models/event.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def update_closes_at_if_manually_closed
240240
#
241241
# Table name: events
242242
#
243-
# id :integer not null, primary key
243+
# id :bigint(8) not null, primary key
244244
# name :string
245245
# slug :string
246246
# url :string

Diff for: app/models/internal_comment.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ def notify_mentioned_event_staff
3838
#
3939
# Table name: comments
4040
#
41-
# id :integer not null, primary key
42-
# proposal_id :integer
43-
# user_id :integer
41+
# id :bigint(8) not null, primary key
42+
# proposal_id :bigint(8)
43+
# user_id :bigint(8)
4444
# parent_id :integer
4545
# body :text
4646
# type :string

Diff for: app/models/invitation.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def accept(user)
2020
#
2121
# Table name: invitations
2222
#
23-
# id :integer not null, primary key
24-
# proposal_id :integer
25-
# user_id :integer
23+
# id :bigint(8) not null, primary key
24+
# proposal_id :bigint(8)
25+
# user_id :bigint(8)
2626
# email :string
2727
# state :string default("pending")
2828
# slug :string

Diff for: app/models/notification.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def short_message
4646
#
4747
# Table name: notifications
4848
#
49-
# id :integer not null, primary key
50-
# user_id :integer
49+
# id :bigint(8) not null, primary key
50+
# user_id :bigint(8)
5151
# message :string
5252
# target_path :string
5353
# read_at :datetime

Diff for: app/models/program_session.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ def destroy_speakers
192192
#
193193
# Table name: program_sessions
194194
#
195-
# id :integer not null, primary key
196-
# event_id :integer
197-
# proposal_id :integer
195+
# id :bigint(8) not null, primary key
196+
# event_id :bigint(8)
197+
# proposal_id :bigint(8)
198198
# title :text
199199
# abstract :text
200-
# track_id :integer
201-
# session_format_id :integer
200+
# track_id :bigint(8)
201+
# session_format_id :bigint(8)
202202
# state :text default("draft")
203203
# created_at :datetime not null
204204
# updated_at :datetime not null

Diff for: app/models/proposal.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,13 @@ def set_updated_by_speaker_at
307307
#
308308
# Table name: proposals
309309
#
310-
# id :integer not null, primary key
311-
# event_id :integer
310+
# id :bigint(8) not null, primary key
311+
# event_id :bigint(8)
312312
# state :string default("submitted")
313313
# uuid :string
314314
# title :string
315-
# session_format_id :integer
316-
# track_id :integer
315+
# session_format_id :bigint(8)
316+
# track_id :bigint(8)
317317
# abstract :text
318318
# details :text
319319
# pitch :text

Diff for: app/models/public_comment.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def notify
3535
#
3636
# Table name: comments
3737
#
38-
# id :integer not null, primary key
39-
# proposal_id :integer
40-
# user_id :integer
38+
# id :bigint(8) not null, primary key
39+
# proposal_id :bigint(8)
40+
# user_id :bigint(8)
4141
# parent_id :integer
4242
# body :text
4343
# type :string

Diff for: app/models/rating.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ def teammate
1414
#
1515
# Table name: ratings
1616
#
17-
# id :integer not null, primary key
18-
# proposal_id :integer
19-
# user_id :integer
17+
# id :bigint(8) not null, primary key
18+
# proposal_id :bigint(8)
19+
# user_id :bigint(8)
2020
# score :integer
2121
# created_at :datetime
2222
# updated_at :datetime

Diff for: app/models/room.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class Room < ApplicationRecord
1111
#
1212
# Table name: rooms
1313
#
14-
# id :integer not null, primary key
15-
# event_id :integer
14+
# id :bigint(8) not null, primary key
15+
# event_id :bigint(8)
1616
# name :string
1717
# room_number :string
1818
# level :string

Diff for: app/models/session_format.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class SessionFormat < ApplicationRecord
1414
#
1515
# Table name: session_formats
1616
#
17-
# id :integer not null, primary key
18-
# event_id :integer
17+
# id :bigint(8) not null, primary key
18+
# event_id :bigint(8)
1919
# name :string
2020
# description :string
2121
# duration :integer
@@ -29,5 +29,5 @@ class SessionFormat < ApplicationRecord
2929
#
3030
# Foreign Keys
3131
#
32-
# fk_rails_9632792490 (event_id => events.id)
32+
# fk_rails_... (event_id => events.id)
3333
#

Diff for: app/models/speaker.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def gravatar_hash
3636
#
3737
# Table name: speakers
3838
#
39-
# id :integer not null, primary key
40-
# user_id :integer
41-
# event_id :integer
42-
# proposal_id :integer
43-
# program_session_id :integer
39+
# id :bigint(8) not null, primary key
40+
# user_id :bigint(8)
41+
# event_id :bigint(8)
42+
# proposal_id :bigint(8)
43+
# program_session_id :bigint(8)
4444
# speaker_name :string
4545
# speaker_email :string
4646
# bio :text

Diff for: app/models/tagging.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ def self.tags_string_to_array(string)
1919
#
2020
# Table name: taggings
2121
#
22-
# id :integer not null, primary key
23-
# proposal_id :integer
22+
# id :bigint(8) not null, primary key
23+
# proposal_id :bigint(8)
2424
# tag :string
2525
# internal :boolean default(FALSE)
2626
# created_at :datetime

Diff for: app/models/teammate.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ def comment_notifications
8888
#
8989
# Table name: teammates
9090
#
91-
# id :integer not null, primary key
92-
# event_id :integer
93-
# user_id :integer
91+
# id :bigint(8) not null, primary key
92+
# event_id :bigint(8)
93+
# user_id :bigint(8)
9494
# role :string
9595
# email :string
9696
# state :string

0 commit comments

Comments
 (0)