Skip to content

Commit

Permalink
Adds resources
Browse files Browse the repository at this point in the history
  • Loading branch information
srinivasgumdelli committed May 28, 2015
1 parent b38e3e9 commit c397460
Show file tree
Hide file tree
Showing 72 changed files with 1,701 additions and 16 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ gem 'autoprefixer-rails'
gem 'smart_listing'
gem 'devise'
gem 'cocoon'
gem 'turbolinks'

group :development, :test do
gem 'rspec-rails'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ GEM
thor (0.19.1)
thread_safe (0.3.5)
tilt (1.4.1)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.7.1)
Expand Down Expand Up @@ -262,4 +264,5 @@ DEPENDENCIES
shoulda-matchers
simple_form
smart_listing
turbolinks
uglifier (>= 1.3.0)
3 changes: 3 additions & 0 deletions app/assets/javascripts/codes.coffee
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/
3 changes: 3 additions & 0 deletions app/assets/javascripts/conditions.coffee
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/
3 changes: 3 additions & 0 deletions app/assets/javascripts/ingredients.coffee
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/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/codes.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Codes controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/conditions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Conditions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/ingredients.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the Ingredients controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
69 changes: 69 additions & 0 deletions app/assets/stylesheets/scaffolds.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
body {
background-color: #fff;
color: #333;
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

p, ol, ul, td {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 13px;
line-height: 18px;
}

pre {
background-color: #eee;
padding: 10px;
font-size: 11px;
}

a {
color: #000;
&:visited {
color: #666;
}
&:hover {
color: #fff;
background-color: #000;
}
}

div {
&.field, &.actions {
margin-bottom: 10px;
}
}

#notice {
color: green;
}

.field_with_errors {
padding: 2px;
background-color: red;
display: table;
}

#error_explanation {
width: 450px;
border: 2px solid red;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #f0f0f0;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 12px;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
font-size: 12px;
list-style: square;
}
}
58 changes: 58 additions & 0 deletions app/controllers/codes_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
class CodesController < ApplicationController
before_action :set_code, only: [:show, :edit, :update, :destroy]

# GET /codes
def index
@codes = Code.all
end

# GET /codes/1
def show
end

# GET /codes/new
def new
@code = Code.new
end

# GET /codes/1/edit
def edit
end

# POST /codes
def create
@code = Code.new(code_params)

if @code.save
redirect_to @code, notice: 'Code was successfully created.'
else
render :new
end
end

# PATCH/PUT /codes/1
def update
if @code.update(code_params)
redirect_to @code, notice: 'Code was successfully updated.'
else
render :edit
end
end

# DELETE /codes/1
def destroy
@code.destroy
redirect_to codes_url, notice: 'Code was successfully destroyed.'
end

private
# Use callbacks to share common setup or constraints between actions.
def set_code
@code = Code.find(params[:id])
end

# Only allow a trusted parameter "white list" through.
def code_params
params.require(:code).permit(:code, :description)
end
end
58 changes: 58 additions & 0 deletions app/controllers/conditions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
class ConditionsController < ApplicationController
before_action :set_condition, only: [:show, :edit, :update, :destroy]

# GET /conditions
def index
@conditions = Condition.all
end

# GET /conditions/1
def show
end

# GET /conditions/new
def new
@condition = Condition.new
end

# GET /conditions/1/edit
def edit
end

# POST /conditions
def create
@condition = Condition.new(condition_params)

if @condition.save
redirect_to @condition, notice: 'Condition was successfully created.'
else
render :new
end
end

# PATCH/PUT /conditions/1
def update
if @condition.update(condition_params)
redirect_to @condition, notice: 'Condition was successfully updated.'
else
render :edit
end
end

# DELETE /conditions/1
def destroy
@condition.destroy
redirect_to conditions_url, notice: 'Condition was successfully destroyed.'
end

private
# Use callbacks to share common setup or constraints between actions.
def set_condition
@condition = Condition.find(params[:id])
end

# Only allow a trusted parameter "white list" through.
def condition_params
params.require(:condition).permit(:condition_name, :description)
end
end
58 changes: 58 additions & 0 deletions app/controllers/ingredients_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
class IngredientsController < ApplicationController
before_action :set_ingredient, only: [:show, :edit, :update, :destroy]

# GET /ingredients
def index
@ingredients = Ingredient.all
end

# GET /ingredients/1
def show
end

# GET /ingredients/new
def new
@ingredient = Ingredient.new
end

# GET /ingredients/1/edit
def edit
end

# POST /ingredients
def create
@ingredient = Ingredient.new(ingredient_params)

if @ingredient.save
redirect_to @ingredient, notice: 'Ingredient was successfully created.'
else
render :new
end
end

# PATCH/PUT /ingredients/1
def update
if @ingredient.update(ingredient_params)
redirect_to @ingredient, notice: 'Ingredient was successfully updated.'
else
render :edit
end
end

# DELETE /ingredients/1
def destroy
@ingredient.destroy
redirect_to ingredients_url, notice: 'Ingredient was successfully destroyed.'
end

private
# Use callbacks to share common setup or constraints between actions.
def set_ingredient
@ingredient = Ingredient.find(params[:id])
end

# Only allow a trusted parameter "white list" through.
def ingredient_params
params.require(:ingredient).permit(:ingredient_name, :description)
end
end
2 changes: 2 additions & 0 deletions app/helpers/codes_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module CodesHelper
end
2 changes: 2 additions & 0 deletions app/helpers/conditions_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ConditionsHelper
end
2 changes: 2 additions & 0 deletions app/helpers/ingredients_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module IngredientsHelper
end
2 changes: 2 additions & 0 deletions app/models/code.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Code < ActiveRecord::Base
end
2 changes: 2 additions & 0 deletions app/models/condition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Condition < ActiveRecord::Base
end
2 changes: 2 additions & 0 deletions app/models/ingredient.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Ingredient < ActiveRecord::Base
end
12 changes: 12 additions & 0 deletions app/views/codes/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%= simple_form_for(@code) do |f| %>
<%= f.error_notification %>

<div class="form-inputs">
<%= f.input :code %>
<%= f.input :description %>
</div>

<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
6 changes: 6 additions & 0 deletions app/views/codes/edit.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<h1>Editing Code</h1>

<%= render 'form' %>
<%= link_to 'Show', @code %> |
<%= link_to 'Back', codes_path %>
29 changes: 29 additions & 0 deletions app/views/codes/index.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<p id="notice"><%= notice %></p>

<h1>Listing Codes</h1>

<table>
<thead>
<tr>
<th>Code</th>
<th>Description</th>
<th colspan="3"></th>
</tr>
</thead>

<tbody>
<% @codes.each do |code| %>
<tr>
<td><%= code.code %></td>
<td><%= code.description %></td>
<td><%= link_to 'Show', code %></td>
<td><%= link_to 'Edit', edit_code_path(code) %></td>
<td><%= link_to 'Destroy', code, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>

<br>

<%= link_to 'New Code', new_code_path %>
5 changes: 5 additions & 0 deletions app/views/codes/new.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>New Code</h1>

<%= render 'form' %>
<%= link_to 'Back', codes_path %>
14 changes: 14 additions & 0 deletions app/views/codes/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<p id="notice"><%= notice %></p>

<p>
<strong>Code:</strong>
<%= @code.code %>
</p>

<p>
<strong>Description:</strong>
<%= @code.description %>
</p>

<%= link_to 'Edit', edit_code_path(@code) %> |
<%= link_to 'Back', codes_path %>
12 changes: 12 additions & 0 deletions app/views/conditions/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%= simple_form_for(@condition) do |f| %>
<%= f.error_notification %>

<div class="form-inputs">
<%= f.input :condition_name %>
<%= f.input :description %>
</div>

<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
Loading

0 comments on commit c397460

Please sign in to comment.