Skip to content

Instantly share code, notes, and snippets.

View austinklenk's full-sized avatar

Austin Klenk austinklenk

  • Master Tech RV
  • Elkhart, Indiana
View GitHub Profile
GEM
remote: https://rubygems.org/
specs:
actioncable (5.1.4)
actionpack (= 5.1.4)
nio4r (~> 2.0)
websocket-driver (~> 0.6.1)
actionmailer (5.1.4)
actionpack (= 5.1.4)
actionview (= 5.1.4)
@austinklenk
austinklenk / Gemfile.rb
Created November 18, 2017 16:57
Spree Gemfile
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
require File.expand_path('../boot', __FILE__)
require 'csv'
require 'rails/all'
# require 'wicked_pdf'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Workorder
class Application < Rails::Application
##Routes File
resources :customers, shallow: :true do
resources :campers do
resources :appointments do
resources :orders do
member do
patch :complete
end
end
class CampersController < ApplicationController
before_action :set_camper, only: [:show, :edit, :update, :destroy]
# before_action :set_customer, only: [:index, :new, :edit, :create, :update]
load_and_authorize_resource
# GET /campers
# GET /campers.json
def index
@campers = @customer.campers
end
class AppointmentsController < ApplicationController
before_action :set_appointment, only: [:show, :edit, :update, :destroy]
# GET /appointments
# GET /appointments.json
def index
@appointments = @camper.appointments
end
# GET /appointments/1
# GET /appointments/1.json
wall GET /wall(.:format) wall#index
shop GET /shop(.:format) wall#shop
campers_list GET /campers/list(.:format) campers#list
new_admin_session GET /admins/sign_in(.:format) admins/sessions#new
admin_session POST /admins/sign_in(.:format) admins/sessions#create
destroy_admin_session DELETE /admins/sign_out(.:format) admins/sessions#destroy
admin_password POST /admins/password(.:format) devise/passwords#create
new_admin_password GET /admins/password/new(.:format) devise/passwords#new
edit_admin_password GET /admins/password/edit(.:format) devise/passwords#edit
PATCH /admins/password(.:format) devise/passwords#update
# Customer Search that works
### Search Field in Customer Index Page with Table
```
<%= search_form_for @search do |f| %>
<th colspan="2"><%= f.text_field :lastName_cont, class: 'customer-search', placeholder: 'Search By Last Name' %></th>
<th><%= f.submit "Search", class: 'btn btn-info btn-block' %></th>
<% end %>
```
// application_helper.rb
def us_states
[
['Alabama', 'AL'],
['Alaska', 'AK'],
['Arizona', 'AZ'],
['Arkansas', 'AR'],
['California', 'CA'],
['Colorado', 'CO'],
Sales-Macbook-Air:Workorder serveradmin$ rake routes
Prefix Verb URI Pattern Controller#Action
new_admin_session GET /admins/sign_in(.:format) devise/sessions#new
admin_session POST /admins/sign_in(.:format) devise/sessions#create
destroy_admin_session DELETE /admins/sign_out(.:format) devise/sessions#destroy
admin_password POST /admins/password(.:format) devise/passwords#create
new_admin_password GET /admins/password/new(.:format) devise/passwords#new
edit_admin_password GET /admins/password/edit(.:format) devise/passwords#edit
PATCH /admins/password(.:format) devise/passwords#update