Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring
This commit is contained in:
3
app/assets/javascripts/dining_charges.coffee
Normal file
3
app/assets/javascripts/dining_charges.coffee
Normal file
@@ -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
app/assets/stylesheets/dining_charges.scss
Normal file
3
app/assets/stylesheets/dining_charges.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the dining_charges controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
74
app/controllers/dining_charges_controller.rb
Normal file
74
app/controllers/dining_charges_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class DiningChargesController < ApplicationController
|
||||
before_action :set_dining_charge, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /dining_charges
|
||||
# GET /dining_charges.json
|
||||
def index
|
||||
@dining_charges = DiningCharge.all
|
||||
end
|
||||
|
||||
# GET /dining_charges/1
|
||||
# GET /dining_charges/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /dining_charges/new
|
||||
def new
|
||||
@dining_charge = DiningCharge.new
|
||||
end
|
||||
|
||||
# GET /dining_charges/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /dining_charges
|
||||
# POST /dining_charges.json
|
||||
def create
|
||||
@dining_charge = DiningCharge.new(dining_charge_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @dining_charge.save
|
||||
format.html { redirect_to @dining_charge, notice: 'Dining charge was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @dining_charge }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @dining_charge.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /dining_charges/1
|
||||
# PATCH/PUT /dining_charges/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @dining_charge.update(dining_charge_params)
|
||||
format.html { redirect_to @dining_charge, notice: 'Dining charge was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @dining_charge }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @dining_charge.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /dining_charges/1
|
||||
# DELETE /dining_charges/1.json
|
||||
def destroy
|
||||
@dining_charge.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to dining_charges_url, notice: 'Dining charge was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_dining_charge
|
||||
@dining_charge = DiningCharge.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def dining_charge_params
|
||||
params.fetch(:dining_charge, {})
|
||||
end
|
||||
end
|
||||
2
app/helpers/dining_charges_helper.rb
Normal file
2
app/helpers/dining_charges_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module DiningChargesHelper
|
||||
end
|
||||
2
app/models/dining_charge.rb
Normal file
2
app/models/dining_charge.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class DiningCharge < ApplicationRecord
|
||||
end
|
||||
2
app/views/dining_charges/_dining_charge.json.jbuilder
Normal file
2
app/views/dining_charges/_dining_charge.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! dining_charge, :id, :created_at, :updated_at
|
||||
json.url dining_charge_url(dining_charge, format: :json)
|
||||
10
app/views/dining_charges/_form.html.erb
Normal file
10
app/views/dining_charges/_form.html.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<%= simple_form_for(@dining_charge) do |f| %>
|
||||
<%= f.error_notification %>
|
||||
|
||||
<div class="form-inputs">
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.button :submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
6
app/views/dining_charges/edit.html.erb
Normal file
6
app/views/dining_charges/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing Dining Charge</h1>
|
||||
|
||||
<%= render 'form', dining_charge: @dining_charge %>
|
||||
|
||||
<%= link_to 'Show', @dining_charge %> |
|
||||
<%= link_to 'Back', dining_charges_path %>
|
||||
25
app/views/dining_charges/index.html.erb
Normal file
25
app/views/dining_charges/index.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<h1>Dining Charges</h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @dining_charges.each do |dining_charge| %>
|
||||
<tr>
|
||||
<td><%= link_to 'Show', dining_charge %></td>
|
||||
<td><%= link_to 'Edit', edit_dining_charge_path(dining_charge) %></td>
|
||||
<td><%= link_to 'Destroy', dining_charge, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'New Dining Charge', new_dining_charge_path %>
|
||||
1
app/views/dining_charges/index.json.jbuilder
Normal file
1
app/views/dining_charges/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.array! @dining_charges, partial: 'dining_charges/dining_charge', as: :dining_charge
|
||||
5
app/views/dining_charges/new.html.erb
Normal file
5
app/views/dining_charges/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New Dining Charge</h1>
|
||||
|
||||
<%= render 'form', dining_charge: @dining_charge %>
|
||||
|
||||
<%= link_to 'Back', dining_charges_path %>
|
||||
4
app/views/dining_charges/show.html.erb
Normal file
4
app/views/dining_charges/show.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= link_to 'Edit', edit_dining_charge_path(@dining_charge) %> |
|
||||
<%= link_to 'Back', dining_charges_path %>
|
||||
1
app/views/dining_charges/show.json.jbuilder
Normal file
1
app/views/dining_charges/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
||||
json.partial! "dining_charges/dining_charge", dining_charge: @dining_charge
|
||||
Reference in New Issue
Block a user