Skip to content

Instantly share code, notes, and snippets.

Austin Klenk austinklenk

Block or report user

Report or block austinklenk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Gemfile.rb
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'
View application.rb
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
View routes
##Routes File
resources :customers, shallow: :true do
resources :campers do
resources :appointments do
resources :orders do
member do
patch :complete
end
end
View Camper
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
View Appointments
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
View Routes.rb
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
View SearchProb
# 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 %>
```
View states.rb
// application_helper.rb
def us_states
[
['Alabama', 'AL'],
['Alaska', 'AK'],
['Arizona', 'AZ'],
['Arkansas', 'AR'],
['California', 'CA'],
['Colorado', 'CO'],
View routes
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
View _form.html.erb
<%= stylesheet_link_tag 'bootstrap-datepicker' %>
<%= javascript_include_tag 'bootstrap-datepicker' %>
<%= bootstrap_form_for([@camper, @order], label_errors: true, inline_errors: false) do |f| %>
<div class="row"><!-- Date Fields Start -->
<div class="col-md-4"><%= f.text_field :title, label: "Work Order Name" %></div>
<div class="col-md-4"><%= f.text_field :dateIn, label: "Date In", class: "datepicker" %></div>
<div class="col-md-4"><%= f.text_field :dateOut, label: "Date Out", class: "datepicker" %></div>
</div><!-- Date Fields End -->
You can’t perform that action at this time.