Skip to content

Commit

Permalink
Strip out json and API functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
alepbloyd committed Nov 26, 2024
1 parent 1b930a9 commit d401934
Show file tree
Hide file tree
Showing 38 changed files with 73 additions and 152 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ gem 'turbo-rails'
gem 'stimulus-rails'

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem 'jbuilder'
# gem 'jbuilder'

# Use Redis adapter to run Action Cable in production
gem "redis", ">= 4.0.1"
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,6 @@ GEM
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jbuilder (2.13.0)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jsbundling-rails (1.3.1)
railties (>= 6.0.0)
json (2.7.5)
Expand Down Expand Up @@ -391,7 +388,6 @@ DEPENDENCIES
faker
faraday
importmap-rails
jbuilder
jsbundling-rails (~> 1.3)
launchy
orderly
Expand Down
19 changes: 5 additions & 14 deletions app/controllers/facilitators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ class FacilitatorsController < ApplicationController
before_action :require_login,
only: %i[index show new edit create update destroy]

# GET /facilitators or /facilitators.json
# GET /facilitators
def index
@facilitators = Facilitator.all
end

# GET /facilitators/1 or /facilitators/1.json
# GET /facilitators/1
def show
end

Expand All @@ -21,7 +21,7 @@ def new
def edit
end

# POST /facilitators or /facilitators.json
# POST /facilitators
def create
require 'pry'
binding.pry
Expand All @@ -33,35 +33,27 @@ def create
redirect_to @facilitator,
notice: 'Facilitator was successfully created.'
end
format.json { render :show, status: :created, location: @facilitator }
else
format.html { render :new, status: :unprocessable_entity }
format.json do
render json: @facilitator.errors, status: :unprocessable_entity
end
end
end
end

# PATCH/PUT /facilitators/1 or /facilitators/1.json
# PATCH/PUT /facilitators/1
def update
respond_to do |format|
if @facilitator.update(facilitator_params)
format.html do
redirect_to @facilitator,
notice: 'Facilitator was successfully updated.'
end
format.json { render :show, status: :ok, location: @facilitator }
else
format.html { render :edit, status: :unprocessable_entity }
format.json do
render json: @facilitator.errors, status: :unprocessable_entity
end
end
end
end

# DELETE /facilitators/1 or /facilitators/1.json
# DELETE /facilitators/1
def destroy
@facilitator.destroy!

Expand All @@ -71,7 +63,6 @@ def destroy
status: :see_other,
notice: 'Facilitator was successfully destroyed.'
end
format.json { head :no_content }
end
end

Expand Down
19 changes: 5 additions & 14 deletions app/controllers/participants_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class ParticipantsController < ApplicationController
before_action :set_participant, only: %i[show edit update destroy]
# before_action :require_login, only: %i[index show edit update destroy]

# GET /participants or /participants.json
# GET /participants
def index
@participants = Participant.all
end

# GET /participants/1 or /participants/1.json
# GET /participants/1
def show
end

Expand All @@ -20,7 +20,7 @@ def new
def edit
end

# POST /participants or /participants.json
# POST /participants
def create
@participant = Participant.new(participant_params)

Expand All @@ -30,35 +30,27 @@ def create
redirect_to @participant,
notice: 'Participant was successfully created.'
end
format.json { render :show, status: :created, location: @participant }
else
format.html { render :new, status: :unprocessable_entity }
format.json do
render json: @participant.errors, status: :unprocessable_entity
end
end
end
end

# PATCH/PUT /participants/1 or /participants/1.json
# PATCH/PUT /participants/1
def update
respond_to do |format|
if @participant.update(participant_params)
format.html do
redirect_to @participant,
notice: 'Participant was successfully updated.'
end
format.json { render :show, status: :ok, location: @participant }
else
format.html { render :edit, status: :unprocessable_entity }
format.json do
render json: @participant.errors, status: :unprocessable_entity
end
end
end
end

# DELETE /participants/1 or /participants/1.json
# DELETE /participants/1
def destroy
@participant.destroy!

Expand All @@ -68,7 +60,6 @@ def destroy
status: :see_other,
notice: 'Participant was successfully destroyed.'
end
format.json { head :no_content }
end
end

Expand Down
21 changes: 5 additions & 16 deletions app/controllers/track_workshops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ class TrackWorkshopsController < ApplicationController
# before_action :require_login,
# only: %i[index show new edit create update destroy]

# GET /track_workshops or /track_workshops.json
# GET /track_workshops
def index
@track_workshops = TrackWorkshop.all
end

# GET /track_workshops/1 or /track_workshops/1.json
# GET /track_workshops/1
def show
end

Expand All @@ -21,7 +21,7 @@ def new
def edit
end

# POST /track_workshops or /track_workshops.json
# POST /track_workshops
def create
@track_workshop = TrackWorkshop.new(track_workshop_params)

Expand All @@ -31,37 +31,27 @@ def create
redirect_to @track_workshop,
notice: 'Track workshop was successfully created.'
end
format.json do
render :show, status: :created, location: @track_workshop
end
else
format.html { render :new, status: :unprocessable_entity }
format.json do
render json: @track_workshop.errors, status: :unprocessable_entity
end
end
end
end

# PATCH/PUT /track_workshops/1 or /track_workshops/1.json
# PATCH/PUT /track_workshops/1
def update
respond_to do |format|
if @track_workshop.update(track_workshop_params)
format.html do
redirect_to @track_workshop,
notice: 'Track workshop was successfully updated.'
end
format.json { render :show, status: :ok, location: @track_workshop }
else
format.html { render :edit, status: :unprocessable_entity }
format.json do
render json: @track_workshop.errors, status: :unprocessable_entity
end
end
end
end

# DELETE /track_workshops/1 or /track_workshops/1.json
# DELETE /track_workshops/1
def destroy
@track_workshop.destroy!

Expand All @@ -71,7 +61,6 @@ def destroy
status: :see_other,
notice: 'Track workshop was successfully destroyed.'
end
format.json { head :no_content }
end
end

Expand Down
19 changes: 5 additions & 14 deletions app/controllers/tracks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ class TracksController < ApplicationController
before_action :set_track, only: %i[show edit update destroy]
# before_action :require_login, only: %i[new edit create update destroy]

# GET /tracks or /tracks.json
# GET /tracks
def index
@tracks = Track.all
end

# GET /tracks/1 or /tracks/1.json
# GET /tracks/1
def show
end

Expand All @@ -20,7 +20,7 @@ def new
def edit
end

# POST /tracks or /tracks.json
# POST /tracks
def create
@track = Track.new(track_params)

Expand All @@ -29,34 +29,26 @@ def create
format.html do
redirect_to @track, notice: 'Track was successfully created.'
end
format.json { render :show, status: :created, location: @track }
else
format.html { render :new, status: :unprocessable_entity }
format.json do
render json: @track.errors, status: :unprocessable_entity
end
end
end
end

# PATCH/PUT /tracks/1 or /tracks/1.json
# PATCH/PUT /tracks/1
def update
respond_to do |format|
if @track.update(track_params)
format.html do
redirect_to @track, notice: 'Track was successfully updated.'
end
format.json { render :show, status: :ok, location: @track }
else
format.html { render :edit, status: :unprocessable_entity }
format.json do
render json: @track.errors, status: :unprocessable_entity
end
end
end
end

# DELETE /tracks/1 or /tracks/1.json
# DELETE /tracks/1
def destroy
@track.destroy!

Expand All @@ -66,7 +58,6 @@ def destroy
status: :see_other,
notice: 'Track was successfully destroyed.'
end
format.json { head :no_content }
end
end

Expand Down
25 changes: 5 additions & 20 deletions app/controllers/workshop_facilitators_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ class WorkshopFacilitatorsController < ApplicationController
# before_action :require_login,
# only: %i[index show new edit create update destroy]

# GET /workshop_facilitators or /workshop_facilitators.json
# GET /workshop_facilitators
def index
@workshop_facilitators = WorkshopFacilitator.all
end

# GET /workshop_facilitators/1 or /workshop_facilitators/1.json
# GET /workshop_facilitators/1
def show
end

Expand All @@ -21,7 +21,7 @@ def new
def edit
end

# POST /workshop_facilitators or /workshop_facilitators.json
# POST /workshop_facilitators
def create
@workshop_facilitator = WorkshopFacilitator.new(workshop_facilitator_params)

Expand All @@ -31,41 +31,27 @@ def create
redirect_to @workshop_facilitator,
notice: 'Workshop facilitator was successfully created.'
end
format.json do
render :show, status: :created, location: @workshop_facilitator
end
else
format.html { render :new, status: :unprocessable_entity }
format.json do
render json: @workshop_facilitator.errors,
status: :unprocessable_entity
end
end
end
end

# PATCH/PUT /workshop_facilitators/1 or /workshop_facilitators/1.json
# PATCH/PUT /workshop_facilitators/1
def update
respond_to do |format|
if @workshop_facilitator.update(workshop_facilitator_params)
format.html do
redirect_to @workshop_facilitator,
notice: 'Workshop facilitator was successfully updated.'
end
format.json do
render :show, status: :ok, location: @workshop_facilitator
end
else
format.html { render :edit, status: :unprocessable_entity }
format.json do
render json: @workshop_facilitator.errors,
status: :unprocessable_entity
end
end
end
end

# DELETE /workshop_facilitators/1 or /workshop_facilitators/1.json
# DELETE /workshop_facilitators/1
def destroy
@workshop_facilitator.destroy!

Expand All @@ -75,7 +61,6 @@ def destroy
status: :see_other,
notice: 'Workshop facilitator was successfully destroyed.'
end
format.json { head :no_content }
end
end

Expand Down
Loading

0 comments on commit d401934

Please sign in to comment.