- added parties
- changed layout for index and added svgs
This commit is contained in:
@ -1,59 +1,47 @@
|
||||
class PartiesController < ApplicationController
|
||||
before_action :set_party, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /parties or /parties.json
|
||||
def index
|
||||
@parties = Party.all
|
||||
end
|
||||
|
||||
# GET /parties/1 or /parties/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /parties/new
|
||||
def new
|
||||
@party = Party.new
|
||||
end
|
||||
|
||||
# GET /parties/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /parties or /parties.json
|
||||
def create
|
||||
@party = Party.new(party_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @party.save
|
||||
format.html { redirect_to @party, notice: "Party was successfully created." }
|
||||
format.json { render :show, status: :created, location: @party }
|
||||
format.html { redirect_to parties_path, notice: "Party was successfully created." }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @party.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /parties/1 or /parties/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @party.update(party_params)
|
||||
format.html { redirect_to @party, notice: "Party was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @party }
|
||||
format.html { redirect_to parties_path, notice: "Party was successfully updated.", status: :see_other }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @party.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /parties/1 or /parties/1.json
|
||||
def destroy
|
||||
@party.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to parties_path, notice: "Party was successfully destroyed.", status: :see_other }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user