Skip to content

Commit

Permalink
Adds react, webpacker and Schedule component
Browse files Browse the repository at this point in the history
  • Loading branch information
jeneve committed Apr 29, 2019
1 parent b2a6e02 commit 1be9409
Show file tree
Hide file tree
Showing 40 changed files with 6,602 additions and 52 deletions.
1 change: 1 addition & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
defaults
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ scratch.md
.ruby-version
.ruby-gemset
.rvmrc

/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ gem 'actionview-encoded_mail_to'
gem 'nokogiri', '~> 1.8.1'
gem 'bootsnap', require: false

gem 'webpacker'
gem 'react-rails'

group :production do
gem 'rails_12factor'
gem 'rack-timeout', '~> 0.5'
Expand Down
19 changes: 19 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ GEM
arel (9.0.0)
autoprefixer-rails (9.3.1)
execjs
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
execjs (~> 2.0)
bcrypt (3.1.12)
better_errors (2.5.0)
coderay (>= 1.0.0)
Expand Down Expand Up @@ -97,6 +101,7 @@ GEM
nokogiri (~> 1.8)
coderay (1.1.2)
concurrent-ruby (1.1.3)
connection_pool (2.2.2)
countries (0.9.3)
currencies (~> 0.4.2)
country_select (1.3.1)
Expand Down Expand Up @@ -270,6 +275,8 @@ GEM
rack (2.0.6)
rack-mini-profiler (1.0.0)
rack (>= 1.2.0)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-timeout (0.5.1)
Expand Down Expand Up @@ -311,6 +318,12 @@ GEM
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
react-rails (2.5.0)
babel-transpiler (>= 0.7.0)
connection_pool
execjs
railties (>= 3.2)
tilt
redcarpet (3.4.0)
request_store (1.4.1)
rack (>= 1.4)
Expand Down Expand Up @@ -400,6 +413,10 @@ GEM
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webpacker (4.0.2)
activesupport (>= 4.2)
rack-proxy (>= 0.6.1)
railties (>= 4.2)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
Expand Down Expand Up @@ -457,6 +474,7 @@ DEPENDENCIES
rails-assets-momentjs!
rails-controller-testing
rails_12factor
react-rails
redcarpet (~> 3.4.0)
responders (~> 2.4.0)
rspec
Expand All @@ -471,6 +489,7 @@ DEPENDENCIES
uglifier (>= 1.3.0)
underscore-rails
web-console
webpacker

RUBY VERSION
ruby 2.4.4p296
Expand Down
Empty file added app/javascript/components/.keep
Empty file.
37 changes: 37 additions & 0 deletions app/javascript/components/Schedule.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react"
import PropTypes from "prop-types"

class Schedule extends React.Component {
render () {
console.log('here!')
return (
<div>
<h1>New Schedule</h1>
<section>
<h2>Schedule:</h2>
<div>{JSON.stringify(this.props.schedule, null, 2)}</div>
</section>
<section>
<h2>Sessions:</h2>
<div>{JSON.stringify(this.props.sessions, null, 2)}</div>
</section>
<section>
<h2>Counts:</h2>
<div>{JSON.stringify(this.props.counts, null, 2)}</div>
</section>
<section>
<h2>Unscheduled Sessions:</h2>
<div>{JSON.stringify(this.props.unscheduledSessions, null, 2)}</div>
</section>
</div>
);
}
}

Schedule.propTypes = {
schedule: PropTypes.object,
sessions: PropTypes.array,
counts: PropTypes.object,
unscheduledSessions: PropTypes.array,
};
export default Schedule
22 changes: 22 additions & 0 deletions app/javascript/packs/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb


// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images', true)
// const imagePath = (name) => images(name, true)

console.log('Hello World from Webpacker')
// Support component names relative to this directory:
var componentRequireContext = require.context("components", true);
var ReactRailsUJS = require("react_ujs");
ReactRailsUJS.useContext(componentRequireContext);
26 changes: 26 additions & 0 deletions app/javascript/packs/hello_react.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
// like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
// of the page.

import React from 'react'
import ReactDOM from 'react-dom'
import PropTypes from 'prop-types'

const Hello = props => (
<div>Hello {props.name}!</div>
)

Hello.defaultProps = {
name: 'David'
}

Hello.propTypes = {
name: PropTypes.string
}

document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(
<Hello name="React" />,
document.body.appendChild(document.createElement('div')),
)
})
5 changes: 5 additions & 0 deletions app/javascript/packs/server_rendering.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// By default, this pack is loaded for server-side rendering.
// It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
var componentRequireContext = require.context("components", true);
var ReactRailsUJS = require("react_ujs");
ReactRailsUJS.useContext(componentRequireContext);
6 changes: 3 additions & 3 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def public?
#
# Table name: comments
#
# id :integer not null, primary key
# proposal_id :integer
# user_id :integer
# id :bigint(8) not null, primary key
# proposal_id :bigint(8)
# user_id :bigint(8)
# parent_id :integer
# body :text
# type :string
Expand Down
2 changes: 1 addition & 1 deletion app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def update_closes_at_if_manually_closed
#
# Table name: events
#
# id :integer not null, primary key
# id :bigint(8) not null, primary key
# name :string
# slug :string
# url :string
Expand Down
6 changes: 3 additions & 3 deletions app/models/internal_comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def notify_mentioned_event_staff
#
# Table name: comments
#
# id :integer not null, primary key
# proposal_id :integer
# user_id :integer
# id :bigint(8) not null, primary key
# proposal_id :bigint(8)
# user_id :bigint(8)
# parent_id :integer
# body :text
# type :string
Expand Down
6 changes: 3 additions & 3 deletions app/models/invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def accept(user)
#
# Table name: invitations
#
# id :integer not null, primary key
# proposal_id :integer
# user_id :integer
# id :bigint(8) not null, primary key
# proposal_id :bigint(8)
# user_id :bigint(8)
# email :string
# state :string default("pending")
# slug :string
Expand Down
4 changes: 2 additions & 2 deletions app/models/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def short_message
#
# Table name: notifications
#
# id :integer not null, primary key
# user_id :integer
# id :bigint(8) not null, primary key
# user_id :bigint(8)
# message :string
# target_path :string
# read_at :datetime
Expand Down
10 changes: 5 additions & 5 deletions app/models/program_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,13 @@ def destroy_speakers
#
# Table name: program_sessions
#
# id :integer not null, primary key
# event_id :integer
# proposal_id :integer
# id :bigint(8) not null, primary key
# event_id :bigint(8)
# proposal_id :bigint(8)
# title :text
# abstract :text
# track_id :integer
# session_format_id :integer
# track_id :bigint(8)
# session_format_id :bigint(8)
# state :text default("draft")
# created_at :datetime not null
# updated_at :datetime not null
Expand Down
8 changes: 4 additions & 4 deletions app/models/proposal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,13 @@ def set_updated_by_speaker_at
#
# Table name: proposals
#
# id :integer not null, primary key
# event_id :integer
# id :bigint(8) not null, primary key
# event_id :bigint(8)
# state :string default("submitted")
# uuid :string
# title :string
# session_format_id :integer
# track_id :integer
# session_format_id :bigint(8)
# track_id :bigint(8)
# abstract :text
# details :text
# pitch :text
Expand Down
6 changes: 3 additions & 3 deletions app/models/public_comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def notify
#
# Table name: comments
#
# id :integer not null, primary key
# proposal_id :integer
# user_id :integer
# id :bigint(8) not null, primary key
# proposal_id :bigint(8)
# user_id :bigint(8)
# parent_id :integer
# body :text
# type :string
Expand Down
6 changes: 3 additions & 3 deletions app/models/rating.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def teammate
#
# Table name: ratings
#
# id :integer not null, primary key
# proposal_id :integer
# user_id :integer
# id :bigint(8) not null, primary key
# proposal_id :bigint(8)
# user_id :bigint(8)
# score :integer
# created_at :datetime
# updated_at :datetime
Expand Down
4 changes: 2 additions & 2 deletions app/models/room.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Room < ApplicationRecord
#
# Table name: rooms
#
# id :integer not null, primary key
# event_id :integer
# id :bigint(8) not null, primary key
# event_id :bigint(8)
# name :string
# room_number :string
# level :string
Expand Down
6 changes: 3 additions & 3 deletions app/models/session_format.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class SessionFormat < ApplicationRecord
#
# Table name: session_formats
#
# id :integer not null, primary key
# event_id :integer
# id :bigint(8) not null, primary key
# event_id :bigint(8)
# name :string
# description :string
# duration :integer
Expand All @@ -29,5 +29,5 @@ class SessionFormat < ApplicationRecord
#
# Foreign Keys
#
# fk_rails_9632792490 (event_id => events.id)
# fk_rails_... (event_id => events.id)
#
10 changes: 5 additions & 5 deletions app/models/speaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def gravatar_hash
#
# Table name: speakers
#
# id :integer not null, primary key
# user_id :integer
# event_id :integer
# proposal_id :integer
# program_session_id :integer
# id :bigint(8) not null, primary key
# user_id :bigint(8)
# event_id :bigint(8)
# proposal_id :bigint(8)
# program_session_id :bigint(8)
# speaker_name :string
# speaker_email :string
# bio :text
Expand Down
4 changes: 2 additions & 2 deletions app/models/tagging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def self.tags_string_to_array(string)
#
# Table name: taggings
#
# id :integer not null, primary key
# proposal_id :integer
# id :bigint(8) not null, primary key
# proposal_id :bigint(8)
# tag :string
# internal :boolean default(FALSE)
# created_at :datetime
Expand Down
6 changes: 3 additions & 3 deletions app/models/teammate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def comment_notifications
#
# Table name: teammates
#
# id :integer not null, primary key
# event_id :integer
# user_id :integer
# id :bigint(8) not null, primary key
# event_id :bigint(8)
# user_id :bigint(8)
# role :string
# email :string
# state :string
Expand Down
Loading

0 comments on commit 1be9409

Please sign in to comment.