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