forked from MichaelRevell/Kariakoo-Commodities
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
47 changed files
with
1,120 additions
and
11 deletions.
There are no files selected for viewing
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://jashkenas.github.com/coffee-script/ |
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://jashkenas.github.com/coffee-script/ |
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://jashkenas.github.com/coffee-script/ |
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 price 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 PriceHistories 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 units 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,83 @@ | ||
class PriceHistoriesController < ApplicationController | ||
# GET /price_histories | ||
# GET /price_histories.json | ||
def index | ||
@price_histories = PriceHistory.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @price_histories } | ||
end | ||
end | ||
|
||
# GET /price_histories/1 | ||
# GET /price_histories/1.json | ||
def show | ||
@price_history = PriceHistory.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @price_history } | ||
end | ||
end | ||
|
||
# GET /price_histories/new | ||
# GET /price_histories/new.json | ||
def new | ||
@price_history = PriceHistory.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @price_history } | ||
end | ||
end | ||
|
||
# GET /price_histories/1/edit | ||
def edit | ||
@price_history = PriceHistory.find(params[:id]) | ||
end | ||
|
||
# POST /price_histories | ||
# POST /price_histories.json | ||
def create | ||
@price_history = PriceHistory.new(params[:price_history]) | ||
|
||
respond_to do |format| | ||
if @price_history.save | ||
format.html { redirect_to @price_history, notice: 'Price history was successfully created.' } | ||
format.json { render json: @price_history, status: :created, location: @price_history } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @price_history.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /price_histories/1 | ||
# PUT /price_histories/1.json | ||
def update | ||
@price_history = PriceHistory.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @price_history.update_attributes(params[:price_history]) | ||
format.html { redirect_to @price_history, notice: 'Price history was successfully updated.' } | ||
format.json { head :ok } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @price_history.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /price_histories/1 | ||
# DELETE /price_histories/1.json | ||
def destroy | ||
@price_history = PriceHistory.find(params[:id]) | ||
@price_history.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to price_histories_url } | ||
format.json { head :ok } | ||
end | ||
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,83 @@ | ||
class UnitsController < ApplicationController | ||
# GET /units | ||
# GET /units.json | ||
def index | ||
@units = Unit.all | ||
|
||
respond_to do |format| | ||
format.html # index.html.erb | ||
format.json { render json: @units } | ||
end | ||
end | ||
|
||
# GET /units/1 | ||
# GET /units/1.json | ||
def show | ||
@unit = Unit.find(params[:id]) | ||
|
||
respond_to do |format| | ||
format.html # show.html.erb | ||
format.json { render json: @unit } | ||
end | ||
end | ||
|
||
# GET /units/new | ||
# GET /units/new.json | ||
def new | ||
@unit = Unit.new | ||
|
||
respond_to do |format| | ||
format.html # new.html.erb | ||
format.json { render json: @unit } | ||
end | ||
end | ||
|
||
# GET /units/1/edit | ||
def edit | ||
@unit = Unit.find(params[:id]) | ||
end | ||
|
||
# POST /units | ||
# POST /units.json | ||
def create | ||
@unit = Unit.new(params[:unit]) | ||
|
||
respond_to do |format| | ||
if @unit.save | ||
format.html { redirect_to @unit, notice: 'Unit was successfully created.' } | ||
format.json { render json: @unit, status: :created, location: @unit } | ||
else | ||
format.html { render action: "new" } | ||
format.json { render json: @unit.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# PUT /units/1 | ||
# PUT /units/1.json | ||
def update | ||
@unit = Unit.find(params[:id]) | ||
|
||
respond_to do |format| | ||
if @unit.update_attributes(params[:unit]) | ||
format.html { redirect_to @unit, notice: 'Unit was successfully updated.' } | ||
format.json { head :ok } | ||
else | ||
format.html { render action: "edit" } | ||
format.json { render json: @unit.errors, status: :unprocessable_entity } | ||
end | ||
end | ||
end | ||
|
||
# DELETE /units/1 | ||
# DELETE /units/1.json | ||
def destroy | ||
@unit = Unit.find(params[:id]) | ||
@unit.destroy | ||
|
||
respond_to do |format| | ||
format.html { redirect_to units_url } | ||
format.json { head :ok } | ||
end | ||
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 PriceHelper | ||
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 PriceHistoriesHelper | ||
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 UnitsHelper | ||
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 Commodity < ActiveRecord::Base | ||
# has_one retail_unit, :class_name => 'unit' | ||
# has_one wholesale_unit, :class_name => 'unit' | ||
# has_one farm_gate_unit, :class_name => 'unit' | ||
# has_one delivered_unit, :class_name => 'unit' | ||
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 @@ | ||
class PriceHistory < ActiveRecord::Base | ||
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
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,49 @@ | ||
<%= form_for(@price_history) do |f| %> | ||
<% if @price_history.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@price_history.errors.count, "error") %> prohibited this price_history from being saved:</h2> | ||
|
||
<ul> | ||
<% @price_history.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="field"> | ||
<%= f.label :farmGateLow %><br /> | ||
<%= f.number_field :farmGateLow %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :farmGateHigh %><br /> | ||
<%= f.number_field :farmGateHigh %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :deliverHigh %><br /> | ||
<%= f.number_field :deliverHigh %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :deliverLow %><br /> | ||
<%= f.number_field :deliverLow %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :wholesaleHigh %><br /> | ||
<%= f.number_field :wholesaleHigh %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :wholesaleHigh %><br /> | ||
<%= f.number_field :wholesaleHigh %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :retailHigh %><br /> | ||
<%= f.number_field :retailHigh %> | ||
</div> | ||
<div class="field"> | ||
<%= f.label :retailLow %><br /> | ||
<%= f.number_field :retailLow %> | ||
</div> | ||
<div class="actions"> | ||
<%= f.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 price_history</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Show', @price_history %> | | ||
<%= link_to 'Back', price_histories_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,37 @@ | ||
<h1>Listing price_histories</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>Farmgatelow</th> | ||
<th>Farmgatehigh</th> | ||
<th>Deliverhigh</th> | ||
<th>Deliverlow</th> | ||
<th>Wholesalehigh</th> | ||
<th>Wholesalehigh</th> | ||
<th>Retailhigh</th> | ||
<th>Retaillow</th> | ||
<th></th> | ||
<th></th> | ||
<th></th> | ||
</tr> | ||
|
||
<% @price_histories.each do |price_history| %> | ||
<tr> | ||
<td><%= price_history.farmGateLow %></td> | ||
<td><%= price_history.farmGateHigh %></td> | ||
<td><%= price_history.deliverHigh %></td> | ||
<td><%= price_history.deliverLow %></td> | ||
<td><%= price_history.wholesaleHigh %></td> | ||
<td><%= price_history.wholesaleHigh %></td> | ||
<td><%= price_history.retailHigh %></td> | ||
<td><%= price_history.retailLow %></td> | ||
<td><%= link_to 'Show', price_history %></td> | ||
<td><%= link_to 'Edit', edit_price_history_path(price_history) %></td> | ||
<td><%= link_to 'Destroy', price_history, confirm: 'Are you sure?', method: :delete %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
|
||
<br /> | ||
|
||
<%= link_to 'New Price history', new_price_history_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,5 @@ | ||
<h1>New price_history</h1> | ||
|
||
<%= render 'form' %> | ||
<%= link_to 'Back', price_histories_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,45 @@ | ||
<p id="notice"><%= notice %></p> | ||
|
||
<p> | ||
<b>Farmgatelow:</b> | ||
<%= @price_history.farmGateLow %> | ||
</p> | ||
|
||
<p> | ||
<b>Farmgatehigh:</b> | ||
<%= @price_history.farmGateHigh %> | ||
</p> | ||
|
||
<p> | ||
<b>Deliverhigh:</b> | ||
<%= @price_history.deliverHigh %> | ||
</p> | ||
|
||
<p> | ||
<b>Deliverlow:</b> | ||
<%= @price_history.deliverLow %> | ||
</p> | ||
|
||
<p> | ||
<b>Wholesalehigh:</b> | ||
<%= @price_history.wholesaleHigh %> | ||
</p> | ||
|
||
<p> | ||
<b>Wholesalehigh:</b> | ||
<%= @price_history.wholesaleHigh %> | ||
</p> | ||
|
||
<p> | ||
<b>Retailhigh:</b> | ||
<%= @price_history.retailHigh %> | ||
</p> | ||
|
||
<p> | ||
<b>Retaillow:</b> | ||
<%= @price_history.retailLow %> | ||
</p> | ||
|
||
|
||
<%= link_to 'Edit', edit_price_history_path(@price_history) %> | | ||
<%= link_to 'Back', price_histories_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,17 @@ | ||
<%= form_for(@unit) do |f| %> | ||
<% if @unit.errors.any? %> | ||
<div id="error_explanation"> | ||
<h2><%= pluralize(@unit.errors.count, "error") %> prohibited this unit from being saved:</h2> | ||
|
||
<ul> | ||
<% @unit.errors.full_messages.each do |msg| %> | ||
<li><%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
|
||
<div class="actions"> | ||
<%= f.submit %> | ||
</div> | ||
<% end %> |
Oops, something went wrong.