diff --git a/Gemfile b/Gemfile index 426af93..e0c253c 100644 --- a/Gemfile +++ b/Gemfile @@ -22,9 +22,9 @@ gem 'jbuilder', '~> 2.7' # Use Active Model has_secure_password gem 'bcrypt' -gem 'bootstrap', '~> 4.0.0' -gem 'jquery-rails' -gem 'jquery-ui-rails' +# gem 'bootstrap', '~> 4.0.0' +# gem 'jquery-rails' +# gem 'jquery-ui-rails' # Use Active Storage variant # gem 'image_processing', '~> 1.2' diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index a504bb2..2c727d4 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -1,4 +1,4 @@ -/* + /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * @@ -13,13 +13,15 @@ *= require_tree . *= require_self */ - -@import "bootstrap"; - -.form-control { - width: inherit;s - - &.inline { - display: inline; - } -} \ No newline at end of file + + @import "bootstrap/scss/bootstrap"; + .form-control { + width: inherit; + &.inline { + display: inline; + } + } + + .alert.fade { + opacity: 0; + } \ No newline at end of file diff --git a/app/assets/stylesheets/errors.scss b/app/assets/stylesheets/errors.scss new file mode 100644 index 0000000..f7f5241 --- /dev/null +++ b/app/assets/stylesheets/errors.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the errors controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/assets/stylesheets/organizations.scss b/app/assets/stylesheets/organizations.scss index 82f42bf..9afd5d0 100644 --- a/app/assets/stylesheets/organizations.scss +++ b/app/assets/stylesheets/organizations.scss @@ -1,3 +1,9 @@ // Place all the styles related to the Organizations controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: https://sass-lang.com/ +.form-control { + width: inherit; + &.inline { + display: inline; + } +} \ No newline at end of file diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb new file mode 100644 index 0000000..4fba65b --- /dev/null +++ b/app/controllers/errors_controller.rb @@ -0,0 +1,11 @@ +class ErrorsController < ApplicationController + def page_not_found + render status: 404 + end +end + + +def internal_server_error + render status: 500 +end +end \ No newline at end of file diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 1a0f9de..d1fee3f 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -1,7 +1,7 @@ class OrganizationsController < ApplicationController before_action :logged_in_user, only: %i[show new create edit update] before_action :set_organization, only: %i[show edit update] - before_action :verify_access, only: %i[show edit update] + before_action :verify_access, only: %i[ edit update] rescue_from ActiveRecord::RecordNotFound, with: :render_not_found @@ -9,7 +9,11 @@ def index end def show - @org_shifts = Shift.where(organization_id: @organization.id).order("updated_at DESC") + if current_user.id == @organization.user_id + @org_shifts = Shift.where(organization_id: @organization.id).order("updated_at DESC") + else + @organization_bio = Organization.where(id: params[:id]).select(:org_name, :org_address, :org_description, :org_city, :org_state).first + end end def new diff --git a/app/controllers/workers_controller.rb b/app/controllers/workers_controller.rb index 605338b..4bd0654 100644 --- a/app/controllers/workers_controller.rb +++ b/app/controllers/workers_controller.rb @@ -1,14 +1,18 @@ class WorkersController < ApplicationController before_action :logged_in_user, only: %i[index show new create edit update] before_action :set_worker, only: %i[show edit update] - before_action :verify_access, only: %i[show edit update] + before_action :verify_access, only: %i[ edit update] rescue_from ActiveRecord::RecordNotFound, with: :render_not_found def index end def show - @worker_shifts = Shift.where(worker_id: current_user.id).order("updated_at DESC") + if current_user.id == @worker.user_id + @worker_shifts = Shift.where(worker_id: current_user.id).order("updated_at DESC") + else + @worker_bio = Worker.where(id: params[:id]).select(:first_name, :last_name, :bio).first + end end def new @@ -55,6 +59,6 @@ def verify_access end def worker_params - params.require(:worker).permit(:first_name, :last_name, :worker_city, :worker_state, :user_id) + params.require(:worker).permit(:first_name, :last_name, :worker_city, :worker_state, :bio, :user_id) end end diff --git a/app/helpers/errors_helper.rb b/app/helpers/errors_helper.rb new file mode 100644 index 0000000..8e3b415 --- /dev/null +++ b/app/helpers/errors_helper.rb @@ -0,0 +1,2 @@ +module ErrorsHelper +end diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 2634bbd..c5215fa 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -8,12 +8,16 @@ require("turbolinks").start() require("@rails/activestorage").start() require("channels") require('jquery') -//= require jquery -//= require jquery_ujs +import 'bootstrap' +import 'bootstrap/dist/js/bootstrap' +import 'bootstrap/dist/css/bootstrap' +require("../../assets/stylesheets/application.scss") + //= require jquery + //= require jquery_ujs // Uncomment to copy all static images under ../images to the output folder and reference // them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) // or the `imagePath` JavaScript helper below. // // const images = require.context('../images', true) -// const imagePath = (name) => images(name, true) +// const imagePath = (name) => images(name, true) \ No newline at end of file diff --git a/public/500.html b/app/views/errors/internal_server_error.html.erb similarity index 99% rename from public/500.html rename to app/views/errors/internal_server_error.html.erb index 78a030a..0fd6fca 100644 --- a/public/500.html +++ b/app/views/errors/internal_server_error.html.erb @@ -63,4 +63,4 @@
If you are the application owner check the logs for more information.