-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from chelsea-shorte/vote-bill
Vote bill
- Loading branch information
Showing
62 changed files
with
580 additions
and
261 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
2 changes: 1 addition & 1 deletion
2
app/assets/stylesheets/commitees.scss → app/assets/stylesheets/amendments.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// Place all the styles related to the COMMITEEs controller here. | ||
// Place all the styles related to the Amendments controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the COMMITTEEs controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
class AmendmentsController < ApplicationController | ||
before_action :set_amendment, only: [:show, :edit, :update, :destroy] | ||
|
||
# GET /amendments | ||
# GET /amendments.json | ||
def index | ||
@amendments = Amendment.all | ||
end | ||
|
||
# GET /amendments/1 | ||
# GET /amendments/1.json | ||
def show | ||
end | ||
|
||
# GET /amendments/new | ||
def new | ||
@amendment = Amendment.new | ||
end | ||
|
||
# GET /amendments/1/edit | ||
def edit | ||
end | ||
|
||
# POST /amendments | ||
# POST /amendments.json | ||
def create | ||
@amendment = Amendment.new(amendment_params) | ||
|
||
respond_to do |format| | ||
if @amendment.save | ||
format.html { redirect_to @amendment, notice: 'Amendment was successfully created.' } | ||
format.json { render :show, status: :created, location: @amendment } | ||
else | ||
format.html { render :new } | ||
format.json { render json: @amendment.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /amendments/1 | ||
# PATCH/PUT /amendments/1.json | ||
def update | ||
respond_to do |format| | ||
if @amendment.update(amendment_params) | ||
format.html { redirect_to @amendment, notice: 'Amendment was successfully updated.' } | ||
format.json { render :show, status: :ok, location: @amendment } | ||
else | ||
format.html { render :edit } | ||
format.json { render json: @amendment.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /amendments/1 | ||
# DELETE /amendments/1.json | ||
def destroy | ||
@amendment.destroy | ||
respond_to do |format| | ||
format.html { redirect_to amendments_url, notice: 'Amendment was successfully destroyed.' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_amendment | ||
@amendment = Amendment.find(params[:id]) | ||
end | ||
|
||
# Never trust parameters from the scary internet, only allow the white list through. | ||
def amendment_params | ||
params.require(:amendment).permit(:sponsor_title) | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
class CommitteesController < ApplicationController | ||
before_action :set_committee, only: [:show, :edit, :update, :destroy] | ||
|
||
# GET /committees | ||
# GET /committees.json | ||
def index | ||
@committees = Committees.all | ||
end | ||
|
||
# GET /committees/1 | ||
# GET /committees/1.json | ||
def show | ||
end | ||
|
||
# GET /committees/new | ||
def new | ||
@committee = Committees.new | ||
end | ||
|
||
# GET /committees/1/edit | ||
def edit | ||
end | ||
|
||
# POST /committees | ||
# POST /committees.json | ||
def create | ||
@committee = Committees.new(committee_params) | ||
|
||
respond_to do |format| | ||
if @committee.save | ||
format.html { redirect_to @committee, notice: 'Committees was successfully created.' } | ||
format.json { render :show, status: :created, location: @committee } | ||
else | ||
format.html { render :new } | ||
format.json { render json: @committee.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PATCH/PUT /committees/1 | ||
# PATCH/PUT /committees/1.json | ||
def update | ||
respond_to do |format| | ||
if @committee.update(committee_params) | ||
format.html { redirect_to @committee, notice: 'Committees was successfully updated.' } | ||
format.json { render :show, status: :ok, location: @committee } | ||
else | ||
format.html { render :edit } | ||
format.json { render json: @committee.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /committees/1 | ||
# DELETE /committees/1.json | ||
def destroy | ||
@committee.destroy | ||
respond_to do |format| | ||
format.html { redirect_to committees_index_url, notice: 'Committees was successfully destroyed.' } | ||
format.json { head :no_content } | ||
end | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_committee | ||
@committee = Committees.find(params[:id]) | ||
end | ||
|
||
# Never trust parameters from the scary internet, only allow the white list through. | ||
def committee_params | ||
params.require(:committee).permit(:propublica_id, :name, :chamber, :url) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AmendmentsHelper | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module CommitteesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
module RepresentativEsHelper | ||
module RepresentativesHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Amendment < ApplicationRecord | ||
belongs_to :bill | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
class Bill < ApplicationRecord | ||
has_many :votes | ||
has_many :amendments | ||
has_and_belongs_to_many :representatives | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Committees < ApplicationRecord | ||
has_and_belongs_to_many :representatives | ||
has_many :subcommittees | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
class Representative < ApplicationRecord | ||
has_and_belongs_to_many :bills | ||
has_and_belongs_to_many :votes | ||
has_and_belongs_to_many :committees | ||
has_and_belongs_to_many :subcommittees | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Subcommittee < ApplicationRecord | ||
belongs_to :committees | ||
has_and_belongs_to_many :representatives | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
class Vote < ApplicationRecord | ||
has_many :vote_parties | ||
#has_many :vote_parties | ||
belongs_to :bill | ||
has_and_belongs_to_many :representatives | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
json.extract! amendment, :id, :sponsor_title, :created_at, :updated_at | ||
json.url amendment_url(amendment, format: :json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<%= form_with(model: amendment, local: true) do |form| %> | ||
<% if amendment.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(amendment.errors.count, "error") %> prohibited this amendment from being saved:</h2> | ||
|
||
<ul> | ||
<% amendment.errors.full_messages.each do |message| %> | ||
<li><%= message %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="field"> | ||
<%= form.label :sponsor_title %> | ||
<%= form.text_field :sponsor_title, id: :amendment_sponsor_title %> | ||
</div> | ||
|
||
<div class="actions"> | ||
<%= form.submit %> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<h1>Editing Amendment</h1> | ||
|
||
<%= render 'form', amendment: @amendment %> | ||
|
||
<%= link_to 'Show', @amendment %> | | ||
<%= link_to 'Back', amendments_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<h1>Amendments</h1> | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Sponsor title</th> | ||
<th colspan="3"></th> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<% @amendments.each do |amendment| %> | ||
<tr> | ||
<td><%= amendment.sponsor_title %></td> | ||
<td><%= link_to 'Show', amendment %></td> | ||
<td><%= link_to 'Edit', edit_amendment_path(amendment) %></td> | ||
<td><%= link_to 'Destroy', amendment, method: :delete, data: { confirm: 'Are you sure?' } %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
|
||
<br> | ||
|
||
<%= link_to 'New Amendment', new_amendment_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
json.array! @amendments, partial: 'amendments/amendment', as: :amendment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h1>New Amendment</h1> | ||
|
||
<%= render 'form', amendment: @amendment %> | ||
|
||
<%= link_to 'Back', amendments_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<strong>Sponsor title:</strong> | ||
<%= @amendment.sponsor_title %> | ||
</p> | ||
|
||
<%= link_to 'Edit', edit_amendment_path(@amendment) %> | | ||
<%= link_to 'Back', amendments_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
json.partial! "amendments/amendment", amendment: @amendment |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.