├── .browserslistrc ├── .gitignore ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── Procfile ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── .keep │ │ └── icons │ │ │ ├── cheveron-right.svg │ │ │ ├── chevron-left.svg │ │ │ └── railsdevs-mark.svg │ └── stylesheets │ │ ├── actiontext.scss │ │ └── application.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── home_controller.rb │ └── jobs_controller.rb ├── helpers │ ├── application_helper.rb │ ├── jobs_helper.rb │ └── simple_discussion │ │ ├── forum_posts_helper.rb │ │ └── forum_threads_helper.rb ├── javascript │ ├── channels │ │ ├── consumer.js │ │ └── index.js │ ├── components │ │ ├── ButtonRemove.vue │ │ ├── FormPagination.vue │ │ ├── JobForm.vue │ │ ├── JobUpsells.vue │ │ ├── StepPagination.vue │ │ ├── StripeForm.vue │ │ ├── fields │ │ │ ├── ApplyLink.vue │ │ │ ├── CompanyDescription.vue │ │ │ ├── CompanyEmail.vue │ │ │ ├── CompanyName.vue │ │ │ ├── CompanyWebsite.vue │ │ │ ├── CompensationRange.vue │ │ │ ├── CompensationType.vue │ │ │ ├── FileSelect.vue │ │ │ ├── JobDescription.vue │ │ │ ├── JobExperience.vue │ │ │ ├── JobRemote.vue │ │ │ └── JobTitle.vue │ │ ├── icons │ │ │ └── SelectArrow.vue │ │ ├── preview │ │ │ ├── PreviewContent.vue │ │ │ └── PreviewSidebar.vue │ │ └── steps │ │ │ ├── JobInfo.vue │ │ │ ├── JobPreview.vue │ │ │ └── JobPurchase.vue │ ├── controllers │ │ ├── index.js │ │ ├── jobs_controller.js │ │ └── vue_component.js │ ├── helpers │ │ └── index.js │ ├── images │ │ └── icons │ │ │ └── checkmark.svg │ ├── packs │ │ └── application.js │ ├── src │ │ └── job_form.js │ ├── store │ │ └── index.js │ └── stylesheets │ │ ├── application.scss │ │ ├── components │ │ ├── _buttons.scss │ │ └── _forms.scss │ │ └── tailwind.config.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ ├── job.rb │ └── user.rb └── views │ ├── active_storage │ └── blobs │ │ └── _blob.html.erb │ ├── devise │ ├── confirmations │ │ └── new.html.erb │ ├── mailer │ │ ├── confirmation_instructions.html.erb │ │ ├── email_changed.html.erb │ │ ├── password_change.html.erb │ │ ├── reset_password_instructions.html.erb │ │ └── unlock_instructions.html.erb │ ├── passwords │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── registrations │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── sessions │ │ └── new.html.erb │ ├── shared │ │ ├── _error_messages.html.erb │ │ ├── _form_wrap.html.erb │ │ └── _links.html.erb │ └── unlocks │ │ └── new.html.erb │ ├── home │ └── index.html.erb │ ├── jobs │ ├── _form.html.erb │ ├── _job.html.erb │ ├── _job.json.jbuilder │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ ├── mailer.text.erb │ └── simple_discussion.html.erb │ ├── shared │ ├── _flash_notice.html.erb │ ├── _head.html.erb │ ├── _header.html.erb │ ├── _left_nav.html.erb │ ├── _right_nav.html.erb │ ├── _select_arrow.html.erb │ └── _spacer.html.erb │ └── simple_discussion │ ├── forum_posts │ ├── _form.html.erb │ ├── _forum_post.html.erb │ └── edit.html.erb │ ├── forum_threads │ ├── _form.html.erb │ ├── _forum_thread.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ └── user_mailer │ ├── new_post.html.erb │ └── new_thread.html.erb ├── babel.config.js ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring ├── webpack ├── webpack-dev-server └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── credentials │ └── development.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── friendly_id.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── simple_discussion.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ └── en.yml ├── puma.rb ├── routes.rb ├── spring.rb ├── storage.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── loaders │ │ └── vue.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── migrate │ ├── 20200725185854_devise_create_users.rb │ ├── 20200725185902_create_friendly_id_slugs.rb │ ├── 20200725192551_create_forum_categories.simple_discussion.rb │ ├── 20200725192552_create_forum_threads.simple_discussion.rb │ ├── 20200725192553_create_forum_posts.simple_discussion.rb │ ├── 20200725192554_create_forum_subscriptions.simple_discussion.rb │ ├── 20200725192722_add_moderator_to_users.rb │ ├── 20200730193200_create_jobs.rb │ ├── 20200730193611_create_active_storage_tables.active_storage.rb │ ├── 20200730193612_create_action_text_tables.action_text.rb │ ├── 20200730194438_add_personas_to_users.rb │ ├── 20200805150042_add_slug_to_jobs.rb │ └── 20210228175314_add_email_to_jobs.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ ├── .keep │ └── auto_annotate_models.rake ├── log └── .keep ├── package.json ├── postcss.config.js ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt ├── storage └── .keep ├── test ├── application_system_test_case.rb ├── channels │ └── application_cable │ │ └── connection_test.rb ├── controllers │ ├── .keep │ └── jobs_controller_test.rb ├── fixtures │ ├── .keep │ ├── action_text │ │ └── rich_texts.yml │ ├── files │ │ └── .keep │ ├── jobs.yml │ └── users.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── job_test.rb │ └── user_test.rb ├── system │ ├── .keep │ └── jobs_test.rb └── test_helper.rb ├── tmp ├── .keep └── pids │ └── .keep ├── vendor └── .keep └── yarn.lock /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | /db/*.sqlite3-* 14 | 15 | # Ignore all logfiles and tempfiles. 16 | /log/* 17 | /tmp/* 18 | !/log/.keep 19 | !/tmp/.keep 20 | 21 | # Ignore pidfiles, but keep the directory. 22 | /tmp/pids/* 23 | !/tmp/pids/ 24 | !/tmp/pids/.keep 25 | 26 | # Ignore uploaded files in development. 27 | /storage/* 28 | !/storage/.keep 29 | 30 | /public/assets 31 | .byebug_history 32 | 33 | # Ignore master key for decrypting credentials and more. 34 | /config/master.key 35 | 36 | /public/packs 37 | /public/packs-test 38 | /node_modules 39 | /yarn-error.log 40 | yarn-debug.log* 41 | .yarn-integrity 42 | 43 | /config/credentials/development.key 44 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.2 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '2.7.2' 5 | 6 | gem 'rails', '~> 6.0', '>= 6.0.3.4' 7 | 8 | gem 'bootsnap', '>= 1.4.2', require: false 9 | gem 'image_processing', '~> 1.2' 10 | gem 'jbuilder', '~> 2.7' 11 | gem 'puma', '~> 4.1' 12 | gem 'redis', '~> 4.0' 13 | gem 'sass-rails', '>= 6' 14 | gem 'pg', '>= 0.18', '< 2.0' 15 | gem 'turbolinks', '~> 5' 16 | gem 'webpacker', '~> 4.0' 17 | 18 | # railsdevs.com custom gems 19 | gem 'devise', '~> 4.7', '>= 4.7.2' 20 | gem 'friendly_id', '~> 5.3' 21 | gem 'name_of_person', '~> 1.1', '>= 1.1.1' 22 | gem 'sidekiq', '~> 6.1', '>= 6.1.1' 23 | gem "inline_svg", "~> 1.7" 24 | gem "pagy", "~> 3.8" 25 | gem "pay", "~> 2.1" 26 | gem "simple_discussion", "~> 1.2" 27 | gem "stripe_event", "~> 2.3" 28 | gem "stripe", "~> 5.22" 29 | gem 'whenever', '~> 1.0' 30 | 31 | group :development, :test do 32 | gem 'annotate', '~> 3.1', '>= 3.1.1' 33 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 34 | gem "faker", "~> 2.13" 35 | gem "pry-rails", "~> 0.3.9" 36 | end 37 | 38 | group :development do 39 | gem 'listen', '~> 3.2' 40 | gem 'spring-watcher-listen', '~> 2.0.0' 41 | gem 'spring' 42 | gem 'web-console', '>= 3.3.0' 43 | end 44 | 45 | group :test do 46 | gem 'capybara', '>= 2.15' 47 | gem 'selenium-webdriver' 48 | gem 'webdrivers' 49 | end 50 | 51 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 52 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: rails server 2 | sidekiq: sidekiq 3 | webpack: bin/webpack-dev-server 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Let's build for Ruby and Rails developers](https://f001.backblazeb2.com/file/webcrunch/base.jpg) 2 | 3 | # Let's Build for Ruby and Rails Developers 4 | 5 | This is a Ruby on Rails application I'm building in public on my blog [web-crunch.com](https://web-crunch.com) and [YouTube channel](https://youtube.com/c/webcrunch). 6 | 7 | You can read/find out more about the project [here](https://web-crunch.com/posts/lets-build-for-ruby-and-rails-developers). 8 | 9 | **TL;DR;** 10 | 11 | This app is a place for 12 | 13 | - Rails and Ruby developers to find new jobs 14 | - Employers to find Rails and Ruby developers 15 | - A small niched community for Ruby/Rails developers to hang out. 16 | 17 | I'm building this app because: 18 | 19 | - I want to! 20 | - It helps others learn 21 | - I could launch and earn from it 22 | - It helps the Ruby and Rails community 23 | - learning in public helps me get better and helps spread the word about my blog and YouTube channel, course, etc... 24 | 25 | ## What problem is this solving? 26 | 27 | Right now it seems like there is no centralized place to find ruby/rails specific jobs or developers. Providing a place (a water cooler of sorts) for these developers to hang out would be a fun way to keep the community alive and well. This could also be a great opportunity for employers to save a lot of time in their search for the perfect developer. 28 | 29 | I'm thinking the app will serve two different audiences. One audience will be a developer and the other will be an employer. 30 | 31 | Employers would visit railsdevs.com to search for developers they may want to hire or post a job so the developer community can apply if it seems like a good fit. 32 | 33 | Developers would visit railsdevs.com to find jobs and participate in the community side of the platform. I'm imagining the community being very basic at first. We don't need to over-engineer a forum until this strikes some validation post-launch. 34 | 35 | ## The application 36 | 37 | As of right now, I've secured the domain name `railsdevs.com`. This will be where the result of this big experiment ends up once pushed live. 38 | 39 | More updates to come as the application presses forward. 40 | 41 | ### Git strategy 42 | 43 | For this screencast series I'll be making a new branch per screencast. This will be helpful I think for the amount of history that's bound to occur and change over time. If you're on a specific part following along be sure to reference the appropriate branch. 44 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/icons/cheveron-right.svg: -------------------------------------------------------------------------------- 1 | cheveron-right 2 | -------------------------------------------------------------------------------- /app/assets/images/icons/chevron-left.svg: -------------------------------------------------------------------------------- 1 | cheveron-left 2 | -------------------------------------------------------------------------------- /app/assets/images/icons/railsdevs-mark.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/assets/stylesheets/actiontext.scss: -------------------------------------------------------------------------------- 1 | // 2 | // Provides a drop-in pointer for the default Trix stylesheet that will format the toolbar and 3 | // the trix-editor content (whether displayed or under editing). Feel free to incorporate this 4 | // inclusion directly in any other asset bundle and remove this file. 5 | // 6 | //= require trix/dist/trix 7 | 8 | // We need to override trix.css’s image gallery styles to accommodate the 9 | // element we wrap around attachments. Otherwise, 10 | // images in galleries will be squished by the max-width: 33%; rule. 11 | .trix-content { 12 | .attachment-gallery { 13 | > action-text-attachment, 14 | > .attachment { 15 | flex: 1 0 33%; 16 | padding: 0 0.5em; 17 | max-width: 33%; 18 | } 19 | 20 | &.attachment-gallery--2, 21 | &.attachment-gallery--4 { 22 | > action-text-attachment, 23 | > .attachment { 24 | flex-basis: 50%; 25 | max-width: 50%; 26 | } 27 | } 28 | } 29 | 30 | action-text-attachment { 31 | .attachment { 32 | padding: 0 !important; 33 | max-width: 100% !important; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | // require_tree . 2 | // require_self 3 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | 4 | before_action :configure_permitted_parameters, if: :devise_controller? 5 | 6 | protected 7 | 8 | def configure_permitted_parameters 9 | keys = [:name, :developer, :employer] 10 | devise_parameter_sanitizer.permit(:sign_up, keys: keys) 11 | devise_parameter_sanitizer.permit(:account_update, keys: keys) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | @jobs = Job.all 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/jobs_controller.rb: -------------------------------------------------------------------------------- 1 | class JobsController < ApplicationController 2 | before_action :set_job, only: [:show, :edit, :update, :destroy] 3 | before_action :authenticate_user!, except: [:index, :show] 4 | 5 | # GET /jobs 6 | # GET /jobs.json 7 | def index 8 | @jobs = Job.published.desc 9 | end 10 | 11 | # GET /jobs/1 12 | # GET /jobs/1.json 13 | def show 14 | end 15 | 16 | # GET /jobs/new 17 | def new 18 | @job = Job.new 19 | end 20 | 21 | # GET /jobs/1/edit 22 | def edit 23 | end 24 | 25 | # POST /jobs 26 | # POST /jobs.json 27 | def create 28 | @job = Job.new(job_params) 29 | @job.user = current_user 30 | if @job.save 31 | render json: { redirect_url: job_url(@job), notice: "Thanks for posting! Your job is now pending review." } 32 | else 33 | render json: @job.errors 34 | end 35 | end 36 | 37 | # PATCH/PUT /jobs/1 38 | # PATCH/PUT /jobs/1.json 39 | def update 40 | respond_to do |format| 41 | if @job.update(job_params) 42 | format.html { redirect_to @job, notice: 'Job was successfully updated.' } 43 | format.json { render :show, status: :ok, location: @job } 44 | else 45 | format.html { render :edit } 46 | format.json { render json: @job.errors, status: :unprocessable_entity } 47 | end 48 | end 49 | end 50 | 51 | # DELETE /jobs/1 52 | # DELETE /jobs/1.json 53 | def destroy 54 | @job.destroy 55 | respond_to do |format| 56 | format.html { redirect_to jobs_url, notice: 'Job was successfully destroyed.' } 57 | format.json { head :no_content } 58 | end 59 | end 60 | 61 | 62 | def intents 63 | intent_amount = case params[:upsell_type].parameterize 64 | when Job::UPSELL_TYPES[:no_thanks] 65 | Job::PRICING[:base] 66 | when Job::UPSELL_TYPES[:good] 67 | Job::PRICING[:good] 68 | when Job::UPSELL_TYPES[:better] 69 | Job::PRICING[:better] 70 | when Job::UPSELL_TYPES[:great] 71 | Job::PRICING[:great] 72 | else 73 | Job::PRICING[:base] 74 | end 75 | 76 | intent_amount = intent_amount * 100 77 | 78 | @intent = Stripe::PaymentIntent.create({ 79 | amount: intent_amount, 80 | currency: "usd", 81 | payment_method_types: ["card"] 82 | }) 83 | 84 | render json: @intent 85 | end 86 | 87 | private 88 | # Use callbacks to share common setup or constraints between actions. 89 | def set_job 90 | @job = Job.find(params[:id]) 91 | end 92 | 93 | # Only allow a list of trusted parameters through. 94 | def job_params 95 | params.permit( 96 | :company_email, 97 | :company_logo, 98 | :company_name, 99 | :company_website, 100 | :company_description, 101 | :compensation_range, 102 | :compensation_type, 103 | :description, 104 | :estimated_hours, 105 | :headquarters, 106 | :link_to_apply, 107 | :price, 108 | :remote, 109 | :role_type, 110 | :title, 111 | :upsell_type, 112 | :years_of_experience, 113 | ) 114 | end 115 | end 116 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def render_svg(name, styles: "fill-current text-gray-500", title: nil) 3 | filename = "#{name}.svg" 4 | title ||= name.underscore.humanize 5 | inline_svg_tag(filename, aria: true, nocomment: true, title: title, class: styles) 6 | end 7 | 8 | def admin? 9 | user_signed_in? && current_user.admin? 10 | end 11 | 12 | def author_of(resource) 13 | user_signed_in? && current_user.id = resource.user_id 14 | end 15 | 16 | def select_arrow 17 | render partial: "shared/select_arrow.html.erb" 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/helpers/jobs_helper.rb: -------------------------------------------------------------------------------- 1 | module JobsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/simple_discussion/forum_posts_helper.rb: -------------------------------------------------------------------------------- 1 | module SimpleDiscussion::ForumPostsHelper 2 | # Override this to use avatars from other places than Gravatar 3 | def avatar_tag(email) 4 | gravatar_image_tag(email, gravatar: { size: 40 }, class: "rounded avatar") 5 | end 6 | 7 | def category_link(category) 8 | link_to category.name, simple_discussion.forum_category_forum_threads_path(category), 9 | style: "color: #{category.color}" 10 | end 11 | 12 | # Override this method to provide your own content formatting like Markdown 13 | def formatted_content(text) 14 | simple_format(text) 15 | end 16 | 17 | def forum_post_classes(forum_post) 18 | klasses = ["forum-post", "card", "mb-3"] 19 | klasses << "solved" if forum_post.solved? 20 | klasses << "original-poster" if forum_post.user == @forum_thread.user 21 | klasses 22 | end 23 | 24 | def forum_user_badge(user) 25 | if user.respond_to?(:moderator) && user.moderator? 26 | content_tag :span, "Mod", class: "badge badge-default" 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /app/helpers/simple_discussion/forum_threads_helper.rb: -------------------------------------------------------------------------------- 1 | module SimpleDiscussion::ForumThreadsHelper 2 | # Used for flagging links in the navbar as active 3 | def forum_link_to(path, opts={}, &block) 4 | link_to path, class: forum_link_class(path, opts), &block 5 | end 6 | 7 | def forum_link_class(matches, opts={}) 8 | case matches 9 | when Array 10 | "active" if matches.any?{ |m| request.path.starts_with?(m) } 11 | when String 12 | "active" if opts.fetch(:exact, false) ? request.path == matches : request.path.starts_with?(matches) 13 | end 14 | end 15 | 16 | # A nice hack to manipulate the layout so we can have sub-layouts 17 | # without any changes in the user's application. 18 | # 19 | # We use this for rendering the sidebar layout for all the forum pages 20 | # 21 | # https://mattbrictson.com/easier-nested-layouts-in-rails 22 | # 23 | def parent_layout(layout) 24 | @view_flow.set(:layout, output_buffer) 25 | output = render(file: "layouts/#{layout}") 26 | self.output_buffer = ActionView::OutputBuffer.new(output) 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/javascript/channels/consumer.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | 4 | import { createConsumer } from "@rails/actioncable" 5 | 6 | export default createConsumer() 7 | -------------------------------------------------------------------------------- /app/javascript/channels/index.js: -------------------------------------------------------------------------------- 1 | // Load all the channels within this directory and all subdirectories. 2 | // Channel files must be named *_channel.js. 3 | 4 | const channels = require.context('.', true, /_channel\.js$/) 5 | channels.keys().forEach(channels) 6 | -------------------------------------------------------------------------------- /app/javascript/components/ButtonRemove.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 32 | -------------------------------------------------------------------------------- /app/javascript/components/FormPagination.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 20 | -------------------------------------------------------------------------------- /app/javascript/components/JobForm.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 87 | -------------------------------------------------------------------------------- /app/javascript/components/StepPagination.vue: -------------------------------------------------------------------------------- 1 | 36 | -------------------------------------------------------------------------------- /app/javascript/components/StripeForm.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 114 | 115 | 117 | -------------------------------------------------------------------------------- /app/javascript/components/fields/ApplyLink.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 49 | -------------------------------------------------------------------------------- /app/javascript/components/fields/CompanyDescription.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 28 | -------------------------------------------------------------------------------- /app/javascript/components/fields/CompanyEmail.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 44 | -------------------------------------------------------------------------------- /app/javascript/components/fields/CompanyName.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 36 | -------------------------------------------------------------------------------- /app/javascript/components/fields/CompanyWebsite.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 40 | -------------------------------------------------------------------------------- /app/javascript/components/fields/CompensationRange.vue: -------------------------------------------------------------------------------- 1 | 164 | 165 | 174 | -------------------------------------------------------------------------------- /app/javascript/components/fields/CompensationType.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 38 | -------------------------------------------------------------------------------- /app/javascript/components/fields/FileSelect.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 83 | 84 | 89 | -------------------------------------------------------------------------------- /app/javascript/components/fields/JobDescription.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 49 | -------------------------------------------------------------------------------- /app/javascript/components/fields/JobExperience.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | 65 | -------------------------------------------------------------------------------- /app/javascript/components/fields/JobRemote.vue: -------------------------------------------------------------------------------- 1 | 34 | -------------------------------------------------------------------------------- /app/javascript/components/fields/JobTitle.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 48 | -------------------------------------------------------------------------------- /app/javascript/components/icons/SelectArrow.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 22 | -------------------------------------------------------------------------------- /app/javascript/components/preview/PreviewContent.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 32 | -------------------------------------------------------------------------------- /app/javascript/components/preview/PreviewSidebar.vue: -------------------------------------------------------------------------------- 1 | 66 | 67 | 76 | -------------------------------------------------------------------------------- /app/javascript/components/steps/JobInfo.vue: -------------------------------------------------------------------------------- 1 | 64 | 65 | 135 | -------------------------------------------------------------------------------- /app/javascript/components/steps/JobPreview.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 49 | -------------------------------------------------------------------------------- /app/javascript/components/steps/JobPurchase.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 71 | -------------------------------------------------------------------------------- /app/javascript/controllers/index.js: -------------------------------------------------------------------------------- 1 | // Load all the controllers within this directory and all subdirectories. 2 | // Controller files must be named *_controller.js. 3 | 4 | import { Application } from "stimulus" 5 | import { definitionsFromContext } from "stimulus/webpack-helpers" 6 | 7 | const application = Application.start() 8 | const context = require.context("controllers", true, /_controller\.js$/) 9 | application.load(definitionsFromContext(context)) 10 | -------------------------------------------------------------------------------- /app/javascript/controllers/jobs_controller.js: -------------------------------------------------------------------------------- 1 | import JobForm from "components/JobForm.vue" 2 | import VueComponent from "./vue_component" 3 | 4 | export default VueComponent(JobForm) 5 | -------------------------------------------------------------------------------- /app/javascript/controllers/vue_component.js: -------------------------------------------------------------------------------- 1 | import { store } from "../store" 2 | import { Controller } from "stimulus" 3 | import Vue from "vue" 4 | import { required, minLength, url, email } from "vuelidate/lib/validators" 5 | const VueComponent = (component) => class extends Controller { 6 | static targets = ["mount"] 7 | 8 | connect() { 9 | const el = this.mountTarget 10 | 11 | window.jobForm = new Vue({ 12 | el, 13 | render: h => h(component), 14 | data: store, 15 | 16 | }) 17 | 18 | window.paymentConfig = { 19 | stripeKey: document.querySelector("meta[name='stripe-public-key']").content 20 | } 21 | } 22 | } 23 | 24 | export default VueComponent 25 | -------------------------------------------------------------------------------- /app/javascript/helpers/index.js: -------------------------------------------------------------------------------- 1 | export function getMetaValue(name) { 2 | const element = findElement(document.head, `meta[name="${name}"]`); 3 | if (element) { 4 | return element.getAttribute("content"); 5 | } 6 | } 7 | 8 | export function findElement(root, selector) { 9 | if (typeof root == "string") { 10 | selector = root; 11 | root = document; 12 | } 13 | return root.querySelector(selector); 14 | } 15 | -------------------------------------------------------------------------------- /app/javascript/images/icons/checkmark.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | // This file is automatically compiled by Webpack, along with any other files 2 | // present in this directory. You're encouraged to place your actual application logic in 3 | // a relevant structure within app/javascript and only use these pack files to reference 4 | // that code so it'll be compiled. 5 | 6 | require("@rails/ujs").start() 7 | require("turbolinks").start() 8 | require("@rails/activestorage").start() 9 | require("channels") 10 | require("trix") 11 | require("@rails/actiontext") 12 | 13 | import "controllers" 14 | import "stylesheets/application" 15 | import "src/job_form"; 16 | -------------------------------------------------------------------------------- /app/javascript/src/job_form.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue" 2 | import { store, actions } from "../store" 3 | import ky from "ky" 4 | import TurbolinksAdapter from "vue-turbolinks" 5 | import { getMetaValue } from "helpers" 6 | import Vuelidate from 'vuelidate' 7 | 8 | Vue.use(TurbolinksAdapter) 9 | Vue.use(Vuelidate) 10 | 11 | Vue.prototype.$store = store 12 | Vue.prototype.$actions = actions 13 | 14 | Vue.prototype.$http = ky.extend({ 15 | hooks: { 16 | beforeRequest: [ 17 | request => { 18 | request.headers.set("X-CSRF-Token", getMetaValue("csrf-token")) 19 | } 20 | ] 21 | }, 22 | retry: 0 23 | }) 24 | -------------------------------------------------------------------------------- /app/javascript/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue/dist/vue.esm" 2 | import axios from "axios" 3 | import { getMetaValue } from "helpers" 4 | 5 | axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded' 6 | axios.defaults.headers.post["X-CSRF-Token"] = getMetaValue("csrf-token") 7 | 8 | export const store = Vue.observable({ 9 | form: { 10 | step: 1, 11 | job: { 12 | cardName: null, 13 | companyName: null, 14 | companyWebsite: null, 15 | companyLogo: null, 16 | companyDescription: null, 17 | email: null, 18 | compensationRange: null, 19 | compensationType: "Full-time", 20 | description: null, 21 | headquarters: null, 22 | linkToApply: null, 23 | price: 199, 24 | basePrice: 199, 25 | remote: true, 26 | title: null, 27 | yearsOfExperience: 3, 28 | upsellType: "No, thanks" 29 | }, 30 | paymentIntentClientSecret: null, 31 | upsellPricing: { 32 | good: 49, 33 | better: 69, 34 | great: 149 35 | } 36 | }, 37 | showPaymentButton: true, 38 | formInvalid: false 39 | 40 | }) 41 | 42 | export const actions = { 43 | updateForm(input, value) { 44 | store.form.job[input] = value 45 | 46 | let storedForm = this.openStorage() 47 | if (!storedForm) storedForm = {} 48 | 49 | storedForm[input] = value 50 | this.saveStorage(storedForm) 51 | }, 52 | 53 | openStorage() { 54 | return JSON.parse(localStorage.getItem('form')) 55 | }, 56 | 57 | saveStorage(form) { 58 | localStorage.setItem("form", JSON.stringify(form)) 59 | }, 60 | 61 | formattedPrice() { 62 | const price = new Intl.NumberFormat("en-EN", { 63 | style: "currency", 64 | currency: "USD", 65 | }).format(store.form.job.price) 66 | return price 67 | }, 68 | 69 | handleBoolean(input, value) { 70 | if (input === value) { 71 | return true 72 | } else { 73 | return false 74 | } 75 | }, 76 | 77 | handlePurchase(stripeResult) { 78 | const formData = new FormData() 79 | const job = store.form.job 80 | 81 | formData.append("email", job.email) 82 | formData.append("company_name", job.companyName) 83 | formData.append("company_website", job.companyWebsite) 84 | formData.append("company_description", job.companyDescription) 85 | formData.append("compensation_range", job.compensationRange) 86 | formData.append("compensation_type", job.compensationType) 87 | formData.append("description", job.description) 88 | formData.append("headquarters", job.headquarters) 89 | formData.append("link_to_apply", job.linkToApply) 90 | formData.append("title", job.title) 91 | formData.append("years_of_experience", job.yearsOfExperience) 92 | // formData.append("upsell_type", job.upsellType) 93 | formData.append("remote", actions.handleBoolean(job.remote, "Yes")) 94 | formData.append("price", job.price) 95 | 96 | if (job.companyLogo) { 97 | formData.append("companyLogo", job.companyLogo) 98 | } 99 | 100 | axios({ 101 | url: "/jobs", 102 | method: "POST", 103 | data: formData 104 | }).then(response => { 105 | if (response.status === 200) { 106 | window.location = response.data.redirect_url 107 | } 108 | }) 109 | .catch(errors => { 110 | // @job.errors TODO: Render in view 111 | console.log(errors) 112 | }) 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | 4 | /*! purgecss start ignore */ 5 | @import "trix/dist/trix.css"; 6 | @import "components/buttons"; 7 | @import "components/forms"; 8 | /*! purgecss end ignore */ 9 | 10 | @tailwind utilities; 11 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/components/_forms.scss: -------------------------------------------------------------------------------- 1 | %focus-style { 2 | @apply shadow outline-none border-gray-500; 3 | 4 | box-shadow: 0 0 0 0.2rem theme("colors.gray.200"); 5 | background-clip: padding-box; 6 | } 7 | 8 | .input { 9 | @apply appearance-none block w-full text-gray-700 border border-gray-400 rounded px-3 leading-tight bg-white shadow-inner; 10 | padding-top: 0.65rem; 11 | padding-bottom: 0.65rem; 12 | 13 | &.input-error { 14 | @apply border-red-400; 15 | } 16 | } 17 | 18 | .input:focus, 19 | .input:hover { 20 | @extend %focus-style; 21 | } 22 | 23 | .label { 24 | @apply inline-block text-gray-700 text-sm font-bold mb-2; 25 | } 26 | 27 | .select { 28 | @apply appearance-none py-3 px-4 pr-8 block w-full bg-white border border-gray-300 text-gray-700 rounded leading-tight; 29 | -webkit-appearance: none; 30 | } 31 | 32 | .select:focus { 33 | @apply outline-none border-gray-400; 34 | 35 | box-shadow: 0 0 0 0.2rem theme("colors.gray.100"); 36 | background-clip: padding-box; 37 | } 38 | 39 | .caret { 40 | @apply pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-800; 41 | } 42 | 43 | .input-group { 44 | @apply mb-6; 45 | } 46 | 47 | .input-file { 48 | height: auto; 49 | z-index: 2; 50 | cursor: pointer; 51 | 52 | @apply inline-block opacity-0 pl-0 pr-0 py-3 px-3 overflow-hidden absolute border-none; 53 | 54 | + label { 55 | @extend .btn; 56 | @extend .btn-default; 57 | 58 | @apply cursor-pointer inline-flex items-center justify-start w-auto; 59 | 60 | * { 61 | pointer-events: none; 62 | } 63 | 64 | &:focus { 65 | outline: 1px dotted #000; 66 | outline: -webkit-focus-ring-color auto 5px; 67 | } 68 | } 69 | } 70 | 71 | .input-checkbox { 72 | @apply flex items-center justify-start; 73 | 74 | input[type="checkbox"] { 75 | @apply hidden appearance-none; 76 | 77 | &:checked ~ label:before { 78 | content: ""; 79 | background-image: url("../images/icons/checkmark.svg"); 80 | background-size: 10px 10px; 81 | border-radius: 2px; 82 | @apply bg-blue-500 border-transparent text-white bg-no-repeat bg-center transition ease-in-out duration-100 shadow-none; 83 | } 84 | 85 | &:disabled { 86 | @apply pointer-events-none opacity-50; 87 | } 88 | } 89 | 90 | label { 91 | @apply cursor-pointer appearance-none; 92 | 93 | &:before { 94 | border-radius: 2px; 95 | border: 1px solid rgb(209, 209, 209); 96 | box-shadow: inset 0 1px 1px rgba(#ddd, 0.8); 97 | content: ""; 98 | height: 16px; 99 | margin-right: 10px; 100 | top: -5px; 101 | width: 16px; 102 | 103 | @apply bg-white inline-flex items-center justify-center relative transition ease-in-out duration-200; 104 | } 105 | 106 | &:hover::before { 107 | @apply bg-gray-100 border-gray-500; 108 | } 109 | } 110 | } 111 | 112 | .input-radio { 113 | @apply flex items-center justify-start; 114 | 115 | input[type="radio"] { 116 | @apply hidden appearance-none; 117 | 118 | &:checked ~ label:before { 119 | content: ""; 120 | @apply bg-blue-500 border-transparent text-white transition ease-in-out duration-100 shadow-none; 121 | } 122 | 123 | &:checked ~ label:after { 124 | @apply bg-white rounded-full; 125 | content: ""; 126 | width: 6px; 127 | height: 6px; 128 | position: absolute; 129 | top: 8px; 130 | left: 5px; 131 | box-shadow: 0 1px 1px rgba(#2b6cb0, 0.9); 132 | } 133 | 134 | &:disabled { 135 | @apply pointer-events-none opacity-50; 136 | } 137 | } 138 | 139 | label { 140 | @apply cursor-pointer appearance-none relative; 141 | 142 | &:before { 143 | border: 1px solid rgb(209, 209, 209); 144 | box-shadow: inset 0 1px 1px rgba(#ddd, 0.8); 145 | content: ""; 146 | height: 16px; 147 | margin-right: 4px; 148 | top: -5px; 149 | width: 16px; 150 | 151 | @apply bg-white inline-flex items-center justify-center relative transition ease-in-out duration-200 rounded-full; 152 | } 153 | 154 | &:hover::before { 155 | @apply bg-gray-100 border-gray-500; 156 | } 157 | } 158 | } 159 | 160 | span.required { 161 | @apply h-1 w-1 rounded-full bg-red-500 inline-block relative; 162 | top: -6px; 163 | } 164 | -------------------------------------------------------------------------------- /app/javascript/stylesheets/tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | target: 'relaxed', 3 | prefix: '', 4 | important: false, 5 | separator: ':', 6 | theme: { 7 | extend: { 8 | backgroundOpacity: { 9 | '80': '0.80', 10 | '95': '0.95', 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/job.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: jobs 4 | # 5 | # id :bigint not null, primary key 6 | # company_name :string 7 | # company_website :string 8 | # compensation_range :string 9 | # compensation_type :string 10 | # email :string 11 | # estimated_hours :string 12 | # featured :boolean default(FALSE) 13 | # featured_until :datetime 14 | # headquarters :string 15 | # link_to_apply :string 16 | # price :integer 17 | # published_at :datetime 18 | # remote :boolean default(FALSE) 19 | # slug :string 20 | # status :string default("pending") 21 | # title :string 22 | # upsell_type :string 23 | # years_of_experience :string 24 | # created_at :datetime not null 25 | # updated_at :datetime not null 26 | # user_id :bigint not null 27 | # 28 | # Indexes 29 | # 30 | # index_jobs_on_slug (slug) UNIQUE 31 | # index_jobs_on_user_id (user_id) 32 | # 33 | # Foreign Keys 34 | # 35 | # fk_rails_... (user_id => users.id) 36 | # 37 | class Job < ApplicationRecord 38 | extend FriendlyId 39 | 40 | friendly_id :slug_candidates, use: [:slugged, :finders] 41 | 42 | # relations 43 | belongs_to :user 44 | has_rich_text :description 45 | has_rich_text :company_description 46 | has_one_attached :company_logo 47 | 48 | # scopes 49 | scope :desc, -> { order(created_at: :desc) } 50 | scope :pending, -> { where(status: JOB_STATUSES[:pending]) } 51 | scope :published, -> { where(status: JOB_STATUSES[:published]) } 52 | scope :archived, -> { where(status: JOB_STATUSES[:archived]) } 53 | 54 | BASE_JOB_PRICE = 199 55 | GOOD_JOB_PRICE = BASE_JOB_PRICE + 49 56 | BETTER_JOB_PRICE = BASE_JOB_PRICE + 69 57 | GREAT_JOB_PRICE = BASE_JOB_PRICE + 149 58 | 59 | # pricing 60 | PRICING = { 61 | base: BASE_JOB_PRICE, 62 | good: GOOD_JOB_PRICE, 63 | better: BETTER_JOB_PRICE, 64 | great: GREAT_JOB_PRICE 65 | } 66 | 67 | UPSELL_TYPES = { 68 | no_thanks: "no-thanks", 69 | good: "good", 70 | better: "better", 71 | great: "great" 72 | } 73 | 74 | # constants 75 | COMPENSATION_TYPES = [ 76 | "Contract", 77 | "Full-time" 78 | ] 79 | 80 | COMPENSATION_RANGES = [ 81 | "50,000 - 60,000", 82 | "60,000 - 70,000", 83 | "70,000 - 80,000", 84 | "80,000 - 90,000", 85 | "90,000 - 100,000", 86 | "110,000 - 120,000", 87 | "120,000 - 130,000", 88 | "130,000 - 140,000", 89 | "140,000 - 150,000", 90 | "160,000 - 170,000", 91 | "170,000 - 180,000", 92 | "180,000 - 190,000", 93 | "190,000 - 200,000", 94 | "200,000 - 210,000", 95 | "210,000 - 220,000", 96 | "220,000 - 230,000", 97 | "230,000 - 240,000", 98 | "240,000 - 250,000", 99 | "greater than 250,000", 100 | ].freeze 101 | 102 | HOURLY_RANGES = [ 103 | "less than 10", 104 | "10-30", 105 | "30-60", 106 | "60-90", 107 | "more than 100", 108 | ].freeze 109 | 110 | JOB_STATUSES = { 111 | pending: "pending", 112 | published: "published", 113 | archived: "archived" 114 | }.freeze 115 | 116 | YEARS_OF_EXPERIENCE_RANGE = ["1","2","3","4","5","6","8","9","10","more than 10"].freeze 117 | 118 | def slug_candidates 119 | [:title, [:title, :company_name]] 120 | end 121 | 122 | def pending? 123 | self.status == Job::JOB_STATUSES[:pending] 124 | end 125 | 126 | def published? 127 | self.status == Job::JOB_STATUSES[:published] 128 | end 129 | 130 | def archived? 131 | self.status == Job::JOB_STATUSES[:archived] 132 | end 133 | 134 | def should_generate_new_friendly_id? 135 | if !slug? 136 | title_changed? 137 | else 138 | false 139 | end 140 | end 141 | 142 | end 143 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: users 4 | # 5 | # id :bigint not null, primary key 6 | # admin :boolean default(FALSE) 7 | # confirmation_sent_at :datetime 8 | # confirmation_token :string 9 | # confirmed_at :datetime 10 | # developer :boolean default(FALSE) 11 | # email :string default(""), not null 12 | # employer :boolean default(FALSE) 13 | # encrypted_password :string default(""), not null 14 | # first_name :string 15 | # last_name :string 16 | # moderator :boolean 17 | # remember_created_at :datetime 18 | # reset_password_sent_at :datetime 19 | # reset_password_token :string 20 | # unconfirmed_email :string 21 | # created_at :datetime not null 22 | # updated_at :datetime not null 23 | # 24 | # Indexes 25 | # 26 | # index_users_on_confirmation_token (confirmation_token) UNIQUE 27 | # index_users_on_email (email) UNIQUE 28 | # index_users_on_reset_password_token (reset_password_token) UNIQUE 29 | # 30 | class User < ApplicationRecord 31 | include SimpleDiscussion::ForumUser 32 | 33 | has_person_name 34 | has_many :jobs, dependent: :destroy 35 | 36 | # Include default devise modules. Others available are: 37 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 38 | devise :database_authenticatable, :registerable, 39 | :recoverable, :rememberable, :validatable, :confirmable 40 | 41 | def name 42 | "#{first_name} #{last_name}" 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /app/views/active_storage/blobs/_blob.html.erb: -------------------------------------------------------------------------------- 1 |
attachment--<%= blob.filename.extension %>"> 2 | <% if blob.representable? %> 3 | <%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %> 4 | <% end %> 5 | 6 |
7 | <% if caption = blob.try(:caption) %> 8 | <%= caption %> 9 | <% else %> 10 | <%= blob.filename %> 11 | <%= number_to_human_size blob.byte_size %> 12 | <% end %> 13 |
14 |
15 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 | 3 |

Resend confirmation instructions

4 | 5 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 6 | <%= render "devise/shared/error_messages", resource: resource %> 7 | 8 |
9 | <%= f.label :email, class: "label" %> 10 | <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: "input" %> 11 |
12 | 13 |
14 | <%= f.submit "Resend confirmation instructions", class: "btn btn-default" %> 15 |
16 | <% end %> 17 | 18 |
19 | 20 | <%= render "devise/shared/links" %> 21 | 22 | <% end %> 23 | 24 | <%= render "devise/shared/form_wrap" %> 25 | -------------------------------------------------------------------------------- /app/views/devise/mailer/confirmation_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome <%= @email %>!

2 | 3 |

You can confirm your account email through the link below:

4 | 5 |

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

6 | -------------------------------------------------------------------------------- /app/views/devise/mailer/email_changed.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @email %>!

2 | 3 | <% if @resource.try(:unconfirmed_email?) %> 4 |

We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.

5 | <% else %> 6 |

We're contacting you to notify you that your email has been changed to <%= @resource.email %>.

7 | <% end %> 8 | -------------------------------------------------------------------------------- /app/views/devise/mailer/password_change.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

We're contacting you to notify you that your password has been changed.

4 | -------------------------------------------------------------------------------- /app/views/devise/mailer/reset_password_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Someone has requested a link to change your password. You can do this through the link below.

4 | 5 |

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

6 | 7 |

If you didn't request this, please ignore this email.

8 |

Your password won't change until you access the link above and create a new one.

9 | -------------------------------------------------------------------------------- /app/views/devise/mailer/unlock_instructions.html.erb: -------------------------------------------------------------------------------- 1 |

Hello <%= @resource.email %>!

2 | 3 |

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

4 | 5 |

Click the link below to unlock your account:

6 | 7 |

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

8 | -------------------------------------------------------------------------------- /app/views/devise/passwords/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 |

Change your password

3 | 4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 5 | <%= render "devise/shared/error_messages", resource: resource %> 6 | <%= f.hidden_field :reset_password_token %> 7 | 8 |
9 |
10 | <%= f.label :password, "New password", class:"label" %> 11 | <% if @minimum_password_length %> 12 | (<%= @minimum_password_length %> characters minimum) 13 | <% end %> 14 |
15 | <%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "input" %> 16 |
17 | 18 |
19 | <%= f.label :password_confirmation, "Confirm new password", class: "label" %> 20 | <%= f.password_field :password_confirmation, autocomplete: "off", class: "input" %> 21 |
22 | 23 |
24 | <%= f.submit "Change my password", class: "btn btn-default" %> 25 |
26 | <% end %> 27 | 28 |
29 | 30 | <%= render "devise/shared/links" %> 31 | 32 | <% end %> 33 | 34 | <%= render "devise/share/form_wrap" %> 35 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 | 3 |

Forgot your password?

4 | 5 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 6 | <%= render "devise/shared/error_messages", resource: resource %> 7 | 8 |
9 | <%= f.label :email, class: "label" %> 10 | <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "input" %> 11 |
12 | 13 |
14 | <%= f.submit "Send me reset password instructions", class: "btn btn-default" %> 15 |
16 | <% end %> 17 | 18 |
19 | 20 | <%= render "devise/shared/links" %> 21 | <% end %> 22 | 23 | <%= render "devise/shared/form_wrap" %> 24 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 |

Edit <%= resource_name.to_s.humanize %>

3 | 4 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 5 | 6 | <%= render "devise/shared/error_messages", resource: resource %> 7 | 8 |
9 | <%= f.label :name, class:"label" %> 10 | <%= f.text_field :name, class:"input" %> 11 |
12 | 13 |
14 | <%= f.label :email, class:"label" %> 15 | <%= f.email_field :email, autocomplete: "email", class:"input" %> 16 |
17 | 18 |
19 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 20 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
21 | <% end %> 22 |
23 | 24 |
25 | <%= f.label :password, class:"label" %> 26 | <%= f.password_field :password, autocomplete: "new-password", class:"input" %> 27 |

<% if @minimum_password_length %> 28 | <%= @minimum_password_length %> characters minimum <% end %> (leave blank if you don't want to change it)

29 | 30 |
31 | 32 |
33 | <%= f.label :password_confirmation, class: "label" %> 34 | <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input" %> 35 |
36 | 37 |
38 | <%= f.label :current_password, class: "label" %> 39 | <%= f.password_field :current_password, autocomplete: "current-password", class: "input" %> 40 |

(we need your current password to confirm your changes)

41 |
42 | 43 |

Roles

44 | 45 |
46 | <%= f.check_box :developer %> 47 | <%= f.label :developer, "Use railsdevs.com as a developer?" %> 48 |
49 | 50 |
51 | <%= f.check_box :employer %> 52 | <%= f.label :employer, "Use railsdevs.com as an employer?" %> 53 |
54 | 55 |
56 | <%= f.submit "Update", class: "btn btn-default" %> 57 |
58 | <% end %> 59 | 60 |
61 | 62 |

Cancel my account

63 | 64 |
65 |
66 |

Unhappy?

67 |
68 | 69 | <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-red" %> 70 |
71 | 72 | <% end %> 73 | 74 | <%= render 'devise/shared/form_wrap' %> 75 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 | 3 |

Sign up

4 | 5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 6 | <%= render "devise/shared/error_messages", resource: resource %> 7 | 8 |
9 | <%= f.label :name, class:"label" %> 10 | <%= f.text_field :name, class:"input" %> 11 |
12 | 13 |
14 | <%= f.label :email, class:"label" %> 15 | <%= f.email_field :email, autocomplete: "email", class:"input" %> 16 |
17 | 18 |
19 |
20 | <%= f.label :password, class: "label" %> 21 | <% if @minimum_password_length %> 22 | (<%= @minimum_password_length %> characters minimum) 23 | <% end %> 24 |
25 | <%= f.password_field :password, autocomplete: "new-password", class: "input" %> 26 |
27 | 28 |
29 | <%= f.label :password_confirmation, class:"label" %> 30 | <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input" %> 31 |
32 | 33 |

Roles

34 | 35 |
36 | <%= f.check_box :developer %> 37 | <%= f.label :developer, "Use railsdevs.com as a developer?" %> 38 |
39 | 40 |
41 | <%= f.check_box :employer %> 42 | <%= f.label :employer, "Use railsdevs.com as an employer?" %> 43 |
44 | 45 |
46 | <%= f.submit "Sign up", class: "btn btn-default" %> 47 |
48 | 49 |
50 | 51 | <% end %> 52 | 53 | <%= render "devise/shared/links" %> 54 | 55 | <% end %> 56 | 57 | <%= render "devise/shared/form_wrap" %> 58 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 |

Log in

3 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 4 | 5 |
6 | <%= f.label :email, class:"label" %> 7 | <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "input" %> 8 |
9 | 10 |
11 | <%= f.label :password, class:"label" %> 12 | <%= f.password_field :password, autocomplete: "current-password", class: "input" %> 13 |
14 | 15 |
16 | <% if devise_mapping.rememberable? -%> 17 | <%= f.check_box :remember_me %> 18 | <%= f.label :remember_me, class:"label" %> 19 | <% end -%> 20 |
21 | 22 |
23 | <%= f.submit "Log in", class: "btn btn-default" %> 24 |
25 | 26 | <% end %> 27 | 28 |
29 | 30 | <%= render "devise/shared/links" %> 31 | <% end %> 32 | 33 | <%= render "devise/shared/form_wrap" %> 34 | -------------------------------------------------------------------------------- /app/views/devise/shared/_error_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% if resource.errors.any? %> 2 |
3 |

4 | <%= I18n.t("errors.messages.not_saved", 5 | count: resource.errors.count, 6 | resource: resource.class.model_name.human.downcase) 7 | %> 8 |

9 | 14 |
15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/devise/shared/_form_wrap.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <%= yield :devise_form %> 4 |
5 |
6 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 |
<%= link_to "Log in", new_session_path(resource_name), class: "block py-2 text-gray-700 underline hover:no-underline" %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name), class: "block py-2 text-gray-700 underline hover:no-underline" %> 7 | <% end -%> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name), class: "block py-2 text-gray-700 underline hover:no-underline" %> 11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), class: "block py-2 text-gray-700 underline hover:no-underline"%> 15 | <% end -%> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name), class: "block py-2 text-gray-700 underline hover:no-underline" %> 19 | <% end -%> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), class: "btn btn-default my-4" %> 24 | <% end -%> 25 | <% end -%> 26 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :devise_form do %> 2 |

Resend unlock instructions

3 | 4 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 5 | <%= render "devise/shared/error_messages", resource: resource %> 6 | 7 |
8 | <%= f.label :email, class: "label" %> 9 | <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "input" %> 10 |
11 | 12 |
13 | <%= f.submit "Resend unlock instructions", class: "btn btn-default" %> 14 |
15 | <% end %> 16 | 17 |
18 | 19 | <%= render "devise/shared/links" %> 20 | <% end %> 21 | 22 | <%= render "devise/shared/form_wrap" %> 23 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 | <% @jobs.each do |job| %> 2 |

<%= link_to job.title, job_path(job) %>

3 | <% end %> 4 | -------------------------------------------------------------------------------- /app/views/jobs/_form.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_with(model: job, local: true, multipart: true) do |form| %> 3 | <% if job.errors.any? %> 4 |
5 |

<%= pluralize(job.errors.count, "error") %> prohibited this job from being saved:

6 | 7 |
    8 | <% job.errors.full_messages.each do |message| %> 9 |
  • <%= message %>
  • 10 | <% end %> 11 |
12 |
13 | <% end %> 14 | 15 |
16 |
17 | <%= form.label :company_logo, class: "label"%> 18 | <%= form.file_field :company_logo %> 19 |
20 | <% if form.object.company_logo.attached? %> 21 | <%= image_tag form.object.company_logo, class: "w-24 h-auto"%> 22 | <% end %> 23 |
24 | 25 |
26 | <%= form.label :title, class: "label"%> 27 | <%= form.text_field :title, class: "input" %> 28 |
29 | 30 |
31 |
32 | <%= form.label :link_to_apply, class: "label"%> 33 | <%= form.text_field :link_to_apply, class: "input" %> 34 |
35 | 36 |
37 | <%= form.label :headquarters, class: "label"%> 38 | <%= form.text_field :headquarters, class: "input" %> 39 |
40 |
41 | 42 |
43 | <%= form.label :description, class: "label"%> 44 | <%= form.rich_text_area :description, class: "input" %> 45 |
46 | 47 |
48 |
49 | <%= form.label :company_name, class: "label"%> 50 | <%= form.text_field :company_name, class: "input" %> 51 |
52 | 53 |
54 | <%= form.label :company_website, class: "label"%> 55 | <%= form.text_field :company_website, class: "input" %> 56 |
57 |
58 | 59 |
60 | <%= form.label :company_description, class: "label"%> 61 | <%= form.rich_text_area :company_description, class: "input" %> 62 |
63 | 64 |
65 |
66 | <%= form.label :compensation_type, class: "label" %> 67 |
68 | <%= form.select :compensation_type, Job::COMPENSATION_TYPES,{}, { class: "select" } %> 69 | <%= select_arrow %> 70 |
71 |
72 | 73 |
74 | <%= form.label :compensation_range, class: "label"%> 75 | <%= form.text_field :compensation_range, class: "input" %> 76 |
77 | 78 |
79 | <%= form.label :estimated_hours, class: "label"%> 80 | <%= form.text_field :estimated_hours, class: "input" %> 81 |
82 |
83 | 84 |
85 | <%= form.label :years_of_experience, class: "label"%> 86 | <%= form.text_field :years_of_experience, class: "input" %> 87 |
88 | 89 |
90 | <%= form.check_box :remote %> 91 | <%= form.label :remote, "Is this a remote only role?", class: "label"%> 92 |
93 | 94 |
95 | <%= form.submit class: "btn btn-green"%> 96 |
97 | <% end %> 98 |
99 | -------------------------------------------------------------------------------- /app/views/jobs/_job.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= link_to job, class: "border-2 border-black rounded-lg py-6 lg:px-12 px-6 mb-4 block transition ease-in-out duration-300 hover:shadow-lg group" do %> 3 | 4 | <% if job.company_logo.attached? %> 5 |
6 | <%= image_tag job.company_logo.variant(resize_to_fit: [200, 200]), class: "w-16 h-16 object-cover border border-black rounded-full flex-shrink-0" %> 7 |
8 | <% end %> 9 | 10 |
11 |

<%= job.company_name %>

12 | 13 | <% if job.featured? %> 14 | Featured 15 | <% end %> 16 |
17 | 18 |

<%= job.title %>

19 | 20 |

21 | <%= job.compensation_type %> 22 | <% if job.compensation_type.downcase == "contract" %> 23 | <%= job.estimated_hours %> hours 24 | <% else %> 25 | <%= number_to_currency(job.compensation_range) %> <%= pluralize(job.years_of_experience, 'year') %> of experience 26 | <% end %> 27 |

28 |

29 | <% if job.remote? %> 30 | Remote, 31 | <% end %> 32 | <%= job.headquarters %> 33 |

34 | 35 | <% end %> 36 | 37 | <% if admin? %> 38 |
39 | <%= link_to 'Edit', edit_job_path(job), class: "underline mr-1" %> 40 | <%= link_to 'Delete', job, method: :delete, data: { confirm: 'Are you sure?' }, class: "underline" %> 41 |
42 | <% end %> 43 |
44 | -------------------------------------------------------------------------------- /app/views/jobs/_job.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! job, :id, :title, :link_to_apply, :description, :company_name, :company_website, :company_description, :compensation_range, :remote, :years_of_experience, :user_id, :created_at, :updated_at 2 | json.url job_url(job, format: :json) 3 | -------------------------------------------------------------------------------- /app/views/jobs/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Edit your job <%= @job.title %>

3 | <%= render 'form', job: @job %> 4 |
5 | -------------------------------------------------------------------------------- /app/views/jobs/index.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :hero do %> 2 |
3 |
4 |

Find a Ruby on Rails developer

5 |

The internet's number one resource for Ruby on Rails developers

6 | 7 |
8 | <%= link_to "Find a developer", "#", class: "btn bg-teal-600 hover:bg-teal-500 py-3 px-6 lg:mr-2 shadow-sm border border-teal-500"%> 9 | <%= link_to "Find a job", jobs_path(anchor: "jobs-index"), class: "btn bg-red-700 lg:ml-2 py-3 px-6 hover:bg-red-600 shadow-sm border border-red-500" %> 10 | 11 |
12 |

or find developer friends in the <%= link_to "community", "#", class: "underline" %>

13 |
14 |
15 | <% end %> 16 | 17 |
18 | <%= render @jobs %> 19 |
20 | -------------------------------------------------------------------------------- /app/views/jobs/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array! @jobs, partial: "jobs/job", as: :job 2 | -------------------------------------------------------------------------------- /app/views/jobs/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= link_to root_path, class:"link text-lg tracking-tight font-semibold group text-red-600 hover:text-red-700 transition ease-in-out flex items-center justify-start" do %> 3 | <%= render_svg "icons/railsdevs-mark", title: "railsdevs.com", styles: "fill-current w-8 h-8 text-red-600 group-hover:text-red-700" %> 4 | RailsDevs 5 | <% end %> 6 |
7 |
8 |
9 |
10 | -------------------------------------------------------------------------------- /app/views/jobs/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | <% if @job.pending? %> 4 |
5 | Pending review 6 |
7 | <% end %> 8 | 9 |
10 | <%= link_to root_path, class: "mb-4 inline-flex items-center justify-start group" do %> 11 | <%= render_svg "icons/chevron-left", styles: "fill-current w-5 h-5 text-red-600 group-hover:text-red-700" %> 12 |

Back to all jobs

13 | <% end %> 14 |
15 | 16 |
17 |
18 | <%= link_to @job.company_name, @job.company_website, class: "text-base text-gray-600 hover:text-teal-500" %> 19 | 20 |

<%= @job.title %>

21 | 22 |

23 | <%= @job.compensation_type %> 24 | <% if @job.compensation_type.downcase == "contract" %> 25 | <%= @job.estimated_hours %> hours 26 | <% else %> 27 | <%= number_to_currency(@job.compensation_range) %> <%= pluralize(@job.years_of_experience, 'year') %> of experience 28 | <% end %> 29 |

30 | 31 |

About the role

32 |
33 | <%= @job.description %> 34 |
35 | 36 |

About the company

37 |
38 | <%= @job.company_description %> 39 |
40 | 41 | <%= link_to "Apply for this role", @job.link_to_apply, class: "btn btn-red px-10 py-3" %> 42 | 43 | <% if author_of(@job) || admin? %> 44 | <%= link_to 'Edit this job', edit_job_path(@job), class: "ml-2 block mt-6" %> 45 | <% end %> 46 |
47 |
48 |
49 | <% if @job.company_logo.attached? %> 50 |
51 |
52 | <%= image_tag @job.company_logo.variant(resize_to_fit: [200, 200]), class: "flex-shrink-0 rounded-full object-cover object-center w-full h-16 border border-black" %> 53 |
54 |
55 | <% end %> 56 |

<%= link_to @job.company_name, @job.company_website, class: "text-base text-gray-600 hover:text-teal-500"%>

57 |

<%= @job.title %>

58 |

59 | <%= @job.compensation_type %> 60 | <% if @job.compensation_type.downcase == "contract" %> 61 | <%= @job.estimated_hours %> hours
62 | <% else %> 63 | <%= number_to_currency(@job.compensation_range) %>
<%= pluralize(@job.years_of_experience, 'year') %> of experience 64 | <% end %> 65 |

66 | <%= link_to "Apply for this role", @job.link_to_apply, class: "btn btn-red px-10 py-3" %> 67 |
68 |
69 |
70 |
71 | -------------------------------------------------------------------------------- /app/views/jobs/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "jobs/job", job: @job 2 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= render "shared/head" %> 4 | 5 | 6 | <%= render "shared/flash_notice" %> 7 | <%= render "shared/header" unless current_page?(new_job_url) %> 8 | 9 | <%= yield :hero %> 10 | 11 |
12 | <%= content_for?(:content) ? yield(:content) : yield %> 13 |
14 | 15 | 16 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/layouts/simple_discussion.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

3 | <%= t('community') %> 4 |

5 |
6 | 7 |
8 |
9 | 10 |
11 | <%= link_to t('ask_a_question'), simple_discussion.new_forum_thread_path, class: "btn btn-outline-primary btn-block" %> 12 |
13 | 14 |
15 |
16 | 17 | <%= t('filters') %> 18 | 19 |
20 |
21 | <%= forum_link_to simple_discussion.forum_threads_path, exact: true do %> 22 | <%= icon "fa-fw fas", "bars" %> 23 | <%= t('.all_threads') %> 24 | <% end %> 25 |
26 | <% if user_signed_in? %> 27 |
28 | <%= forum_link_to simple_discussion.mine_forum_threads_path do %><%= icon "fa-fw far", "user-circle" %> 29 | <%= t('.my_questions') %> 30 | <% end %> 31 |
32 |
33 | <%= forum_link_to simple_discussion.participating_forum_threads_path do %> 34 | <%= icon "fa-fw far", "comments" %> 35 | <%= t('.participating') %> 36 | <% end %> 37 |
38 | <% end %> 39 |
40 | <%= forum_link_to simple_discussion.answered_forum_threads_path do %> 41 | <%= icon "fa-fw fas", "check" %> 42 | <%= t('.answered') %> 43 | <% end %> 44 |
45 |
46 | <%= forum_link_to simple_discussion.unanswered_forum_threads_path do %> 47 | <%= icon "fa-fw fas", "question" %> 48 | <%= t('.unanswered') %> 49 | <% end %> 50 |
51 |
52 | 53 |
54 | 55 |
56 |
57 | 58 | <%= t('.by_category') %> 59 | 60 |
61 |
<%= forum_link_to simple_discussion.forum_threads_path, exact: true do %><%= icon "fa-fw fas", "circle" %> All<% end %>
62 | <% ForumCategory.sorted.each do |category| %> 63 |
64 | <%= forum_link_to simple_discussion.forum_category_forum_threads_path(category) do %> 65 | <%= icon "fa-fw fas", "circle", style: "color: #{category.color}" %> 66 | <%= category.name %> 67 | <% end %> 68 |
69 | <% end %> 70 |
71 | 72 | <% if @forum_thread.present? && @forum_thread.persisted? %> 73 |
74 | 75 | <%# User has not posted in the thread or subscribed %> 76 |
<%= t('.notifications') %>
77 | 78 | <%= link_to simple_discussion.forum_thread_notifications_path(@forum_thread), method: :post, class: "btn btn-secondary btn-sm btn-block mb-2" do %> 79 | <% if @forum_thread.subscribed? current_user %> 80 | <%= icon "fa-fw fas", "bell-slash" %> <%= t('.unsubscribe') %> 81 | <% else %> 82 | <%= icon "fa-fw fas", "bell" %> 83 | <%= t('.suscribe') %> 84 | <% end %> 85 | <% end %> 86 | 87 | <%= @forum_thread.subscribed_reason(current_user) %> 88 | <% end %> 89 |
90 | 91 |
92 | 93 |
94 | 95 |
96 | <%= yield %> 97 |
98 | 99 |
100 |
101 | 102 | <% parent_layout("application") %> 103 | -------------------------------------------------------------------------------- /app/views/shared/_flash_notice.html.erb: -------------------------------------------------------------------------------- 1 | <% flash.each do |type, message| %> 2 | <% if type == "alert" %> 3 |
4 |
<%= message %>
5 |
6 | <% end %> 7 | <% if type == "notice" %> 8 |
9 |
<%= message %>
10 |
11 | <% end %> 12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/shared/_head.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% if content_for?(:title) %> 4 | <%= yield :title %> | 5 | <% end %> 6 | railsdevs.com 7 | 8 | 9 | <%= csrf_meta_tags %> 10 | <%= csp_meta_tag %> 11 | 12 | 13 | 14 | 15 | <%= stylesheet_link_tag "https://fonts.googleapis.com/css2?family=Inter:wght@400;700;900&display=swap", media: 'all', 'data-turbolinks-track': 'reload' %> 16 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 17 | <%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 18 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 19 | <%= javascript_include_tag 'https://js.stripe.com/v3/', 'data-turbolinks-track': 'reload' %> 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/views/shared/_header.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 6 |
7 | -------------------------------------------------------------------------------- /app/views/shared/_left_nav.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= link_to root_path, class:"link text-lg tracking-tight font-semibold group text-red-600 hover:text-red-700 transition ease-in-out flex items-center justify-start" do %> 3 | <%= render_svg "icons/railsdevs-mark", title: "railsdevs.com", styles: "fill-current w-8 h-8 text-red-600 group-hover:text-red-700" %> 4 | RailsDevs 5 | <% end %> 6 |
7 |
8 | 11 |
12 | -------------------------------------------------------------------------------- /app/views/shared/_right_nav.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | <% if user_signed_in? %> 7 | <%= link_to "Edit account", edit_user_registration_path, class: "btn btn-transparent mr-2" %> 8 | <%= link_to "Log out", destroy_user_session_path, method: :delete, class:"btn btn-transparent" %> 9 | <% else %> 10 | <%= link_to "Login", new_user_session_path, class:"btn btn-transparent mr-2" %> 11 | <%= link_to "Sign Up", new_user_registration_path, class:"btn btn-transparent" %> 12 | <% end %> 13 | 14 | | 15 | 16 | <%= link_to "Find jobs", jobs_path, class: "btn btn-transparent mr-2" %> 17 | <%= link_to "Post a job", new_job_path, class: "btn btn-teal" %> 18 |
19 |
20 | -------------------------------------------------------------------------------- /app/views/shared/_select_arrow.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | -------------------------------------------------------------------------------- /app/views/shared/_spacer.html.erb: -------------------------------------------------------------------------------- 1 |
2 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_posts/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for [@forum_thread, @forum_post], 2 | url: (@forum_post.persisted? ? simple_discussion.forum_thread_forum_post_path(@forum_thread, @forum_post) : simple_discussion.forum_thread_forum_posts_path(@forum_thread)), 3 | html: { data: { behavior: "comment-form" } } do |f| %> 4 | 5 | <% if @forum_post.errors.any? %> 6 |
7 |

<%= pluralize(@forum_post.errors.count, "error") %> prohibited this forum_post from being saved:

8 | 9 | 14 |
15 | <% end %> 16 | 17 |
18 | <%= f.text_area :body, placeholder: t('add_a_comment'), rows: 8, class: "form-control simplemde", data: { behavior: "comment-body" } %> 19 |
20 | 21 |
22 |
23 | 24 | <%# Describe text formatting options here with a link %> 25 | <%#= link_to "Parsed with Markdown", "https://guides.github.com/features/mastering-markdown/", target: "_blank" %> 26 | 27 |
28 | 29 | <%= f.button "#{f.object.new_record? ? t('comment') : t('update_comment') }", class: "btn btn-primary", data: {disable_with: " #{t('saving_comment')}"} %> 30 |
31 | 32 | <% end %> 33 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_posts/_forum_post.html.erb: -------------------------------------------------------------------------------- 1 | <%# We don't currently cache the forum posts because they have permissions to deal with %> 2 | 3 | <%= content_tag :div, id: dom_id(forum_post), class: forum_post_classes(forum_post) do %> 4 |
5 | 6 | <% if is_moderator_or_owner?(forum_post) %> 7 |
8 | <%= link_to icon("fas","edit"), simple_discussion.edit_forum_thread_forum_post_path(@forum_thread, forum_post), 9 | class: "text-muted", 10 | data: { toggle: "tooltip", placement: "left" }, 11 | title: t('edit_this_post') 12 | %> 13 |   14 | <%= link_to icon("fas","trash"), simple_discussion.forum_thread_forum_post_path(@forum_thread, forum_post), 15 | class: "text-muted", 16 | method: :delete, 17 | data: { toggle: "tooltip", placement: "left", confirm: "Are you sure you want to delete this post?" }, 18 | title: t('edit_this_post') 19 | %> 20 |
21 | <% end %> 22 | 23 |
24 | <%= avatar_tag(forum_post.user.email) %> 25 | 26 | 27 | <%= forum_post.user.name %> <%= forum_user_badge(forum_post.user) %> 28 | 29 | 30 | <%= t('commented_on') %> 31 | <%= link_to forum_post.created_at.strftime("%b %d, %Y"), simple_discussion.forum_thread_path(@forum_thread, anchor: "forum_post_#{forum_post.id}") %>: 32 | 33 |
34 |
35 | 36 |
37 | <%= formatted_content forum_post.body %> 38 |
39 | 40 | <% if @forum_thread.solved? && forum_post.solved? %> 41 | 52 | 53 | <% elsif is_moderator_or_owner?(@forum_thread) %> 54 | 64 | <% end %> 65 | <% end %> 66 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_posts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

<%= link_to "← Back to the thread", simple_discussion.forum_thread_path(@forum_thread) %>

2 | 3 |

<%= content_tag :span, "Pinned", class: "text-muted" if @forum_thread.pinned? %> <%= @forum_thread.title %>

4 | 5 |

6 | <%= category_link(@forum_thread.forum_category) %> 7 | • <%= t('asked_time_ago', time: time_ago_in_words(@forum_thread.created_at), author: @forum_thread.user.name) %> 8 |

9 |

10 | 11 |
12 | 13 | <%= content_tag :div, id: dom_id(@forum_post), class: forum_post_classes(@forum_post) do %> 14 |
15 |
16 | <%= avatar_tag(@forum_post.user.email) %> 17 | <%= @forum_post.user.name %> 18 | 19 | <%= t('commented_on')%> 20 | <%= link_to @forum_post.created_at.strftime("%b %d, %Y"), simple_discussion.forum_thread_url(@forum_thread, anchor: "forum_post_#{@forum_post.id}") %>: 21 | 22 |
23 |
24 | 25 |
26 | <%= render "form" %> 27 |
28 | <% end %> 29 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_threads/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for @forum_thread, 2 | url: (@forum_thread.persisted? ? simple_discussion.forum_thread_path(@forum_thread) : simple_discussion.forum_threads_path), 3 | html: { data: {behavior: "comment-form"} } do |f| %> 4 | 5 | <% if @forum_thread.errors.any? %> 6 |
7 |

<%= pluralize(@forum_thread.errors.count, "error") %> prohibited this forum_thread from being saved:

8 | 9 | 14 |
15 | <% end %> 16 | 17 |
18 | <%= f.label :forum_category_id, t('choose_a_category') %> 19 | <%= f.collection_select :forum_category_id, ForumCategory.sorted, :id, :name, {include_blank: t('pick_a_category')}, {autofocus: true, class: "form-control"} %> 20 |
21 | 22 |
23 | <%= f.label t('title') %> 24 | <%= f.text_field :title, placeholder: t('how_do_i'), class: "form-control" %> 25 |
26 | 27 | <% if local_assigns.fetch(:posts, true) %> 28 | <%= f.fields_for :forum_posts do |p| %> 29 |
30 | <%= p.label :body, t('what_help_needed') %> 31 | <%= p.text_area :body, placeholder: t('add_a_comment'), rows: 10, class: "form-control simplemde", data: { behavior: "comment-body" } %> 32 |
33 | <% end %> 34 | <% end %> 35 | 36 |
37 | <% if f.object.new_record? %> 38 | <%= f.button t('ask_your_question'), class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %> 39 | <% else %> 40 | <%= f.button "Update Thread", class: "btn btn-primary", data: {disable_with: " #{t('saving')}"} %> 41 | <% end %> 42 |
43 | 44 | <% end %> 45 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_threads/_forum_thread.html.erb: -------------------------------------------------------------------------------- 1 | <%= cache forum_thread do %> 2 |
3 |
4 | 5 |
6 | <%= avatar_tag(forum_thread.user.email) %> 7 |
8 | 9 |
10 |

11 | <% if forum_thread.solved? %> 12 | <%= icon "fas", "check-circle" %> 13 | <% end %> 14 | 15 | <%= link_to simple_discussion.forum_thread_path(forum_thread) do %> 16 | <%= icon "fas", "thumb-tack", class: "text-muted" if forum_thread.pinned? %> <%= forum_thread.title %> 17 | <% end %> 18 |

19 | 20 |
21 | <%= category_link(forum_thread.forum_category) %> 22 | • <%= t('asked_time_ago', time: time_ago_in_words(forum_thread.created_at), author: forum_thread.user.name) %> 23 |
24 | 25 |

<%= truncate(forum_thread.forum_posts.first.body, length: 200) %>

26 |
27 | 28 |
29 | <%= link_to simple_discussion.forum_thread_path(forum_thread), class: "thread-posts-count" do %> 30 | <%= forum_thread.forum_posts_count %> 31 | <%= t("post", count: forum_thread.forum_posts_count) %> 32 | <% end %> 33 |
34 | 35 |
36 |
37 | <% end %> 38 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_threads/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_for :title, "Edit Thread" %> 2 | 3 |

<%= t('edit_thread') %>

4 | 5 |
6 | <%= render 'form', posts: false %> 7 |
8 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_threads/index.html.erb: -------------------------------------------------------------------------------- 1 | <% if @forum_threads.none? %> 2 | 3 |
<%= t('search_not_found') %>. <%= t('check_out') %> <%= link_to t('latest_questions'), simple_discussion.forum_threads_path %> <%= t('instead') %>
4 | 5 | <% else %> 6 | 7 | <%= render partial: "simple_discussion/forum_threads/forum_thread", collection: @forum_threads, spacer_template: "shared/spacer" %> 8 | 9 |
10 | <%= will_paginate @forum_threads, url_builder: simple_discussion, renderer: SimpleDiscussion::BootstrapLinkRenderer %> 11 |
12 | 13 | <% end %> 14 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_threads/new.html.erb: -------------------------------------------------------------------------------- 1 |

<%= t('start_a_discussion') %>

2 | 3 |
4 | <%= render 'form' %> 5 |
6 | -------------------------------------------------------------------------------- /app/views/simple_discussion/forum_threads/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

<%= icon "fas", "thumb-tack", class: "text-muted" if @forum_thread.pinned? %> <%= @forum_thread.title %>

4 |
5 | 6 | <% if is_moderator_or_owner?(@forum_thread) %> 7 |
8 | <%= link_to icon("fas","pencil"), simple_discussion.edit_forum_thread_path(@forum_thread), 9 | class: "text-muted", 10 | data: { toggle: "tooltip", placement: "left" }, 11 | title: t('edit_this_thread') %> 12 |
13 | <% end %> 14 | 15 |
16 | 17 |

18 | <%= category_link(@forum_thread.forum_category) %> 19 | • <%= t('asked_time_ago', time: time_ago_in_words(@forum_thread.created_at), author: @forum_thread.user.name) %> 20 |

21 | 22 | <%= render partial: "simple_discussion/forum_posts/forum_post", collection: @forum_thread.forum_posts.includes(:user).sorted %> 23 | 24 | <%= render partial: "simple_discussion/forum_posts/form" if user_signed_in? %> 25 | -------------------------------------------------------------------------------- /app/views/simple_discussion/user_mailer/new_post.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= gravatar_image_tag @forum_post.user.email, style: "float: left" %> 3 | 4 |
5 |

<%= @forum_post.user.name %> commented:

6 | <%= formatted_content @forum_post.body %> 7 |
8 |
9 | 10 |
11 | 12 |

<%= link_to "Reply to this comment", forum_thread_url(@forum_post.forum_thread, anchor: "forum_post_#{@forum_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %>

13 | -------------------------------------------------------------------------------- /app/views/simple_discussion/user_mailer/new_thread.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= gravatar_image_tag @forum_post.user.email, style: "float: left" %> 3 | 4 |
5 |

<%= @forum_post.user.name %> commented:

6 | <%= formatted_content @forum_post.body %> 7 |
8 |
9 | 10 |
11 | 12 |

<%= link_to "Reply to this comment", forum_thread_url(@forum_post.forum_thread, anchor: "forum_post_#{@forum_post.id}"), style: "background:#be2126; color:#fff; text-decoration:none; padding: 10px 20px" %>

13 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function(api) { 2 | var validEnv = ['development', 'test', 'production'] 3 | var currentEnv = api.env() 4 | var isDevelopmentEnv = api.env('development') 5 | var isProductionEnv = api.env('production') 6 | var isTestEnv = api.env('test') 7 | 8 | if (!validEnv.includes(currentEnv)) { 9 | throw new Error( 10 | 'Please specify a valid `NODE_ENV` or ' + 11 | '`BABEL_ENV` environment variables. Valid values are "development", ' + 12 | '"test", and "production". Instead, received: ' + 13 | JSON.stringify(currentEnv) + 14 | '.' 15 | ) 16 | } 17 | 18 | return { 19 | presets: [ 20 | isTestEnv && [ 21 | '@babel/preset-env', 22 | { 23 | targets: { 24 | node: 'current' 25 | } 26 | } 27 | ], 28 | (isProductionEnv || isDevelopmentEnv) && [ 29 | '@babel/preset-env', 30 | { 31 | forceAllTransforms: true, 32 | useBuiltIns: 'entry', 33 | corejs: 3, 34 | modules: false, 35 | exclude: ['transform-typeof-symbol'] 36 | } 37 | ] 38 | ].filter(Boolean), 39 | plugins: [ 40 | 'babel-plugin-macros', 41 | '@babel/plugin-syntax-dynamic-import', 42 | isTestEnv && 'babel-plugin-dynamic-import-node', 43 | '@babel/plugin-transform-destructuring', 44 | [ 45 | '@babel/plugin-proposal-class-properties', 46 | { 47 | loose: true 48 | } 49 | ], 50 | [ 51 | '@babel/plugin-proposal-object-rest-spread', 52 | { 53 | useBuiltIns: true 54 | } 55 | ], 56 | [ 57 | '@babel/plugin-transform-runtime', 58 | { 59 | helpers: false, 60 | regenerator: true, 61 | corejs: false 62 | } 63 | ], 64 | [ 65 | '@babel/plugin-transform-regenerator', 66 | { 67 | async: false 68 | } 69 | ] 70 | ].filter(Boolean) 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'bundle' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "rubygems" 12 | 13 | m = Module.new do 14 | module_function 15 | 16 | def invoked_as_script? 17 | File.expand_path($0) == File.expand_path(__FILE__) 18 | end 19 | 20 | def env_var_version 21 | ENV["BUNDLER_VERSION"] 22 | end 23 | 24 | def cli_arg_version 25 | return unless invoked_as_script? # don't want to hijack other binstubs 26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 | bundler_version = nil 28 | update_index = nil 29 | ARGV.each_with_index do |a, i| 30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 | bundler_version = a 32 | end 33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 | bundler_version = $1 35 | update_index = i 36 | end 37 | bundler_version 38 | end 39 | 40 | def gemfile 41 | gemfile = ENV["BUNDLE_GEMFILE"] 42 | return gemfile if gemfile && !gemfile.empty? 43 | 44 | File.expand_path("../../Gemfile", __FILE__) 45 | end 46 | 47 | def lockfile 48 | lockfile = 49 | case File.basename(gemfile) 50 | when "gems.rb" then gemfile.sub(/\.rb$/, gemfile) 51 | else "#{gemfile}.lock" 52 | end 53 | File.expand_path(lockfile) 54 | end 55 | 56 | def lockfile_version 57 | return unless File.file?(lockfile) 58 | lockfile_contents = File.read(lockfile) 59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 | Regexp.last_match(1) 61 | end 62 | 63 | def bundler_version 64 | @bundler_version ||= 65 | env_var_version || cli_arg_version || 66 | lockfile_version 67 | end 68 | 69 | def bundler_requirement 70 | return "#{Gem::Requirement.default}.a" unless bundler_version 71 | 72 | bundler_gem_version = Gem::Version.new(bundler_version) 73 | 74 | requirement = bundler_gem_version.approximate_recommendation 75 | 76 | return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") 77 | 78 | requirement += ".a" if bundler_gem_version.prerelease? 79 | 80 | requirement 81 | end 82 | 83 | def load_bundler! 84 | ENV["BUNDLE_GEMFILE"] ||= gemfile 85 | 86 | activate_bundler 87 | end 88 | 89 | def activate_bundler 90 | gem_error = activation_error_handling do 91 | gem "bundler", bundler_requirement 92 | end 93 | return if gem_error.nil? 94 | require_error = activation_error_handling do 95 | require "bundler/version" 96 | end 97 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 98 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 99 | exit 42 100 | end 101 | 102 | def activation_error_handling 103 | yield 104 | nil 105 | rescue StandardError, LoadError => e 106 | e 107 | end 108 | end 109 | 110 | m.load_bundler! 111 | 112 | if m.invoked_as_script? 113 | load Gem.bin_path("bundler", "bundle") 114 | end 115 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to setup or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at anytime and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies 21 | # system('bin/yarn') 22 | 23 | # puts "\n== Copying sample files ==" 24 | # unless File.exist?('config/database.yml') 25 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 26 | # end 27 | 28 | puts "\n== Preparing database ==" 29 | system! 'bin/rails db:prepare' 30 | 31 | puts "\n== Removing old logs and tempfiles ==" 32 | system! 'bin/rails log:clear tmp:clear' 33 | 34 | puts "\n== Restarting application server ==" 35 | system! 'bin/rails restart' 36 | end 37 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads Spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == 'spring' } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/webpack_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::WebpackRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "bundler/setup" 11 | 12 | require "webpacker" 13 | require "webpacker/dev_server_runner" 14 | 15 | APP_ROOT = File.expand_path("..", __dir__) 16 | Dir.chdir(APP_ROOT) do 17 | Webpacker::DevServerRunner.run(ARGV) 18 | end 19 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | begin 5 | exec "yarnpkg", *ARGV 6 | rescue Errno::ENOENT 7 | $stderr.puts "Yarn executable was not detected in the system." 8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 9 | exit 1 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Railsdevs 10 | class Application < Rails::Application 11 | config.active_job.queue_adapter = :sidekiq 12 | # Initialize configuration defaults for originally generated Rails version. 13 | config.load_defaults 6.0 14 | 15 | # Settings in config/environments/* take precedence over those specified here. 16 | # Application configuration can go into files in config/initializers 17 | # -- all .rb files in that directory are automatically loaded after loading 18 | # the framework and any gems in your application. 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | require 'bootsnap/setup' # Speed up boot time by caching expensive operations. 5 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: railsdevs_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | RIOeRX8irimjJi6yEeOTtP1y9LNtvof9BFY/oivqrpliTiQpWJ76FISu9Aq+rlX7OVE6rG8e1oC1sLsmF69cfPv5Cw9c5/+dwRDdlyHqL+DsZUX0b7rVZHG9IXoX5Pkwpil7rUsdGvltGWNgPEyPIbgsENoX/dRzpAczH93IS4Boih3B6D3n1KISTYFPDCMT/7rF8kvwSq/pSACYbQQCCzGaAxguthYIyoJoLtY5YEWq/P5Q2Zt2+AniF/2SvPeR+z6aA/emSzvbYUOU8l5oxwIHWasKo0d09/3hQjf7SRAgb+Ye9K+VR2gDL3FrcQU8H26HSm9LGFz+PtFSU/G5jjQ3p+Wm7j1jeJL9pLWfLv/XSzFwJjzumWhhPvG00jdAmTTA3l1FeN3s52+Ge3tGyjeVhF/StHZLt9lX--g5Jeyk7n313pB+z7--aXWxm90cIoLkoJBS/1XrFg== -------------------------------------------------------------------------------- /config/credentials/development.yml.enc: -------------------------------------------------------------------------------- 1 | A522p8SSCQFl+Rbp9briTHkIXsd3DSfqXxBU/DvKB8CqRENaCw8oZASSTkEdHxXE9vzQyzqxuue0raG9evBwCF+NXSMKWDjzNugB7PWsZ8PT+QvZXS7+pqzaWU5yVkgI1LJHHuuRNFQGKJSijG+oBIF/s6I3lJfvfoVhfM5BBk3Vc9ev6TganwDK1Bh3HpEZpRXib3Vl5SwCiER7dCbuLxQhmtiMGsIc/hzIjlyBkVfjTRNzjcmzWQvRlL/rxB6G/hy0PZ0QSjOLCpiTzb9brQAVKXg2bVCCOQ1DuiOM399Q669ZUr4OF9TKBlIaA1ij6UAXFbN7Ep5gxrON3SJQT2n8in9hicgu7dY5KW+82ugmQNRYRLnPbvf0viTu8FQQUThU8dRQu6HIUT4/Ti6V0Ostq2iQPG3SnbYd4lI=--dx5JodxK6aHmIvvL--CcH+0Ogq78k74Jsxip31sQ== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.3 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On macOS with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On macOS with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see Rails configuration guide 21 | # https://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: railsdevs_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: railsdevs 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: railsdevs_test 61 | 62 | # As with config/credentials.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: railsdevs_production 84 | username: railsdevs 85 | password: <%= ENV['RAILSDEVS_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } 3 | # Settings specified here will take precedence over those in config/application.rb. 4 | 5 | # In the development environment your application's code is reloaded on 6 | # every request. This slows down response time but is perfect for development 7 | # since you don't have to restart the web server when you make code changes. 8 | config.cache_classes = false 9 | 10 | # Do not eager load code on boot. 11 | config.eager_load = false 12 | 13 | # Show full error reports. 14 | config.consider_all_requests_local = true 15 | 16 | # Enable/disable caching. By default caching is disabled. 17 | # Run rails dev:cache to toggle caching. 18 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 19 | config.action_controller.perform_caching = true 20 | config.action_controller.enable_fragment_cache_logging = true 21 | 22 | config.cache_store = :memory_store 23 | config.public_file_server.headers = { 24 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 25 | } 26 | else 27 | config.action_controller.perform_caching = false 28 | 29 | config.cache_store = :null_store 30 | end 31 | 32 | # Store uploaded files on the local file system (see config/storage.yml for options). 33 | config.active_storage.service = :local 34 | 35 | # Don't care if the mailer can't send. 36 | config.action_mailer.raise_delivery_errors = false 37 | 38 | config.action_mailer.perform_caching = false 39 | 40 | # Print deprecation notices to the Rails logger. 41 | config.active_support.deprecation = :log 42 | 43 | # Raise an error on page load if there are pending migrations. 44 | config.active_record.migration_error = :page_load 45 | 46 | # Highlight code that triggered database queries in logs. 47 | config.active_record.verbose_query_logs = true 48 | 49 | # Debug mode disables concatenation and preprocessing of assets. 50 | # This option may cause significant delays in view rendering with a large 51 | # number of complex assets. 52 | config.assets.debug = true 53 | 54 | # Suppress logger output for asset requests. 55 | config.assets.quiet = true 56 | 57 | # Raises error for missing translations. 58 | # config.action_view.raise_on_missing_translations = true 59 | 60 | # Use an evented file watcher to asynchronously detect changes in source code, 61 | # routes, locales, etc. This feature depends on the listen gem. 62 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 63 | end 64 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 18 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 19 | # config.require_master_key = true 20 | 21 | # Disable serving static files from the `/public` folder by default since 22 | # Apache or NGINX already handles this. 23 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 24 | 25 | # Compress CSS using a preprocessor. 26 | # config.assets.css_compressor = :sass 27 | 28 | # Do not fallback to assets pipeline if a precompiled asset is missed. 29 | config.assets.compile = false 30 | 31 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 32 | # config.action_controller.asset_host = 'http://assets.example.com' 33 | 34 | # Specifies the header that your server uses for sending files. 35 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 36 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 37 | 38 | # Store uploaded files on the local file system (see config/storage.yml for options). 39 | config.active_storage.service = :local 40 | 41 | # Mount Action Cable outside main process or domain. 42 | # config.action_cable.mount_path = nil 43 | # config.action_cable.url = 'wss://example.com/cable' 44 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 45 | 46 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 47 | # config.force_ssl = true 48 | 49 | # Use the lowest log level to ensure availability of diagnostic information 50 | # when problems arise. 51 | config.log_level = :debug 52 | 53 | # Prepend all log lines with the following tags. 54 | config.log_tags = [ :request_id ] 55 | 56 | # Use a different cache store in production. 57 | # config.cache_store = :mem_cache_store 58 | 59 | # Use a real queuing backend for Active Job (and separate queues per environment). 60 | # config.active_job.queue_adapter = :resque 61 | # config.active_job.queue_name_prefix = "railsdevs_production" 62 | 63 | config.action_mailer.perform_caching = false 64 | 65 | # Ignore bad email addresses and do not raise email delivery errors. 66 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 67 | # config.action_mailer.raise_delivery_errors = false 68 | 69 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 70 | # the I18n.default_locale when a translation cannot be found). 71 | config.i18n.fallbacks = true 72 | 73 | # Send deprecation notices to registered listeners. 74 | config.active_support.deprecation = :notify 75 | 76 | # Use default logging formatter so that PID and timestamp are not suppressed. 77 | config.log_formatter = ::Logger::Formatter.new 78 | 79 | # Use a different logger for distributed setups. 80 | # require 'syslog/logger' 81 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 82 | 83 | if ENV["RAILS_LOG_TO_STDOUT"].present? 84 | logger = ActiveSupport::Logger.new(STDOUT) 85 | logger.formatter = config.log_formatter 86 | config.logger = ActiveSupport::TaggedLogging.new(logger) 87 | end 88 | 89 | # Do not dump schema after migrations. 90 | config.active_record.dump_schema_after_migration = false 91 | 92 | # Inserts middleware to perform automatic connection switching. 93 | # The `database_selector` hash is used to pass options to the DatabaseSelector 94 | # middleware. The `delay` is used to determine how long to wait after a write 95 | # to send a subsequent read to the primary. 96 | # 97 | # The `database_resolver` class is used by the middleware to determine which 98 | # database is appropriate to use based on the time delay. 99 | # 100 | # The `database_resolver_context` class is used by the middleware to set 101 | # timestamps for the last write to the primary. The resolver uses the context 102 | # class timestamps to determine how long to wait before reading from the 103 | # replica. 104 | # 105 | # By default Rails will store a last write timestamp in the session. The 106 | # DatabaseSelector middleware is designed as such you can define your own 107 | # strategy for connection switching and pass that into the middleware through 108 | # these configuration options. 109 | # config.active_record.database_selector = { delay: 2.seconds } 110 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 111 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 112 | end 113 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # The test environment is used exclusively to run your application's 2 | # test suite. You never need to work with it otherwise. Remember that 3 | # your test database is "scratch space" for the test suite and is wiped 4 | # and recreated between test runs. Don't rely on the data there! 5 | 6 | Rails.application.configure do 7 | # Settings specified here will take precedence over those in config/application.rb. 8 | 9 | config.cache_classes = false 10 | config.action_view.cache_template_loading = true 11 | 12 | # Do not eager load code on boot. This avoids loading your whole application 13 | # just for the purpose of running a single test. If you are using a tool that 14 | # preloads Rails for running tests, you may have to set it to true. 15 | config.eager_load = false 16 | 17 | # Configure public file server for tests with Cache-Control for performance. 18 | config.public_file_server.enabled = true 19 | config.public_file_server.headers = { 20 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 21 | } 22 | 23 | # Show full error reports and disable caching. 24 | config.consider_all_requests_local = true 25 | config.action_controller.perform_caching = false 26 | config.cache_store = :null_store 27 | 28 | # Raise exceptions instead of rendering exception templates. 29 | config.action_dispatch.show_exceptions = false 30 | 31 | # Disable request forgery protection in test environment. 32 | config.action_controller.allow_forgery_protection = false 33 | 34 | # Store uploaded files on the local file system in a temporary directory. 35 | config.active_storage.service = :test 36 | 37 | config.action_mailer.perform_caching = false 38 | 39 | # Tell Action Mailer not to deliver emails to the real world. 40 | # The :test delivery method accumulates sent emails in the 41 | # ActionMailer::Base.deliveries array. 42 | config.action_mailer.delivery_method = :test 43 | 44 | # Print deprecation notices to the stderr. 45 | config.active_support.deprecation = :stderr 46 | 47 | # Raises error for missing translations. 48 | # config.action_view.raise_on_missing_translations = true 49 | end 50 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 15 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | # # If you are using webpack-dev-server then specify webpack-dev-server host 15 | # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? 16 | 17 | # # Specify URI for violation reports 18 | # # policy.report_uri "/csp-violation-report-endpoint" 19 | # end 20 | 21 | Rails.application.config.content_security_policy do |policy| 22 | if Rails.env.development? 23 | policy.script_src :self, :https, :unsafe_eval 24 | else 25 | policy.script_src :self, :https 26 | end 27 | end 28 | 29 | # If you are using UJS then enable automatic nonce generation 30 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 31 | 32 | # Set the nonce only to specific directives 33 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 34 | 35 | # Report CSP violations to a specified URI 36 | # For further information see the following documentation: 37 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 38 | # Rails.application.config.content_security_policy_report_only = true 39 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/friendly_id.rb: -------------------------------------------------------------------------------- 1 | # FriendlyId Global Configuration 2 | # 3 | # Use this to set up shared configuration options for your entire application. 4 | # Any of the configuration options shown here can also be applied to single 5 | # models by passing arguments to the `friendly_id` class method or defining 6 | # methods in your model. 7 | # 8 | # To learn more, check out the guide: 9 | # 10 | # http://norman.github.io/friendly_id/file.Guide.html 11 | 12 | FriendlyId.defaults do |config| 13 | # ## Reserved Words 14 | # 15 | # Some words could conflict with Rails's routes when used as slugs, or are 16 | # undesirable to allow as slugs. Edit this list as needed for your app. 17 | config.use :reserved 18 | 19 | config.reserved_words = %w(new edit index session login logout users admin 20 | stylesheets assets javascripts images) 21 | 22 | # This adds an option to treat reserved words as conflicts rather than exceptions. 23 | # When there is no good candidate, a UUID will be appended, matching the existing 24 | # conflict behavior. 25 | 26 | # config.treat_reserved_as_conflict = true 27 | 28 | # ## Friendly Finders 29 | # 30 | # Uncomment this to use friendly finders in all models. By default, if 31 | # you wish to find a record by its friendly id, you must do: 32 | # 33 | # MyModel.friendly.find('foo') 34 | # 35 | # If you uncomment this, you can do: 36 | # 37 | # MyModel.find('foo') 38 | # 39 | # This is significantly more convenient but may not be appropriate for 40 | # all applications, so you must explicity opt-in to this behavior. You can 41 | # always also configure it on a per-model basis if you prefer. 42 | # 43 | # Something else to consider is that using the :finders addon boosts 44 | # performance because it will avoid Rails-internal code that makes runtime 45 | # calls to `Module.extend`. 46 | # 47 | # config.use :finders 48 | # 49 | # ## Slugs 50 | # 51 | # Most applications will use the :slugged module everywhere. If you wish 52 | # to do so, uncomment the following line. 53 | # 54 | # config.use :slugged 55 | # 56 | # By default, FriendlyId's :slugged addon expects the slug column to be named 57 | # 'slug', but you can change it if you wish. 58 | # 59 | # config.slug_column = 'slug' 60 | # 61 | # By default, slug has no size limit, but you can change it if you wish. 62 | # 63 | # config.slug_limit = 255 64 | # 65 | # When FriendlyId can not generate a unique ID from your base method, it appends 66 | # a UUID, separated by a single dash. You can configure the character used as the 67 | # separator. If you're upgrading from FriendlyId 4, you may wish to replace this 68 | # with two dashes. 69 | # 70 | # config.sequence_separator = '-' 71 | # 72 | # Note that you must use the :slugged addon **prior** to the line which 73 | # configures the sequence separator, or else FriendlyId will raise an undefined 74 | # method error. 75 | # 76 | # ## Tips and Tricks 77 | # 78 | # ### Controlling when slugs are generated 79 | # 80 | # As of FriendlyId 5.0, new slugs are generated only when the slug field is 81 | # nil, but if you're using a column as your base method can change this 82 | # behavior by overriding the `should_generate_new_friendly_id?` method that 83 | # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave 84 | # more like 4.0. 85 | # Note: Use(include) Slugged module in the config if using the anonymous module. 86 | # If you have `friendly_id :name, use: slugged` in the model, Slugged module 87 | # is included after the anonymous module defined in the initializer, so it 88 | # overrides the `should_generate_new_friendly_id?` method from the anonymous module. 89 | # 90 | # config.use :slugged 91 | # config.use Module.new { 92 | # def should_generate_new_friendly_id? 93 | # slug.blank? || _changed? 94 | # end 95 | # } 96 | # 97 | # FriendlyId uses Rails's `parameterize` method to generate slugs, but for 98 | # languages that don't use the Roman alphabet, that's not usually sufficient. 99 | # Here we use the Babosa library to transliterate Russian Cyrillic slugs to 100 | # ASCII. If you use this, don't forget to add "babosa" to your Gemfile. 101 | # 102 | # config.use Module.new { 103 | # def normalize_friendly_id(text) 104 | # text.to_slug.normalize! :transliterations => [:russian, :latin] 105 | # end 106 | # } 107 | end 108 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/simple_discussion.rb: -------------------------------------------------------------------------------- 1 | # https://github.com/excid3/simple_discussion#email-and-slack-notifications 2 | 3 | SimpleDiscussion.setup do |config| 4 | config.send_email_notifications = true # Default: true 5 | config.send_slack_notifications = false # Default: true 6 | end 7 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/heartcombo/devise/wiki/I18n 2 | 3 | en: 4 | devise: 5 | confirmations: 6 | confirmed: "Your email address has been successfully confirmed." 7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." 8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." 9 | failure: 10 | already_authenticated: "You are already signed in." 11 | inactive: "Your account is not activated yet." 12 | invalid: "Invalid %{authentication_keys} or password." 13 | locked: "Your account is locked." 14 | last_attempt: "You have one more attempt before your account is locked." 15 | not_found_in_database: "Invalid %{authentication_keys} or password." 16 | timeout: "Your session expired. Please sign in again to continue." 17 | unauthenticated: "You need to sign in or sign up before continuing." 18 | unconfirmed: "You have to confirm your email address before continuing." 19 | mailer: 20 | confirmation_instructions: 21 | subject: "Confirmation instructions" 22 | reset_password_instructions: 23 | subject: "Reset password instructions" 24 | unlock_instructions: 25 | subject: "Unlock instructions" 26 | email_changed: 27 | subject: "Email Changed" 28 | password_change: 29 | subject: "Password Changed" 30 | omniauth_callbacks: 31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"." 32 | success: "Successfully authenticated from %{kind} account." 33 | passwords: 34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." 35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." 36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." 37 | updated: "Your password has been changed successfully. You are now signed in." 38 | updated_not_active: "Your password has been changed successfully." 39 | registrations: 40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." 41 | signed_up: "Welcome! You have signed up successfully." 42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." 43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." 44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." 45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address." 46 | updated: "Your account has been updated successfully." 47 | updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again" 48 | sessions: 49 | signed_in: "Signed in successfully." 50 | signed_out: "Signed out successfully." 51 | already_signed_out: "Signed out successfully." 52 | unlocks: 53 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 54 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 55 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 56 | errors: 57 | messages: 58 | already_confirmed: "was already confirmed, please try signing in" 59 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 60 | expired: "has expired, please request a new one" 61 | not_found: "not found" 62 | not_locked: "was not locked" 63 | not_saved: 64 | one: "1 error prohibited this %{resource} from being saved:" 65 | other: "%{count} errors prohibited this %{resource} from being saved:" 66 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 12 | # 13 | port ENV.fetch("PORT") { 3000 } 14 | 15 | # Specifies the `environment` that Puma will run in. 16 | # 17 | environment ENV.fetch("RAILS_ENV") { "development" } 18 | 19 | # Specifies the `pidfile` that Puma will use. 20 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 21 | 22 | # Specifies the number of `workers` to boot in clustered mode. 23 | # Workers are forked web server processes. If using threads and workers together 24 | # the concurrency of the application would be max `threads` * `workers`. 25 | # Workers do not work on JRuby or Windows (both of which do not support 26 | # processes). 27 | # 28 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 29 | 30 | # Use the `preload_app!` method when specifying a `workers` number. 31 | # This directive tells Puma to first boot the application and load code 32 | # before forking the application. This takes advantage of Copy On Write 33 | # process behavior so workers use less memory. 34 | # 35 | # preload_app! 36 | 37 | # Allow puma to be restarted by `rails restart` command. 38 | plugin :tmp_restart 39 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | require 'sidekiq/web' 2 | 3 | Rails.application.routes.draw do 4 | resources :jobs 5 | authenticate :user, lambda { |u| u.admin? } do 6 | mount Sidekiq::Web => '/sidekiq' 7 | end 8 | 9 | mount SimpleDiscussion::Engine => "/forum" 10 | 11 | post "intents", to: "jobs#intents" 12 | 13 | devise_for :users 14 | root to: 'jobs#index' 15 | end 16 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | Spring.watch( 2 | ".ruby-version", 3 | ".rbenv-vars", 4 | "tmp/restart.txt", 5 | "tmp/caching-dev.txt" 6 | ) 7 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | const { VueLoaderPlugin } = require('vue-loader') 3 | const vue = require('./loaders/vue') 4 | 5 | environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin()) 6 | environment.loaders.prepend('vue', vue) 7 | module.exports = environment 8 | -------------------------------------------------------------------------------- /config/webpack/loaders/vue.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | test: /\.vue(\.erb)?$/, 3 | use: [{ 4 | loader: 'vue-loader' 5 | }] 6 | } 7 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_root_path: public 7 | public_output_path: packs 8 | cache_path: tmp/cache/webpacker 9 | check_yarn_integrity: false 10 | webpack_compile_output: true 11 | 12 | # Additional paths webpack should lookup modules 13 | # ['app/assets', 'engine/foo/app/assets'] 14 | resolved_paths: [] 15 | 16 | # Reload manifest.json on all requests so we reload latest compiled packs 17 | cache_manifest: false 18 | 19 | # Extract and emit a css file 20 | extract_css: false 21 | 22 | static_assets_extensions: 23 | - .jpg 24 | - .jpeg 25 | - .png 26 | - .gif 27 | - .tiff 28 | - .ico 29 | - .svg 30 | - .eot 31 | - .otf 32 | - .ttf 33 | - .woff 34 | - .woff2 35 | 36 | extensions: 37 | - .vue 38 | - .mjs 39 | - .js 40 | - .sass 41 | - .scss 42 | - .css 43 | - .module.sass 44 | - .module.scss 45 | - .module.css 46 | - .png 47 | - .svg 48 | - .gif 49 | - .jpeg 50 | - .jpg 51 | 52 | development: 53 | <<: *default 54 | compile: true 55 | 56 | # Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules 57 | check_yarn_integrity: true 58 | 59 | # Reference: https://webpack.js.org/configuration/dev-server/ 60 | dev_server: 61 | https: false 62 | host: localhost 63 | port: 3035 64 | public: localhost:3035 65 | hmr: false 66 | # Inline should be set to true if using HMR 67 | inline: true 68 | overlay: true 69 | compress: true 70 | disable_host_check: true 71 | use_local_ip: false 72 | quiet: false 73 | pretty: false 74 | headers: 75 | 'Access-Control-Allow-Origin': '*' 76 | watch_options: 77 | ignored: '**/node_modules/**' 78 | 79 | 80 | test: 81 | <<: *default 82 | compile: true 83 | 84 | # Compile test packs to a separate directory 85 | public_output_path: packs-test 86 | 87 | production: 88 | <<: *default 89 | 90 | # Production depends on precompilation of packs prior to booting for performance. 91 | compile: false 92 | 93 | # Extract and emit a css file 94 | extract_css: true 95 | 96 | # Cache manifest.json for performance 97 | cache_manifest: true 98 | -------------------------------------------------------------------------------- /db/migrate/20200725185854_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DeviseCreateUsers < ActiveRecord::Migration[6.0] 4 | def change 5 | create_table :users do |t| 6 | ## Database authenticatable 7 | t.string :email, null: false, default: "" 8 | t.string :encrypted_password, null: false, default: "" 9 | 10 | ## Recoverable 11 | t.string :reset_password_token 12 | t.datetime :reset_password_sent_at 13 | 14 | ## Rememberable 15 | t.datetime :remember_created_at 16 | 17 | ## Trackable 18 | # t.integer :sign_in_count, default: 0, null: false 19 | # t.datetime :current_sign_in_at 20 | # t.datetime :last_sign_in_at 21 | # t.string :current_sign_in_ip 22 | # t.string :last_sign_in_ip 23 | 24 | ## Confirmable 25 | t.string :confirmation_token 26 | t.datetime :confirmed_at 27 | t.datetime :confirmation_sent_at 28 | t.string :unconfirmed_email # Only if using reconfirmable 29 | 30 | ## Lockable 31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 32 | # t.string :unlock_token # Only if unlock strategy is :email or :both 33 | # t.datetime :locked_at 34 | 35 | t.string :first_name 36 | t.string :last_name 37 | t.boolean :admin, default: false 38 | 39 | t.timestamps null: false 40 | end 41 | 42 | add_index :users, :email, unique: true 43 | add_index :users, :reset_password_token, unique: true 44 | add_index :users, :confirmation_token, unique: true 45 | # add_index :users, :unlock_token, unique: true 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /db/migrate/20200725185902_create_friendly_id_slugs.rb: -------------------------------------------------------------------------------- 1 | MIGRATION_CLASS = 2 | if ActiveRecord::VERSION::MAJOR >= 5 3 | ActiveRecord::Migration["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"] 4 | else 5 | ActiveRecord::Migration 6 | end 7 | 8 | class CreateFriendlyIdSlugs < MIGRATION_CLASS 9 | def change 10 | create_table :friendly_id_slugs do |t| 11 | t.string :slug, :null => false 12 | t.integer :sluggable_id, :null => false 13 | t.string :sluggable_type, :limit => 50 14 | t.string :scope 15 | t.datetime :created_at 16 | end 17 | add_index :friendly_id_slugs, [:sluggable_type, :sluggable_id] 18 | add_index :friendly_id_slugs, [:slug, :sluggable_type], length: { slug: 140, sluggable_type: 50 } 19 | add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /db/migrate/20200725192551_create_forum_categories.simple_discussion.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from simple_discussion (originally 20170417012930) 2 | class CreateForumCategories < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :forum_categories do |t| 5 | t.string :name, null: false 6 | t.string :slug, null: false 7 | t.string :color, default: "000000" 8 | 9 | t.timestamps 10 | end 11 | 12 | ForumCategory.reset_column_information 13 | 14 | ForumCategory.create( 15 | name: "General", 16 | color: "#4ea1d3", 17 | ) 18 | 19 | ForumCategory.create( 20 | name: "Feedback", 21 | color: "#16bc9c", 22 | ) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /db/migrate/20200725192552_create_forum_threads.simple_discussion.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from simple_discussion (originally 20170417012931) 2 | class CreateForumThreads < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :forum_threads do |t| 5 | t.references :forum_category, foreign_key: true 6 | t.references :user, foreign_key: true 7 | t.string :title, null: false 8 | t.string :slug, null: false 9 | t.integer :forum_posts_count, default: 0 10 | t.boolean :pinned, default: false 11 | t.boolean :solved, default: false 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20200725192553_create_forum_posts.simple_discussion.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from simple_discussion (originally 20170417012932) 2 | class CreateForumPosts < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :forum_posts do |t| 5 | t.references :forum_thread, foreign_key: true 6 | t.references :user, foreign_key: true 7 | t.text :body 8 | t.boolean :solved, default: false 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20200725192554_create_forum_subscriptions.simple_discussion.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from simple_discussion (originally 20170417012933) 2 | class CreateForumSubscriptions < ActiveRecord::Migration[4.2] 3 | def change 4 | create_table :forum_subscriptions do |t| 5 | t.references :forum_thread, foreign_key: true 6 | t.references :user, foreign_key: true 7 | t.string :subscription_type 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20200725192722_add_moderator_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddModeratorToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :moderator, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200730193200_create_jobs.rb: -------------------------------------------------------------------------------- 1 | class CreateJobs < ActiveRecord::Migration[6.0] 2 | def change 3 | create_table :jobs do |t| 4 | t.string :years_of_experience 5 | t.string :title 6 | t.string :status, default: "pending" 7 | t.string :link_to_apply 8 | t.string :compensation_range 9 | t.string :compensation_type 10 | t.string :estimated_hours 11 | t.string :company_website 12 | t.string :company_name 13 | t.string :headquarters 14 | t.string :upsell_type 15 | t.references :user, null: false, foreign_key: true 16 | t.integer :price 17 | t.datetime :published_at 18 | t.datetime :featured_until 19 | t.boolean :remote, default: false 20 | t.boolean :featured, default: false 21 | 22 | t.timestamps 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /db/migrate/20200730193611_create_active_storage_tables.active_storage.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from active_storage (originally 20170806125915) 2 | class CreateActiveStorageTables < ActiveRecord::Migration[5.2] 3 | def change 4 | create_table :active_storage_blobs do |t| 5 | t.string :key, null: false 6 | t.string :filename, null: false 7 | t.string :content_type 8 | t.text :metadata 9 | t.bigint :byte_size, null: false 10 | t.string :checksum, null: false 11 | t.datetime :created_at, null: false 12 | 13 | t.index [ :key ], unique: true 14 | end 15 | 16 | create_table :active_storage_attachments do |t| 17 | t.string :name, null: false 18 | t.references :record, null: false, polymorphic: true, index: false 19 | t.references :blob, null: false 20 | 21 | t.datetime :created_at, null: false 22 | 23 | t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true 24 | t.foreign_key :active_storage_blobs, column: :blob_id 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /db/migrate/20200730193612_create_action_text_tables.action_text.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from action_text (originally 20180528164100) 2 | class CreateActionTextTables < ActiveRecord::Migration[6.0] 3 | def change 4 | create_table :action_text_rich_texts do |t| 5 | t.string :name, null: false 6 | t.text :body, size: :long 7 | t.references :record, null: false, polymorphic: true, index: false 8 | 9 | t.timestamps 10 | 11 | t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20200730194438_add_personas_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddPersonasToUsers < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :users, :developer, :boolean, default: false 4 | add_column :users, :employer, :boolean, default: false 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20200805150042_add_slug_to_jobs.rb: -------------------------------------------------------------------------------- 1 | class AddSlugToJobs < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :jobs, :slug, :string 4 | add_index :jobs, :slug, unique: true 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210228175314_add_email_to_jobs.rb: -------------------------------------------------------------------------------- 1 | class AddEmailToJobs < ActiveRecord::Migration[6.0] 2 | def change 3 | add_column :jobs, :email, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Characte#r.create(name: 'Luke', movie: movies.first) 8 | 9 | User.delete_all 10 | Job.delete_all 11 | 12 | admin = User.new(email: "andy@web-crunch.com", password: "password", password_confirmation: "password", admin: true, developer: true, employer: true) 13 | admin.skip_confirmation! 14 | admin.save 15 | 16 | developer = User.new(email: "developer@web-crunch.com", password: "password", password_confirmation: "password", admin: false, developer: true, employer: false) 17 | developer.skip_confirmation! 18 | developer.save 19 | 20 | employer = User.new(email: "employer@web-crunch.com", password: "password", password_confirmation: "password", admin: false, developer: false, employer: true) 21 | employer.skip_confirmation! 22 | employer.save 23 | 24 | Job.create!( 25 | company_name: "Google", 26 | company_website: "https://google.com", 27 | compensation_range: "170,000 - 180,000", 28 | compensation_type: "Full-time", 29 | estimated_hours: nil, 30 | featured: false, 31 | featured_until: nil, 32 | headquarters: "California", 33 | link_to_apply: "https://google.com/apply", 34 | price: 199, 35 | published_at: DateTime.now, 36 | remote: false, 37 | slug: "rails-developer-at-google", 38 | status: "published", 39 | title: "Rails developer at Google", 40 | upsell_type: nil, 41 | years_of_experience: "5", 42 | user_id: admin.id, 43 | description: Faker::Hipster.paragraph, 44 | company_description: Faker::Hipster.paragraph 45 | ) 46 | 47 | Job.create!( 48 | company_name: "Dropbox", 49 | company_website: "https://dropbox.com", 50 | compensation_range: nil, 51 | compensation_type: "Contract", 52 | estimated_hours: "more than 100", 53 | featured: true, 54 | featured_until: 1.week.from_now.beginning_of_day, 55 | headquarters: "California", 56 | link_to_apply: "https://dropbox.com/apply", 57 | price: 299, 58 | published_at: DateTime.now, 59 | remote: true, 60 | slug: "ruby-developer-at-dropbox", 61 | status: "published", 62 | title: "Ruby developer at Dropbox", 63 | upsell_type: "best", 64 | years_of_experience: "5", 65 | user_id: employer.id, 66 | description: Faker::Hipster.paragraph, 67 | company_description: Faker::Hipster.paragraph 68 | ) 69 | 70 | Job.create!( 71 | company_name: "Apple", 72 | company_website: "https://apple.com", 73 | compensation_range: "240,000 - 250,000", 74 | compensation_type: "Full-time", 75 | estimated_hours: nil, 76 | featured: false, 77 | featured_until: nil, 78 | headquarters: "California", 79 | link_to_apply: "https://apple.com/apply", 80 | price: 199, 81 | published_at: DateTime.now, 82 | remote: false, 83 | slug: "ruby-developer-at-apple", 84 | status: "published", 85 | title: "Ruby developer at Apple", 86 | upsell_type: nil, 87 | years_of_experience: "8", 88 | user_id: employer.id, 89 | description: Faker::Hipster.paragraph, 90 | company_description: Faker::Hipster.paragraph 91 | ) 92 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/tasks/auto_annotate_models.rake: -------------------------------------------------------------------------------- 1 | # NOTE: only doing this in development as some production environments (Heroku) 2 | # NOTE: are sensitive to local FS writes, and besides -- it's just not proper 3 | # NOTE: to have a dev-mode tool do its thing in production. 4 | if Rails.env.development? 5 | require 'annotate' 6 | task :set_annotation_options do 7 | # You can override any of these by setting an environment variable of the 8 | # same name. 9 | Annotate.set_defaults( 10 | 'active_admin' => 'false', 11 | 'additional_file_patterns' => [], 12 | 'routes' => 'false', 13 | 'models' => 'true', 14 | 'position_in_routes' => 'before', 15 | 'position_in_class' => 'before', 16 | 'position_in_test' => 'before', 17 | 'position_in_fixture' => 'before', 18 | 'position_in_factory' => 'before', 19 | 'position_in_serializer' => 'before', 20 | 'show_foreign_keys' => 'true', 21 | 'show_complete_foreign_keys' => 'false', 22 | 'show_indexes' => 'true', 23 | 'simple_indexes' => 'false', 24 | 'model_dir' => 'app/models', 25 | 'root_dir' => '', 26 | 'include_version' => 'false', 27 | 'require' => '', 28 | 'exclude_tests' => 'false', 29 | 'exclude_fixtures' => 'false', 30 | 'exclude_factories' => 'false', 31 | 'exclude_serializers' => 'false', 32 | 'exclude_scaffolds' => 'true', 33 | 'exclude_controllers' => 'true', 34 | 'exclude_helpers' => 'true', 35 | 'exclude_sti_subclasses' => 'false', 36 | 'ignore_model_sub_dir' => 'false', 37 | 'ignore_columns' => nil, 38 | 'ignore_routes' => nil, 39 | 'ignore_unknown_models' => 'false', 40 | 'hide_limit_column_types' => 'integer,bigint,boolean', 41 | 'hide_default_column_types' => 'json,jsonb,hstore', 42 | 'skip_on_db_migrate' => 'false', 43 | 'format_bare' => 'true', 44 | 'format_rdoc' => 'false', 45 | 'format_yard' => 'false', 46 | 'format_markdown' => 'false', 47 | 'sort' => 'false', 48 | 'force' => 'false', 49 | 'frozen' => 'false', 50 | 'classified_sort' => 'true', 51 | 'trace' => 'false', 52 | 'wrapper_open' => nil, 53 | 'wrapper_close' => nil, 54 | 'with_comment' => 'true' 55 | ) 56 | end 57 | 58 | Annotate.load_tasks 59 | end 60 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "railsdevs", 3 | "private": true, 4 | "dependencies": { 5 | "@fullhuman/postcss-purgecss": "^2.3.0", 6 | "@rails/actioncable": "^6.0.0", 7 | "@rails/actiontext": "^6.0.3-2", 8 | "@rails/activestorage": "^6.0.0", 9 | "@rails/ujs": "^6.0.0", 10 | "@rails/webpacker": "4.2.2", 11 | "@tailwindcss/typography": "^0.2.0", 12 | "axios": "^0.21.1", 13 | "ky": "^0.23.0", 14 | "node-forge": "^0.10.0", 15 | "stimulus": "^1.1.1", 16 | "tailwindcss": "^1.5.2", 17 | "trix": "^1.2.0", 18 | "turbolinks": "^5.2.0", 19 | "vue": "^2.6.11", 20 | "vue-loader": "^15.9.3", 21 | "vue-template-compiler": "^2.6.11", 22 | "vue-trix": "^1.1.11", 23 | "vue-turbolinks": "^2.1.0", 24 | "vuelidate": "^0.7.6" 25 | }, 26 | "version": "0.1.0", 27 | "devDependencies": { 28 | "webpack-dev-server": "^3.11.0" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | let environment = { 2 | plugins: [ 3 | require('tailwindcss')('./app/javascript/stylesheets/tailwind.config.js'), 4 | require('autoprefixer'), 5 | require('postcss-import'), 6 | require('postcss-flexbugs-fixes'), 7 | require('postcss-preset-env')({ 8 | autoprefixer: { 9 | flexbox: 'no-2009' 10 | }, 11 | stage: 3 12 | }) 13 | ] 14 | }; 15 | 16 | // Only run PurgeCSS in production 17 | if (process.env.RAILS_ENV === 'production') { 18 | environment.plugins.push( 19 | require('@fullhuman/postcss-purgecss')({ 20 | content: [ 21 | './app/**/*.html.erb', 22 | './app/helpers/**/*.rb', 23 | './app/javascript/**/*.js', 24 | './app/javascript/**/*.vue' 25 | ], 26 | defaultExtractor: (content) => content.match(/[A-Za-z0-9-_:/]+/g) || [] 27 | }) 28 | ); 29 | } 30 | 31 | module.exports = environment; 32 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/storage/.keep -------------------------------------------------------------------------------- /test/application_system_test_case.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase 4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400] 5 | end 6 | -------------------------------------------------------------------------------- /test/channels/application_cable/connection_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase 4 | # test "connects with cookies" do 5 | # cookies.signed[:user_id] = 42 6 | # 7 | # connect 8 | # 9 | # assert_equal connection.user_id, "42" 10 | # end 11 | end 12 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/jobs_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class JobsControllerTest < ActionDispatch::IntegrationTest 4 | setup do 5 | @job = jobs(:one) 6 | end 7 | 8 | test "should get index" do 9 | get jobs_url 10 | assert_response :success 11 | end 12 | 13 | test "should get new" do 14 | get new_job_url 15 | assert_response :success 16 | end 17 | 18 | test "should create job" do 19 | assert_difference('Job.count') do 20 | post jobs_url, params: { job: { company_name: @job.company_name, company_website: @job.company_website, compensation_range: @job.compensation_range, link_to_apply: @job.link_to_apply, remote: @job.remote, role_type: @job.role_type, title: @job.title, user_id: @job.user_id, years_of_experience: @job.years_of_experience } } 21 | end 22 | 23 | assert_redirected_to job_url(Job.last) 24 | end 25 | 26 | test "should show job" do 27 | get job_url(@job) 28 | assert_response :success 29 | end 30 | 31 | test "should get edit" do 32 | get edit_job_url(@job) 33 | assert_response :success 34 | end 35 | 36 | test "should update job" do 37 | patch job_url(@job), params: { job: { company_name: @job.company_name, company_website: @job.company_website, compensation_range: @job.compensation_range, link_to_apply: @job.link_to_apply, remote: @job.remote, role_type: @job.role_type, title: @job.title, user_id: @job.user_id, years_of_experience: @job.years_of_experience } } 38 | assert_redirected_to job_url(@job) 39 | end 40 | 41 | test "should destroy job" do 42 | assert_difference('Job.count', -1) do 43 | delete job_url(@job) 44 | end 45 | 46 | assert_redirected_to jobs_url 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/action_text/rich_texts.yml: -------------------------------------------------------------------------------- 1 | # one: 2 | # record: name_of_fixture (ClassOfFixture) 3 | # name: content 4 | # body:

In a million stars!

5 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/fixtures/jobs.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: jobs 4 | # 5 | # id :bigint not null, primary key 6 | # company_name :string 7 | # company_website :string 8 | # compensation_range :string 9 | # compensation_type :string 10 | # email :string 11 | # estimated_hours :string 12 | # featured :boolean default(FALSE) 13 | # featured_until :datetime 14 | # headquarters :string 15 | # link_to_apply :string 16 | # price :integer 17 | # published_at :datetime 18 | # remote :boolean default(FALSE) 19 | # slug :string 20 | # status :string default("pending") 21 | # title :string 22 | # upsell_type :string 23 | # years_of_experience :string 24 | # created_at :datetime not null 25 | # updated_at :datetime not null 26 | # user_id :bigint not null 27 | # 28 | # Indexes 29 | # 30 | # index_jobs_on_slug (slug) UNIQUE 31 | # index_jobs_on_user_id (user_id) 32 | # 33 | # Foreign Keys 34 | # 35 | # fk_rails_... (user_id => users.id) 36 | # 37 | 38 | one: 39 | title: MyString 40 | link_to_apply: MyString 41 | company_name: MyString 42 | company_website: MyString 43 | role_type: MyString 44 | compensation_range: MyString 45 | remote: false 46 | years_of_experience: MyString 47 | user: one 48 | 49 | two: 50 | title: MyString 51 | link_to_apply: MyString 52 | company_name: MyString 53 | company_website: MyString 54 | role_type: MyString 55 | compensation_range: MyString 56 | remote: false 57 | years_of_experience: MyString 58 | user: two 59 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: users 4 | # 5 | # id :bigint not null, primary key 6 | # admin :boolean default(FALSE) 7 | # confirmation_sent_at :datetime 8 | # confirmation_token :string 9 | # confirmed_at :datetime 10 | # developer :boolean default(FALSE) 11 | # email :string default(""), not null 12 | # employer :boolean default(FALSE) 13 | # encrypted_password :string default(""), not null 14 | # first_name :string 15 | # last_name :string 16 | # moderator :boolean 17 | # remember_created_at :datetime 18 | # reset_password_sent_at :datetime 19 | # reset_password_token :string 20 | # unconfirmed_email :string 21 | # created_at :datetime not null 22 | # updated_at :datetime not null 23 | # 24 | # Indexes 25 | # 26 | # index_users_on_confirmation_token (confirmation_token) UNIQUE 27 | # index_users_on_email (email) UNIQUE 28 | # index_users_on_reset_password_token (reset_password_token) UNIQUE 29 | # 30 | 31 | # This model initially had no columns defined. If you add columns to the 32 | # model remove the '{}' from the fixture names and add the columns immediately 33 | # below each fixture, per the syntax in the comments below 34 | # 35 | one: {} 36 | # column: value 37 | # 38 | two: {} 39 | # column: value 40 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/models/.keep -------------------------------------------------------------------------------- /test/models/job_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: jobs 4 | # 5 | # id :bigint not null, primary key 6 | # company_name :string 7 | # company_website :string 8 | # compensation_range :string 9 | # compensation_type :string 10 | # email :string 11 | # estimated_hours :string 12 | # featured :boolean default(FALSE) 13 | # featured_until :datetime 14 | # headquarters :string 15 | # link_to_apply :string 16 | # price :integer 17 | # published_at :datetime 18 | # remote :boolean default(FALSE) 19 | # slug :string 20 | # status :string default("pending") 21 | # title :string 22 | # upsell_type :string 23 | # years_of_experience :string 24 | # created_at :datetime not null 25 | # updated_at :datetime not null 26 | # user_id :bigint not null 27 | # 28 | # Indexes 29 | # 30 | # index_jobs_on_slug (slug) UNIQUE 31 | # index_jobs_on_user_id (user_id) 32 | # 33 | # Foreign Keys 34 | # 35 | # fk_rails_... (user_id => users.id) 36 | # 37 | require 'test_helper' 38 | 39 | class JobTest < ActiveSupport::TestCase 40 | # test "the truth" do 41 | # assert true 42 | # end 43 | end 44 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | # == Schema Information 2 | # 3 | # Table name: users 4 | # 5 | # id :bigint not null, primary key 6 | # admin :boolean default(FALSE) 7 | # confirmation_sent_at :datetime 8 | # confirmation_token :string 9 | # confirmed_at :datetime 10 | # developer :boolean default(FALSE) 11 | # email :string default(""), not null 12 | # employer :boolean default(FALSE) 13 | # encrypted_password :string default(""), not null 14 | # first_name :string 15 | # last_name :string 16 | # moderator :boolean 17 | # remember_created_at :datetime 18 | # reset_password_sent_at :datetime 19 | # reset_password_token :string 20 | # unconfirmed_email :string 21 | # created_at :datetime not null 22 | # updated_at :datetime not null 23 | # 24 | # Indexes 25 | # 26 | # index_users_on_confirmation_token (confirmation_token) UNIQUE 27 | # index_users_on_email (email) UNIQUE 28 | # index_users_on_reset_password_token (reset_password_token) UNIQUE 29 | # 30 | require 'test_helper' 31 | 32 | class UserTest < ActiveSupport::TestCase 33 | # test "the truth" do 34 | # assert true 35 | # end 36 | end 37 | -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/test/system/.keep -------------------------------------------------------------------------------- /test/system/jobs_test.rb: -------------------------------------------------------------------------------- 1 | require "application_system_test_case" 2 | 3 | class JobsTest < ApplicationSystemTestCase 4 | setup do 5 | @job = jobs(:one) 6 | end 7 | 8 | test "visiting the index" do 9 | visit jobs_url 10 | assert_selector "h1", text: "Jobs" 11 | end 12 | 13 | test "creating a Job" do 14 | visit jobs_url 15 | click_on "New Job" 16 | 17 | fill_in "Company name", with: @job.company_name 18 | fill_in "Company website", with: @job.company_website 19 | fill_in "Compensation range", with: @job.compensation_range 20 | fill_in "Link to apply", with: @job.link_to_apply 21 | check "Remote" if @job.remote 22 | fill_in "Role type", with: @job.role_type 23 | fill_in "Title", with: @job.title 24 | fill_in "User", with: @job.user_id 25 | fill_in "Years of experience", with: @job.years_of_experience 26 | click_on "Create Job" 27 | 28 | assert_text "Job was successfully created" 29 | click_on "Back" 30 | end 31 | 32 | test "updating a Job" do 33 | visit jobs_url 34 | click_on "Edit", match: :first 35 | 36 | fill_in "Company name", with: @job.company_name 37 | fill_in "Company website", with: @job.company_website 38 | fill_in "Compensation range", with: @job.compensation_range 39 | fill_in "Link to apply", with: @job.link_to_apply 40 | check "Remote" if @job.remote 41 | fill_in "Role type", with: @job.role_type 42 | fill_in "Title", with: @job.title 43 | fill_in "User", with: @job.user_id 44 | fill_in "Years of experience", with: @job.years_of_experience 45 | click_on "Update Job" 46 | 47 | assert_text "Job was successfully updated" 48 | click_on "Back" 49 | end 50 | 51 | test "destroying a Job" do 52 | visit jobs_url 53 | page.accept_confirm do 54 | click_on "Destroy", match: :first 55 | end 56 | 57 | assert_text "Job was successfully destroyed" 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require_relative '../config/environment' 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Run tests in parallel with specified workers 7 | parallelize(workers: :number_of_processors) 8 | 9 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/tmp/.keep -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/tmp/pids/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/justalever/railsdevs_public/3d9a5ebdc78d1a16b041e9133498b7d6a1ccebc6/vendor/.keep --------------------------------------------------------------------------------