diff --git a/Pearlception/app/assets/javascripts/grades.coffee b/Pearlception/app/assets/javascripts/grades.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/Pearlception/app/assets/javascripts/grades.coffee @@ -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/ diff --git a/Pearlception/app/assets/stylesheets/grades.scss b/Pearlception/app/assets/stylesheets/grades.scss new file mode 100644 index 0000000..ba73e1a --- /dev/null +++ b/Pearlception/app/assets/stylesheets/grades.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the grades controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/Pearlception/app/controllers/grades_controller.rb b/Pearlception/app/controllers/grades_controller.rb new file mode 100644 index 0000000..2d197f1 --- /dev/null +++ b/Pearlception/app/controllers/grades_controller.rb @@ -0,0 +1,11 @@ +class GradesController < ApplicationController + before_filter :deny_to_visitors + + def index + @grades = Grade.all + end + + def deny_to_visitors + redirect_to "/signin" unless user_signed_in? && !current_user.admin? + end +end diff --git a/Pearlception/app/helpers/grades_helper.rb b/Pearlception/app/helpers/grades_helper.rb new file mode 100644 index 0000000..5514f32 --- /dev/null +++ b/Pearlception/app/helpers/grades_helper.rb @@ -0,0 +1,2 @@ +module GradesHelper +end diff --git a/Pearlception/app/models/user.rb b/Pearlception/app/models/user.rb index 4b7680d..486d2eb 100644 --- a/Pearlception/app/models/user.rb +++ b/Pearlception/app/models/user.rb @@ -7,9 +7,7 @@ class User < ApplicationRecord :recoverable, :rememberable, :trackable, :validatable def after_database_authentication - binding.pry if !self.admin - binding.pry Apartment::Tenant.switch!(Company.find(self.company_id).company_name.gsub(/'/,'').gsub(/\s/,'')) end end diff --git a/Pearlception/app/views/companies/index.html.erb b/Pearlception/app/views/companies/index.html.erb index b505cdf..48197a8 100644 --- a/Pearlception/app/views/companies/index.html.erb +++ b/Pearlception/app/views/companies/index.html.erb @@ -39,9 +39,7 @@ <% if current_user.admin? %>
| Grade Name | +Min Volume | +Max Volume | +Min Length | +Max Length | +Min Width | +Max Width | +Min Height | +Max Height | +
|---|
No Grades Recorded.
+