Skip to content

Commit

Permalink
Merge pull request #62 from camsys/quarter1
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mathmerized authored Mar 18, 2019
2 parents 739087e + 4481eea commit c9088bf
Show file tree
Hide file tree
Showing 123 changed files with 5,662 additions and 2,718 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: ruby
rvm:
- 2.2.2
- 2.5.3
branches:
only:
- master
Expand Down
10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ source "https://rubygems.org"

# To use debugger
# gem 'debugger'
gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter4
gem 'transam_reporting', git: 'https://github.com/camsys/transam_reporting', branch: :quarter4
gem 'transam_transit', git: 'https://github.com/camsys/transam_transit', branch: :quarter4
gem 'mysql2', '~> 0.3.20' # lock gem for dummy app
gem 'transam_core', git: 'https://github.com/camsys/transam_core', branch: :quarter1
gem 'transam_reporting', git: 'https://github.com/camsys/transam_reporting', branch: :quarter1
gem 'transam_transit', git: 'https://github.com/camsys/transam_transit', branch: :quarter1
gem 'mysql2', '~> 0.5.1' # lock gem for dummy app
gem "capybara", '2.6.2' # lock gem for old capybara behavior on hidden element xpath

gem 'rails-controller-testing' # assigns has been extracted to this gem

# This gem allows us to share githooks. Githooks in the .hooks folder can be checked
# in, and when "bundle install" is run this gem automatically creates symlinks into
# your local .git/hooks. If you have pre-existing hooks in .git/hooks, it will move
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/grant_amendments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Place all the behaviors and hooks related to the matching controller here.
// All this logic will automatically be available in application.js.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/grant_amendments.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
Place all the styles related to the matching controller here.
They will automatically be included in application.css.
*/
76 changes: 76 additions & 0 deletions app/controllers/grant_amendments_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
class GrantAmendmentsController < OrganizationAwareController
add_breadcrumb "Home", :root_path
add_breadcrumb "Grants", :grants_path

before_action :set_grant

before_action :set_grant_amendment, only: [:show, :edit, :update, :destroy]

before_action :set_paper_trail_whodunnit

# GET /grant_amendments
def index
@grant_amendments = @grant.grant_amendments
end

# GET /grant_amendments/1
def show
end

# GET /grant_amendments/new
def new
add_breadcrumb @grant.to_s, grant_path(@grant)
add_breadcrumb "New Amendment"

@grant_amendment = @grant.grant_amendments.build
end

# GET /grant_amendments/1/edit
def edit
add_breadcrumb @grant.to_s, grant_path(@grant)
add_breadcrumb "Update Amendment"
end

# POST /grant_amendments
def create
@grant_amendment = @grant.grant_amendments.build(grant_amendment_params)
@grant_amendment.creator = current_user

if @grant_amendment.save
redirect_to @grant, notice: 'Grant amendment was successfully created.'
else
render :new
end
end

# PATCH/PUT /grant_amendments/1
def update
if @grant_amendment.update(grant_amendment_params)

redirect_to @grant, notice: 'Grant amendment was successfully updated.'
else
render :edit
end
end

# DELETE /grant_amendments/1
def destroy
@grant_amendment.destroy
redirect_to @grant, notice: 'Grant amendment was successfully destroyed.'
end

private
def set_grant
@grant = Grant.find_by(object_key: params[:grant_id])
end

# Use callbacks to share common setup or constraints between actions.
def set_grant_amendment
@grant_amendment = GrantAmendment.find_by(object_key: params[:id])
end

# Only allow a trusted parameter "white list" through.
def grant_amendment_params
params.require(:grant_amendment).permit(GrantAmendment.allowable_params)
end
end
74 changes: 74 additions & 0 deletions app/controllers/grant_apportionments_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
class GrantApportionmentsController < OrganizationAwareController

before_action :set_grant
before_action :set_grant_apportionment, only: [:show, :edit, :update, :destroy]

# GET /grant_apportionments
def index
@grant_apportionments = @grant.grant_apportionments
end

# GET /grant_apportionments/1
def show
end

# GET /grant_apportionments/new
def new
@grant_apportionment = GrantApportionment.new
end

# GET /grant_apportionments/1/edit
def edit
end

# POST /grant_apportionments
def create
@grant_apportionment.creator = current_user

@grant_apportionment = GrantApportionment.new(grant_apportionment_params)

if @grant_apportionment.save
redirect_to @grant, notice: 'Grant apportionment was successfully created.'
else
render :new
end
end

# PATCH/PUT /grant_apportionments/1
def update

@grant_apportionment.updater = current_user

respond_to do |format|
if @grant_apportionment.update(grant_apportionment_params)
notify_user(:notice, "Grant apportionment was successfully updated.")
format.html { redirect_to @grant }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @grant.errors, status: :unprocessable_entity }
end
end
end

# DELETE /grant_apportionments/1
def destroy
@grant_apportionment.destroy
redirect_to @grant, notice: 'Grant apportionment was successfully destroyed.'
end

private
def set_grant
@grant = Grant.find_by(object_key: params[:grant_id])
end

# Use callbacks to share common setup or constraints between actions.
def set_grant_apportionment
@grant_apportionment = GrantApportionment.find_by(object_key: params[:id])
end

# Only allow a trusted parameter "white list" through.
def grant_apportionment_params
params.require(:grant_apportionment).permit(GrantApportionment.allowable_params)
end
end
Loading

0 comments on commit c9088bf

Please sign in to comment.