apply confirm page

parent b3617479
Pipeline #1386 failed with stages
in 0 seconds
...@@ -11,6 +11,8 @@ gem 'slim-rails' ...@@ -11,6 +11,8 @@ gem 'slim-rails'
gem 'kaminari', '~> 1.2', '>= 1.2.1' gem 'kaminari', '~> 1.2', '>= 1.2.1'
gem 'friendly_id', '~> 5.4', '>= 5.4.2' gem 'friendly_id', '~> 5.4', '>= 5.4.2'
gem 'babosa' gem 'babosa'
gem 'active_storage_validations'
gem 'mini_magick', '>= 4.9.5'
# Use sqlite3 as the database for Active Record # Use sqlite3 as the database for Active Record
gem 'mysql2', '~> 0.5.3' gem 'mysql2', '~> 0.5.3'
# Use Puma as the app server # Use Puma as the app server
......
...@@ -39,6 +39,8 @@ GEM ...@@ -39,6 +39,8 @@ GEM
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_storage_validations (0.9.5)
rails (>= 5.2.0)
activejob (6.1.4) activejob (6.1.4)
activesupport (= 6.1.4) activesupport (= 6.1.4)
globalid (>= 0.3.6) globalid (>= 0.3.6)
...@@ -119,6 +121,7 @@ GEM ...@@ -119,6 +121,7 @@ GEM
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
marcel (1.0.1) marcel (1.0.1)
method_source (1.0.0) method_source (1.0.0)
mini_magick (4.11.0)
mini_mime (1.1.0) mini_mime (1.1.0)
minitest (5.14.4) minitest (5.14.4)
msgpack (1.4.2) msgpack (1.4.2)
...@@ -234,6 +237,7 @@ PLATFORMS ...@@ -234,6 +237,7 @@ PLATFORMS
x86_64-linux x86_64-linux
DEPENDENCIES DEPENDENCIES
active_storage_validations
babosa babosa
bootsnap (>= 1.4.4) bootsnap (>= 1.4.4)
bootstrap (~> 5.0.1) bootstrap (~> 5.0.1)
...@@ -243,6 +247,7 @@ DEPENDENCIES ...@@ -243,6 +247,7 @@ DEPENDENCIES
jbuilder (~> 2.7) jbuilder (~> 2.7)
kaminari (~> 1.2, >= 1.2.1) kaminari (~> 1.2, >= 1.2.1)
listen (~> 3.3) listen (~> 3.3)
mini_magick (>= 4.9.5)
mysql2 (~> 0.5.3) mysql2 (~> 0.5.3)
nokogiri (~> 1.11, >= 1.11.7) nokogiri (~> 1.11, >= 1.11.7)
puma (~> 5.0) puma (~> 5.0)
......
class ApplyJobsController < ApplicationController
def new
end
def confirm
@apply_job = ApplyJob.new(apply_params)
end
def done
@apply_job = ApplyJob.new(apply_params)
if @apply_job.save
flash[:success] = "Done!"
redirect_to confirm_url(@apply_job)
else
redirect_to root_url
end
end
private
def apply_params
params.permit(:name, :email, :cv)
end
end
module ApplyJobsHelper
end
class ApplyJob < ApplicationRecord class ApplyJob < ApplicationRecord
belongs_to :user belongs_to :user
belongs_to :job belongs_to :job
has_one_attached :cv
validates :name, presence: true #size: { less_than_or_equal_to: 400.bytes, message: 'is not given between size' }
validates :email, presence: true
validates :cv, attached: true #, content_type: { in: 'application/pdf', message: 'must be a valid cv format' }
#content_type: { in: %w[application/msword application/pdf]
end end
ul#ex1.p-4.nav.nav-tabs.nav-fill.mb-3[role="tablist"]
li.nav-item[role="presentation"]
a#ex2-tab-1.nav-link.active[data-mdb-toggle="tab" href="#ex2-tabs-1" role="tab" aria-controls="ex2-tabs-1" aria-selected="true"]
| New apply
li.nav-item[role="presentation"]
a#ex2-tab-2.nav-link[data-mdb-toggle="tab" href="#ex2-tabs-2" role="tab" aria-controls="ex2-tabs-2" aria-selected="false"]
| Confirm
li.nav-item[role="presentation"]
a#ex2-tab-3.nav-link[data-mdb-toggle="tab" href="#ex2-tabs-3" role="tab" aria-controls="ex2-tabs-3" aria-selected="false"]
| Done
/ #ex2-content.tab-content
/ #ex2-tabs-1.tab-pane.fade.show.active[role="tabpanel" aria-labelledby="ex2-tab-1"]
/ | Tab 1 content
/ #ex2-tabs-2.tab-pane.fade[role="tabpanel" aria-labelledby="ex2-tab-2"]
/ | Tab 2 content
/ #ex2-tabs-3.tab-pane.fade[role="tabpanel" aria-labelledby="ex2-tab-3"]
/ | Tab 3 content
\ No newline at end of file
h2.text-center.p-4
| CONFIRM INFORMATION
.col-md-6.offset-md-3
= form_with(model: @apply_job, url: '/done', local: true) do |f|
= f.label :name
= f.text_field :name, required: true, placeholder: "Type name...", class: 'form-control'
= f.label :email
= f.text_field :email, required: true, placeholder: "Type email...", class: 'form-control'
p
= f.label :cv, "CV"
= f.file_field :cv, required: true, accept: "application/pdf"
.span.p-4.text-center
= f.submit "Done", class: "btn btn-primary btn-lg"
\ No newline at end of file
h3
| Doneeeee
\ No newline at end of file
= render 'ribbon'
h2.text-center.p-4
| APPLY INFORMATION
.col-md-6.offset-md-3
= form_with(model: @apply_job, url: '/confirm', local: true) do |f|
= f.label :name
= f.text_field :name, required: true, placeholder: "Type name...", class: 'form-control'
= f.label :email
= f.text_field :email, required: true, placeholder: "Type email...", class: 'form-control'
p
= f.label :cv, "CV"
= f.file_field :cv, required: true, accept: "application/pdf"
.span.p-4.text-center
= f.submit "Confirm", class: "btn btn-primary btn-lg"
\ No newline at end of file
...@@ -3,7 +3,7 @@ nav.breadcrumb[style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb"] ...@@ -3,7 +3,7 @@ nav.breadcrumb[style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb"]
li.breadcrumb-item li.breadcrumb-item
= link_to "Top", root_path = link_to "Top", root_path
li.breadcrumb-item li.breadcrumb-item
- @job.cities.each do |city| - @job.cities.each.uniq do |city|
= link_to city.name + ' ', city_slug_path(city.slug) = link_to city.name + ' ', city_slug_path(city.slug)
li.breadcrumb-item li.breadcrumb-item
- @job.industries.each do |industry| - @job.industries.each do |industry|
......
.search.p-3.offset-md-2 .search.p-3.offset-md-2
= form_with(url: '/jobs', method: 'get', local: true) do = form_with(url: '/jobs', local: true) do
= text_field_tag :search, params[:search], placeholder: "Search", class: "form" = text_field_tag :search, params[:search], placeholder: "Search", class: "form"
= submit_tag "Search", name: nil, class: 'btn-primary' = submit_tag "Search", name: nil, class: 'btn-primary'
\ No newline at end of file
...@@ -46,10 +46,10 @@ ...@@ -46,10 +46,10 @@
p.mb-2 p.mb-2
= @job.other_requirement = @job.other_requirement
.col-sm-2.p-3.apply-job .col-sm-2.p-3.apply-job
= link_to "Apply this Job", "#", class: "btn btn-outline-primary btn-lg" = link_to "Apply this Job", apply_path(job_id: @job.id), class: "btn btn-outline-primary btn-lg"
.row.bg-white.p-4 .row.bg-white.p-4
.col.text-end .col.text-end
= link_to "Apply this Job", "#", class: "btn btn-outline-primary btn-lg" = link_to "Apply this Job", apply_path(job_id: @job.id), class: "btn btn-outline-primary btn-lg"
.col .col
= link_to "Favourite", "#", class: "btn btn-outline-primary btn-lg" = link_to "Favourite", "#", class: "btn btn-outline-primary btn-lg"
...@@ -5,4 +5,7 @@ Rails.application.routes.draw do ...@@ -5,4 +5,7 @@ Rails.application.routes.draw do
get 'jobs/city/:city_slug', to: 'jobs#index', as: 'city_slug' get 'jobs/city/:city_slug', to: 'jobs#index', as: 'city_slug'
get 'jobs/industry/:industry_slug', to: 'jobs#index', as: 'industry_slug' get 'jobs/industry/:industry_slug', to: 'jobs#index', as: 'industry_slug'
get 'detail/:job_slug', to: 'jobs#show', as: 'detail' get 'detail/:job_slug', to: 'jobs#show', as: 'detail'
get 'apply', to: 'apply_jobs#new'
post 'confirm', to: 'apply_jobs#confirm'
post 'done', to: 'apply_jobs#done'
end end
\ No newline at end of file
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
t.text :metadata
t.string :service_name, null: false
t.bigint :byte_size, null: false
t.string :checksum, null: false
t.datetime :created_at, null: false
t.index [ :key ], unique: true
end
create_table :active_storage_attachments do |t|
t.string :name, null: false
t.references :record, null: false, polymorphic: true, index: false
t.references :blob, null: false
t.datetime :created_at, null: false
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end
class AddNameEmailToApplyJobs < ActiveRecord::Migration[6.1]
def change
add_column :apply_jobs, :name, :string
add_column :apply_jobs, :email, :string
end
end
...@@ -10,7 +10,35 @@ ...@@ -10,7 +10,35 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_08_05_021856) do ActiveRecord::Schema.define(version: 2021_08_05_151654) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
t.bigint "record_id", null: false
t.bigint "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
end
create_table "active_storage_blobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "key", null: false
t.string "filename", null: false
t.string "content_type"
t.text "metadata"
t.string "service_name", null: false
t.bigint "byte_size", null: false
t.string "checksum", null: false
t.datetime "created_at", null: false
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
end
create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
create_table "apply_jobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t| create_table "apply_jobs", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false t.bigint "user_id", null: false
...@@ -18,6 +46,8 @@ ActiveRecord::Schema.define(version: 2021_08_05_021856) do ...@@ -18,6 +46,8 @@ ActiveRecord::Schema.define(version: 2021_08_05_021856) do
t.binary "cv" t.binary "cv"
t.datetime "created_at", precision: 6, null: false t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
t.string "name"
t.string "email"
t.index ["job_id"], name: "index_apply_jobs_on_job_id" t.index ["job_id"], name: "index_apply_jobs_on_job_id"
t.index ["user_id"], name: "index_apply_jobs_on_user_id" t.index ["user_id"], name: "index_apply_jobs_on_user_id"
end end
...@@ -138,6 +168,8 @@ ActiveRecord::Schema.define(version: 2021_08_05_021856) do ...@@ -138,6 +168,8 @@ ActiveRecord::Schema.define(version: 2021_08_05_021856) do
t.datetime "updated_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false
end end
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
add_foreign_key "apply_jobs", "jobs" add_foreign_key "apply_jobs", "jobs"
add_foreign_key "apply_jobs", "users" add_foreign_key "apply_jobs", "users"
add_foreign_key "cities", "regions" add_foreign_key "cities", "regions"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment