├── .gitattributes ├── .gitignore ├── .rubocop.yml ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── Procfile.dev ├── README.md ├── Rakefile ├── _banner ├── app ├── assets │ ├── builds │ │ └── .keep │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── .keep │ │ ├── Socialize.png │ │ ├── ad-1 (1).jpg │ │ ├── ad-1 (2).jpg │ │ ├── ad-1 (3).jpg │ │ ├── dev-work-icon.png │ │ ├── dev-work-navbar.png │ │ ├── logo.png │ │ ├── newlogo.png │ │ ├── userphoto.jpg │ │ ├── userphoto_square.jpg │ │ └── wallpaper.jpg │ └── stylesheets │ │ ├── application.scss │ │ ├── components │ │ ├── _address_autocomplete.scss │ │ ├── _alert.scss │ │ ├── _avatar.scss │ │ ├── _banner.scss │ │ ├── _button.scss │ │ ├── _footer.scss │ │ ├── _form_legend_clear.scss │ │ ├── _index.scss │ │ ├── _map.scss │ │ └── _sidebar.scss │ │ ├── config │ │ ├── _bootstrap_variables.scss │ │ ├── _colors.scss │ │ └── _fonts.scss │ │ └── pages │ │ ├── _devise.scss │ │ ├── _home.scss │ │ ├── _index.scss │ │ ├── _my_offers.scss │ │ └── _show.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── application_controller.rb │ ├── callbacks_controller.rb │ ├── challenges_controller.rb │ ├── concerns │ │ └── .keep │ ├── filters_controller.rb │ ├── offers_controller.rb │ ├── pages_controller.rb │ ├── registrations_controller.rb │ └── users_controller.rb ├── helpers │ └── application_helper.rb ├── javascript │ ├── application.js │ └── controllers │ │ ├── address_autocomplete_controller.js │ │ ├── application.js │ │ ├── hello_controller.js │ │ ├── index.js │ │ ├── map_controller.js │ │ └── sidebar_controller.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── challenge.rb │ ├── comment.rb │ ├── concerns │ │ └── .keep │ ├── filter.rb │ ├── offer.rb │ └── user.rb ├── policies │ ├── application_policy.rb │ ├── challenge_policy.rb │ └── offer_policy.rb └── views │ ├── challenges │ ├── _form.html.erb │ ├── _info_window.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.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 │ │ └── _links.html.erb │ └── unlocks │ │ └── new.html.erb │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ ├── offers │ ├── index.html.erb │ ├── review.html.erb │ └── show.html.erb │ ├── pages │ └── home.html.erb │ └── shared │ ├── _banner.html.erb │ ├── _button.html.erb │ ├── _flashes.html.erb │ ├── _footer.html.erb │ ├── _form.html.erb │ ├── _index-cards.html.erb │ ├── _navbar.html.erb │ └── _sidebar.html.erb ├── bin ├── bundle ├── dev ├── rails ├── rake └── setup ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── assets.rb │ ├── content_security_policy.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── geocoder.rb │ ├── inflections.rb │ ├── permissions_policy.rb │ ├── simple_form.rb │ └── simple_form_bootstrap.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ └── simple_form.en.yml ├── puma.rb ├── routes.rb └── storage.yml ├── db ├── migrate │ ├── 20220829123454_create_users.rb │ ├── 20220829123545_create_filters.rb │ ├── 20220829124023_create_challenges.rb │ ├── 20220829135339_add_details_to_users.rb │ ├── 20220829135415_add_details_to_filters.rb │ ├── 20220829135525_add_details_to_challenges.rb │ ├── 20220829141529_add_devise_to_users.rb │ ├── 20220831095635_create_active_storage_tables.active_storage.rb │ ├── 20220831100114_add_image_to_users.rb │ ├── 20220901112950_addingcoordinates.rb │ ├── 20220901113442_add_location.rb │ ├── 20220901152701_add_city_to_challenges.rb │ ├── 20220902104452_remove_image_url_from_users.rb │ ├── 20220905195945_create_comments.rb │ ├── 20220905200231_add_content_to_comment.rb │ ├── 20220905200356_rename_comment_to_content.rb │ ├── 20220928211345_add_omniauth_to_users.rb │ ├── 20220928221019_add_columns_to_users.rb │ ├── 20220930214131_create_offers.rb │ ├── 20220930215302_add_price_to_offers.rb │ ├── 20220930220534_add_offers_to_users.rb │ ├── 20220930220602_add_offers_to_challenges.rb │ └── 20221003065436_add_admin_to_users.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep ├── tasks │ └── .keep └── templates │ └── erb │ └── scaffold │ └── _form.html.erb ├── log └── .keep ├── package.json ├── 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 │ ├── challenges_controller_test.rb │ ├── filters_controller_test.rb │ ├── offers_controller_test.rb │ └── users_controller_test.rb ├── fixtures │ └── files │ │ └── .keep ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── challenge_test.rb │ ├── comment_test.rb │ ├── filter_test.rb │ ├── offer_test.rb │ └── user_test.rb ├── policies │ ├── challenge_policy_test.rb │ └── offer_policy_test.rb ├── system │ └── .keep └── test_helper.rb ├── tmp ├── .keep ├── pids │ └── .keep └── storage │ └── .keep ├── webpack.config.js └── yarn.lock /.gitattributes: -------------------------------------------------------------------------------- 1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files. 2 | 3 | db/schema.rb linguist-generated 4 | 5 | vendor/* linguist-vendored 6 | -------------------------------------------------------------------------------- /.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 all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore pidfiles, but keep the directory. 17 | /tmp/pids/* 18 | !/tmp/pids/ 19 | !/tmp/pids/.keep 20 | 21 | # Ignore uploaded files in development. 22 | /storage/* 23 | !/storage/.keep 24 | /tmp/storage/* 25 | !/tmp/storage/ 26 | !/tmp/storage/.keep 27 | 28 | /public/assets 29 | 30 | # Ignore master key for decrypting credentials and more. 31 | /config/master.key 32 | 33 | /app/assets/builds/* 34 | !/app/assets/builds/.keep 35 | 36 | /node_modules 37 | # Ignore .env file containing credentials. 38 | .env* 39 | 40 | # Ignore Mac and Linux file system files 41 | *.swp 42 | .DS_Store 43 | .env* 44 | # /config/initializers 45 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | AllCops: 2 | NewCops: enable 3 | Exclude: 4 | - 'bin/**/*' 5 | - 'db/**/*' 6 | - 'config/**/*' 7 | - 'node_modules/**/*' 8 | - 'script/**/*' 9 | - 'support/**/*' 10 | - 'tmp/**/*' 11 | - 'test/**/*' 12 | 13 | Style/ConditionalAssignment: 14 | Enabled: false 15 | Style/StringLiterals: 16 | Enabled: false 17 | Style/RedundantReturn: 18 | Enabled: false 19 | Style/Documentation: 20 | Enabled: false 21 | Style/WordArray: 22 | Enabled: false 23 | Metrics/AbcSize: 24 | Enabled: false 25 | Style/MutableConstant: 26 | Enabled: false 27 | Style/SignalException: 28 | Enabled: false 29 | Metrics/CyclomaticComplexity: 30 | Enabled: false 31 | Style/MissingRespondToMissing: 32 | Enabled: false 33 | Lint/MissingSuper: 34 | Enabled: false 35 | Style/FrozenStringLiteralComment: 36 | Enabled: false 37 | Layout/LineLength: 38 | Max: 120 39 | Style/EmptyMethod: 40 | Enabled: false 41 | Bundler/OrderedGems: 42 | Enabled: false 43 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.1.2 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby "3.1.2" 5 | 6 | gem "image_processing", ">= 1.2" 7 | 8 | # Random image gem 9 | gem "image_suckr" 10 | 11 | 12 | gem "dotenv-rails", groups: [:development, :test] 13 | # Font-awesome 14 | 15 | gem "font-awesome-rails" 16 | 17 | gem "geocoder" 18 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" 19 | gem "rails", "~> 7.0.3", ">= 7.0.3.1" 20 | 21 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] 22 | gem "sprockets-rails" 23 | 24 | # Use postgresql as the database for Active Record 25 | gem "pg", "~> 1.1" 26 | 27 | # Use the Puma web server [https://github.com/puma/puma] 28 | gem "puma", "~> 5.0" 29 | 30 | # Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails] 31 | gem "jsbundling-rails" 32 | 33 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] 34 | gem "turbo-rails" 35 | 36 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] 37 | gem "stimulus-rails" 38 | 39 | # Build JSON APIs with ease [https://github.com/rails/jbuilder] 40 | gem "jbuilder" 41 | 42 | 43 | # Use Redis adapter to run Action Cable in production 44 | # gem "redis", "~> 4.0" 45 | 46 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] 47 | # gem "kredis" 48 | 49 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] 50 | # gem "bcrypt", "~> 3.1.7" 51 | 52 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 53 | gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] 54 | 55 | # Reduces boot times through caching; required in config/boot.rb 56 | gem "bootsnap", require: false 57 | 58 | # Use Sass to process CSS 59 | gem "sassc-rails" 60 | 61 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] 62 | # gem "image_processing", "~> 1.2" 63 | 64 | gem "autoprefixer-rails" 65 | gem "font-awesome-sass", "~> 6.1" 66 | gem "simple_form", github: "heartcombo/simple_form" 67 | group :development, :test do 68 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem 69 | gem "debug", platforms: %i[ mri mingw x64_mingw ] 70 | gem "dotenv-rails" 71 | 72 | end 73 | 74 | gem "pundit" 75 | gem "devise" 76 | # gem 'omniauth' 77 | gem 'omniauth-github' 78 | gem "omniauth-rails_csrf_protection" 79 | gem 'faker', :git => 'https://github.com/faker-ruby/faker.git', :branch => 'master' 80 | gem "cloudinary" 81 | 82 | group :development do 83 | # Use console on exceptions pages [https://github.com/rails/web-console] 84 | gem "web-console" 85 | 86 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] 87 | # gem "rack-mini-profiler" 88 | 89 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] 90 | # gem "spring" 91 | end 92 | 93 | group :test do 94 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] 95 | gem "capybara" 96 | gem "selenium-webdriver" 97 | gem "webdrivers" 98 | end 99 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/faker-ruby/faker.git 3 | revision: efedb39cb752ef575f1f6af0fe944064d3bb379b 4 | branch: master 5 | specs: 6 | faker (2.23.0) 7 | i18n (>= 1.8.11, < 2) 8 | 9 | GIT 10 | remote: https://github.com/heartcombo/simple_form.git 11 | revision: 921ce9c3fc100e1737125ba1b5a2037c03f2de1b 12 | specs: 13 | simple_form (5.2.0) 14 | actionpack (>= 5.2) 15 | activemodel (>= 5.2) 16 | 17 | GEM 18 | remote: https://rubygems.org/ 19 | specs: 20 | actioncable (7.0.4.3) 21 | actionpack (= 7.0.4.3) 22 | activesupport (= 7.0.4.3) 23 | nio4r (~> 2.0) 24 | websocket-driver (>= 0.6.1) 25 | actionmailbox (7.0.4.3) 26 | actionpack (= 7.0.4.3) 27 | activejob (= 7.0.4.3) 28 | activerecord (= 7.0.4.3) 29 | activestorage (= 7.0.4.3) 30 | activesupport (= 7.0.4.3) 31 | mail (>= 2.7.1) 32 | net-imap 33 | net-pop 34 | net-smtp 35 | actionmailer (7.0.4.3) 36 | actionpack (= 7.0.4.3) 37 | actionview (= 7.0.4.3) 38 | activejob (= 7.0.4.3) 39 | activesupport (= 7.0.4.3) 40 | mail (~> 2.5, >= 2.5.4) 41 | net-imap 42 | net-pop 43 | net-smtp 44 | rails-dom-testing (~> 2.0) 45 | actionpack (7.0.4.3) 46 | actionview (= 7.0.4.3) 47 | activesupport (= 7.0.4.3) 48 | rack (~> 2.0, >= 2.2.0) 49 | rack-test (>= 0.6.3) 50 | rails-dom-testing (~> 2.0) 51 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 52 | actiontext (7.0.4.3) 53 | actionpack (= 7.0.4.3) 54 | activerecord (= 7.0.4.3) 55 | activestorage (= 7.0.4.3) 56 | activesupport (= 7.0.4.3) 57 | globalid (>= 0.6.0) 58 | nokogiri (>= 1.8.5) 59 | actionview (7.0.4.3) 60 | activesupport (= 7.0.4.3) 61 | builder (~> 3.1) 62 | erubi (~> 1.4) 63 | rails-dom-testing (~> 2.0) 64 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 65 | activejob (7.0.4.3) 66 | activesupport (= 7.0.4.3) 67 | globalid (>= 0.3.6) 68 | activemodel (7.0.4.3) 69 | activesupport (= 7.0.4.3) 70 | activerecord (7.0.4.3) 71 | activemodel (= 7.0.4.3) 72 | activesupport (= 7.0.4.3) 73 | activestorage (7.0.4.3) 74 | actionpack (= 7.0.4.3) 75 | activejob (= 7.0.4.3) 76 | activerecord (= 7.0.4.3) 77 | activesupport (= 7.0.4.3) 78 | marcel (~> 1.0) 79 | mini_mime (>= 1.1.0) 80 | activesupport (7.0.4.3) 81 | concurrent-ruby (~> 1.0, >= 1.0.2) 82 | i18n (>= 1.6, < 2) 83 | minitest (>= 5.1) 84 | tzinfo (~> 2.0) 85 | addressable (2.8.3) 86 | public_suffix (>= 2.0.2, < 6.0) 87 | autoprefixer-rails (10.4.13.0) 88 | execjs (~> 2) 89 | aws_cf_signer (0.1.3) 90 | bcrypt (3.1.18) 91 | bindex (0.8.1) 92 | bootsnap (1.16.0) 93 | msgpack (~> 1.2) 94 | builder (3.2.4) 95 | capybara (3.39.0) 96 | addressable 97 | matrix 98 | mini_mime (>= 0.1.3) 99 | nokogiri (~> 1.8) 100 | rack (>= 1.6.0) 101 | rack-test (>= 0.6.3) 102 | regexp_parser (>= 1.5, < 3.0) 103 | xpath (~> 3.2) 104 | cloudinary (1.25.0) 105 | aws_cf_signer 106 | rest-client (>= 2.0.0) 107 | concurrent-ruby (1.2.2) 108 | crass (1.0.6) 109 | date (3.3.3) 110 | debug (1.7.2) 111 | irb (>= 1.5.0) 112 | reline (>= 0.3.1) 113 | devise (4.9.2) 114 | bcrypt (~> 3.0) 115 | orm_adapter (~> 0.1) 116 | railties (>= 4.1.0) 117 | responders 118 | warden (~> 1.2.3) 119 | domain_name (0.5.20190701) 120 | unf (>= 0.0.5, < 1.0.0) 121 | dotenv (2.8.1) 122 | dotenv-rails (2.8.1) 123 | dotenv (= 2.8.1) 124 | railties (>= 3.2) 125 | erubi (1.12.0) 126 | execjs (2.8.1) 127 | faraday (2.7.4) 128 | faraday-net_http (>= 2.0, < 3.1) 129 | ruby2_keywords (>= 0.0.4) 130 | faraday-net_http (3.0.2) 131 | ffi (1.15.5) 132 | font-awesome-rails (4.7.0.8) 133 | railties (>= 3.2, < 8.0) 134 | font-awesome-sass (6.4.0) 135 | sassc (~> 2.0) 136 | geocoder (1.8.1) 137 | globalid (1.1.0) 138 | activesupport (>= 5.0) 139 | hashie (5.0.0) 140 | http-accept (1.7.0) 141 | http-cookie (1.0.5) 142 | domain_name (~> 0.5) 143 | i18n (1.12.0) 144 | concurrent-ruby (~> 1.0) 145 | image_processing (1.12.2) 146 | mini_magick (>= 4.9.5, < 5) 147 | ruby-vips (>= 2.0.17, < 3) 148 | image_suckr (0.2.0) 149 | io-console (0.6.0) 150 | irb (1.6.3) 151 | reline (>= 0.3.0) 152 | jbuilder (2.11.5) 153 | actionview (>= 5.0.0) 154 | activesupport (>= 5.0.0) 155 | jsbundling-rails (1.1.1) 156 | railties (>= 6.0.0) 157 | jwt (2.7.0) 158 | loofah (2.20.0) 159 | crass (~> 1.0.2) 160 | nokogiri (>= 1.5.9) 161 | mail (2.8.1) 162 | mini_mime (>= 0.1.1) 163 | net-imap 164 | net-pop 165 | net-smtp 166 | marcel (1.0.2) 167 | matrix (0.4.2) 168 | method_source (1.0.0) 169 | mime-types (3.4.1) 170 | mime-types-data (~> 3.2015) 171 | mime-types-data (3.2023.0218.1) 172 | mini_magick (4.12.0) 173 | mini_mime (1.1.2) 174 | minitest (5.18.0) 175 | msgpack (1.7.0) 176 | multi_xml (0.6.0) 177 | net-imap (0.3.4) 178 | date 179 | net-protocol 180 | net-pop (0.1.2) 181 | net-protocol 182 | net-protocol (0.2.1) 183 | timeout 184 | net-smtp (0.3.3) 185 | net-protocol 186 | netrc (0.11.0) 187 | nio4r (2.5.9) 188 | nokogiri (1.14.2-arm64-darwin) 189 | racc (~> 1.4) 190 | nokogiri (1.14.2-x86_64-linux) 191 | racc (~> 1.4) 192 | oauth2 (2.0.9) 193 | faraday (>= 0.17.3, < 3.0) 194 | jwt (>= 1.0, < 3.0) 195 | multi_xml (~> 0.5) 196 | rack (>= 1.2, < 4) 197 | snaky_hash (~> 2.0) 198 | version_gem (~> 1.1) 199 | omniauth (2.1.1) 200 | hashie (>= 3.4.6) 201 | rack (>= 2.2.3) 202 | rack-protection 203 | omniauth-github (2.0.1) 204 | omniauth (~> 2.0) 205 | omniauth-oauth2 (~> 1.8) 206 | omniauth-oauth2 (1.8.0) 207 | oauth2 (>= 1.4, < 3) 208 | omniauth (~> 2.0) 209 | omniauth-rails_csrf_protection (1.0.1) 210 | actionpack (>= 4.2) 211 | omniauth (~> 2.0) 212 | orm_adapter (0.5.0) 213 | pg (1.4.6) 214 | public_suffix (5.0.1) 215 | puma (5.6.5) 216 | nio4r (~> 2.0) 217 | pundit (2.3.0) 218 | activesupport (>= 3.0.0) 219 | racc (1.6.2) 220 | rack (2.2.6.4) 221 | rack-protection (3.0.5) 222 | rack 223 | rack-test (2.1.0) 224 | rack (>= 1.3) 225 | rails (7.0.4.3) 226 | actioncable (= 7.0.4.3) 227 | actionmailbox (= 7.0.4.3) 228 | actionmailer (= 7.0.4.3) 229 | actionpack (= 7.0.4.3) 230 | actiontext (= 7.0.4.3) 231 | actionview (= 7.0.4.3) 232 | activejob (= 7.0.4.3) 233 | activemodel (= 7.0.4.3) 234 | activerecord (= 7.0.4.3) 235 | activestorage (= 7.0.4.3) 236 | activesupport (= 7.0.4.3) 237 | bundler (>= 1.15.0) 238 | railties (= 7.0.4.3) 239 | rails-dom-testing (2.0.3) 240 | activesupport (>= 4.2.0) 241 | nokogiri (>= 1.6) 242 | rails-html-sanitizer (1.5.0) 243 | loofah (~> 2.19, >= 2.19.1) 244 | railties (7.0.4.3) 245 | actionpack (= 7.0.4.3) 246 | activesupport (= 7.0.4.3) 247 | method_source 248 | rake (>= 12.2) 249 | thor (~> 1.0) 250 | zeitwerk (~> 2.5) 251 | rake (13.0.6) 252 | regexp_parser (2.7.0) 253 | reline (0.3.3) 254 | io-console (~> 0.5) 255 | responders (3.1.0) 256 | actionpack (>= 5.2) 257 | railties (>= 5.2) 258 | rest-client (2.1.0) 259 | http-accept (>= 1.7.0, < 2.0) 260 | http-cookie (>= 1.0.2, < 2.0) 261 | mime-types (>= 1.16, < 4.0) 262 | netrc (~> 0.8) 263 | rexml (3.2.5) 264 | ruby-vips (2.1.4) 265 | ffi (~> 1.12) 266 | ruby2_keywords (0.0.5) 267 | rubyzip (2.3.2) 268 | sassc (2.4.0) 269 | ffi (~> 1.9) 270 | sassc-rails (2.1.2) 271 | railties (>= 4.0.0) 272 | sassc (>= 2.0) 273 | sprockets (> 3.0) 274 | sprockets-rails 275 | tilt 276 | selenium-webdriver (4.8.6) 277 | rexml (~> 3.2, >= 3.2.5) 278 | rubyzip (>= 1.2.2, < 3.0) 279 | websocket (~> 1.0) 280 | snaky_hash (2.0.1) 281 | hashie 282 | version_gem (~> 1.1, >= 1.1.1) 283 | sprockets (4.2.0) 284 | concurrent-ruby (~> 1.0) 285 | rack (>= 2.2.4, < 4) 286 | sprockets-rails (3.4.2) 287 | actionpack (>= 5.2) 288 | activesupport (>= 5.2) 289 | sprockets (>= 3.0.0) 290 | stimulus-rails (1.2.1) 291 | railties (>= 6.0.0) 292 | thor (1.2.1) 293 | tilt (2.1.0) 294 | timeout (0.3.2) 295 | turbo-rails (1.4.0) 296 | actionpack (>= 6.0.0) 297 | activejob (>= 6.0.0) 298 | railties (>= 6.0.0) 299 | tzinfo (2.0.6) 300 | concurrent-ruby (~> 1.0) 301 | unf (0.1.4) 302 | unf_ext 303 | unf_ext (0.0.8.2) 304 | version_gem (1.1.2) 305 | warden (1.2.9) 306 | rack (>= 2.0.9) 307 | web-console (4.2.0) 308 | actionview (>= 6.0.0) 309 | activemodel (>= 6.0.0) 310 | bindex (>= 0.4.0) 311 | railties (>= 6.0.0) 312 | webdrivers (5.2.0) 313 | nokogiri (~> 1.6) 314 | rubyzip (>= 1.3.0) 315 | selenium-webdriver (~> 4.0) 316 | websocket (1.2.9) 317 | websocket-driver (0.7.5) 318 | websocket-extensions (>= 0.1.0) 319 | websocket-extensions (0.1.5) 320 | xpath (3.2.0) 321 | nokogiri (~> 1.8) 322 | zeitwerk (2.6.7) 323 | 324 | PLATFORMS 325 | arm64-darwin-21 326 | x86_64-linux 327 | 328 | DEPENDENCIES 329 | autoprefixer-rails 330 | bootsnap 331 | capybara 332 | cloudinary 333 | debug 334 | devise 335 | dotenv-rails 336 | faker! 337 | font-awesome-rails 338 | font-awesome-sass (~> 6.1) 339 | geocoder 340 | image_processing (>= 1.2) 341 | image_suckr 342 | jbuilder 343 | jsbundling-rails 344 | omniauth-github 345 | omniauth-rails_csrf_protection 346 | pg (~> 1.1) 347 | puma (~> 5.0) 348 | pundit 349 | rails (~> 7.0.3, >= 7.0.3.1) 350 | sassc-rails 351 | selenium-webdriver 352 | simple_form! 353 | sprockets-rails 354 | stimulus-rails 355 | turbo-rails 356 | tzinfo-data 357 | web-console 358 | webdrivers 359 | 360 | RUBY VERSION 361 | ruby 3.1.2p20 362 | 363 | BUNDLED WITH 364 | 2.3.20 365 | -------------------------------------------------------------------------------- /Procfile.dev: -------------------------------------------------------------------------------- 1 | web: bin/rails server -p 3000 2 | js: yarn build --watch 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dev.Work 2 | 3 |
4 | 5 | ## A platform where you can find the developer you need for code troubles you have 6 | 7 | With our app you can: 8 | - Create challenges in an award-based approach to tackle them with hundreds of code-hungry programmers in our website 9 | - Find a challenge you can tackle and enter the auction to be the person to fix the bug 10 | and many many more 11 | 12 | ## Usage 13 | 14 | ~~Visit our website and sign up NOW! www.DEVWORK.team~~ 15 | 16 | ## !! WARNING !! Due to disappearance of Heroku Free plan, the website is down. 17 | 18 | Don't forget to watch our GitHub repo for updates and never forget: 19 | ##
Whatever bug you can't fix, Dev.Work can!
20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /_banner: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/_banner -------------------------------------------------------------------------------- /app/assets/builds/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/builds/.keep -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | //= link_tree ../builds 4 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/Socialize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/Socialize.png -------------------------------------------------------------------------------- /app/assets/images/ad-1 (1).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/ad-1 (1).jpg -------------------------------------------------------------------------------- /app/assets/images/ad-1 (2).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/ad-1 (2).jpg -------------------------------------------------------------------------------- /app/assets/images/ad-1 (3).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/ad-1 (3).jpg -------------------------------------------------------------------------------- /app/assets/images/dev-work-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/dev-work-icon.png -------------------------------------------------------------------------------- /app/assets/images/dev-work-navbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/dev-work-navbar.png -------------------------------------------------------------------------------- /app/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/logo.png -------------------------------------------------------------------------------- /app/assets/images/newlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/newlogo.png -------------------------------------------------------------------------------- /app/assets/images/userphoto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/userphoto.jpg -------------------------------------------------------------------------------- /app/assets/images/userphoto_square.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/userphoto_square.jpg -------------------------------------------------------------------------------- /app/assets/images/wallpaper.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/assets/images/wallpaper.jpg -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | // Graphical variables 2 | @import "config/fonts"; 3 | @import "config/colors"; 4 | @import "config/bootstrap_variables"; 5 | 6 | // External libraries 7 | @import "bootstrap/scss/bootstrap"; 8 | @import "font-awesome"; 9 | @import "@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder"; 10 | 11 | 12 | // Your CSS partials 13 | @import "components/index"; 14 | @import "pages/index"; 15 | @import "pages/show"; 16 | @import "pages/my_offers"; 17 | @import "pages/home"; 18 | @import "pages/devise"; 19 | 20 | .wrapper { 21 | display: flex; 22 | justify-content: space-between; 23 | flex-direction: column; 24 | min-height: 100vh; 25 | } 26 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_address_autocomplete.scss: -------------------------------------------------------------------------------- 1 | .mapboxgl-ctrl-geocoder { 2 | max-width: none; 3 | width: 100%; 4 | border: 1px solid lightgrey; 5 | box-shadow: none; 6 | background-color: rgba($color: #ffffff, $alpha: 0.5); 7 | } 8 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_alert.scss: -------------------------------------------------------------------------------- 1 | .alert { 2 | position: fixed; 3 | bottom: 16px; 4 | right: 16px; 5 | z-index: 1000; 6 | } 7 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_avatar.scss: -------------------------------------------------------------------------------- 1 | .avatar { 2 | width: 40px; 3 | height: 40px; 4 | border-radius: 50%; 5 | } 6 | .avatar-large { 7 | width: 56px; 8 | border-radius: 50%; 9 | } 10 | .avatar-bordered { 11 | width: 40px; 12 | border-radius: 50%; 13 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 14 | border: white 1px solid; 15 | } 16 | .avatar-square { 17 | width: 40px; 18 | height: 40px; 19 | border-radius: 0px; 20 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 21 | border: white 1px solid; 22 | } 23 | .avatar-custom { 24 | width: 40%; 25 | border-radius: 50%; 26 | } 27 | 28 | .avatar-custom2 { 29 | margin: 0px; 30 | width: 90%; 31 | height: 80%; 32 | border-radius: 50%; 33 | } 34 | 35 | .avatar-sidebar { 36 | border-radius: 50%; 37 | } 38 | 39 | .avatar-offer { 40 | width: 100px; 41 | height: 100px; 42 | border-radius: 50%; 43 | } 44 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_banner.scss: -------------------------------------------------------------------------------- 1 | body{ 2 | background-image: linear-gradient(rgba(0,50,0,0.8),rgba(0,0,0,0.8)), url(wallpaper.jpg); 3 | background-repeat: no-repeat; 4 | background-position: center; 5 | background-size: cover; 6 | background-attachment: fixed; 7 | } 8 | 9 | 10 | .banner { 11 | padding-top: 350px ; 12 | } 13 | 14 | // .container { 15 | // margin-bottom: 100px; 16 | // } 17 | 18 | .second { 19 | background-image: linear-gradient(rgba(0,0,0,0.4),rgba(0,0,0,0.4)); 20 | width: 50%; 21 | padding-bottom: 10px; 22 | border-radius: 15px; 23 | } 24 | 25 | .learn_more{ 26 | border-radius: 15px !important; 27 | } 28 | 29 | .banner h1 { 30 | margin: 0; 31 | color: white; 32 | text-shadow: 1px 1px 3px rgba(0,0,0,0.2); 33 | font-size: 60px; 34 | margin-bottom: 20px; 35 | 36 | } 37 | 38 | .banner p { 39 | font-size: 30px; 40 | color: white; 41 | text-shadow: 1px 1px 3px rgba(0,0,0,0.2); 42 | margin-top: 10px; 43 | font-weight: lighter; 44 | } 45 | 46 | 47 | 48 | 49 | .btn-primary:hover{ 50 | background-color: rgb(176, 179, 164); 51 | text-decoration: none; 52 | } 53 | /* try with this image banner{ 54 | background-image: url(https://images.unsplash.com/photo-1539627831859-a911cf04d3cd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjB8fHB1enpsZXxlbnwwfHwwfHw%3D&auto=format&fit=crop&w=500&q=60); 55 | background-size: cover; 56 | background-position: center; */ 57 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_button.scss: -------------------------------------------------------------------------------- 1 | #button{ 2 | color: orange; 3 | background-color: black; 4 | border-radius: 15px !important; 5 | } 6 | #button:hover{ 7 | color: white; 8 | background-color: #03194e; 9 | } 10 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_footer.scss: -------------------------------------------------------------------------------- 1 | .footer { 2 | background-color: rgba($color: #ffffff, $alpha: 0.5); 3 | color: #00000099; 4 | text-decoration:none !important; 5 | &-a{ 6 | text-decoration:none !important; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_form_legend_clear.scss: -------------------------------------------------------------------------------- 1 | // In bootstrap 5 legend floats left and requires the following element 2 | // to be cleared. In a radio button or checkbox group the element after 3 | // the legend will be the automatically generated hidden input; the fix 4 | // in https://github.com/twbs/bootstrap/pull/30345 applies to the hidden 5 | // input and has no visual effect. Here we try to fix matters by 6 | // applying the clear to the div wrapping the first following radio button 7 | // or checkbox. 8 | legend ~ div.form-check:first-of-type { 9 | clear: left; 10 | } 11 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_index.scss: -------------------------------------------------------------------------------- 1 | // Import your components CSS files here. 2 | @import "alert"; 3 | @import "avatar"; 4 | @import "form_legend_clear"; 5 | @import "banner"; 6 | @import "button"; 7 | @import "map"; 8 | @import "sidebar"; 9 | @import "address_autocomplete"; 10 | @import "footer"; 11 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_map.scss: -------------------------------------------------------------------------------- 1 | .mapboxgl-popup { 2 | max-width: 200px; 3 | } 4 | 5 | .mapboxgl-popup-content { 6 | text-align: center; 7 | font-family: "Open Sans", sans-serif; 8 | width:fit-content; 9 | } 10 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_sidebar.scss: -------------------------------------------------------------------------------- 1 | /* Google Font Link */ 2 | // @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap'); 3 | *{ 4 | margin: 0; 5 | padding: 0; 6 | box-sizing: border-box; 7 | font-family: 'Ubuntu', sans-serif; 8 | } 9 | .sidebar{ 10 | position: fixed; 11 | left: 0; 12 | top: 0; 13 | height: 100%; 14 | width: 78px; 15 | background-color: rgba($color: #000000, $alpha: 0.5); 16 | padding: 6px 14px; 17 | z-index: 99; 18 | transition: all 0.5s ease; 19 | } 20 | .sidebar.open{ 21 | width: 250px; 22 | } 23 | .sidebar .logo-details{ 24 | height: 60px; 25 | display: flex; 26 | align-items: center; 27 | position: relative; 28 | } 29 | .sidebar .logo-details .icon{ 30 | opacity: 0; 31 | transition: all 0.5s ease; 32 | } 33 | .sidebar .logo-details .logo_name{ 34 | color: #FAF9F9; 35 | font-size: 20px; 36 | font-weight: 600; 37 | opacity: 0; 38 | width: 384px; 39 | transition: all 0.5s ease; 40 | } 41 | .sidebar.open .logo-details .icon, 42 | .sidebar.open .logo-details .logo_name{ 43 | opacity: 1; 44 | } 45 | .sidebar .logo-details #btn{ 46 | position: absolute; 47 | top: 50%; 48 | right: 0; 49 | transform: translateY(-50%); 50 | font-size: 22px; 51 | transition: all 0.5s ease; 52 | font-size: 23px; 53 | text-align: center; 54 | cursor: pointer; 55 | transition: all 0.5s ease; 56 | color:#FAF9F9 57 | } 58 | .sidebar.open .logo-details #btn{ 59 | text-align: right; 60 | } 61 | .sidebar i{ 62 | color: rgb(0, 0, 0); 63 | height: 60px; 64 | min-width: 50px; 65 | font-size: 28px; 66 | text-align: center; 67 | line-height: 60px; 68 | } 69 | .sidebar .nav-list{ 70 | margin-top: 20px; 71 | height: 100%; 72 | } 73 | .sidebar li{ 74 | position: relative; 75 | margin: 8px 0; 76 | list-style: none; 77 | } 78 | .sidebar li .tooltip{ 79 | position: absolute; 80 | top: -20px; 81 | left: calc(100% + 15px); 82 | z-index: 3; 83 | background: #FAF9F9; 84 | box-shadow: 0 5px 10px rgba(207, 136, 136, 0.3); 85 | padding: 6px 12px; 86 | border-radius: 15px; 87 | font-size: 15px; 88 | font-weight: 400; 89 | opacity: 0; 90 | white-space: nowrap; 91 | pointer-events: none; 92 | transition: 0.1s; 93 | } 94 | .sidebar li:hover .tooltip{ 95 | opacity: 1; 96 | pointer-events: auto; 97 | transition: all 0.1s ease; 98 | top: 50%; 99 | transform: translateY(-50%); 100 | } 101 | .sidebar.open li .tooltip{ 102 | display: none; 103 | } 104 | .sidebar input{ 105 | font-size: 15px; 106 | color: #8d7197; 107 | font-weight: 400; 108 | outline: none; 109 | height: 50px; 110 | width: 100%; 111 | width: 50px; 112 | border: none; 113 | border-radius: 15px; 114 | transition: all 0.5s ease; 115 | background: #FAF9F9; 116 | } 117 | .sidebar.open input{ 118 | padding: 0 20px 0 50px; 119 | width: 100%; 120 | } 121 | .sidebar .bx-search{ 122 | position: absolute; 123 | top: 50%; 124 | left: 0; 125 | transform: translateY(-50%); 126 | font-size: 22px; 127 | background: #FAF9F9; 128 | color: rgb(0, 0, 0); 129 | } 130 | .sidebar.open .bx-search:hover{ 131 | background: #FAF9F9; 132 | color: rgb(0, 0, 0); 133 | } 134 | .sidebar .bx-search:hover{ 135 | background: rgb(0, 0, 0); 136 | color: #FAF9F9; 137 | } 138 | .sidebar li a{ 139 | display: flex; 140 | height: 100%; 141 | width: 100%; 142 | border-radius: 15px; 143 | align-items: center; 144 | text-decoration: none; 145 | transition: all 0s ease; 146 | background: #FAF9F9; 147 | } 148 | .sidebar li a:hover{ 149 | background: rgb(0, 0, 0); 150 | } 151 | .sidebar li a .links_name{ 152 | color: rgb(0, 0, 0); 153 | font-size: 15px; 154 | font-weight: 400; 155 | white-space: nowrap; 156 | opacity: 0; 157 | pointer-events: none; 158 | transition: 0.5s; 159 | } 160 | .sidebar.open li a .links_name{ 161 | opacity: 1; 162 | pointer-events: auto; 163 | } 164 | .sidebar li a:hover .links_name, 165 | .sidebar li a:hover i{ 166 | transition: all 0.5s ease; 167 | color: #FAF9F9; 168 | } 169 | .sidebar li i{ 170 | height: 50px; 171 | line-height: 50px; 172 | font-size: 18px; 173 | border-radius: 15px; 174 | } 175 | .sidebar li.profile{ 176 | position: fixed; 177 | height: 60px; 178 | width: 78px; 179 | left: 0; 180 | bottom: -8px; 181 | padding: 10px 14px; 182 | background: #D1AAAA; 183 | transition: all 0.5s ease; 184 | overflow: hidden; 185 | } 186 | .sidebar.open li.profile{ 187 | width: 250px; 188 | } 189 | .sidebar li .profile-details{ 190 | display: flex; 191 | align-items: center; 192 | flex-wrap: nowrap; 193 | } 194 | .sidebar li img{ 195 | height: 45px; 196 | width: 45px; 197 | object-fit: cover; 198 | border-radius: 15px; 199 | margin-right: 10px; 200 | } 201 | .sidebar li.profile .name, 202 | .sidebar li.profile .job{ 203 | font-size: 15px; 204 | font-weight: 400; 205 | color: #fff; 206 | white-space: nowrap; 207 | } 208 | .sidebar li.profile .job{ 209 | font-size: 12px; 210 | } 211 | .sidebar .profile #log_out{ 212 | position: absolute; 213 | top: 50%; 214 | right: 0; 215 | transform: translateY(-50%); 216 | background: #D1AAAA; 217 | width: 100%; 218 | height: 60px; 219 | line-height: 60px; 220 | border-radius: 15px; 221 | transition: all 0.5s ease; 222 | } 223 | .sidebar.open .profile #log_out{ 224 | width: 50px; 225 | background: none; 226 | } 227 | .home-section{ 228 | position: relative; 229 | background: #000000; 230 | min-height: 100vh; 231 | top: 0; 232 | left: 78px; 233 | width: calc(100% - 78px); 234 | transition: all 0.5s ease; 235 | z-index: 2; 236 | } 237 | .sidebar.open ~ .home-section{ 238 | left: 250px; 239 | width: calc(100% - 250px); 240 | } 241 | .home-section .text{ 242 | display: inline-block; 243 | color: #D1AAAA; 244 | font-size: 25px; 245 | font-weight: 500; 246 | margin: 18px 247 | } 248 | @media (max-width: 420px) { 249 | .sidebar li .tooltip{ 250 | display: none; 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /app/assets/stylesheets/config/_bootstrap_variables.scss: -------------------------------------------------------------------------------- 1 | // This is where you override default Bootstrap variables 2 | // 1. All Bootstrap variables are here => https://github.com/twbs/bootstrap/blob/master/scss/_variables.scss 3 | // 2. These variables are defined with default value (see https://robots.thoughtbot.com/sass-default) 4 | // 3. You can override them below! 5 | 6 | // General style 7 | $font-family-sans-serif: $body-font; 8 | $headings-font-family: $headers-font; 9 | $body-bg: $light-gray; 10 | $font-size-base: 1rem; 11 | 12 | // Colors 13 | $body-color: $gray; 14 | $primary: $blue; 15 | $success: $green; 16 | $info: $yellow; 17 | $danger: $red; 18 | $warning: $orange; 19 | 20 | // Buttons & inputs' radius 21 | $border-radius: 2px; 22 | $border-radius-lg: 2px; 23 | $border-radius-sm: 2px; 24 | 25 | // Override other variables below! 26 | -------------------------------------------------------------------------------- /app/assets/stylesheets/config/_colors.scss: -------------------------------------------------------------------------------- 1 | // Define variables for your color scheme 2 | 3 | // For example: 4 | $red: #FD1015; 5 | $blue: #0c51b9; 6 | $yellow: #FFC65A; 7 | $orange: #c46512; 8 | $green: #1EDD88; 9 | $gray: #0E0000; 10 | $light-gray: #F4F4F4; 11 | -------------------------------------------------------------------------------- /app/assets/stylesheets/config/_fonts.scss: -------------------------------------------------------------------------------- 1 | // Import Google fonts 2 | @import url('https://fonts.googleapis.com/css?family=Nunito:400,700|Work+Sans:400,700&display=swap'); 3 | 4 | // Define fonts for body and headers 5 | $body-font: "Work Sans", "Helvetica", "sans-serif"; 6 | $headers-font: "Nunito", "Helvetica", "sans-serif"; 7 | 8 | // To use a font file (.woff) uncomment following lines 9 | // @font-face { 10 | // font-family: "Font Name"; 11 | // src: font-url('FontFile.eot'); 12 | // src: font-url('FontFile.eot?#iefix') format('embedded-opentype'), 13 | // font-url('FontFile.woff') format('woff'), 14 | // font-url('FontFile.ttf') format('truetype') 15 | // } 16 | // $my-font: "Font Name"; 17 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_devise.scss: -------------------------------------------------------------------------------- 1 | .sign-in-container { 2 | display: flex; 3 | flex-direction: column; 4 | justify-items: center; 5 | align-items: center; 6 | } 7 | 8 | .blank-row { 9 | height: 15vh; 10 | } 11 | 12 | .sign-in-header { 13 | margin: 10px 0; 14 | } 15 | 16 | .sign-in-box { 17 | display: flex; 18 | padding: 60px 40px 20px 40px; 19 | width: 25vw; 20 | flex-direction: column; 21 | justify-content: center; 22 | align-items: center; 23 | background-color: #555b6eb9; 24 | border-radius: 15px; 25 | box-shadow: rgba(0, 0, 0, 0.7); 26 | } 27 | 28 | .sign-in-button { 29 | // width: 100%; 30 | margin-top: 2vh; 31 | margin-bottom: 2vh; 32 | color: rgb(255, 255, 255); 33 | // width: 100%; 34 | 35 | &:hover { 36 | 37 | opacity: 0.7; 38 | color: black; 39 | transition: 0.3s; 40 | } 41 | } 42 | 43 | 44 | .devise-buttons { 45 | display: flex; 46 | align-items: center; 47 | justify-content: center; 48 | } 49 | 50 | #github-create-button { 51 | background-color: #787D90; 52 | color: white; 53 | box-shadow: inset 0 0 0 4px #ffffff0b; 54 | text-align: center; 55 | 56 | &:hover { 57 | background-color: white; 58 | opacity: 0.9; 59 | color: black; 60 | transition: 0.3s; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_home.scss: -------------------------------------------------------------------------------- 1 | // Specific CSS for your home-page 2 | body{ 3 | text-align: center; 4 | } 5 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_index.scss: -------------------------------------------------------------------------------- 1 | // Import page-specific CSS files here. 2 | @import "home"; 3 | @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@500;700&display=swap'); 4 | 5 | body{ 6 | background-image: linear-gradient(rgba(255, 255, 255, 0.8),rgba(221, 193, 193, 0.8)), url(wallpaper.jpg); 7 | background-repeat: no-repeat; 8 | background-position: center; 9 | background-size: cover; 10 | background-attachment: fixed; 11 | 12 | } 13 | .container h1, p { 14 | font-family: 'Roboto', sans-serif; 15 | font-weight:bold; 16 | } 17 | 18 | #title { 19 | background-color: rgba(255, 255, 255, 0.5); 20 | border-radius: 15px; 21 | } 22 | 23 | .img-tag{ 24 | height:20px; 25 | width: 20px; 26 | padding: 0px; 27 | margin: 0px; 28 | } 29 | 30 | .fa-location-dot{ 31 | color:#3fb1ce 32 | } 33 | 34 | #map { 35 | border-radius: 15px; 36 | border: 0px solid black; 37 | margin-bottom: 30px; 38 | box-shadow: 0 0 12px 0 rgba(0,0,0,0.2); 39 | } 40 | .rounded{ 41 | border-radius: 50%; 42 | } 43 | 44 | .card{ 45 | border: none; 46 | transition: all 500ms cubic-bezier(0.19, 1, 0.22, 1); 47 | overflow:hidden; 48 | border-radius: 15px; 49 | box-shadow: 0 0 12px 0 rgba(0,0,0,0.2); 50 | } 51 | 52 | .grid { 53 | display: grid; 54 | grid-template-columns: 1fr 1fr 1fr; 55 | grid-gap: 16px; 56 | } 57 | 58 | 59 | .grid_offer { 60 | display: grid; 61 | grid-template-columns: 1fr 1fr; 62 | grid-gap: 8px; 63 | } 64 | 65 | 66 | .c-details span { 67 | font-weight: 300; 68 | font-size: 13px 69 | } 70 | 71 | .icon { 72 | width: 50px; 73 | height: 50px; 74 | background-color: #eee; 75 | border-radius: 15px; 76 | display: flex; 77 | align-items: center; 78 | justify-content: center; 79 | font-size: 39px 80 | } 81 | 82 | .badge { 83 | background-color: #d0c9b0; 84 | width: fit-content; 85 | height: 30px; 86 | padding-bottom: 5px; 87 | padding-top: 8px; 88 | border-radius: 10px; 89 | display: flex; 90 | color: #070500; 91 | justify-content: space-between; 92 | align-items: right; 93 | overflow: hidden; 94 | font-size: 16px; 95 | } 96 | 97 | .text1 { 98 | font-size: 20px; 99 | color: #a5aec0; 100 | font-weight: 600 101 | } 102 | 103 | .text2 { 104 | font-size: 20px; 105 | color:#070500; 106 | } 107 | 108 | .city{ 109 | color:gray; 110 | font-size:15px; 111 | font-weight:bold; 112 | } 113 | 114 | .mapboxgl-ctrl-bottom-right{ 115 | display:none !important 116 | } 117 | 118 | .mapboxgl-ctrl-bottom-left{ 119 | display:none !important 120 | } 121 | 122 | 123 | .avatar-img{ 124 | height:50px; 125 | width: 50px; 126 | border-radius: 50%; 127 | object-fit: cover; 128 | } 129 | 130 | // .image { 131 | // height: 50px; 132 | // width: 50px; 133 | // } 134 | .index-event-card{ 135 | position: absolute; 136 | top: 0px; 137 | margin-top: 15px; 138 | right: 20px; 139 | padding: 5px; 140 | width: 250px; 141 | height: 54rem; 142 | border-radius: 15px; 143 | border: hsla(0, 0%, 100%, 0.8); 144 | border-width: 3px; 145 | border-style: dashed; 146 | color:white; 147 | background-color: rgba($color: #000000, $alpha: 0.5); 148 | } 149 | 150 | .adlink { 151 | color: rgb(255, 255, 255) !important; 152 | text-decoration: none !important; 153 | font-weight: bold; 154 | } 155 | 156 | .adlink:hover { 157 | text-decoration: underline !important; 158 | } 159 | 160 | .image img{ 161 | height: 100px; 162 | width: 100px; 163 | border-radius:50%; 164 | border: 1px solid rgba(43, 44, 43, 0.718); 165 | box-shadow: 2px 2px #05060636; 166 | } 167 | 168 | #filtertext { 169 | border-radius: 15px !important; 170 | height: 38px; 171 | } 172 | 173 | #filterbutton{ 174 | border-radius: 15px !important; 175 | 176 | } 177 | 178 | #resetfilterbutton{ 179 | border-radius: 15px !important; 180 | } 181 | 182 | .draw-border { 183 | box-shadow: inset 0 0 0 4px #ffffff1c; 184 | background-color: #555b6e; 185 | color: #0000001c; 186 | padding: 8px 25px; 187 | border-radius: 15px; 188 | margin-top: 30px; 189 | } 190 | 191 | .draw-border::before, 192 | .draw-border::after { 193 | border: 0 solid transparent; 194 | box-sizing: border-box; 195 | pointer-events: none; 196 | position: absolute; 197 | width: 0rem; 198 | height: 0; 199 | bottom: 0; 200 | right: 0; 201 | } 202 | 203 | .draw-border:hover::before { 204 | -webkit-transition-delay: 0s, 0s, 0.25s; 205 | transition-delay: 0s, 0s, 0.25s; 206 | } 207 | 208 | .draw-border:hover::after { 209 | -webkit-transition-delay: 0s, 0.25s, 0s; 210 | } 211 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_my_offers.scss: -------------------------------------------------------------------------------- 1 | 2 | .split-card { 3 | display: flex; 4 | flex-direction: row; 5 | align-items: center; 6 | justify-content: center; 7 | } 8 | 9 | .split-items { 10 | padding: 3px 8px; 11 | // display: flex; 12 | // flex-direction: column; 13 | // align-items: center; 14 | // justify-content: center; 15 | } 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_show.scss: -------------------------------------------------------------------------------- 1 | // .offers { 2 | // display: flex; 3 | // justify-content: space-between; 4 | // } 5 | body{ 6 | background-image: linear-gradient(rgba(255, 255, 255, 0.8),rgba(221, 193, 193, 0.8)), url(wallpaper.jpg); 7 | background-repeat: no-repeat; 8 | background-position: center; 9 | background-size: cover; 10 | background-attachment: fixed; 11 | 12 | } 13 | 14 | .offers-container { 15 | display: flex; 16 | } 17 | 18 | .offers { 19 | display:grid; 20 | grid-template-columns: 1fr 1fr; 21 | grid-gap: 8px; 22 | justify-content: space-between; 23 | list-style-type: none; 24 | padding-left: none; 25 | list-style-position: inside; 26 | } 27 | 28 | // .offers li:not(:last-child) { 29 | // border-bottom: 1px solid rgba(128, 128, 128, 0.377); 30 | // } 31 | 32 | // .offers-right { 33 | // overflow-y: scroll; 34 | // margin-left: 15px; 35 | // border-radius: 20px; 36 | // box-shadow: 0 0 12px 0 rgba(0,0,0,0.2); 37 | // height: 100%; 38 | // } 39 | 40 | // .offers-right::-webkit-scrollbar { 41 | // display: none; /* Safari and Chrome */ 42 | // } 43 | 44 | // .offers-left { 45 | // flex: 1; 46 | // } 47 | 48 | .cardshow { 49 | // overflow: hidden; 50 | height: auto; 51 | padding: 10px 0; 52 | // height: 100%; 53 | display: flex; 54 | background-color: white; 55 | flex-direction: column; 56 | align-items: center; 57 | border: none; 58 | transition: all 500ms cubic-bezier(0.19, 1, 0.22, 1); 59 | overflow: hidden; 60 | border-radius: 15px; 61 | box-shadow: 0 0 12px 0 rgba(0,0,0,0.2); 62 | // margin: 10px; 63 | } 64 | 65 | .card-body { 66 | width: 75%; 67 | } 68 | 69 | .card-image { 70 | text-align: center; 71 | margin-bottom: 10px; 72 | } 73 | 74 | .card-image img { 75 | height: 150px; 76 | width: 150px; 77 | margin-left: 15px; 78 | margin-right: 15px; 79 | border-radius: 50%; 80 | object-fit: cover; 81 | border: 2px solid rgba(43, 44, 43, 0.718); 82 | box-shadow: 2px 2px #05060636; 83 | } 84 | 85 | .comments { 86 | padding-left: none; 87 | } 88 | 89 | .comment { 90 | display: flex; 91 | align-items: center; 92 | } 93 | 94 | .comment img { 95 | margin: 15px; 96 | } 97 | 98 | #offer-alert { 99 | top: 90px; 100 | bottom: auto; 101 | // width: 100%; 102 | opacity: 0.9; 103 | } 104 | 105 | 106 | .show-grid { 107 | display: grid; 108 | grid-template-columns: 4fr 2fr; 109 | grid-gap: 26px; 110 | } 111 | 112 | .grid-left { 113 | height: 80vh; 114 | border-radius: 15px; 115 | display: flex; 116 | flex-direction: column; 117 | } 118 | 119 | 120 | .show-top-left { 121 | border-radius: 15px; 122 | overflow-y: scroll; 123 | flex-grow: 1; 124 | } 125 | 126 | .show-top-left::-webkit-scrollbar { 127 | display: none; /* Safari and Chrome */ 128 | } 129 | 130 | .show-top-right { 131 | border-radius: 15px; 132 | } 133 | 134 | .grid-right { 135 | height: 80vh; 136 | overflow-y: scroll; 137 | border-radius: 15px; 138 | } 139 | 140 | .grid-right::-webkit-scrollbar { 141 | display: none; /* Safari and Chrome */ 142 | } 143 | 144 | #challenge_buttons { 145 | border-radius: 15px !important; 146 | } 147 | 148 | .form-control { 149 | border-radius: 15px !important; 150 | } 151 | 152 | .form-select{ 153 | border-radius: 15px !important; 154 | } 155 | -------------------------------------------------------------------------------- /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 | before_action :authenticate_user! 3 | before_action :configure_permitted_parameters, if: :devise_controller? 4 | include Pundit::Authorization 5 | 6 | # def after_sign_in_path_for(resource) 7 | # if current_user.location.nil? 8 | # edit_user_path(current_user) 9 | # else 10 | # users_path 11 | # end 12 | # end 13 | 14 | # Pundit: allow-list approach 15 | after_action :verify_authorized, except: :index, unless: :skip_pundit? 16 | after_action :verify_policy_scoped, only: :index, unless: :skip_pundit? 17 | 18 | # Uncomment when you *really understand* Pundit! 19 | rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized 20 | def user_not_authorized 21 | flash[:alert] = "You are not authorized to perform this action." 22 | redirect_to(root_path) 23 | end 24 | 25 | def configure_permitted_parameters 26 | # For additional fields in app/views/devise/registrations/new.html.erb 27 | devise_parameter_sanitizer.permit(:sign_up, keys: [:nickname, :photo]) 28 | 29 | # For additional in app/views/devise/registrations/edit.html.erb 30 | devise_parameter_sanitizer.permit(:account_update, keys: [:nickname, :photo]) 31 | end 32 | 33 | def default_url_options 34 | { host: ENV["DOMAIN"] || "localhost:3000" } 35 | end 36 | 37 | private 38 | 39 | def skip_pundit? 40 | devise_controller? || params[:controller] =~ /(^(rails_)?admin)|(^pages$)/ 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /app/controllers/callbacks_controller.rb: -------------------------------------------------------------------------------- 1 | # This has been added manually (not in terminal) - could be 2 | # a source of error later on 3 | 4 | class CallbacksController < Devise::OmniauthCallbacksController 5 | def github 6 | @user = User.from_omniauth(request.env["omniauth.auth"]) 7 | sign_in_and_redirect @user 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/controllers/challenges_controller.rb: -------------------------------------------------------------------------------- 1 | class ChallengesController < ApplicationController 2 | include ActionView::Helpers::UrlHelper 3 | 4 | before_action :set_challenge, only: %i[show edit update destroy] 5 | 6 | def show 7 | authorize @challenge 8 | @offers = @challenge.offers 9 | @offer = Offer.new 10 | end 11 | 12 | def index 13 | @challenges = policy_scope(Challenge) 14 | @filters = Filter.all 15 | if params[:filter].present? && params[:query].present? && params[:location].present? 16 | @filter = Filter.find_by(name: params[:filter]) 17 | @challenges = Challenge.where('filter_id = ?', @filter.id).where("title ILIKE ?", "%#{params[:query]}%").where(location: params[:location]) 18 | elsif params[:query].present? && params[:location].present? 19 | @challenges = Challenge.where("title ILIKE ?", "%#{params[:query]}%").where(location: params[:location]) 20 | elsif params[:filter].present? && params[:location].present? 21 | @filter = Filter.find_by(name: params[:filter]) 22 | @challenges = Challenge.where('filter_id = ?', @filter.id).where(location: params[:location]) 23 | elsif params[:filter].present? && params[:query].present? 24 | @filter = Filter.find_by(name: params[:filter]) 25 | @challenges = Challenge.where('filter_id = ?', @filter.id).where("title ILIKE ?", "%#{params[:query]}%") 26 | elsif params[:query].present? 27 | @challenges = Challenge.where("title ILIKE ?", "%#{params[:query]}%") 28 | elsif params[:location].present? 29 | @challenges = Challenge.where(location: params[:location]) 30 | elsif params[:filter].present? 31 | @filter = Filter.find_by(name: params[:filter]) 32 | @challenges = Challenge.where('filter_id = ?', @filter.id) 33 | elsif current_page?(my_challenges_path) 34 | @challenges = current_user.challenges 35 | else 36 | @challenges = Challenge.all 37 | end 38 | 39 | locations = Challenge.distinct.pluck(:location) 40 | @location_filters = [] 41 | locations.each do |location| 42 | if !location.nil? 43 | @location_filters << location 44 | end 45 | end 46 | 47 | @markers = @challenges.geocoded.map do |challenge| 48 | { 49 | lat: challenge.latitude, 50 | lng: challenge.longitude, 51 | info_window: render_to_string(partial: "info_window", locals: {challenge: challenge}) 52 | } 53 | end 54 | end 55 | 56 | def new 57 | @challenge = Challenge.new 58 | authorize @challenge 59 | end 60 | 61 | def create 62 | @challenge = Challenge.new(challenge_params) 63 | @challenge.user = current_user 64 | @challenge.filter = Filter.find(params[:challenge][:filter_id]) 65 | authorize @challenge 66 | if @challenge.save 67 | redirect_to challenge_path(@challenge) 68 | else 69 | render :new, status: :unprocessable_entity 70 | end 71 | end 72 | 73 | def destroy 74 | authorize @challenge 75 | @challenge.destroy 76 | redirect_to challenges_path(@challenges), status: :see_other 77 | end 78 | 79 | def edit 80 | authorize @challenge 81 | end 82 | 83 | def update 84 | authorize @challenge 85 | @challenge.update(challenge_params) 86 | redirect_to challenge_path(@challenge) 87 | end 88 | 89 | private 90 | 91 | def set_challenge 92 | @challenge = Challenge.find(params[:id]) 93 | end 94 | 95 | def challenge_params 96 | params.require(:challenge).permit(:title, :content, :price_max, :deadline, :location, photos: []) 97 | end 98 | end 99 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/filters_controller.rb: -------------------------------------------------------------------------------- 1 | class FiltersController < ApplicationController 2 | end 3 | -------------------------------------------------------------------------------- /app/controllers/offers_controller.rb: -------------------------------------------------------------------------------- 1 | class OffersController < ApplicationController 2 | def index 3 | @offers = policy_scope(Offer) 4 | @user_offers = Offer.where(user: current_user) 5 | end 6 | 7 | def show 8 | # @challenge = Challenge.find(params[:id]) 9 | @offer = Offer.where(user: current_user).where(challenge: @challenge) 10 | authorize @offer 11 | end 12 | 13 | def create 14 | @challenge = Challenge.find(params[:challenge_id]) 15 | @offer = Offer.new(offer_params) 16 | @offer.user = current_user 17 | @offer.challenge = @challenge 18 | authorize @offer 19 | if @offer.save 20 | redirect_to challenge_path(@challenge), notice: "Offer has been made..." 21 | else 22 | render 'challenges/show', status: :unprocessable_entity, locals: { '@offers': @challenge.offers } 23 | end 24 | end 25 | # def comment 26 | # @offer = offer.find(params[:id]) 27 | # @challenge = Challenge.find(params[:challenge_id]) 28 | # end 29 | 30 | def edit 31 | authorize @offer 32 | end 33 | 34 | def update 35 | authorize @offer 36 | @offer.update(offer_params) 37 | redirect_to offers_path(@offers) 38 | end 39 | 40 | def destroy 41 | authorize @offer 42 | @offer.destroy 43 | redirect_to challenges_path(@challenges), status: :see_other 44 | end 45 | 46 | private 47 | 48 | def offer_params 49 | params.require(:offer).permit(:date, :price) 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | def home 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/registrations_controller.rb: -------------------------------------------------------------------------------- 1 | class RegistrationsController < Devise::RegistrationsController 2 | private 3 | 4 | # def signup_params 5 | # params.require(:user).permit( :name, 6 | # :email, 7 | # :password, 8 | # :password_confirmation) 9 | # end 10 | 11 | # def account_update_params 12 | # params.require(:user).permit( :name, 13 | # :email, 14 | # :password, 15 | # :password_confirmation) 16 | # end 17 | 18 | def sign_up_params 19 | params.require(:user).permit(:name, :email, :password, :password_confirmation) 20 | end 21 | 22 | def account_update_params 23 | params.require(:user).permit(:name, :email, :password, :password_confirmation, :current_password) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | def edit 3 | @user = current_user 4 | end 5 | 6 | def update 7 | @user = current_user 8 | @user.update(sign_up_params) 9 | redirect_to users_path 10 | end 11 | 12 | private 13 | 14 | def user_params 15 | params.require(:user).permit(:photo) 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/javascript/application.js: -------------------------------------------------------------------------------- 1 | // Entry point for the build script in your package.json 2 | import "@hotwired/turbo-rails" 3 | import "./controllers" 4 | import "bootstrap" 5 | -------------------------------------------------------------------------------- /app/javascript/controllers/address_autocomplete_controller.js: -------------------------------------------------------------------------------- 1 | import { Controller } from "@hotwired/stimulus" 2 | 3 | // Connects to data-controller="address-autocomplete" 4 | export default class extends Controller { 5 | connect() { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/javascript/controllers/application.js: -------------------------------------------------------------------------------- 1 | import { Application } from "@hotwired/stimulus" 2 | 3 | const application = Application.start() 4 | 5 | // Configure Stimulus development experience 6 | application.debug = false 7 | window.Stimulus = application 8 | 9 | export { application } 10 | -------------------------------------------------------------------------------- /app/javascript/controllers/hello_controller.js: -------------------------------------------------------------------------------- 1 | import { Controller } from "@hotwired/stimulus" 2 | 3 | export default class extends Controller { 4 | connect() { 5 | this.element.textContent = "Hello World!" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /app/javascript/controllers/index.js: -------------------------------------------------------------------------------- 1 | // This file is auto-generated by ./bin/rails stimulus:manifest:update 2 | // Run that command whenever you add a new controller or create them with 3 | // ./bin/rails generate stimulus controllerName 4 | 5 | import { application } from "./application" 6 | 7 | import AddressAutocompleteController from "./address_autocomplete_controller" 8 | application.register("address-autocomplete", AddressAutocompleteController) 9 | 10 | import HelloController from "./hello_controller" 11 | application.register("hello", HelloController) 12 | 13 | import MapController from "./map_controller" 14 | application.register("map", MapController) 15 | 16 | import SidebarController from "./sidebar_controller" 17 | application.register("sidebar", SidebarController) 18 | -------------------------------------------------------------------------------- /app/javascript/controllers/map_controller.js: -------------------------------------------------------------------------------- 1 | import { Controller } from "@hotwired/stimulus" 2 | import MapboxGeocoder from "@mapbox/mapbox-gl-geocoder" 3 | 4 | export default class extends Controller { 5 | static values = { 6 | apiKey: String, 7 | markers: Array 8 | } 9 | 10 | connect() { 11 | mapboxgl.accessToken = this.apiKeyValue 12 | this.map = new mapboxgl.Map({ 13 | container: this.element, 14 | style: "mapbox://styles/mapbox/streets-v11" 15 | }) 16 | this.#addMarkersToMap() 17 | this.#fitMapToMarkers() 18 | this.map.addControl(new MapboxGeocoder({ accessToken: mapboxgl.accessToken, 19 | mapboxgl: mapboxgl })) 20 | } 21 | 22 | #addMarkersToMap() { 23 | this.markersValue.forEach((marker) => { 24 | const popup = new mapboxgl.Popup().setHTML(marker.info_window) 25 | new mapboxgl.Marker() 26 | .setLngLat([ marker.lng, marker.lat ]) 27 | .setPopup(popup) 28 | .addTo(this.map) 29 | }) 30 | } 31 | 32 | #fitMapToMarkers() { 33 | const bounds = new mapboxgl.LngLatBounds() 34 | this.markersValue.forEach(marker => bounds.extend([ marker.lng, marker.lat ])) 35 | this.map.fitBounds(bounds, { padding: 10, maxZoom: 12, duration: 0 }) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/javascript/controllers/sidebar_controller.js: -------------------------------------------------------------------------------- 1 | import { Controller } from "@hotwired/stimulus" 2 | 3 | export default class extends Controller { 4 | static targets = ["menu", "search", "sidebar"] 5 | 6 | connect() { 7 | } 8 | change() { 9 | this.sidebarTarget.classList.toggle("open"); 10 | 11 | if(this.sidebarTarget.classList.contains("open")){ 12 | this.menuTarget.classList.replace("bx-menu", "bx-menu-alt-right"); 13 | }else { 14 | this.menuTarget.classList.replace("bx-menu-alt-right","bx-menu"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /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 | primary_abstract_class 3 | end 4 | -------------------------------------------------------------------------------- /app/models/challenge.rb: -------------------------------------------------------------------------------- 1 | class Challenge < ApplicationRecord 2 | belongs_to :filter 3 | belongs_to :user 4 | has_many :offers, dependent: :destroy 5 | has_many :comments, dependent: :destroy 6 | has_many_attached :photos 7 | 8 | validates :title, :content, :price_max, :deadline, :location, presence: true 9 | 10 | geocoded_by :location 11 | 12 | after_validation :geocode, if: :location 13 | end 14 | -------------------------------------------------------------------------------- /app/models/comment.rb: -------------------------------------------------------------------------------- 1 | class Comment < ApplicationRecord 2 | belongs_to :user 3 | belongs_to :challenge 4 | end 5 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/filter.rb: -------------------------------------------------------------------------------- 1 | class Filter < ApplicationRecord 2 | has_many :challenges 3 | end 4 | -------------------------------------------------------------------------------- /app/models/offer.rb: -------------------------------------------------------------------------------- 1 | class Offer < ApplicationRecord 2 | belongs_to :challenge 3 | belongs_to :user 4 | 5 | validates :date, :price, presence: true 6 | end 7 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 4 | after_create :set_default_avatar 5 | devise :database_authenticatable, :registerable, 6 | :recoverable, :rememberable, :validatable, :omniauthable 7 | has_many :offers, dependent: :destroy 8 | has_many :comments, dependent: :destroy 9 | has_many :challenges 10 | has_one_attached :photo 11 | 12 | validates :nickname, :name, presence: true 13 | def set_default_avatar 14 | return if photo.attached? 15 | 16 | path = "https://res.cloudinary.com/dp6zhyocx/image/upload/v1662046666/pqwya0pvqts4ubv0eqi6.jpg" 17 | file = URI.open(path) 18 | photo.attach(io: file, filename: "userphoto.png", content_type: "image/png") 19 | save 20 | end 21 | 22 | def self.from_omniauth(auth) 23 | where(provider: auth.provider, uid: auth.uid).first_or_create do |user| 24 | user.provider = auth.provider 25 | user.nickname = auth.info.nickname 26 | user.image = auth.info.image 27 | user.html_url = auth.extra.raw_info.html_url 28 | user.name = auth.info.name 29 | user.uid = auth.uid 30 | user.email = auth.info.email 31 | user.password = Devise.friendly_token[0,20] 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /app/policies/application_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationPolicy 4 | attr_reader :user, :record 5 | 6 | def initialize(user, record) 7 | @user = user 8 | @record = record 9 | end 10 | 11 | def index? 12 | false 13 | end 14 | 15 | def show? 16 | false 17 | end 18 | 19 | def create? 20 | false 21 | end 22 | 23 | def new? 24 | create? 25 | end 26 | 27 | def update? 28 | false 29 | end 30 | 31 | def edit? 32 | update? 33 | end 34 | 35 | def destroy? 36 | false 37 | end 38 | 39 | class Scope 40 | def initialize(user, scope) 41 | @user = user 42 | @scope = scope 43 | end 44 | 45 | def resolve 46 | raise NotImplementedError, "You must define #resolve in #{self.class}" 47 | end 48 | 49 | private 50 | 51 | attr_reader :user, :scope 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /app/policies/challenge_policy.rb: -------------------------------------------------------------------------------- 1 | class ChallengePolicy < ApplicationPolicy 2 | class Scope < Scope 3 | # NOTE: Be explicit about which records you allow access to! 4 | def resolve 5 | scope.all 6 | end 7 | end 8 | 9 | def show? 10 | true 11 | end 12 | 13 | def new? 14 | true 15 | end 16 | 17 | def create? 18 | true 19 | end 20 | 21 | def edit? 22 | update? 23 | end 24 | 25 | def update? 26 | user.admin? ? true : record.user == user 27 | end 28 | 29 | def destroy? 30 | update? 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /app/policies/offer_policy.rb: -------------------------------------------------------------------------------- 1 | class OfferPolicy < ApplicationPolicy 2 | class Scope < Scope 3 | # NOTE: Be explicit about which records you allow access to! 4 | def resolve 5 | scope.all 6 | end 7 | end 8 | 9 | def show? 10 | true 11 | end 12 | 13 | def new? 14 | true 15 | end 16 | 17 | def create? 18 | true 19 | end 20 | 21 | def edit? 22 | update? 23 | end 24 | 25 | def update? 26 | user.admin? ? true : record.user == user 27 | end 28 | 29 | def destroy? 30 | update? 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /app/views/challenges/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= f.input :address, 2 | input_html: {data: {address_autocomplete_target: "address"}, class: "d-none"}, 3 | wrapper_html: {data: {controller: "address-autocomplete", address_autocomplete_api_key_value: ENV["MAPBOX_API_KEY"]}} 4 | %> 5 | -------------------------------------------------------------------------------- /app/views/challenges/_info_window.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | <% if challenge.user.image %> 7 | <%= image_tag challenge.user.image, class: "avatar-custom", style:"height:80px !important; width:80px !important" %> 8 | <% elsif challenge.user.photo %> 9 | <%= cl_image_tag challenge.user.photo.key, class: "avatar-custom", style:"height:80px !important; width:80px !important" %> 10 | <% else %> 11 | <%= image_tag "userphoto_square.jpg", class:"avatar-custom", style: "height:80px; width:67.8px" %> 12 | <% end %> 13 |
14 |
15 | 16 |
17 |
<%= challenge.user.nickname %>: <%= challenge.title %>
18 |
19 | <% if !challenge.user.html_url.nil? %> 20 | <%= link_to "GitHub", challenge.user.html_url, class:"btn rounded-5 btn-sm", style:"background-color:#8d7197; color:white" %> 21 | <% else %> 22 | <%= link_to "GitHub", "https://www.github.com", class:"btn rounded-5 btn-sm", style:"background-color:#8d7197; color:white" %> 23 | <% end %> 24 | <%= link_to "Challenge", challenge_path(challenge), class:"btn rounded-5 btn-sm", style:"background-color:#8d7197; color:white" %> 25 |
26 |
27 |
28 |
29 |
30 |
31 | -------------------------------------------------------------------------------- /app/views/challenges/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

Update challenge

6 | <%= simple_form_for @challenge do |f| %> 7 | <%= f.input :title, placeholder: 'Edit the Title' %> 8 | <%= f.input :content, placeholder: 'Edit the description' %> 9 | <%= f.input :location, placeholder: 'Edit Challenge location' %> 10 | <%= f.association :filter, label: "Programming language ¹", collection: Filter.all.order(:name), input_html: { data: { controller: "tom-select" } } %> 11 | <%= f.input :price_max, placeholder: 'Edit price of your project' %> 12 | <%= f.input :photos, as: :file, input_html: { multiple: true } %> 13 | <%= f.input :deadline, placeholder: 'Edit deadline of your project' %> 14 | <%= f.submit class:"btn btn-dark btn-lg rounded-lg", id: "challenge_buttons" %> 15 | <% end %> 16 |
17 |
18 |
19 |

* All the fields need to be present for successful update

20 |

1 You cannot change the programming language of the challenge - for that you need to create a new one

21 |
22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /app/views/challenges/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <% if current_page?(challenges_path) %> 3 |
4 |
5 |

Welcome to Dev.Work

6 |

Find challenges below and help out fellow developers

7 |
8 |
9 |
10 |
15 |
16 |
17 |
18 |

Are you always working and cannot socialize?

19 | <%= image_tag "ad-1 (1).jpg", class:'my-2', style:'width:200px' %> 20 |

You have tried making friends but no coders around you?

21 | <%= image_tag "ad-1 (2).jpg", class:'my-2', style:'width:200px' %> 22 |

Are you looking for a place to socialize and talk about coding?

23 | <%= image_tag "ad-1 (3).jpg", class:'my-2', style:'width:200px' %> 24 |

Check out Socialize!

25 | <%= image_tag "Socialize.png", style:'width:130px' %> 26 |
27 |
28 |
29 |
30 | <% if @filter.present? %> 31 |

<%= "Your have selected #{@filter.name} language" %>

32 | <% elsif params[:location].present? %> 33 |

<%= "Your have selected #{params[:location]} city" %>

34 | <% else %> 35 |

<%= "Your have not selected any filter" %>

36 | <% end %> 37 |
38 |
39 |
40 | 50 |
51 | 61 |
62 | <%= link_to "Reset filters", challenges_path, class:"btn btn-secondary", id:"resetfilterbutton"%> 63 |
64 | <%= render "shared/index-cards" %> 65 | <% end %> 66 | <% if current_page?(my_challenges_path) %> 67 |
68 |
69 |

Your Challenges

70 | <% if @challenges.empty? %> 71 |

You have not posted a challenge yet! Check back again later...

72 | <% else %> 73 |

Below you can see all the challenges you have created

74 | <% end %> 75 |
76 |
77 |
78 |
83 |
84 |
85 | <%= render "shared/index-cards" %> 86 | <% end %> 87 |
88 | -------------------------------------------------------------------------------- /app/views/challenges/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

Create a new challenge

6 | <%= simple_form_for @challenge do |f| %> 7 | <%= f.input :title, placeholder: 'Add a Title' %> 8 | <%= f.input :content, placeholder: 'Describe in Details' %> 9 | <%= f.input :location, placeholder: 'Specify Challenge location' %> 10 | <%= f.association :filter, label: "Programming language ¹", collection: Filter.all.order(:name), input_html: { data: { controller: "tom-select" } } %> 11 | <%= f.input :price_max, placeholder: 'Put maximum price in Euros' %> 12 | <%= f.input :photos, as: :file, input_html: { multiple: true } %> 13 | <%= f.input :deadline, placeholder: 'Put a deadline for your project' %> 14 | <%= f.submit class:"btn btn-dark btn-lg rounded-lg challenge-buttons", id: "challenge_buttons" %> 15 | <% end %> 16 |
17 |
18 |
19 |

* All the fields need to be present for successful challenge creation

20 |

1 You will not be able to change the programming language of the challenge afterwards - choose wisely

21 |
22 |
23 |
24 |
25 | -------------------------------------------------------------------------------- /app/views/challenges/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | <%# ALL: The challenge itself %> 6 |
7 |
8 | <% if @challenge.user.image? %> 9 | <%= image_tag "#{@challenge.user.image}" %> 10 | <% elsif @challenge.user.photo.attached? %> 11 | <%= cl_image_tag(@challenge.user.photo.key) %> 12 | <% end %> 13 |
14 |
<%= @challenge.user.nickname %>
15 |
<%= @challenge.location %>
16 |
17 |
18 |

<%= @challenge.title %>

19 |

Maximum price: €<%= @challenge.price_max %>

20 |

Deadline: <%= @challenge.deadline.strftime("%B %d, %Y") %>

21 |

Language: <%= @challenge.filter.name %>

22 |

<%= @challenge.content %>

23 | <% @challenge.photos.each do |photo| %> 24 | <%= cl_image_tag photo.key, height: 400, width: 600, crop: :fit, class:"my-1" %> 25 | <% end %> 26 |
27 | <% if policy(@challenge).edit? %> 28 | <%= link_to "Delete this challenge", challenge_path(@challenge), class: "btn btn-danger mt-5 mb-1", id: "challenge_buttons", 29 | style:"color:white; background-color:#D0021B !important; border-color:#D0021B !important;", 30 | data: { turbo_method: :delete, turbo_confirm: "Are you sure to delete this challenge?" } %> 31 | <%= link_to "Edit this challenge", edit_challenge_path(@challenge), class: "btn btn-info mt-5 mb-1", id: "challenge_buttons" %> 32 | <%= link_to "Back to Challenges", "/challenges", class:"btn btn-secondary btn mt-5 mb-1", style:"border-radius:15px" %> 33 | <% end %> 34 |
35 |
36 |
37 |
38 | <%# ONLY USERS: Form for those making an offer %> 39 | <% if current_user != @challenge.user %> 40 |
41 |
42 |

Offer your skills

43 |

Do you think you have the required skills? Let them know for how much 44 | you could do the challenge and how long it will take you:

45 | <%= simple_form_for [@challenge, @offer] do |f| %> 46 |
47 |
48 | <%= f.input :price, label: "Price, €" %> 49 |
50 |
51 | <%= f.input :date, label: 'Proposed date of completion' %> 52 |
53 |
54 |
55 | <%= f.submit "Make offer", class:"btn btn-dark btn-lg rounded-lg mt-2", id:"button" %> 56 | <% end %> 57 | <%= link_to "Back to Challenges", "/challenges", class:"btn btn-secondary btn-lg mt-2", style:"border-radius:15px" %> 58 |
59 |
60 |
61 | <% end %> 62 | 63 | <%# ONLY OWNERS: Showing the offers made and able to accept offer %> 64 | <% if current_user == @challenge.user %> 65 |
66 |
67 |

Offers

68 | <% if @offers.empty? %> 69 |

There are no offers on this challenge! Check back again later...

70 | <% else %> 71 |
72 |
    73 | <%#
    %> 74 | <% @offers.each do |offer| %> 75 |
    76 | 77 | 78 |
    79 | <%#
    %> 80 |
    81 |
    82 | <% if offer.user.image.present? %> 83 | <%= image_tag(offer.user.image, class: "avatar-offer") %> 84 | <% elsif @offer.user.photo.attached? %> 85 | <%= cl_image_tag(@offer.user.photo.key) %> 86 | <% end %> 87 |
    88 |
    89 |
    90 |
    91 |

    <%= offer.user.nickname %> 92 |

    93 |
    94 | <%#= image_tag(offer.user.image, class: "avatar-offer") %> 95 |

    Offered price: €<%= offer.price %>

    96 |
    97 |
    98 |

    Offered date of completion: <%= offer.date %>

    99 | <%= link_to "Accept offer", challenge_path(@challenge), class: "btn btn-success", id: "challenge_buttons", style:"background-color:#009900; color:#ffffff; border-width:0px" %> 100 |
    101 |
    102 | 103 | <% end %> 104 |
105 |
106 | <% end %> 107 |
108 |
109 | <% end %> 110 |
111 |
112 | <%# ALL: Comments left on the challenge %> 113 |
114 |
115 |

Comments

116 | <% if @comments.nil? %> 117 |

There are no comments on this challenge! Check back again later...

118 | <% else %> 119 |
120 | <% @comments.each do |comment| %> 121 |
122 | <%= cl_image_tag(comment.user.photo.key, class: "avatar") %> 123 | <%= comment %> 124 |
125 | <% end %> 126 |
127 | <% end %> 128 |
129 |
130 |
131 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend confirmation instructions

2 | 3 | <%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= f.error_notification %> 5 | <%= f.full_error :confirmation_token %> 6 | 7 |
8 | <%= f.input :email, 9 | required: true, 10 | autofocus: true, 11 | value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), 12 | input_html: { autocomplete: "email" } %> 13 |
14 | 15 |
16 | <%= f.button :submit, "Resend confirmation instructions" %> 17 |
18 | <% end %> 19 | 20 | <%= render "devise/shared/links" %> 21 | -------------------------------------------------------------------------------- /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 |

Change your password

2 | 3 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 4 | <%= f.error_notification %> 5 | 6 | <%= f.input :reset_password_token, as: :hidden %> 7 | <%= f.full_error :reset_password_token %> 8 | 9 |
10 | <%= f.input :password, 11 | label: "New password", 12 | required: true, 13 | autofocus: true, 14 | hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), 15 | input_html: { autocomplete: "new-password" } %> 16 | <%= f.input :password_confirmation, 17 | label: "Confirm your new password", 18 | required: true, 19 | input_html: { autocomplete: "new-password" } %> 20 |
21 | 22 |
23 | <%= f.button :submit, "Change my password" %> 24 |
25 | <% end %> 26 | 27 | <%= render "devise/shared/links" %> 28 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |

Forgot your password?

2 | 3 | <%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= f.error_notification %> 5 | 6 |
7 | <%= f.input :email, 8 | required: true, 9 | autofocus: true, 10 | input_html: { autocomplete: "email" } %> 11 |
12 | 13 |
14 | <%= f.button :submit, "Send me reset password instructions" %> 15 |
16 | <% end %> 17 | 18 | <%= render "devise/shared/links" %> 19 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Edit <%= resource_name.to_s.humanize %>

5 | 6 | <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 7 | <%= f.error_notification %> 8 | 9 |
10 | <%= f.input :email, required: true, autofocus: true %> 11 | 12 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 13 |

Currently waiting confirmation for: <%= resource.unconfirmed_email %>

14 | <% end %> 15 | 16 | <%= f.input :nickname, 17 | required: true, 18 | autofocus: true, 19 | input_html: { autocomplete: "email" }%> 20 | <%= f.input :password, 21 | hint: "leave it blank if you don't want to change it", 22 | required: false, 23 | input_html: { autocomplete: "new-password" } %> 24 | <%= f.input :password_confirmation, 25 | required: false, 26 | input_html: { autocomplete: "new-password" } %> 27 | <%= f.input :current_password, 28 | hint: "we need your current password to confirm your changes", 29 | required: true, 30 | input_html: { autocomplete: "current-password" } %> 31 |
32 | 33 |
34 | <%= f.button :submit, "Update" %> 35 |
36 | <% end %> 37 | 38 |

Cancel my account

39 | 40 |

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

41 | 42 | <%= link_to "Back", :back %> 43 |
44 |
45 |
46 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 | 39 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 | 33 | -------------------------------------------------------------------------------- /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 |
    10 | <% resource.errors.full_messages.each do |message| %> 11 |
  • <%= message %>
  • 12 | <% end %> 13 |
14 |
15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if devise_mapping.omniauthable? %> 2 | <%- resource_class.omniauth_providers.each do |provider| %> 3 | <%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { 'turbo-method' => :post }, class:"button draw-border mr-2 sign-in-button"%>
4 | <% end %> 5 | <% end %> 6 | 7 | <%- if controller_name != 'sessions' %> 8 | <%#= link_to "Log in", new_session_path(resource_name) %>
9 | <% end %> 10 | 11 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 12 | <%#= link_to "Sign up", new_registration_path(resource_name) %>
13 | <% end %> 14 | 15 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 16 | <%#= link_to "Forgot your password?", new_password_path(resource_name) %>
17 | <% end %> 18 | 19 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 20 | <%#= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
21 | <% end %> 22 | 23 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 24 | <%#= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
25 | <% end %> 26 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend unlock instructions

2 | 3 | <%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= f.error_notification %> 5 | <%= f.full_error :unlock_token %> 6 | 7 |
8 | <%= f.input :email, 9 | required: true, 10 | autofocus: true, 11 | input_html: { autocomplete: "email" } %> 12 |
13 | 14 |
15 | <%= f.button :submit, "Resend unlock instructions" %> 16 |
17 | <% end %> 18 | 19 | <%= render "devise/shared/links" %> 20 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%# class h-100 sticks the footer at the bottom %> 4 | 5 | 6 | Dev.Work 7 | 8 | <%= csrf_meta_tags %> 9 | <%= csp_meta_tag %> 10 | <%# Bootstrap %> 11 | 12 | <%# Fontawesome %> 13 | 14 | <%# Box Icons %> 15 | 16 | 17 | 20 | 21 | 24 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> 25 | 26 | 27 | <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> 28 | 29 | 30 | 31 | 32 |
33 | <%#
%> 34 |
35 | <% unless current_page?(root_path) %> 36 | <%= render "shared/sidebar" %> 37 | <% end %> 38 | <%= render 'shared/flashes' %> 39 |
40 | <%= yield %> 41 |
42 |
43 |
44 | <% unless current_page?(root_path) %> 45 | <%= render "shared/footer" %> 46 | <% end %> 47 | <%#
%> 48 |
49 |
50 | 51 | 56 | 57 | -------------------------------------------------------------------------------- /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/offers/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Your Offers

5 | <% if @user_offers.empty? %> 6 |

You haven't made any offers yet! Any offers you make will be shown here...

7 | <% else %> 8 |

Below you can see all the offers you have made

9 | <% end %> 10 |
11 |
12 |
17 |
18 |
19 |
20 |
21 | <% @user_offers.each do |offer| %> 22 |
23 |

<%= offer.challenge.title %>

24 |
25 |
26 |

Their maximum price:

27 |

<%= offer.challenge.price_max %>

28 |

The deadline:

29 |

<%= offer.challenge.deadline %>

30 |
31 |
32 |

My offered price:

33 |

<%= offer.price %>

34 |

My proposed date:

35 |

<%= offer.date %>

36 |
37 |
38 | <%= link_to "See challenge", challenge_path(offer.challenge), class:"btn btn-dark btn-lg rounded-lg mx-3", style:"position:absolute;bottom:10px; width:180px", id:"button" %> 39 | <%= link_to "View offer", "#", class:"btn btn-dark btn-lg rounded-lg mx-3", style:"position:absolute;bottom:10px; right:0px; width:180px", id:"button" %> 40 |
41 | <% end %> 42 |
43 | <%# end %> 44 |
45 | -------------------------------------------------------------------------------- /app/views/offers/review.html.erb: -------------------------------------------------------------------------------- 1 | <%= simple_form_for([@challenge, @offer]) do |f| %> 2 | <%= f.input :comment %> 3 | <%= f.submit %> 4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/views/offers/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

Details of Your Offer

6 | <%= simple_form_for @challenge do |f| %> 7 | <%= f.input :title, placeholder: 'Edit the Title' %> 8 | <%= f.input :content, placeholder: 'Edit the description' %> 9 | <%= f.input :location, placeholder: 'Edit Challenge location' %> 10 | <%= f.association :filter, label: "Programming language ¹", collection: Filter.all.order(:name), input_html: { data: { controller: "tom-select" } } %> 11 | <%= f.input :price_max, placeholder: 'Edit price of your project' %> 12 | <%= f.input :deadline, placeholder: 'Edit deadline of your project' %> 13 | <%= f.submit class:"btn btn-dark btn-lg rounded-lg", id: "challenge_buttons" %> 14 | <% end %> 15 |
16 |
17 |
18 |

* All the fields need to be present for successful update

19 |

1 You cannot change the programming language of the challenge - for that you need to create a new one

20 |
21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /app/views/pages/home.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= render "shared/banner" %> 3 | -------------------------------------------------------------------------------- /app/views/shared/_banner.html.erb: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /app/views/shared/_button.html.erb: -------------------------------------------------------------------------------- 1 | Primary link 2 | -------------------------------------------------------------------------------- /app/views/shared/_flashes.html.erb: -------------------------------------------------------------------------------- 1 | <% if notice %> 2 | 6 | <% end %> 7 | <% if alert %> 8 | 12 | <% end %> 13 | -------------------------------------------------------------------------------- /app/views/shared/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 98 | -------------------------------------------------------------------------------- /app/views/shared/_form.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/views/shared/_form.html.erb -------------------------------------------------------------------------------- /app/views/shared/_index-cards.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 | <% @challenges.each_with_index do |challenge, index| %> 4 | <%#
%> 5 |
6 |
7 |
8 |
9 |
10 | <% if challenge.user.image? %> 11 | <%= image_tag "#{challenge.user.image}" %> 12 | <% elsif challenge.user.photo.attached? %> 13 | <%= cl_image_tag(challenge.user.photo.key) %> 14 | <% end %> 15 |
16 | <%#
17 | 1 days ago 18 |
%> 19 |
20 |
.
21 |
<%= challenge.user.name %> 22 |
23 |
<%= challenge.location %>
24 |
25 | 26 |
27 |
<%= challenge.filter.name %> 28 |
29 | 30 |
31 |
32 |

<%= challenge.title %> 33 |

34 |
35 |
36 |
Deadline: <%= challenge.deadline.strftime("%B %d, %Y") %> 37 | 38 | 39 |
40 |
41 |
42 | <%= link_to "View details", challenge_path(challenge), class:"btn btn-dark btn-lg rounded-lg", id:"button"%> 43 |
44 | <%#
%> 45 | <% end %> 46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /app/views/shared/_navbar.html.erb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/app/views/shared/_navbar.html.erb -------------------------------------------------------------------------------- /app/views/shared/_sidebar.html.erb: -------------------------------------------------------------------------------- 1 | 78 | -------------------------------------------------------------------------------- /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", __dir__) 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_requirement 64 | @bundler_requirement ||= 65 | env_var_version || cli_arg_version || 66 | bundler_requirement_for(lockfile_version) 67 | end 68 | 69 | def bundler_requirement_for(version) 70 | return "#{Gem::Requirement.default}.a" unless version 71 | 72 | bundler_gem_version = Gem::Version.new(version) 73 | 74 | requirement = bundler_gem_version.approximate_recommendation 75 | 76 | return requirement unless Gem.rubygems_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/dev: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if ! foreman version &> /dev/null 4 | then 5 | echo "Installing foreman..." 6 | gem install foreman 7 | fi 8 | 9 | foreman start -f Procfile.dev "$@" 10 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path("../config/application", __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /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 set up or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at any time 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 | # puts "\n== Copying sample files ==" 21 | # unless File.exist?("config/database.yml") 22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml" 23 | # end 24 | 25 | puts "\n== Preparing database ==" 26 | system! "bin/rails db:prepare" 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! "bin/rails log:clear tmp:clear" 30 | 31 | puts "\n== Restarting application server ==" 32 | system! "bin/rails restart" 33 | end 34 | -------------------------------------------------------------------------------- /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 | Rails.application.load_server 7 | -------------------------------------------------------------------------------- /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 DevWork 10 | class Application < Rails::Application 11 | config.generators do |generate| 12 | generate.assets false 13 | generate.helper false 14 | generate.test_framework :test_unit, fixture: false 15 | end 16 | # Initialize configuration defaults for originally generated Rails version. 17 | config.load_defaults 7.0 18 | 19 | # Configuration for the application, engines, and railties goes here. 20 | # 21 | # These settings can be overridden in specific environments using the files 22 | # in config/environments, which are processed later. 23 | # 24 | # config.time_zone = "Central Time (US & Canada)" 25 | # config.eager_load_paths << Rails.root.join("extras") 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /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: DevWork_Production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | 5ZLKyGjngKBvEzFITztcuLYikjLSvgNndBbh71pDCKT122MR67/Zu3msmp+t9Ibe7+6ID19rCeJiVjYLx3gs9gy48f8vJioHXSsLeMIaAeCklirwOKZPXlMUHIM7tiCmhXu4XpeP+9vD7LynljWgFaePGcuRGcqIVgIZ+jjrX83PXMOHfDMTFeRI9FVivf0juiH0TjtfqDr89o3GoSQB6sgT022IYcTXGJby9B0csiCzD0t/iAncg1FyKLmn1AyXhrGEjcC+CfFgGIoSIX0tj4/JTZAOQWTAZJvBnwp+1l06sB/OBJOM775B+htS5P5OTDAxjX/16Fr61999iO8ii5yGkWZLX1hASehPBI83/a175VTWGQE63T/PhIqLsXPriWw7vfw1lgH5mJDmqvP+SHTiKgAiAIf2KdIh--9CHFJNM5Cwo48U+a--1X6r/wHpsWWNR5ujTeW2hg== -------------------------------------------------------------------------------- /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: DevWork_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 running Rails. 32 | #username: rbnb 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: Devwork_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 or a full connection URL as an environment 67 | # variable when you boot the app. For example: 68 | # 69 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 70 | # 71 | # If the connection URL is provided in the special DATABASE_URL environment 72 | # variable, Rails will automatically merge its configuration values on top of 73 | # the values provided in this file. Alternatively, you can specify a connection 74 | # URL environment variable explicitly: 75 | # 76 | # production: 77 | # url: <%= ENV["MY_APP_DATABASE_URL"] %> 78 | # 79 | # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database 80 | # for a full overview on how database connection configuration can be specified. 81 | # 82 | production: 83 | <<: *default 84 | database: DevWork_Production 85 | username: DevWork 86 | password: <%= ENV["DEVWORK_DATABASE_PASSWORD"] %> 87 | -------------------------------------------------------------------------------- /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 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # In the development environment your application's code is reloaded any time 7 | # it changes. This slows down response time but is perfect for development 8 | # since you don't have to restart the web server when you make code changes. 9 | config.cache_classes = false 10 | 11 | # Do not eager load code on boot. 12 | config.eager_load = false 13 | 14 | # Show full error reports. 15 | config.consider_all_requests_local = true 16 | 17 | # Enable server timing 18 | config.server_timing = true 19 | 20 | # Enable/disable caching. By default caching is disabled. 21 | # Run rails dev:cache to toggle caching. 22 | if Rails.root.join("tmp/caching-dev.txt").exist? 23 | config.action_controller.perform_caching = true 24 | config.action_controller.enable_fragment_cache_logging = true 25 | 26 | config.cache_store = :memory_store 27 | config.public_file_server.headers = { 28 | "Cache-Control" => "public, max-age=#{2.days.to_i}" 29 | } 30 | else 31 | config.action_controller.perform_caching = false 32 | 33 | config.cache_store = :null_store 34 | end 35 | 36 | # Store uploaded files on the local file system (see config/storage.yml for options). 37 | # config.active_storage.service = :local 38 | config.active_storage.service = :cloudinary 39 | 40 | # Don't care if the mailer can't send. 41 | config.action_mailer.raise_delivery_errors = false 42 | 43 | config.action_mailer.perform_caching = false 44 | 45 | # Print deprecation notices to the Rails logger. 46 | config.active_support.deprecation = :log 47 | 48 | # Raise exceptions for disallowed deprecations. 49 | config.active_support.disallowed_deprecation = :raise 50 | 51 | # Tell Active Support which deprecation messages to disallow. 52 | config.active_support.disallowed_deprecation_warnings = [] 53 | 54 | # Raise an error on page load if there are pending migrations. 55 | config.active_record.migration_error = :page_load 56 | 57 | # Highlight code that triggered database queries in logs. 58 | config.active_record.verbose_query_logs = true 59 | 60 | # Suppress logger output for asset requests. 61 | config.assets.quiet = true 62 | 63 | # Raises error for missing translations. 64 | # config.i18n.raise_on_missing_translations = true 65 | 66 | # Annotate rendered view with file names. 67 | # config.action_view.annotate_rendered_view_with_filenames = true 68 | 69 | # Uncomment if you wish to allow Action Cable access from any origin. 70 | # config.action_cable.disable_request_forgery_protection = true 71 | end 72 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | Rails.application.configure do 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? 26 | 27 | # Compress CSS using a preprocessor. 28 | # config.assets.css_compressor = :sass 29 | 30 | # Do not fallback to assets pipeline if a precompiled asset is missed. 31 | config.assets.compile = false 32 | 33 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 34 | # config.asset_host = "http://assets.example.com" 35 | 36 | # Specifies the header that your server uses for sending files. 37 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache 38 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX 39 | 40 | # Store uploaded files on the local file system (see config/storage.yml for options). 41 | # config.active_storage.service = :local 42 | config.active_storage.service = :cloudinary 43 | 44 | 45 | # Mount Action Cable outside main process or domain. 46 | # config.action_cable.mount_path = nil 47 | # config.action_cable.url = "wss://example.com/cable" 48 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] 49 | 50 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 51 | config.force_ssl = true 52 | 53 | # Include generic and useful information about system operation, but avoid logging too much 54 | # information to avoid inadvertent exposure of personally identifiable information (PII). 55 | config.log_level = :info 56 | 57 | # Prepend all log lines with the following tags. 58 | config.log_tags = [ :request_id ] 59 | 60 | # Use a different cache store in production. 61 | # config.cache_store = :mem_cache_store 62 | 63 | # Use a real queuing backend for Active Job (and separate queues per environment). 64 | # config.active_job.queue_adapter = :resque 65 | # config.active_job.queue_name_prefix = "rbnb_production" 66 | 67 | config.action_mailer.perform_caching = false 68 | 69 | # Ignore bad email addresses and do not raise email delivery errors. 70 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 71 | # config.action_mailer.raise_delivery_errors = false 72 | 73 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 74 | # the I18n.default_locale when a translation cannot be found). 75 | config.i18n.fallbacks = true 76 | 77 | # Don't log any deprecations. 78 | config.active_support.report_deprecations = false 79 | 80 | # Use default logging formatter so that PID and timestamp are not suppressed. 81 | config.log_formatter = ::Logger::Formatter.new 82 | 83 | # Use a different logger for distributed setups. 84 | # require "syslog/logger" 85 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") 86 | 87 | if ENV["RAILS_LOG_TO_STDOUT"].present? 88 | logger = ActiveSupport::Logger.new(STDOUT) 89 | logger.formatter = config.log_formatter 90 | config.logger = ActiveSupport::TaggedLogging.new(logger) 91 | end 92 | 93 | # Do not dump schema after migrations. 94 | config.active_record.dump_schema_after_migration = false 95 | end 96 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | require "active_support/core_ext/integer/time" 2 | 3 | # The test environment is used exclusively to run your application's 4 | # test suite. You never need to work with it otherwise. Remember that 5 | # your test database is "scratch space" for the test suite and is wiped 6 | # and recreated between test runs. Don't rely on the data there! 7 | 8 | Rails.application.configure do 9 | # Settings specified here will take precedence over those in config/application.rb. 10 | 11 | # Turn false under Spring and add config.action_view.cache_template_loading = true. 12 | config.cache_classes = true 13 | 14 | # Eager loading loads your whole application. When running a single test locally, 15 | # this probably isn't necessary. It's a good idea to do in a continuous integration 16 | # system, or in some way before deploying your code. 17 | config.eager_load = ENV["CI"].present? 18 | 19 | # Configure public file server for tests with Cache-Control for performance. 20 | config.public_file_server.enabled = true 21 | config.public_file_server.headers = { 22 | "Cache-Control" => "public, max-age=#{1.hour.to_i}" 23 | } 24 | 25 | # Show full error reports and disable caching. 26 | config.consider_all_requests_local = true 27 | config.action_controller.perform_caching = false 28 | config.cache_store = :null_store 29 | 30 | # Raise exceptions instead of rendering exception templates. 31 | config.action_dispatch.show_exceptions = false 32 | 33 | # Disable request forgery protection in test environment. 34 | config.action_controller.allow_forgery_protection = false 35 | 36 | # Store uploaded files on the local file system in a temporary directory. 37 | config.active_storage.service = :test 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Tell Action Mailer not to deliver emails to the real world. 42 | # The :test delivery method accumulates sent emails in the 43 | # ActionMailer::Base.deliveries array. 44 | config.action_mailer.delivery_method = :test 45 | 46 | # Print deprecation notices to the stderr. 47 | config.active_support.deprecation = :stderr 48 | 49 | # Raise exceptions for disallowed deprecations. 50 | config.active_support.disallowed_deprecation = :raise 51 | 52 | # Tell Active Support which deprecation messages to disallow. 53 | config.active_support.disallowed_deprecation_warnings = [] 54 | 55 | # Raises error for missing translations. 56 | # config.i18n.raise_on_missing_translations = true 57 | 58 | # Annotate rendered view with file names. 59 | # config.action_view.annotate_rendered_view_with_filenames = true 60 | end 61 | -------------------------------------------------------------------------------- /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 | 9 | Rails.application.config.assets.paths << Rails.root.join("node_modules") 10 | # Precompile additional assets. 11 | # application.js, application.css, and all non-JS/CSS in the app/assets 12 | # folder are already added. 13 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 14 | -------------------------------------------------------------------------------- /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 | # See the Securing Rails Applications Guide for more information: 5 | # https://guides.rubyonrails.org/security.html#content-security-policy-header 6 | 7 | # Rails.application.configure do 8 | # config.content_security_policy do |policy| 9 | # policy.default_src :self, :https 10 | # policy.font_src :self, :https, :data 11 | # policy.img_src :self, :https, :data 12 | # policy.object_src :none 13 | # policy.script_src :self, :https 14 | # policy.style_src :self, :https 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | # 19 | # # Generate session nonces for permitted importmap and inline scripts 20 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } 21 | # config.content_security_policy_nonce_directives = %w(script-src) 22 | # 23 | # # Report violations without enforcing the policy. 24 | # # config.content_security_policy_report_only = true 25 | # end 26 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure parameters to be filtered from the log file. Use this to limit dissemination of 4 | # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported 5 | # notations and behaviors. 6 | Rails.application.config.filter_parameters += [ 7 | :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn 8 | ] 9 | -------------------------------------------------------------------------------- /config/initializers/geocoder.rb: -------------------------------------------------------------------------------- 1 | Geocoder.configure( 2 | # Geocoding options 3 | # timeout: 3, # geocoding service timeout (secs) 4 | # lookup: :nominatim, # name of geocoding service (symbol) 5 | # ip_lookup: :ipinfo_io, # name of IP address geocoding service (symbol) 6 | # language: :en, # ISO-639 language code 7 | # use_https: false, # use HTTPS for lookup requests? (if supported) 8 | # http_proxy: nil, # HTTP proxy server (user:pass@host:port) 9 | # https_proxy: nil, # HTTPS proxy server (user:pass@host:port) 10 | # api_key: nil, # API key for geocoding service 11 | # cache: nil, # cache object (must respond to #[], #[]=, and #del) 12 | 13 | # Exceptions that should not be rescued by default 14 | # (if you want to implement custom error handling); 15 | # supports SocketError and Timeout::Error 16 | # always_raise: [], 17 | 18 | # Calculation options 19 | units: :km, # :km for kilometers or :mi for miles 20 | # distances: :linear # :spherical or :linear 21 | 22 | # Cache configuration 23 | # cache_options: { 24 | # expiration: 2.days, 25 | # prefix: 'geocoder:' 26 | # } 27 | ) 28 | -------------------------------------------------------------------------------- /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/permissions_policy.rb: -------------------------------------------------------------------------------- 1 | # Define an application-wide HTTP permissions policy. For further 2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy 3 | # 4 | # Rails.application.config.permissions_policy do |f| 5 | # f.camera :none 6 | # f.gyroscope :none 7 | # f.microphone :none 8 | # f.usb :none 9 | # f.fullscreen :self 10 | # f.payment :self, "https://secure.example.com" 11 | # end 12 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | # 3 | # Uncomment this and change the path if necessary to include your own 4 | # components. 5 | # See https://github.com/heartcombo/simple_form#custom-components to know 6 | # more about custom components. 7 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } 8 | # 9 | # Use this setup block to configure all options available in SimpleForm. 10 | SimpleForm.setup do |config| 11 | # Wrappers are used by the form builder to generate a 12 | # complete input. You can remove any component from the 13 | # wrapper, change the order or even add your own to the 14 | # stack. The options given below are used to wrap the 15 | # whole input. 16 | config.wrappers :default, class: :input, 17 | hint_class: :field_with_hint, error_class: :field_with_errors, valid_class: :field_without_errors do |b| 18 | ## Extensions enabled by default 19 | # Any of these extensions can be disabled for a 20 | # given input by passing: `f.input EXTENSION_NAME => false`. 21 | # You can make any of these extensions optional by 22 | # renaming `b.use` to `b.optional`. 23 | 24 | # Determines whether to use HTML5 (:email, :url, ...) 25 | # and required attributes 26 | b.use :html5 27 | 28 | # Calculates placeholders automatically from I18n 29 | # You can also pass a string as f.input placeholder: "Placeholder" 30 | b.use :placeholder 31 | 32 | ## Optional extensions 33 | # They are disabled unless you pass `f.input EXTENSION_NAME => true` 34 | # to the input. If so, they will retrieve the values from the model 35 | # if any exists. If you want to enable any of those 36 | # extensions by default, you can change `b.optional` to `b.use`. 37 | 38 | # Calculates maxlength from length validations for string inputs 39 | # and/or database column lengths 40 | b.optional :maxlength 41 | 42 | # Calculate minlength from length validations for string inputs 43 | b.optional :minlength 44 | 45 | # Calculates pattern from format validations for string inputs 46 | b.optional :pattern 47 | 48 | # Calculates min and max from length validations for numeric inputs 49 | b.optional :min_max 50 | 51 | # Calculates readonly automatically from readonly attributes 52 | b.optional :readonly 53 | 54 | ## Inputs 55 | # b.use :input, class: 'input', error_class: 'is-invalid', valid_class: 'is-valid' 56 | b.use :label_input 57 | b.use :hint, wrap_with: { tag: :span, class: :hint } 58 | b.use :error, wrap_with: { tag: :span, class: :error } 59 | 60 | ## full_messages_for 61 | # If you want to display the full error message for the attribute, you can 62 | # use the component :full_error, like: 63 | # 64 | # b.use :full_error, wrap_with: { tag: :span, class: :error } 65 | end 66 | 67 | # The default wrapper to be used by the FormBuilder. 68 | config.default_wrapper = :default 69 | 70 | # Define the way to render check boxes / radio buttons with labels. 71 | # Defaults to :nested for bootstrap config. 72 | # inline: input + label 73 | # nested: label > input 74 | config.boolean_style = :nested 75 | 76 | # Default class for buttons 77 | config.button_class = 'btn' 78 | 79 | # Method used to tidy up errors. Specify any Rails Array method. 80 | # :first lists the first message for each field. 81 | # Use :to_sentence to list all errors for each field. 82 | # config.error_method = :first 83 | 84 | # Default tag used for error notification helper. 85 | config.error_notification_tag = :div 86 | 87 | # CSS class to add for error notification helper. 88 | config.error_notification_class = 'error_notification' 89 | 90 | # Series of attempts to detect a default label method for collection. 91 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 92 | 93 | # Series of attempts to detect a default value method for collection. 94 | # config.collection_value_methods = [ :id, :to_s ] 95 | 96 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 97 | # config.collection_wrapper_tag = nil 98 | 99 | # You can define the class to use on all collection wrappers. Defaulting to none. 100 | # config.collection_wrapper_class = nil 101 | 102 | # You can wrap each item in a collection of radio/check boxes with a tag, 103 | # defaulting to :span. 104 | # config.item_wrapper_tag = :span 105 | 106 | # You can define a class to use in all item wrappers. Defaulting to none. 107 | # config.item_wrapper_class = nil 108 | 109 | # How the label text should be generated altogether with the required text. 110 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } 111 | 112 | # You can define the class to use on all labels. Default is nil. 113 | # config.label_class = nil 114 | 115 | # You can define the default class to be used on forms. Can be overridden 116 | # with `html: { :class }`. Defaulting to none. 117 | # config.default_form_class = nil 118 | 119 | # You can define which elements should obtain additional classes 120 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 121 | 122 | # Whether attributes are required by default (or not). Default is true. 123 | # config.required_by_default = true 124 | 125 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 126 | # These validations are enabled in SimpleForm's internal config but disabled by default 127 | # in this configuration, which is recommended due to some quirks from different browsers. 128 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 129 | # change this configuration to true. 130 | config.browser_validations = false 131 | 132 | # Custom mappings for input types. This should be a hash containing a regexp 133 | # to match as key, and the input type that will be used when the field name 134 | # matches the regexp as value. 135 | # config.input_mappings = { /count/ => :integer } 136 | 137 | # Custom wrappers for input types. This should be a hash containing an input 138 | # type as key and the wrapper that will be used for all inputs with specified type. 139 | # config.wrapper_mappings = { string: :prepend } 140 | 141 | # Namespaces where SimpleForm should look for custom input classes that 142 | # override default inputs. 143 | # config.custom_inputs_namespaces << "CustomInputs" 144 | 145 | # Default priority for time_zone inputs. 146 | # config.time_zone_priority = nil 147 | 148 | # Default priority for country inputs. 149 | # config.country_priority = nil 150 | 151 | # When false, do not use translations for labels. 152 | # config.translate_labels = true 153 | 154 | # Automatically discover new inputs in Rails' autoload path. 155 | # config.inputs_discovery = true 156 | 157 | # Cache SimpleForm inputs discovery 158 | # config.cache_discovery = !Rails.env.development? 159 | 160 | # Default class for inputs 161 | # config.input_class = nil 162 | 163 | # Define the default class of the input wrapper of the boolean input. 164 | config.boolean_label_class = 'checkbox' 165 | 166 | # Defines if the default input wrapper class should be included in radio 167 | # collection wrappers. 168 | # config.include_default_input_wrapper_class = true 169 | 170 | # Defines which i18n scope will be used in Simple Form. 171 | # config.i18n_scope = 'simple_form' 172 | 173 | # Defines validation classes to the input_field. By default it's nil. 174 | # config.input_field_valid_class = 'is-valid' 175 | # config.input_field_error_class = 'is-invalid' 176 | end 177 | -------------------------------------------------------------------------------- /config/initializers/simple_form_bootstrap.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # These defaults are defined and maintained by the community at 4 | # https://github.com/heartcombo/simple_form-bootstrap 5 | # Please submit feedback, changes and tests only there. 6 | 7 | # Uncomment this and change the path if necessary to include your own 8 | # components. 9 | # See https://github.com/heartcombo/simple_form#custom-components 10 | # to know more about custom components. 11 | # Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f } 12 | 13 | # Use this setup block to configure all options available in SimpleForm. 14 | SimpleForm.setup do |config| 15 | # Default class for buttons 16 | config.button_class = 'btn' 17 | 18 | # Define the default class of the input wrapper of the boolean input. 19 | config.boolean_label_class = 'form-check-label' 20 | 21 | # How the label text should be generated altogether with the required text. 22 | config.label_text = lambda { |label, required, explicit_label| "#{label} #{required}" } 23 | 24 | # Define the way to render check boxes / radio buttons with labels. 25 | config.boolean_style = :inline 26 | 27 | # You can wrap each item in a collection of radio/check boxes with a tag 28 | config.item_wrapper_tag = :div 29 | 30 | # Defines if the default input wrapper class should be included in radio 31 | # collection wrappers. 32 | config.include_default_input_wrapper_class = false 33 | 34 | # CSS class to add for error notification helper. 35 | config.error_notification_class = 'alert alert-danger' 36 | 37 | # Method used to tidy up errors. Specify any Rails Array method. 38 | # :first lists the first message for each field. 39 | # :to_sentence to list all errors for each field. 40 | config.error_method = :to_sentence 41 | 42 | # add validation classes to `input_field` 43 | config.input_field_error_class = 'is-invalid' 44 | config.input_field_valid_class = 'is-valid' 45 | 46 | 47 | # vertical forms 48 | # 49 | # vertical default_wrapper 50 | config.wrappers :vertical_form, class: 'mb-3' do |b| 51 | b.use :html5 52 | b.use :placeholder 53 | b.optional :maxlength 54 | b.optional :minlength 55 | b.optional :pattern 56 | b.optional :min_max 57 | b.optional :readonly 58 | b.use :label, class: 'form-label' 59 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 60 | b.use :full_error, wrap_with: { class: 'invalid-feedback' } 61 | b.use :hint, wrap_with: { class: 'form-text' } 62 | end 63 | 64 | # vertical input for boolean 65 | config.wrappers :vertical_boolean, tag: 'fieldset', class: 'mb-3' do |b| 66 | b.use :html5 67 | b.optional :readonly 68 | b.wrapper :form_check_wrapper, class: 'form-check' do |bb| 69 | bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 70 | bb.use :label, class: 'form-check-label' 71 | bb.use :full_error, wrap_with: { class: 'invalid-feedback' } 72 | bb.use :hint, wrap_with: { class: 'form-text' } 73 | end 74 | end 75 | 76 | # vertical input for radio buttons and check boxes 77 | config.wrappers :vertical_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b| 78 | b.use :html5 79 | b.optional :readonly 80 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| 81 | ba.use :label_text 82 | end 83 | b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 84 | b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' } 85 | b.use :hint, wrap_with: { class: 'form-text' } 86 | end 87 | 88 | # vertical input for inline radio buttons and check boxes 89 | config.wrappers :vertical_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', tag: 'fieldset', class: 'mb-3' do |b| 90 | b.use :html5 91 | b.optional :readonly 92 | b.wrapper :legend_tag, tag: 'legend', class: 'col-form-label pt-0' do |ba| 93 | ba.use :label_text 94 | end 95 | b.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 96 | b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' } 97 | b.use :hint, wrap_with: { class: 'form-text' } 98 | end 99 | 100 | # vertical file input 101 | config.wrappers :vertical_file, class: 'mb-3' do |b| 102 | b.use :html5 103 | b.use :placeholder 104 | b.optional :maxlength 105 | b.optional :minlength 106 | b.optional :readonly 107 | b.use :label, class: 'form-label' 108 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 109 | b.use :full_error, wrap_with: { class: 'invalid-feedback' } 110 | b.use :hint, wrap_with: { class: 'form-text' } 111 | end 112 | 113 | # vertical select input 114 | config.wrappers :vertical_select, class: 'mb-3' do |b| 115 | b.use :html5 116 | b.optional :readonly 117 | b.use :label, class: 'form-label' 118 | b.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid' 119 | b.use :full_error, wrap_with: { class: 'invalid-feedback' } 120 | b.use :hint, wrap_with: { class: 'form-text' } 121 | end 122 | 123 | # vertical multi select 124 | config.wrappers :vertical_multi_select, class: 'mb-3' do |b| 125 | b.use :html5 126 | b.optional :readonly 127 | b.use :label, class: 'form-label' 128 | b.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |ba| 129 | ba.use :input, class: 'form-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid' 130 | end 131 | b.use :full_error, wrap_with: { class: 'invalid-feedback d-block' } 132 | b.use :hint, wrap_with: { class: 'form-text' } 133 | end 134 | 135 | # vertical range input 136 | config.wrappers :vertical_range, class: 'mb-3' do |b| 137 | b.use :html5 138 | b.use :placeholder 139 | b.optional :readonly 140 | b.optional :step 141 | b.use :label, class: 'form-label' 142 | b.use :input, class: 'form-range', error_class: 'is-invalid', valid_class: 'is-valid' 143 | b.use :full_error, wrap_with: { class: 'invalid-feedback' } 144 | b.use :hint, wrap_with: { class: 'form-text' } 145 | end 146 | 147 | 148 | # horizontal forms 149 | # 150 | # horizontal default_wrapper 151 | config.wrappers :horizontal_form, class: 'row mb-3' do |b| 152 | b.use :html5 153 | b.use :placeholder 154 | b.optional :maxlength 155 | b.optional :minlength 156 | b.optional :pattern 157 | b.optional :min_max 158 | b.optional :readonly 159 | b.use :label, class: 'col-sm-3 col-form-label' 160 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 161 | ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 162 | ba.use :full_error, wrap_with: { class: 'invalid-feedback' } 163 | ba.use :hint, wrap_with: { class: 'form-text' } 164 | end 165 | end 166 | 167 | # horizontal input for boolean 168 | config.wrappers :horizontal_boolean, class: 'row mb-3' do |b| 169 | b.use :html5 170 | b.optional :readonly 171 | b.wrapper :grid_wrapper, class: 'col-sm-9 offset-sm-3' do |wr| 172 | wr.wrapper :form_check_wrapper, class: 'form-check' do |bb| 173 | bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 174 | bb.use :label, class: 'form-check-label' 175 | bb.use :full_error, wrap_with: { class: 'invalid-feedback' } 176 | bb.use :hint, wrap_with: { class: 'form-text' } 177 | end 178 | end 179 | end 180 | 181 | # horizontal input for radio buttons and check boxes 182 | config.wrappers :horizontal_collection, item_wrapper_class: 'form-check', item_label_class: 'form-check-label', class: 'row mb-3' do |b| 183 | b.use :html5 184 | b.optional :readonly 185 | b.use :label, class: 'col-sm-3 col-form-label pt-0' 186 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 187 | ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 188 | ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' } 189 | ba.use :hint, wrap_with: { class: 'form-text' } 190 | end 191 | end 192 | 193 | # horizontal input for inline radio buttons and check boxes 194 | config.wrappers :horizontal_collection_inline, item_wrapper_class: 'form-check form-check-inline', item_label_class: 'form-check-label', class: 'row mb-3' do |b| 195 | b.use :html5 196 | b.optional :readonly 197 | b.use :label, class: 'col-sm-3 col-form-label pt-0' 198 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 199 | ba.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 200 | ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' } 201 | ba.use :hint, wrap_with: { class: 'form-text' } 202 | end 203 | end 204 | 205 | # horizontal file input 206 | config.wrappers :horizontal_file, class: 'row mb-3' do |b| 207 | b.use :html5 208 | b.use :placeholder 209 | b.optional :maxlength 210 | b.optional :minlength 211 | b.optional :readonly 212 | b.use :label, class: 'col-sm-3 col-form-label' 213 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 214 | ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 215 | ba.use :full_error, wrap_with: { class: 'invalid-feedback' } 216 | ba.use :hint, wrap_with: { class: 'form-text' } 217 | end 218 | end 219 | 220 | # horizontal select input 221 | config.wrappers :horizontal_select, class: 'row mb-3' do |b| 222 | b.use :html5 223 | b.optional :readonly 224 | b.use :label, class: 'col-sm-3 col-form-label' 225 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 226 | ba.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid' 227 | ba.use :full_error, wrap_with: { class: 'invalid-feedback' } 228 | ba.use :hint, wrap_with: { class: 'form-text' } 229 | end 230 | end 231 | 232 | # horizontal multi select 233 | config.wrappers :horizontal_multi_select, class: 'row mb-3' do |b| 234 | b.use :html5 235 | b.optional :readonly 236 | b.use :label, class: 'col-sm-3 col-form-label' 237 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 238 | ba.wrapper class: 'd-flex flex-row justify-content-between align-items-center' do |bb| 239 | bb.use :input, class: 'form-select mx-1', error_class: 'is-invalid', valid_class: 'is-valid' 240 | end 241 | ba.use :full_error, wrap_with: { class: 'invalid-feedback d-block' } 242 | ba.use :hint, wrap_with: { class: 'form-text' } 243 | end 244 | end 245 | 246 | # horizontal range input 247 | config.wrappers :horizontal_range, class: 'row mb-3' do |b| 248 | b.use :html5 249 | b.use :placeholder 250 | b.optional :readonly 251 | b.optional :step 252 | b.use :label, class: 'col-sm-3 col-form-label pt-0' 253 | b.wrapper :grid_wrapper, class: 'col-sm-9' do |ba| 254 | ba.use :input, class: 'form-range', error_class: 'is-invalid', valid_class: 'is-valid' 255 | ba.use :full_error, wrap_with: { class: 'invalid-feedback' } 256 | ba.use :hint, wrap_with: { class: 'form-text' } 257 | end 258 | end 259 | 260 | 261 | # inline forms 262 | # 263 | # inline default_wrapper 264 | config.wrappers :inline_form, class: 'col-12' do |b| 265 | b.use :html5 266 | b.use :placeholder 267 | b.optional :maxlength 268 | b.optional :minlength 269 | b.optional :pattern 270 | b.optional :min_max 271 | b.optional :readonly 272 | b.use :label, class: 'visually-hidden' 273 | 274 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 275 | b.use :error, wrap_with: { class: 'invalid-feedback' } 276 | b.optional :hint, wrap_with: { class: 'form-text' } 277 | end 278 | 279 | # inline input for boolean 280 | config.wrappers :inline_boolean, class: 'col-12' do |b| 281 | b.use :html5 282 | b.optional :readonly 283 | b.wrapper :form_check_wrapper, class: 'form-check' do |bb| 284 | bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 285 | bb.use :label, class: 'form-check-label' 286 | bb.use :error, wrap_with: { class: 'invalid-feedback' } 287 | bb.optional :hint, wrap_with: { class: 'form-text' } 288 | end 289 | end 290 | 291 | 292 | # bootstrap custom forms 293 | # 294 | # custom input switch for boolean 295 | config.wrappers :custom_boolean_switch, class: 'mb-3' do |b| 296 | b.use :html5 297 | b.optional :readonly 298 | b.wrapper :form_check_wrapper, tag: 'div', class: 'form-check form-switch' do |bb| 299 | bb.use :input, class: 'form-check-input', error_class: 'is-invalid', valid_class: 'is-valid' 300 | bb.use :label, class: 'form-check-label' 301 | bb.use :full_error, wrap_with: { tag: 'div', class: 'invalid-feedback' } 302 | bb.use :hint, wrap_with: { class: 'form-text' } 303 | end 304 | end 305 | 306 | 307 | # Input Group - custom component 308 | # see example app and config at https://github.com/heartcombo/simple_form-bootstrap 309 | config.wrappers :input_group, class: 'mb-3' do |b| 310 | b.use :html5 311 | b.use :placeholder 312 | b.optional :maxlength 313 | b.optional :minlength 314 | b.optional :pattern 315 | b.optional :min_max 316 | b.optional :readonly 317 | b.use :label, class: 'form-label' 318 | b.wrapper :input_group_tag, class: 'input-group' do |ba| 319 | ba.optional :prepend 320 | ba.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 321 | ba.optional :append 322 | ba.use :full_error, wrap_with: { class: 'invalid-feedback' } 323 | end 324 | b.use :hint, wrap_with: { class: 'form-text' } 325 | end 326 | 327 | 328 | # Floating Labels form 329 | # 330 | # floating labels default_wrapper 331 | config.wrappers :floating_labels_form, class: 'form-floating mb-3' do |b| 332 | b.use :html5 333 | b.use :placeholder 334 | b.optional :maxlength 335 | b.optional :minlength 336 | b.optional :pattern 337 | b.optional :min_max 338 | b.optional :readonly 339 | b.use :input, class: 'form-control', error_class: 'is-invalid', valid_class: 'is-valid' 340 | b.use :label 341 | b.use :full_error, wrap_with: { class: 'invalid-feedback' } 342 | b.use :hint, wrap_with: { class: 'form-text' } 343 | end 344 | 345 | # custom multi select 346 | config.wrappers :floating_labels_select, class: 'form-floating mb-3' do |b| 347 | b.use :html5 348 | b.optional :readonly 349 | b.use :input, class: 'form-select', error_class: 'is-invalid', valid_class: 'is-valid' 350 | b.use :label 351 | b.use :full_error, wrap_with: { class: 'invalid-feedback' } 352 | b.use :hint, wrap_with: { class: 'form-text' } 353 | end 354 | 355 | 356 | # The default wrapper to be used by the FormBuilder. 357 | config.default_wrapper = :vertical_form 358 | 359 | # Custom wrappers for input types. This should be a hash containing an input 360 | # type as key and the wrapper that will be used for all inputs with specified type. 361 | config.wrapper_mappings = { 362 | boolean: :vertical_boolean, 363 | check_boxes: :vertical_collection, 364 | date: :vertical_multi_select, 365 | datetime: :vertical_multi_select, 366 | file: :vertical_file, 367 | radio_buttons: :vertical_collection, 368 | range: :vertical_range, 369 | time: :vertical_multi_select, 370 | select: :vertical_select 371 | } 372 | end 373 | -------------------------------------------------------------------------------- /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/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /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 `worker_timeout` threshold that Puma will use to wait before 12 | # terminating a worker in development environments. 13 | # 14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" 15 | 16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 17 | # 18 | port ENV.fetch("PORT") { 3000 } 19 | 20 | # Specifies the `environment` that Puma will run in. 21 | # 22 | environment ENV.fetch("RAILS_ENV") { "development" } 23 | 24 | # Specifies the `pidfile` that Puma will use. 25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 26 | 27 | # Specifies the number of `workers` to boot in clustered mode. 28 | # Workers are forked web server processes. If using threads and workers together 29 | # the concurrency of the application would be max `threads` * `workers`. 30 | # Workers do not work on JRuby or Windows (both of which do not support 31 | # processes). 32 | # 33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 34 | 35 | # Use the `preload_app!` method when specifying a `workers` number. 36 | # This directive tells Puma to first boot the application and load code 37 | # before forking the application. This takes advantage of Copy On Write 38 | # process behavior so workers use less memory. 39 | # 40 | # preload_app! 41 | 42 | # Allow puma to be restarted by `bin/rails restart` command. 43 | plugin :tmp_restart 44 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | devise_for :users, :controllers => {:registrations => "registrations", omniauth_callbacks: "callbacks"} 3 | root to: "pages#home" 4 | # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html 5 | 6 | # Defines the root path route ("/") 7 | # root "articles#index" 8 | resources :challenges, only: %i[show index new create destroy edit update] do 9 | resources :offers, only: %i[show index create update] 10 | resources :comments, only: %i[index create] 11 | end 12 | resources :users, only: [:index, :show, :edit, :update], path: "index" do 13 | end 14 | resources :offers, only: %i[destroy] 15 | # resources :comments, only: %i[edit update destroy] 16 | get '/my_challenges', action: :index, controller: 'challenges' 17 | get '/my_offers', action: :index, controller: 'offers' 18 | end 19 | -------------------------------------------------------------------------------- /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 bin/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-<%= Rails.env %> 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-<%= Rails.env %> 23 | 24 | # Use bin/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-<%= Rails.env %> 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | cloudinary: 36 | service: Cloudinary 37 | folder: <%= Rails.env %> 38 | -------------------------------------------------------------------------------- /db/migrate/20220829123454_create_users.rb: -------------------------------------------------------------------------------- 1 | class CreateUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :users do |t| 4 | 5 | t.timestamps 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20220829123545_create_filters.rb: -------------------------------------------------------------------------------- 1 | class CreateFilters < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :filters do |t| 4 | 5 | t.timestamps 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20220829124023_create_challenges.rb: -------------------------------------------------------------------------------- 1 | class CreateChallenges < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :challenges do |t| 4 | t.references :filter, null: false, foreign_key: true 5 | t.references :user, null: false, foreign_key: true 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20220829135339_add_details_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddDetailsToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :nickname, :string 4 | add_column :users, :name, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220829135415_add_details_to_filters.rb: -------------------------------------------------------------------------------- 1 | class AddDetailsToFilters < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :filters, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220829135525_add_details_to_challenges.rb: -------------------------------------------------------------------------------- 1 | class AddDetailsToChallenges < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :challenges, :title, :string 4 | add_column :challenges, :content, :text 5 | add_column :challenges, :price_max, :integer 6 | add_column :challenges, :deadline, :date 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20220829141529_add_devise_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddDeviseToUsers < ActiveRecord::Migration[7.0] 4 | def self.up 5 | change_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 | 36 | # Uncomment below if timestamps were not included in your original model. 37 | # t.timestamps null: false 38 | end 39 | 40 | add_index :users, :email, unique: true 41 | add_index :users, :reset_password_token, unique: true 42 | # add_index :users, :confirmation_token, unique: true 43 | # add_index :users, :unlock_token, unique: true 44 | end 45 | 46 | def self.down 47 | # By default, we don't want to make any assumption about how to roll back a migration when your 48 | # model already existed. Please edit below which fields you would like to remove in this migration. 49 | raise ActiveRecord::IrreversibleMigration 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /db/migrate/20220831095635_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 | # Use Active Record's configured type for primary and foreign keys 5 | primary_key_type, foreign_key_type = primary_and_foreign_key_types 6 | 7 | create_table :active_storage_blobs, id: primary_key_type do |t| 8 | t.string :key, null: false 9 | t.string :filename, null: false 10 | t.string :content_type 11 | t.text :metadata 12 | t.string :service_name, null: false 13 | t.bigint :byte_size, null: false 14 | t.string :checksum 15 | 16 | if connection.supports_datetime_with_precision? 17 | t.datetime :created_at, precision: 6, null: false 18 | else 19 | t.datetime :created_at, null: false 20 | end 21 | 22 | t.index [ :key ], unique: true 23 | end 24 | 25 | create_table :active_storage_attachments, id: primary_key_type do |t| 26 | t.string :name, null: false 27 | t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type 28 | t.references :blob, null: false, type: foreign_key_type 29 | 30 | if connection.supports_datetime_with_precision? 31 | t.datetime :created_at, precision: 6, null: false 32 | else 33 | t.datetime :created_at, null: false 34 | end 35 | 36 | t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true 37 | t.foreign_key :active_storage_blobs, column: :blob_id 38 | end 39 | 40 | create_table :active_storage_variant_records, id: primary_key_type do |t| 41 | t.belongs_to :blob, null: false, index: false, type: foreign_key_type 42 | t.string :variation_digest, null: false 43 | 44 | t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true 45 | t.foreign_key :active_storage_blobs, column: :blob_id 46 | end 47 | end 48 | 49 | private 50 | def primary_and_foreign_key_types 51 | config = Rails.configuration.generators 52 | setting = config.options[config.orm][:primary_key_type] 53 | primary_key_type = setting || :primary_key 54 | foreign_key_type = setting || :bigint 55 | [primary_key_type, foreign_key_type] 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /db/migrate/20220831100114_add_image_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddImageToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :image_url, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220901112950_addingcoordinates.rb: -------------------------------------------------------------------------------- 1 | class Addingcoordinates < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :challenges, :latitude, :float 4 | add_column :challenges, :longitude, :float 5 | 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220901113442_add_location.rb: -------------------------------------------------------------------------------- 1 | class AddLocation < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :challenges, :location, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220901152701_add_city_to_challenges.rb: -------------------------------------------------------------------------------- 1 | class AddCityToChallenges < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :challenges, :cities, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220902104452_remove_image_url_from_users.rb: -------------------------------------------------------------------------------- 1 | class RemoveImageUrlFromUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :users, :image_url, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220905195945_create_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateComments < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :comments do |t| 4 | t.references :user, null: false, foreign_key: true 5 | t.references :challenge, null: false, foreign_key: true 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20220905200231_add_content_to_comment.rb: -------------------------------------------------------------------------------- 1 | class AddContentToComment < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :comments, :comment, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220905200356_rename_comment_to_content.rb: -------------------------------------------------------------------------------- 1 | class RenameCommentToContent < ActiveRecord::Migration[7.0] 2 | def change 3 | rename_column :comments, :comment, :content 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220928211345_add_omniauth_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddOmniauthToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :provider, :string 4 | add_column :users, :uid, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220928221019_add_columns_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddColumnsToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :image, :string 4 | add_column :users, :html_url, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220930214131_create_offers.rb: -------------------------------------------------------------------------------- 1 | class CreateOffers < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :offers do |t| 4 | 5 | t.timestamps 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20220930215302_add_price_to_offers.rb: -------------------------------------------------------------------------------- 1 | class AddPriceToOffers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :offers, :price, :integer 4 | add_column :offers, :date, :date 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220930220534_add_offers_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddOffersToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_reference :offers, :user, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220930220602_add_offers_to_challenges.rb: -------------------------------------------------------------------------------- 1 | class AddOffersToChallenges < ActiveRecord::Migration[7.0] 2 | def change 3 | add_reference :offers, :challenge, foreign_key: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221003065436_add_admin_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddAdminToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :admin, :boolean 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `bin/rails 6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema[7.0].define(version: 2022_10_03_065436) do 14 | # These are extensions that must be enabled in order to support this database 15 | enable_extension "plpgsql" 16 | 17 | create_table "active_storage_attachments", force: :cascade do |t| 18 | t.string "name", null: false 19 | t.string "record_type", null: false 20 | t.bigint "record_id", null: false 21 | t.bigint "blob_id", null: false 22 | t.datetime "created_at", null: false 23 | t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" 24 | t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true 25 | end 26 | 27 | create_table "active_storage_blobs", force: :cascade do |t| 28 | t.string "key", null: false 29 | t.string "filename", null: false 30 | t.string "content_type" 31 | t.text "metadata" 32 | t.string "service_name", null: false 33 | t.bigint "byte_size", null: false 34 | t.string "checksum" 35 | t.datetime "created_at", null: false 36 | t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true 37 | end 38 | 39 | create_table "active_storage_variant_records", force: :cascade do |t| 40 | t.bigint "blob_id", null: false 41 | t.string "variation_digest", null: false 42 | t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true 43 | end 44 | 45 | create_table "challenges", force: :cascade do |t| 46 | t.bigint "filter_id", null: false 47 | t.bigint "user_id", null: false 48 | t.datetime "created_at", null: false 49 | t.datetime "updated_at", null: false 50 | t.string "title" 51 | t.text "content" 52 | t.integer "price_max" 53 | t.date "deadline" 54 | t.float "latitude" 55 | t.float "longitude" 56 | t.string "location" 57 | t.string "cities" 58 | t.index ["filter_id"], name: "index_challenges_on_filter_id" 59 | t.index ["user_id"], name: "index_challenges_on_user_id" 60 | end 61 | 62 | create_table "comments", force: :cascade do |t| 63 | t.bigint "user_id", null: false 64 | t.bigint "challenge_id", null: false 65 | t.datetime "created_at", null: false 66 | t.datetime "updated_at", null: false 67 | t.string "content" 68 | t.index ["challenge_id"], name: "index_comments_on_challenge_id" 69 | t.index ["user_id"], name: "index_comments_on_user_id" 70 | end 71 | 72 | create_table "filters", force: :cascade do |t| 73 | t.datetime "created_at", null: false 74 | t.datetime "updated_at", null: false 75 | t.string "name" 76 | end 77 | 78 | create_table "offers", force: :cascade do |t| 79 | t.datetime "created_at", null: false 80 | t.datetime "updated_at", null: false 81 | t.integer "price" 82 | t.date "date" 83 | t.bigint "user_id" 84 | t.bigint "challenge_id" 85 | t.index ["challenge_id"], name: "index_offers_on_challenge_id" 86 | t.index ["user_id"], name: "index_offers_on_user_id" 87 | end 88 | 89 | create_table "users", force: :cascade do |t| 90 | t.datetime "created_at", null: false 91 | t.datetime "updated_at", null: false 92 | t.string "nickname" 93 | t.string "name" 94 | t.string "email", default: "", null: false 95 | t.string "encrypted_password", default: "", null: false 96 | t.string "reset_password_token" 97 | t.datetime "reset_password_sent_at" 98 | t.datetime "remember_created_at" 99 | t.string "provider" 100 | t.string "uid" 101 | t.string "image" 102 | t.string "html_url" 103 | t.boolean "admin" 104 | t.index ["email"], name: "index_users_on_email", unique: true 105 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 106 | end 107 | 108 | add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" 109 | add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id" 110 | add_foreign_key "challenges", "filters" 111 | add_foreign_key "challenges", "users" 112 | add_foreign_key "comments", "challenges" 113 | add_foreign_key "comments", "users" 114 | add_foreign_key "offers", "challenges" 115 | add_foreign_key "offers", "users" 116 | end 117 | -------------------------------------------------------------------------------- /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 bin/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 | # Character.create(name: "Luke", movie: movies.first) 8 | 9 | require 'faker' 10 | 11 | Offer.destroy_all 12 | Challenge.destroy_all 13 | Filter.destroy_all 14 | User.destroy_all 15 | 16 | puts "Generating seeds..." 17 | 18 | lang = ['Java', 'Kotlin', 'Ruby', 'Javascript', 'Swift', 'Dart', 'CSS', 19 | 'HTML', 'Bash', 'XML', 'C++', 'Rust', 'Pascal', 'Fortran', 'PHP', 20 | 'Perl'] 21 | 22 | title = ['Diagnostics fail to Load', 'Need a hand with Partials', 'Compilation Error', 'Runtime issue - Cannot load', 23 | "Says 'Unexpected program Termination'", 'System Failure after many repeats', 24 | 'Poor performance - Need to change framework', 'Library subroutine failure right before presentation', 25 | 'Client is not happy - Please guide', 'Fix this join us', 'Shows syntax error and nobody has information', 26 | 'Incorrect program design - Urgent', 'Stuck in infinite loop - No way out', 'Logics fail - no clue - Urgent'] 27 | 28 | addresses = ['Geneva', 'Zurich', 'Bern', 'Cambridge', 'Oxford', 'Kathmandu', 'Berlin', 'Frankfurt', 'Paris', 'Bristol', 29 | 'Paris', 'Essen', 'Lyon', 'Kyiv', 'Madrid', 'Porto', 'Lisbon', 'Seville', 'Palermo', 'Vienna', 'Delhi', 30 | 'San Francisco', 'Washington', 'Nairobi', 'Melbourne', 'Canberra', 'Montreal', 'Beijing', 'Tokyo', 31 | 'Mumbai', 'Osaka', 'Istanbul', 'Rio de Janeiro', 'Jakarta', 'Chicago'] 32 | 33 | array = ["https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 34 | "https://images.unsplash.com/photo-1558287340-ac154cb1b31b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=927&q=80", 35 | "https://images.unsplash.com/photo-1552162864-987ac51d1177?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 36 | "https://images.unsplash.com/photo-1514501259756-f4b6fbeffa67?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 37 | "https://images.unsplash.com/photo-1595273185163-347066c49ad3?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 38 | "https://images.unsplash.com/photo-1592158169526-9deda479afce?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=860&q=80", 39 | "https://images.unsplash.com/photo-1534330786040-317bdb76ccff?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=917&q=80", 40 | "https://images.unsplash.com/photo-1584308972272-9e4e7685e80f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 41 | "https://images.unsplash.com/photo-1596935884412-2caade8438a8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 42 | "https://images.unsplash.com/photo-1485206412256-701ccc5b93ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=894&q=80", 43 | "https://images.unsplash.com/photo-1605087880595-8cc6db61f3c6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 44 | "https://images.unsplash.com/photo-1547212371-eb5e6a4b590c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 45 | "https://images.unsplash.com/photo-1597004897768-c503466472cc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 46 | "https://images.unsplash.com/photo-1597223557154-721c1cecc4b0?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 47 | "https://images.unsplash.com/photo-1534126416832-a88fdf2911c2?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 48 | "https://images.unsplash.com/photo-1542909168-82c3e7fdca5c?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 49 | "https://images.unsplash.com/photo-1532318065232-2ba7c6676cd5?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=923&q=80", 50 | "https://images.unsplash.com/photo-1526382925646-27b5eb86796e?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 51 | "https://images.unsplash.com/photo-1579503841516-e0bd7fca5faa?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 52 | "https://images.unsplash.com/photo-1536792414922-14b978901fcd?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 53 | "https://images.unsplash.com/photo-1515175704145-8a06ffce6b77?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=896&q=80", 54 | "https://images.unsplash.com/photo-1608153488161-803b502750fc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 55 | "https://images.unsplash.com/photo-1595897952944-878f3abafb5a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 56 | "https://images.unsplash.com/photo-1558216144-fef86b75da36?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 57 | "https://images.unsplash.com/photo-1562045726-c54c4d58b602?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 58 | "https://images.unsplash.com/photo-1601234699404-4867fa71f87f?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=865&q=80", 59 | "https://images.unsplash.com/photo-1585837146751-a44118595680?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=858&q=80", 60 | "https://images.unsplash.com/photo-1541576980233-97577392db9a?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=884&q=80", 61 | "https://images.unsplash.com/photo-1571988654190-ef2bfb6fb147?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 62 | "https://images.unsplash.com/photo-1592334873219-42ca023e48ce?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=861&q=80", 63 | "https://images.unsplash.com/photo-1585042570881-d5c0cb418ed8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 64 | "https://images.unsplash.com/photo-1527980965255-d3b416303d12?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 65 | "https://images.unsplash.com/photo-1534644586429-7681a71bc591?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 66 | "https://images.unsplash.com/photo-1509112756314-34a0badb29d4?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=931&q=80", 67 | "https://images.unsplash.com/photo-1513091550446-33297bfca05b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=880&q=80", 68 | "https://images.unsplash.com/photo-1529068755536-a5ade0dcb4e8?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=881&q=80"] 69 | 70 | content = ['Here is a piece of code that shows some very peculiar behavior. For some strange reason, sorting the 71 | data (before the timed region) miraculously makes the loop almost six times faster. (Sorting itself takes 72 | more time than this one pass over the array, so it is not actually worth doing if we needed to calculate 73 | this for an unknown array). My first thought was that sorting brings the data into the cache, but then I 74 | thought how silly that was because the array was just generated.', "What are the stack and heap? 75 | Where are they located physically in a computer's memory? To what extent are they controlled by the OS or 76 | language run-time? What is their scope? What determines their sizes? What makes one faster?", "How do I 77 | toggle the visibility of an element using .hide(), .show(), or .toggle()? How do I test if an element is 78 | visible or hidden?", "Recently, I ran some of my code through Crockford's JSLint, and it gave the following 79 | error: 'Problem at line 1 character 1: Missing 'use strict' statement'. Doing some searching, I realized 80 | that some people add 'use strict'; into their code. Once I added the statement, the error stopped appearing. 81 | Unfortunately, Google did not reveal much of the history behind this string statement. Certainly it must 82 | have something to do with how it is interpreted by the browser, but I have no idea what the effect would be. 83 | So what is 'use strict'; all about, what does it imply, and is it still relevant? Do any of the current 84 | browsers respond to the 'use strict'; string or is it for future use?", "How would you explain closures to 85 | someone with a knowledge of the concepts they consist of (for example functions, variables and the like), 86 | but does not understand closures themselves? I have seen the Scheme example given on Wikipedia, but 87 | unfortunately it did not help.", "I am planning to execute a shell script on a remote server using Ansible 88 | playbook. 89 | blank test.sh file: 90 | touch test.sh 91 | Playbook: 92 | --- 93 | - name: Transfer and execute a script. 94 | hosts: server 95 | user: test_user 96 | sudo: yes 97 | tasks: 98 | - name: Transfer the script 99 | copy: src=test.sh dest=/home/test_user mode=0777 100 | - name: Execute the script 101 | local_action: command sudo sh /home/test_user/test.sh 102 | When I run the playbook, the transfer successfully occurs but the script is not executed.", "I have a 103 | long-running docker build process, so I would prefer not to disable caching for the entire build 104 | (with --no-cache). However, I would like to invalidate caching for a particular step. 105 | 106 | I had a bright idea: remove the cached layer and rebuild so this has to rebuild. 107 | 108 | I used: 109 | 110 | docker build --progress=plain 111 | to get hold of the sha of the cached layer: 112 | 113 | #16 [stage-9 3/15] RUN pip install -r /tmp/requirements.lock 114 | #16 sha256:e4ac79a1eac5702cd296ccf33a1cfa2e0c3890c77d42737dc62a3b26ac3e798e 115 | #16 CACHED 116 | But then I got this error 117 | 118 | > docker rmi e4ac79a1eac5702cd296ccf33a1cfa2e0c3890c77d42737dc62a3b26ac3e798 119 | Error: No such image: e4ac79a1eac5702cd296ccf33a1cfa2e0c3890c77d42737dc62a3b26ac3e798 120 | Is there an (easy) way of deleting this layer? 121 | 122 | Note: For most use cases (and maybe even this one) you might like to use the --no-cache option for docker 123 | build"] 124 | 125 | filter_array = [] 126 | 127 | # lang.size.times do 128 | lang.each do |filter| 129 | filter = Filter.new(name: filter) 130 | filter.save! 131 | filter_array << filter 132 | end 133 | 134 | user_array = [] 135 | 136 | 20.times do 137 | puts "Creating users!" 138 | user = User.new(nickname: Faker::Name.first_name, 139 | name: Faker::Name.name, 140 | email: Faker::Internet.email, 141 | password: "123456") 142 | user.photo.attach(io: URI.open(array.sample), filename: "profile.png", content_type: "image/png") 143 | user.save! 144 | user_array << user 145 | end 146 | 147 | 50.times do 148 | puts "Creating challenges!" 149 | challenge = Challenge.new(title: title.sample, 150 | content: content.sample, 151 | price_max: rand(100), 152 | deadline: Faker::Date.between(from: '2022-09-10', to: '2022-12-31'), 153 | filter: filter_array.sample, 154 | user: user_array.sample, 155 | location: addresses.sample) 156 | challenge.save! 157 | end 158 | 159 | puts "Seeds added..." 160 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%# frozen_string_literal: true %> 2 | <%%= simple_form_for(@<%= singular_table_name %>) do |f| %> 3 | <%%= f.error_notification %> 4 | <%%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> 5 | 6 |
7 | <%- attributes.each do |attribute| -%> 8 | <%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %> 9 | <%- end -%> 10 |
11 | 12 |
13 | <%%= f.button :submit %> 14 |
15 | <%% end %> 16 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "private": "true", 4 | "dependencies": { 5 | "@hotwired/stimulus": "^3.1.0", 6 | "@hotwired/turbo-rails": "^7.1.3", 7 | "@mapbox/mapbox-gl-geocoder": "^5.0.1", 8 | "@popperjs/core": "^2.11.6", 9 | "bootstrap": "^5.2.0", 10 | "webpack": "^5.74.0", 11 | "webpack-cli": "^4.10.0" 12 | }, 13 | "scripts": { 14 | "build": "webpack --config webpack.config.js" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /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/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/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/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/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/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/challenges_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ChallengesControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/filters_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class FiltersControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/offers_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class OffersControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class UsersControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/models/.keep -------------------------------------------------------------------------------- /test/models/challenge_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ChallengeTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/comment_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class CommentTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/filter_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class FilterTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/offer_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class OfferTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/policies/challenge_policy_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ChallengePolicyTest < ActiveSupport::TestCase 4 | def test_scope 5 | end 6 | 7 | def test_show 8 | end 9 | 10 | def test_create 11 | end 12 | 13 | def test_update 14 | end 15 | 16 | def test_destroy 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/policies/offer_policy_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class OfferPolicyTest < ActiveSupport::TestCase 4 | def test_scope 5 | end 6 | 7 | def test_show 8 | end 9 | 10 | def test_create 11 | end 12 | 13 | def test_update 14 | end 15 | 16 | def test_destroy 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /test/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/test/system/.keep -------------------------------------------------------------------------------- /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/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/tmp/.keep -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/tmp/pids/.keep -------------------------------------------------------------------------------- /tmp/storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EleoXDA/Dev.Work_RB/04abd63617f115b88cbfe7fd564fc30b55e74366/tmp/storage/.keep -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path") 2 | const webpack = require("webpack") 3 | 4 | module.exports = { 5 | mode: "production", 6 | devtool: "source-map", 7 | entry: { 8 | application: "./app/javascript/application.js" 9 | }, 10 | output: { 11 | filename: "[name].js", 12 | sourceMapFilename: "[file].map", 13 | path: path.resolve(__dirname, "app/assets/builds"), 14 | }, 15 | plugins: [ 16 | new webpack.optimize.LimitChunkCountPlugin({ 17 | maxChunks: 1 18 | }) 19 | ] 20 | } 21 | --------------------------------------------------------------------------------