├── .gitattributes ├── .gitignore ├── .rubocop.yml ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── Procfile.dev ├── README.md ├── Rakefile ├── app ├── assets │ ├── builds │ │ └── .keep │ ├── config │ │ └── manifest.js │ ├── images │ │ ├── .keep │ │ ├── Elect-Logo.png │ │ ├── Question-1.jpg │ │ ├── Question-10.jpg │ │ ├── Question-2.jpg │ │ ├── Question-3.jpg │ │ ├── Question-4.jpg │ │ ├── Question-5.jpg │ │ ├── Question-6.jpg │ │ ├── Question-7.jpg │ │ ├── Question-8.jpg │ │ ├── Question-9.jpg │ │ ├── background-elect.png │ │ ├── dog.jpg │ │ ├── favicon.png │ │ ├── hands.jpg │ │ ├── meme.jpeg │ │ ├── nazare.jpg │ │ ├── profile.png │ │ ├── side.png │ │ ├── user(1).png │ │ ├── user-avatar.jpg │ │ ├── user.png │ │ ├── usericon.png │ │ └── vote.png │ └── stylesheets │ │ ├── abouts │ │ └── index.scss │ │ ├── application.scss │ │ ├── components │ │ ├── _alert.scss │ │ ├── _avatar.scss │ │ ├── _banner.scss │ │ ├── _button.scss │ │ ├── _devise.scss │ │ ├── _footer.scss │ │ ├── _form_legend_clear.scss │ │ ├── _index.scss │ │ ├── _jshow.scss │ │ ├── _navbar.scss │ │ └── _questions.scss │ │ ├── config │ │ ├── _bootstrap_variables.scss │ │ ├── _colors.scss │ │ └── _fonts.scss │ │ ├── pages │ │ ├── _home.scss │ │ └── _index.scss │ │ └── searches │ │ ├── index.scss │ │ └── show.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── abouts_controller.rb │ ├── answers_controller.rb │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── pages_controller.rb │ ├── questions_controller.rb │ ├── searches_controller.rb │ ├── user_answers_controller.rb │ └── users_controller.rb ├── helpers │ ├── application_helper.rb │ └── meta_tags_helper.rb ├── javascript │ ├── application.js │ └── controllers │ │ ├── application.js │ │ ├── hello_controller.js │ │ └── index.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── about.rb │ ├── answer.rb │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ ├── question.rb │ ├── search.rb │ ├── user.rb │ └── user_answer.rb └── views │ ├── abouts │ └── index.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 │ ├── pages │ └── home.html.erb │ ├── questions │ └── show.html.erb │ ├── searches │ ├── index.html.erb │ └── show.html.erb │ ├── shared │ ├── _flashes.html.erb │ ├── _footer.html.erb │ └── _navbar.html.erb │ └── users │ ├── show.html.erb │ └── top.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 │ ├── default_meta.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── permissions_policy.rb │ ├── simple_form.rb │ └── simple_form_bootstrap.rb ├── locales │ ├── devise.en.yml │ ├── en.yml │ └── simple_form.en.yml ├── meta.yml ├── puma.rb ├── routes.rb └── storage.yml ├── db ├── data │ ├── answers.csv │ └── questions.csv ├── migrate │ ├── 20221129182412_devise_create_users.rb │ ├── 20221129184113_create_questions.rb │ ├── 20221129184123_create_answers.rb │ ├── 20221129184131_create_user_answers.rb │ ├── 20221129191406_add_columns_to_users.rb │ ├── 20221130222019_create_active_storage_tables.active_storage.rb │ ├── 20221201182643_create_searches.rb │ ├── 20221201193312_add_columns_to_searches.rb │ ├── 20221205165541_create_abouts.rb │ └── 20221205165810_add_orientation_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 │ ├── abouts_controller_test.rb │ ├── answers_controller_test.rb │ ├── news_policies_controller_test.rb │ ├── questions_controller_test.rb │ ├── searches_controller_test.rb │ ├── user_answers_controller_test.rb │ └── users_controller_test.rb ├── fixtures │ └── files │ │ └── .keep ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── about_test.rb │ ├── answer_test.rb │ ├── news_policy_test.rb │ ├── question_test.rb │ ├── search_test.rb │ ├── user_answer_test.rb │ └── user_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 | # Mark the database schema as having been generated. 4 | db/schema.rb linguist-generated 5 | 6 | # Mark any vendored files as having been vendored. 7 | vendor/* linguist-vendored 8 | -------------------------------------------------------------------------------- /.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 | # Ignore Mac and Linux file system files 40 | *.swp 41 | .DS_Store 42 | .env* 43 | -------------------------------------------------------------------------------- /.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 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" 7 | gem "rails", "~> 7.0.4" 8 | 9 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails] 10 | gem "sprockets-rails" 11 | 12 | # Use postgresql as the database for Active Record 13 | gem "pg", "~> 1.1" 14 | 15 | # Use the Puma web server [https://github.com/puma/puma] 16 | gem "puma", "~> 5.0" 17 | 18 | # Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails] 19 | gem "jsbundling-rails" 20 | 21 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] 22 | gem "turbo-rails" 23 | 24 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] 25 | gem "stimulus-rails" 26 | 27 | # Build JSON APIs with ease [https://github.com/rails/jbuilder] 28 | gem "jbuilder" 29 | 30 | # Use Redis adapter to run Action Cable in production 31 | # gem "redis", "~> 4.0" 32 | 33 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis] 34 | # gem "kredis" 35 | 36 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword] 37 | # gem "bcrypt", "~> 3.1.7" 38 | 39 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 40 | gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] 41 | 42 | # Reduces boot times through caching; required in config/boot.rb 43 | gem "bootsnap", require: false 44 | 45 | # Use Sass to process CSS 46 | gem "sassc-rails" 47 | 48 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images] 49 | # gem "image_processing", "~> 1.2" 50 | 51 | gem "devise" 52 | gem "autoprefixer-rails" 53 | gem "font-awesome-sass", "~> 6.1" 54 | group :development, :test do 55 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem 56 | gem "debug", platforms: %i[ mri mingw x64_mingw ] 57 | gem "dotenv-rails" 58 | 59 | end 60 | 61 | group :development do 62 | # Use console on exceptions pages [https://github.com/rails/web-console] 63 | gem "web-console" 64 | 65 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler] 66 | # gem "rack-mini-profiler" 67 | 68 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring] 69 | # gem "spring" 70 | end 71 | 72 | group :test do 73 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] 74 | gem "capybara" 75 | gem "selenium-webdriver" 76 | gem "webdrivers" 77 | end 78 | 79 | gem "simple_form", github: "heartcombo/simple_form" 80 | 81 | # add cloudinary gem 82 | gem "cloudinary" 83 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/heartcombo/simple_form.git 3 | revision: 31fe25504771bd6cd425b585a4e0ed652fba4521 4 | specs: 5 | simple_form (5.1.0) 6 | actionpack (>= 5.2) 7 | activemodel (>= 5.2) 8 | 9 | GEM 10 | remote: https://rubygems.org/ 11 | specs: 12 | actioncable (7.0.4) 13 | actionpack (= 7.0.4) 14 | activesupport (= 7.0.4) 15 | nio4r (~> 2.0) 16 | websocket-driver (>= 0.6.1) 17 | actionmailbox (7.0.4) 18 | actionpack (= 7.0.4) 19 | activejob (= 7.0.4) 20 | activerecord (= 7.0.4) 21 | activestorage (= 7.0.4) 22 | activesupport (= 7.0.4) 23 | mail (>= 2.7.1) 24 | net-imap 25 | net-pop 26 | net-smtp 27 | actionmailer (7.0.4) 28 | actionpack (= 7.0.4) 29 | actionview (= 7.0.4) 30 | activejob (= 7.0.4) 31 | activesupport (= 7.0.4) 32 | mail (~> 2.5, >= 2.5.4) 33 | net-imap 34 | net-pop 35 | net-smtp 36 | rails-dom-testing (~> 2.0) 37 | actionpack (7.0.4) 38 | actionview (= 7.0.4) 39 | activesupport (= 7.0.4) 40 | rack (~> 2.0, >= 2.2.0) 41 | rack-test (>= 0.6.3) 42 | rails-dom-testing (~> 2.0) 43 | rails-html-sanitizer (~> 1.0, >= 1.2.0) 44 | actiontext (7.0.4) 45 | actionpack (= 7.0.4) 46 | activerecord (= 7.0.4) 47 | activestorage (= 7.0.4) 48 | activesupport (= 7.0.4) 49 | globalid (>= 0.6.0) 50 | nokogiri (>= 1.8.5) 51 | actionview (7.0.4) 52 | activesupport (= 7.0.4) 53 | builder (~> 3.1) 54 | erubi (~> 1.4) 55 | rails-dom-testing (~> 2.0) 56 | rails-html-sanitizer (~> 1.1, >= 1.2.0) 57 | activejob (7.0.4) 58 | activesupport (= 7.0.4) 59 | globalid (>= 0.3.6) 60 | activemodel (7.0.4) 61 | activesupport (= 7.0.4) 62 | activerecord (7.0.4) 63 | activemodel (= 7.0.4) 64 | activesupport (= 7.0.4) 65 | activestorage (7.0.4) 66 | actionpack (= 7.0.4) 67 | activejob (= 7.0.4) 68 | activerecord (= 7.0.4) 69 | activesupport (= 7.0.4) 70 | marcel (~> 1.0) 71 | mini_mime (>= 1.1.0) 72 | activesupport (7.0.4) 73 | concurrent-ruby (~> 1.0, >= 1.0.2) 74 | i18n (>= 1.6, < 2) 75 | minitest (>= 5.1) 76 | tzinfo (~> 2.0) 77 | addressable (2.8.1) 78 | public_suffix (>= 2.0.2, < 6.0) 79 | autoprefixer-rails (10.4.7.0) 80 | execjs (~> 2) 81 | aws_cf_signer (0.1.3) 82 | bcrypt (3.1.18) 83 | bindex (0.8.1) 84 | bootsnap (1.15.0) 85 | msgpack (~> 1.2) 86 | builder (3.2.4) 87 | capybara (3.38.0) 88 | addressable 89 | matrix 90 | mini_mime (>= 0.1.3) 91 | nokogiri (~> 1.8) 92 | rack (>= 1.6.0) 93 | rack-test (>= 0.6.3) 94 | regexp_parser (>= 1.5, < 3.0) 95 | xpath (~> 3.2) 96 | childprocess (4.1.0) 97 | cloudinary (1.23.0) 98 | aws_cf_signer 99 | rest-client (>= 2.0.0) 100 | concurrent-ruby (1.1.10) 101 | crass (1.0.6) 102 | debug (1.6.3) 103 | irb (>= 1.3.6) 104 | reline (>= 0.3.1) 105 | devise (4.8.1) 106 | bcrypt (~> 3.0) 107 | orm_adapter (~> 0.1) 108 | railties (>= 4.1.0) 109 | responders 110 | warden (~> 1.2.3) 111 | domain_name (0.5.20190701) 112 | unf (>= 0.0.5, < 1.0.0) 113 | dotenv (2.8.1) 114 | dotenv-rails (2.8.1) 115 | dotenv (= 2.8.1) 116 | railties (>= 3.2) 117 | erubi (1.11.0) 118 | execjs (2.8.1) 119 | ffi (1.15.5) 120 | font-awesome-sass (6.2.1) 121 | sassc (~> 2.0) 122 | globalid (1.0.0) 123 | activesupport (>= 5.0) 124 | http-accept (1.7.0) 125 | http-cookie (1.0.5) 126 | domain_name (~> 0.5) 127 | i18n (1.12.0) 128 | concurrent-ruby (~> 1.0) 129 | io-console (0.5.11) 130 | irb (1.5.1) 131 | reline (>= 0.3.0) 132 | jbuilder (2.11.5) 133 | actionview (>= 5.0.0) 134 | activesupport (>= 5.0.0) 135 | jsbundling-rails (1.0.3) 136 | railties (>= 6.0.0) 137 | loofah (2.19.0) 138 | crass (~> 1.0.2) 139 | nokogiri (>= 1.5.9) 140 | mail (2.7.1) 141 | mini_mime (>= 0.1.1) 142 | marcel (1.0.2) 143 | matrix (0.4.2) 144 | method_source (1.0.0) 145 | mime-types (3.4.1) 146 | mime-types-data (~> 3.2015) 147 | mime-types-data (3.2022.0105) 148 | mini_mime (1.1.2) 149 | minitest (5.16.3) 150 | msgpack (1.6.0) 151 | net-imap (0.3.1) 152 | net-protocol 153 | net-pop (0.1.2) 154 | net-protocol 155 | net-protocol (0.1.3) 156 | timeout 157 | net-smtp (0.3.3) 158 | net-protocol 159 | netrc (0.11.0) 160 | nio4r (2.5.8) 161 | nokogiri (1.13.9-arm64-darwin) 162 | racc (~> 1.4) 163 | nokogiri (1.13.9-x86_64-linux) 164 | racc (~> 1.4) 165 | orm_adapter (0.5.0) 166 | pg (1.4.5) 167 | public_suffix (5.0.0) 168 | puma (5.6.5) 169 | nio4r (~> 2.0) 170 | racc (1.6.0) 171 | rack (2.2.4) 172 | rack-test (2.0.2) 173 | rack (>= 1.3) 174 | rails (7.0.4) 175 | actioncable (= 7.0.4) 176 | actionmailbox (= 7.0.4) 177 | actionmailer (= 7.0.4) 178 | actionpack (= 7.0.4) 179 | actiontext (= 7.0.4) 180 | actionview (= 7.0.4) 181 | activejob (= 7.0.4) 182 | activemodel (= 7.0.4) 183 | activerecord (= 7.0.4) 184 | activestorage (= 7.0.4) 185 | activesupport (= 7.0.4) 186 | bundler (>= 1.15.0) 187 | railties (= 7.0.4) 188 | rails-dom-testing (2.0.3) 189 | activesupport (>= 4.2.0) 190 | nokogiri (>= 1.6) 191 | rails-html-sanitizer (1.4.3) 192 | loofah (~> 2.3) 193 | railties (7.0.4) 194 | actionpack (= 7.0.4) 195 | activesupport (= 7.0.4) 196 | method_source 197 | rake (>= 12.2) 198 | thor (~> 1.0) 199 | zeitwerk (~> 2.5) 200 | rake (13.0.6) 201 | regexp_parser (2.6.1) 202 | reline (0.3.1) 203 | io-console (~> 0.5) 204 | responders (3.0.1) 205 | actionpack (>= 5.0) 206 | railties (>= 5.0) 207 | rest-client (2.1.0) 208 | http-accept (>= 1.7.0, < 2.0) 209 | http-cookie (>= 1.0.2, < 2.0) 210 | mime-types (>= 1.16, < 4.0) 211 | netrc (~> 0.8) 212 | rexml (3.2.5) 213 | rubyzip (2.3.2) 214 | sassc (2.4.0) 215 | ffi (~> 1.9) 216 | sassc-rails (2.1.2) 217 | railties (>= 4.0.0) 218 | sassc (>= 2.0) 219 | sprockets (> 3.0) 220 | sprockets-rails 221 | tilt 222 | selenium-webdriver (4.6.1) 223 | childprocess (>= 0.5, < 5.0) 224 | rexml (~> 3.2, >= 3.2.5) 225 | rubyzip (>= 1.2.2, < 3.0) 226 | websocket (~> 1.0) 227 | sprockets (4.1.1) 228 | concurrent-ruby (~> 1.0) 229 | rack (> 1, < 3) 230 | sprockets-rails (3.4.2) 231 | actionpack (>= 5.2) 232 | activesupport (>= 5.2) 233 | sprockets (>= 3.0.0) 234 | stimulus-rails (1.2.0) 235 | railties (>= 6.0.0) 236 | thor (1.2.1) 237 | tilt (2.0.11) 238 | timeout (0.3.0) 239 | turbo-rails (1.3.2) 240 | actionpack (>= 6.0.0) 241 | activejob (>= 6.0.0) 242 | railties (>= 6.0.0) 243 | tzinfo (2.0.5) 244 | concurrent-ruby (~> 1.0) 245 | unf (0.1.4) 246 | unf_ext 247 | unf_ext (0.0.8.2) 248 | warden (1.2.9) 249 | rack (>= 2.0.9) 250 | web-console (4.2.0) 251 | actionview (>= 6.0.0) 252 | activemodel (>= 6.0.0) 253 | bindex (>= 0.4.0) 254 | railties (>= 6.0.0) 255 | webdrivers (5.2.0) 256 | nokogiri (~> 1.6) 257 | rubyzip (>= 1.3.0) 258 | selenium-webdriver (~> 4.0) 259 | websocket (1.2.9) 260 | websocket-driver (0.7.5) 261 | websocket-extensions (>= 0.1.0) 262 | websocket-extensions (0.1.5) 263 | xpath (3.2.0) 264 | nokogiri (~> 1.8) 265 | zeitwerk (2.6.6) 266 | 267 | PLATFORMS 268 | arm64-darwin-21 269 | x86_64-linux 270 | 271 | DEPENDENCIES 272 | autoprefixer-rails 273 | bootsnap 274 | capybara 275 | cloudinary 276 | debug 277 | devise 278 | dotenv-rails 279 | font-awesome-sass (~> 6.1) 280 | jbuilder 281 | jsbundling-rails 282 | pg (~> 1.1) 283 | puma (~> 5.0) 284 | rails (~> 7.0.4) 285 | sassc-rails 286 | selenium-webdriver 287 | simple_form! 288 | sprockets-rails 289 | stimulus-rails 290 | turbo-rails 291 | tzinfo-data 292 | web-console 293 | webdrivers 294 | 295 | RUBY VERSION 296 | ruby 3.1.2p20 297 | 298 | BUNDLED WITH 299 | 2.3.26 300 | -------------------------------------------------------------------------------- /Procfile.dev: -------------------------------------------------------------------------------- 1 | web: bin/rails server -p 3000 2 | js: yarn build --watch 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Rails app generated with [lewagon/rails-templates](https://github.com/lewagon/rails-templates), created by the [Le Wagon coding bootcamp](https://www.lewagon.com) team. 2 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative "config/application" 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/builds/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/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/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/images/Elect-Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Elect-Logo.png -------------------------------------------------------------------------------- /app/assets/images/Question-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-1.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-10.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-2.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-3.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-4.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-5.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-6.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-7.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-8.jpg -------------------------------------------------------------------------------- /app/assets/images/Question-9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/Question-9.jpg -------------------------------------------------------------------------------- /app/assets/images/background-elect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/background-elect.png -------------------------------------------------------------------------------- /app/assets/images/dog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/dog.jpg -------------------------------------------------------------------------------- /app/assets/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/favicon.png -------------------------------------------------------------------------------- /app/assets/images/hands.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/hands.jpg -------------------------------------------------------------------------------- /app/assets/images/meme.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/meme.jpeg -------------------------------------------------------------------------------- /app/assets/images/nazare.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/nazare.jpg -------------------------------------------------------------------------------- /app/assets/images/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/profile.png -------------------------------------------------------------------------------- /app/assets/images/side.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/side.png -------------------------------------------------------------------------------- /app/assets/images/user(1).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/user(1).png -------------------------------------------------------------------------------- /app/assets/images/user-avatar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/user-avatar.jpg -------------------------------------------------------------------------------- /app/assets/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/user.png -------------------------------------------------------------------------------- /app/assets/images/usericon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/usericon.png -------------------------------------------------------------------------------- /app/assets/images/vote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/images/vote.png -------------------------------------------------------------------------------- /app/assets/stylesheets/abouts/index.scss: -------------------------------------------------------------------------------- 1 | .banner-about { 2 | background-color: #228896; 3 | background-image: url("https://res.cloudinary.com/dgjvosgwy/image/upload/v1670510112/development/hands_e9tw49.jpg"); 4 | padding: 3% 10% 3% 10%; 5 | background-size: cover; 6 | text-align: center; 7 | display: inherit; 8 | } 9 | h3.about-title { 10 | text-align: center; 11 | font-style: normal; 12 | font-weight: 400; 13 | font-size: 50px; 14 | margin-top: 5%; 15 | color: #FFFFFF; 16 | } 17 | img.img-about { 18 | width: 100%; 19 | align-content: justify; 20 | padding: 20px; 21 | } 22 | .about-us { 23 | background-color: #228896; 24 | border-radius: 20px; 25 | opacity: 95%; 26 | width: 50%; 27 | height: 50%; 28 | display: inline-grid; 29 | padding: 1% 5% 5% 5%; 30 | } 31 | p.about-text { 32 | color: white; 33 | font-size: 25px; 34 | font-style: normal; 35 | font-weight: 300; 36 | background-color: none; 37 | text-align: justify; 38 | } 39 | 40 | div.about-btn { 41 | padding: 15px; 42 | box-sizing: content-box; 43 | 44 | a { 45 | text-align: left; 46 | font-size: 20px; 47 | color: #FFFFFF; 48 | text-decoration: none; 49 | background-color: black; 50 | border-radius: 15px; 51 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /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 | 10 | // Your CSS partials 11 | @import "components/index"; 12 | @import "pages/index"; 13 | 14 | @import "searches/index"; 15 | @import "searches/show"; 16 | @import "abouts/index"; 17 | 18 | * { 19 | // border: 1px solid red; 20 | margin: 0; 21 | padding: 0; 22 | font-family: 'Roboto', sans-serif; 23 | } 24 | -------------------------------------------------------------------------------- /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: 56px; 3 | border-radius: 50%; 4 | } 5 | .avatar-large { 6 | width: 56px; 7 | border-radius: 50%; 8 | } 9 | .avatar-bordered { 10 | width: 40px; 11 | border-radius: 50%; 12 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 13 | border: white 1px solid; 14 | } 15 | .avatar-square { 16 | width: 40px; 17 | border-radius: 0px; 18 | box-shadow: 0 1px 2px rgba(0,0,0,0.2); 19 | border: white 1px solid; 20 | } 21 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_banner.scss: -------------------------------------------------------------------------------- 1 | .banner { 2 | background-size: cover; 3 | background-position: center; 4 | height: 84vh; 5 | text-align: left; 6 | justify-content: left; 7 | align-items: center; 8 | display: flex; 9 | } 10 | 11 | .banner h1 { 12 | width: 100%; 13 | color: #fff; 14 | text-shadow: 3px 3px #000; 15 | font-size: 5rem; 16 | font-style: normal; 17 | font-weight: 600; 18 | line-height: 150%; 19 | } 20 | 21 | .banner p { 22 | color: black; 23 | font-size: 2rem !important; 24 | font-style: normal; 25 | font-weight: 600; 26 | } 27 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_button.scss: -------------------------------------------------------------------------------- 1 | .btn.btn-home { 2 | padding: 0.6rem 1.2rem; 3 | background: #000; 4 | color: #fff; 5 | font-size: 1.2rem; 6 | border-radius: 4px; 7 | border: 1px solid #fff; 8 | transition: ease-in-out 0.5s; 9 | } 10 | 11 | .btn.btn-home:hover { 12 | border: 2px solid #fff; 13 | } 14 | 15 | .btn-signin { 16 | padding: 0.5rem 1.2rem !important; 17 | background: #000; 18 | color: #fff; 19 | font-size: 1rem !important; 20 | border-radius: 4px; 21 | border: 1px solid #fff; 22 | transition: ease-in-out 0.5s; 23 | } 24 | 25 | .btn-signin:hover { 26 | border: 2px solid #fff; 27 | } 28 | 29 | .btn-form { 30 | background-color:black; 31 | color: white; 32 | border-radius: 10px; 33 | font-weight: 600; 34 | transition: ease-in-out 0.5s; 35 | } 36 | 37 | .btn-form:hover { 38 | border: 2px solid #fff; 39 | background-color:black; 40 | color: white; 41 | } 42 | 43 | .btn.btn-next { 44 | padding: 0.5rem 0.8rem; 45 | background: #000; 46 | color: #fff; 47 | font-size: 1rem; 48 | border-radius: 16px; 49 | } 50 | 51 | .btn-check-candidates { 52 | padding: 0.5rem 0.8rem; 53 | background: #000; 54 | color: #fff; 55 | font-size: 1rem; 56 | border-radius: 16px; 57 | } 58 | 59 | .btn.btn-index { 60 | padding: 0.5rem 0.8rem; 61 | background: #000; 62 | color: #fff; 63 | font-size: 1rem; 64 | border-radius: 16px; 65 | } 66 | 67 | .btn-share-link { 68 | color:#d1d1d1; 69 | border-radius: 50px; 70 | background: black; 71 | margin-top: 0px; 72 | } 73 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_devise.scss: -------------------------------------------------------------------------------- 1 | .form-label { 2 | margin: 8px 0 8px 0; 3 | font-weight: bold; 4 | font-size: 20px; 5 | color:black; 6 | text-align: left; 7 | } 8 | 9 | .form-control { 10 | display: block; 11 | font-size: 1rem; 12 | font-weight: 400; 13 | line-height: 1.5; 14 | background-color: #ffffff; 15 | background-clip: padding-box; 16 | border-radius: 10px; 17 | } 18 | 19 | h2 { 20 | font-weight: bold; 21 | } 22 | 23 | .form-select { 24 | font-size: 1rem; 25 | font-weight: 400; 26 | line-height: 1.5; 27 | background-color: #ffffff; 28 | background-clip: padding-box; 29 | border-radius: 10px; 30 | } 31 | 32 | .form-text { 33 | color: black; 34 | } 35 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_footer.scss: -------------------------------------------------------------------------------- 1 | .footer { 2 | background: black; 3 | display: flex; 4 | align-items: center; 5 | justify-content: space-between; 6 | height: 7vh; 7 | padding: 0px 50px; 8 | color: #d1d1d1; 9 | } 10 | .footer-links { 11 | display: flex; 12 | align-items: center; 13 | } 14 | .footer-links a { 15 | color: #d1d1d1; 16 | opacity: 0.7; 17 | text-decoration: none; 18 | font-size: 24px; 19 | padding: 0px 10px; 20 | } 21 | .footer-links a:hover { 22 | opacity: 1; 23 | font-size: 32px; 24 | } 25 | -------------------------------------------------------------------------------- /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 "navbar"; 6 | @import "button"; 7 | @import "devise"; 8 | @import "footer"; 9 | @import "jshow"; 10 | @import "banner"; 11 | @import "questions"; 12 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_jshow.scss: -------------------------------------------------------------------------------- 1 | .question-card { 2 | 3 | img { 4 | width: 40%; 5 | margin: 10px; 6 | padding: 15px; 7 | object-fit:cover; 8 | border-radius: 30px; 9 | } 10 | h3 { 11 | font-weight: bold; 12 | font-size: 20px; 13 | z-index: 2; 14 | } 15 | } 16 | 17 | .button-questionary { 18 | padding: 2px 18px; 19 | background-color: black; 20 | color: white; 21 | border-radius: 50px;; 22 | font-size: 15px; 23 | } 24 | 25 | .myfirstclass .form-check{ 26 | padding-left: 0; 27 | } 28 | 29 | .category-wrapper { 30 | display: flex; 31 | justify-content: space-between; 32 | flex-wrap: wrap; 33 | } 34 | 35 | .category-item { 36 | flex: 0 0 30%; 37 | } 38 | 39 | // .form-check-input-question { 40 | // position: absolute; 41 | // transform: scale(0); 42 | // } 43 | 44 | // .form-check-input-question + label { 45 | // display: block; 46 | // width: 310px; 47 | // text-align: center; 48 | // padding: 5px 5px 5px 5px; 49 | // border: 1px solid rgba(110, 109, 109, 0.527); 50 | // border-radius: 50px; 51 | // background-color: #d1d1d1; 52 | // cursor: pointer; 53 | // } 54 | 55 | .form-check-input:checked + label { 56 | color: black !important; 57 | background-color: #228896; 58 | } 59 | 60 | .user_answer_answer { 61 | display: flex; 62 | flex-direction: column; 63 | justify-content: center; 64 | align-items: center; 65 | } 66 | 67 | 68 | 69 | 70 | // form-check-question 71 | // form-check-label-question 72 | // form-check-input-question 73 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_navbar.scss: -------------------------------------------------------------------------------- 1 | .navbar-lewagon { 2 | justify-content: space-between; 3 | background: black; 4 | width: 100vw; 5 | height: 9vh; 6 | left: 0px; 7 | top: 0px; 8 | } 9 | 10 | .navbar-lewagon .navbar-collapse { 11 | flex-grow: 0; 12 | } 13 | 14 | .navbar-lewagon .nav-link, li { 15 | font-style: normal; 16 | font-size: 1rem; 17 | color: #fff; 18 | } 19 | 20 | .navbar-lewagon .navbar-brand img { 21 | position: absolute; 22 | height: 60px; 23 | left: 20px; 24 | top: 9px; 25 | } 26 | 27 | .nav-item { 28 | align-self: center; 29 | margin: 0 16px 0 8px; 30 | } 31 | 32 | .img-logo a:hover{ 33 | height: 15px; 34 | } 35 | -------------------------------------------------------------------------------- /app/assets/stylesheets/components/_questions.scss: -------------------------------------------------------------------------------- 1 | .question-img { 2 | display: block !important; 3 | margin-left: auto !important; 4 | margin-right: auto !important; 5 | width: 44% !important; 6 | } 7 | -------------------------------------------------------------------------------- /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: 5px; 22 | $border-radius-lg: 5px; 23 | $border-radius-sm: 5px; 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: #0D6EFD; 6 | $yellow: #FFC65A; 7 | $orange: #E67E22; 8 | $green: #1EDD88; 9 | $gray: #0E0000; 10 | $light-gray: #F4F4F4; 11 | $btn-color: rgb(64, 78, 79); 12 | $btn-font: #DCD7C9; 13 | $bkg-color: #F2F0EB; 14 | -------------------------------------------------------------------------------- /app/assets/stylesheets/config/_fonts.scss: -------------------------------------------------------------------------------- 1 | // Import Google fonts 2 | @import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); 3 | 4 | // Define fonts for body and headers 5 | $body-font: "Roboto", "sans-serif"; 6 | $headers-font: "Roboto", "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/_home.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/assets/stylesheets/pages/_home.scss -------------------------------------------------------------------------------- /app/assets/stylesheets/pages/_index.scss: -------------------------------------------------------------------------------- 1 | // Import page-specific CSS files here. 2 | @import "home"; 3 | 4 | .page-container { 5 | display: grid; 6 | grid-template-rows: auto 1fr auto; 7 | min-height: 100vh; 8 | } 9 | 10 | #main-content { 11 | background-color: #228896; 12 | } 13 | -------------------------------------------------------------------------------- /app/assets/stylesheets/searches/index.scss: -------------------------------------------------------------------------------- 1 | .title-search-index { 2 | text-align: center; 3 | font-style: normal; 4 | font-weight: 500; 5 | font-size: 30px; 6 | padding: 4px; 7 | margin-top: 2%; 8 | color: #FFFFFF; 9 | } 10 | 11 | .banner-search-index { 12 | background: #228896; 13 | min-height: 100%; 14 | display: flex; 15 | flex-direction: column; 16 | align-items: center; 17 | justify-content: center; 18 | } 19 | 20 | // # # # FORMS DE PESQUISA # # # 21 | 22 | .container-search-index { 23 | padding: 15px; 24 | box-sizing: border-box; 25 | text-align: center; 26 | display: inline; 27 | color:#FFFFFF; 28 | background-color: black; 29 | border-radius: 15px; 30 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); /* this adds the "card" effect */; 31 | 32 | } 33 | 34 | .row-search-show { 35 | display: flex; 36 | flex-wrap: wrap; 37 | justify-content: start; 38 | padding: initial; 39 | margin: 4rem; 40 | } 41 | 42 | .selects { 43 | padding: 15px; 44 | display: inline-block; 45 | } 46 | 47 | // # # # BOTÃO SEARCH # # # 48 | .selects-search { 49 | display: inline; 50 | } 51 | -------------------------------------------------------------------------------- /app/assets/stylesheets/searches/show.scss: -------------------------------------------------------------------------------- 1 | .banner-search-show { 2 | background: #228896; 3 | min-height: 100%; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: center; 8 | } 9 | 10 | .title-search-show { 11 | text-align: center; 12 | font-style: normal; 13 | font-weight: 500; 14 | font-size: 30px; 15 | padding: 30px; 16 | margin-top: 5%; 17 | color: black; 18 | } 19 | 20 | .container-search-show { 21 | text-align: center; 22 | padding-left: 5%; 23 | padding-right: 5%; 24 | } 25 | 26 | 27 | .col-2.search-show { 28 | display: inline-table; 29 | } 30 | 31 | // # # # CARDS # # # 32 | 33 | .card.mt-4 { 34 | border-radius: 15px 15px 15px 15px; 35 | border: 0.5px solid #777676; 36 | box-shadow: 6px 6px rgba(0, 0, 0, 0.2); /* this adds the "card" effect */ 37 | box-sizing: content-box; 38 | width: 300px; 39 | height: 300px; 40 | padding: 15px; 41 | background: #FFFFFF; 42 | } 43 | 44 | .img-search-show{ 45 | box-sizing: border-box; 46 | border-radius: 10px; 47 | } 48 | 49 | .card-body-search-show{ 50 | margin: 1rem 0; 51 | width: 100%; 52 | height: 100%; 53 | } 54 | .card-text-search-show { 55 | box-sizing: border-box; 56 | font-style: normal; 57 | font-weight: 400; 58 | font-size: 13px; 59 | text-align: left; 60 | display: contents; 61 | color: black; 62 | } 63 | 64 | .icons-search { 65 | // padding: 2px; 66 | margin-right: 2px; 67 | } 68 | 69 | 70 | // # # RETURN BUTTON ## 71 | 72 | .show-search-btn { 73 | padding: 15px; 74 | box-sizing: content-box; 75 | 76 | a { 77 | text-align: left; 78 | font-size: 20px; 79 | color: #FFFFFF; 80 | text-decoration: none; 81 | background-color: black; 82 | border-radius: 15px; 83 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /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/abouts_controller.rb: -------------------------------------------------------------------------------- 1 | class AboutsController < ApplicationController 2 | skip_before_action :authenticate_user! 3 | def index 4 | @about = About.new 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/answers_controller.rb: -------------------------------------------------------------------------------- 1 | class AnswersController < ApplicationController 2 | end 3 | -------------------------------------------------------------------------------- /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 | 5 | def configure_permitted_parameters 6 | # For additional fields in app/views/devise/registrations/new.html.erb 7 | devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :party, :role, :gender, :photo, :race, :state]) 8 | 9 | # For additional in app/views/devise/registrations/edit.html.erb 10 | devise_parameter_sanitizer.permit(:account_update, keys: [:name, :party, :role, :gender, :photo, :race, :state]) 11 | end 12 | 13 | def default_url_options 14 | { host: ENV["DOMAIN"] || "localhost:3000" } 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/pages_controller.rb: -------------------------------------------------------------------------------- 1 | class PagesController < ApplicationController 2 | skip_before_action :authenticate_user!, only: [ :home ] 3 | 4 | def home 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /app/controllers/questions_controller.rb: -------------------------------------------------------------------------------- 1 | class QuestionsController < ApplicationController 2 | def index 3 | @questions = Question.all 4 | end 5 | 6 | def show 7 | @question = Question.find(params[:id]) 8 | @user_answer = UserAnswer.new(user: current_user) 9 | end 10 | 11 | private 12 | 13 | def question_params 14 | params.require(:question).permit(:content, :photo) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/controllers/searches_controller.rb: -------------------------------------------------------------------------------- 1 | class SearchesController < ApplicationController 2 | def index 3 | @search = Search.new 4 | @states = User.distinct.pluck(:state) 5 | @parties = User.distinct.pluck(:party) 6 | @genders = User.distinct.pluck(:gender) 7 | @races = User.distinct.pluck(:race) 8 | end 9 | 10 | def show 11 | @search = Search.find(params[:id]) 12 | end 13 | 14 | def create 15 | @search = Search.create(search_params) 16 | redirect_to search_path(@search) 17 | end 18 | 19 | private 20 | 21 | def search_params 22 | params.require(:search).permit(:state, :party, :gender, :race) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/controllers/user_answers_controller.rb: -------------------------------------------------------------------------------- 1 | class UserAnswersController < ApplicationController 2 | def new 3 | @user_answer = UserAnswer.new 4 | end 5 | 6 | def create 7 | @user_answer = UserAnswer.new 8 | answer = Answer.find(params[:user_answer][:answer_id]) 9 | @user_answer.user = current_user 10 | @user_answer.answer = answer 11 | if @user_answer.save! 12 | if @user_answer.answer.question == Question.last 13 | current_user.set_orientation 14 | redirect_to user_path(current_user.id) 15 | 16 | else 17 | redirect_to question_path(@user_answer.answer.question.id + 1) 18 | end 19 | else 20 | render 'questions/1', status: :unprocessable_entity 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | skip_before_action :authenticate_user!, only: [:index, :show] 3 | 4 | def top 5 | @users = User.all 6 | end 7 | 8 | def index 9 | @users = User.all 10 | @user = User.search(params[:search]) # to look for candidates ... 11 | end 12 | 13 | def show 14 | @users = User.find(params[:id]) 15 | end 16 | 17 | private 18 | 19 | def user_params 20 | params.require(:user).permit(:id, :name, :role, :state, :party, :email, :gender, :race, :photo, :orientation) 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/meta_tags_helper.rb: -------------------------------------------------------------------------------- 1 | # app/helpers/meta_tags_helper.rb 2 | module MetaTagsHelper 3 | def meta_title 4 | content_for?(:meta_title) ? content_for(:meta_title) : DEFAULT_META["meta_title"] 5 | end 6 | 7 | def meta_description 8 | content_for?(:meta_description) ? content_for(:meta_description) : DEFAULT_META["meta_description"] 9 | end 10 | 11 | def meta_image 12 | meta_image = (content_for?(:meta_image) ? content_for(:meta_image) : DEFAULT_META["meta_image"]) 13 | # little twist to make it work equally with an asset or a url 14 | meta_image.starts_with?("http") ? meta_image : image_url(meta_image) 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /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/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 HelloController from "./hello_controller" 8 | application.register("hello", HelloController) 9 | -------------------------------------------------------------------------------- /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/about.rb: -------------------------------------------------------------------------------- 1 | class About < ApplicationRecord 2 | end 3 | -------------------------------------------------------------------------------- /app/models/answer.rb: -------------------------------------------------------------------------------- 1 | class Answer < ApplicationRecord 2 | belongs_to :question 3 | has_many :user_answers 4 | validates :content, presence: true 5 | end 6 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | primary_abstract_class 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/question.rb: -------------------------------------------------------------------------------- 1 | class Question < ApplicationRecord 2 | has_many :answers 3 | validates :content, presence: true 4 | # has_one_attached :photo 5 | end 6 | -------------------------------------------------------------------------------- /app/models/search.rb: -------------------------------------------------------------------------------- 1 | class Search < ApplicationRecord 2 | self.inheritance_column = "not_sti" 3 | 4 | def search_user 5 | user = User.all 6 | 7 | user = user.where(['state LIKE ?', state]) if state.present? 8 | user = user.where(['party LIKE ?', party]) if party.present? 9 | user = user.where(['gender LIKE ?', gender]) if gender.present? 10 | user = user.where(['race LIKE ?', race]) if race.present? 11 | 12 | return user 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable 4 | devise :database_authenticatable, :registerable, 5 | :recoverable, :rememberable, :validatable 6 | 7 | has_many :user_answers 8 | validates :name, presence: true 9 | validates :state, presence: true 10 | has_one_attached :photo 11 | validates_length_of :name, :maximum => 30 12 | 13 | def self.search(search) 14 | if search 15 | where(["name LIKE ?", "%#{search}%"]) 16 | else 17 | all 18 | end 19 | end 20 | 21 | def set_orientation 22 | # create a score for each one of the political orientations ... 23 | score_left = 0 24 | score_right = 0 25 | score_center = 0 26 | 27 | # iterate through each one of the user answers and assign +1 ... 28 | self.user_answers.all.each do |user_answer| 29 | if user_answer.answer.profile == 'Left' 30 | score_left += 1 31 | elsif user_answer.answer.profile == 'Right' 32 | score_right += 1 33 | else 34 | score_center += 1 35 | end 36 | end 37 | 38 | # return the score for each political orientation in the profile page ... 39 | if score_left > score_right && score_left > score_center 40 | # we should say that the voter has a left-wing profile ... 41 | self.orientation = 'left-wing' 42 | elsif score_right > score_left && score_right > score_center 43 | # we should say that the voter has a right-wing profile ... 44 | self.orientation = 'right-wing' 45 | else 46 | # we should say that the voter has a centered profile ... 47 | self.orientation = 'centrist' 48 | end 49 | self.save! 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /app/models/user_answer.rb: -------------------------------------------------------------------------------- 1 | class UserAnswer < ApplicationRecord 2 | belongs_to :user 3 | belongs_to :answer 4 | end 5 | -------------------------------------------------------------------------------- /app/views/abouts/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%= content_for(:navbar_class, "navbar-home") %> 4 | 5 | 6 | 28 | -------------------------------------------------------------------------------- /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 | <%= f.input :email, 8 | required: true, 9 | autofocus: true, 10 | value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), 11 | input_html: { autocomplete: "email" } %> 12 |
13 | 14 |
15 | <%= f.button :submit, "Resend confirmation instructions" %> 16 |
17 | <% end %> 18 | 19 | <%= render "devise/shared/links" %> 20 | -------------------------------------------------------------------------------- /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 |
2 |
3 |

Forgot your password?

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

Edit <%= resource_name.to_s.humanize %>

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

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

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

Cancel my account

32 | 33 |
34 |
Unhappy?
35 | <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-link" %> 36 |
37 | 38 | <%= link_to "Back", :back %> 39 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Sign up

4 | <%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), data: { turbo: :false }) do |f| %> 5 | <%= f.error_notification %> 6 |
7 |
8 | <%= f.input :name, 9 | required: true, 10 | autofocus: true, 11 | input_html: { autocomplete: "name" } %> 12 | <%= f.input :email, 13 | required: true, 14 | autofocus: true, 15 | input_html: { autocomplete: "email" } %> 16 | <%= f.input :state, 17 | required: true, 18 | collection: [ 'Acre', 'Alagoas', 'Amapá', 'Amazonas', 'Bahia', 'Ceará', 'Distrito Federal', 19 | 'Espírito Santo', 'Goiás', 'Maranhão', 'Mato Grosso', 'Mato Grosso do Sul', 'Minas Gerais', 20 | 'Pará', 'Paraíba', 'Paraná', 'Pernambuco', 'Piauí', 'Rio de Janeiro', 'Rio Grande do Norte', 21 | 'Rio Grande do Sul', 'Rondônia', 'Roraima', 'Santa Catarina', 'São Paulo', 'Sergipe', 'Tocantins' ] %> 22 |
23 |

How would you like to register?

24 | <%= f.input_field :role, 25 | as: :radio_buttons, 26 | collection: [['voter', 'As a voter'], ['candidate', 'As a candidate']], 27 | label_method: :second, 28 | value_method: :first, 29 | required: true %> 30 |
31 | <%= f.input :party, 32 | hint: "If you're a candidate affiliated to a political party", 33 | autofocus: true, 34 | input_html: { autocomplete: "party" } %> 35 | <%= f.input :gender, 36 | hint: "If you're a candidate affiliated to a political party", 37 | collection: [ 'male', 'female' ] %> 38 | <%= f.input :race, 39 | hint: "If you're a candidate affiliated to a political party", 40 | collection: [ 'white', 'black', 'indian', 'asian' ] %> 41 | <%= f.input :photo, 42 | as: :file %> 43 | <%= f.input :password, 44 | required: true, 45 | hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), 46 | input_html: { autocomplete: "new-password" } %> 47 | <%= f.input :password_confirmation, 48 | required: true, 49 | input_html: { autocomplete: "new-password" } %> 50 |
51 |
52 | 53 |
54 | <%= f.button :submit, "Sign up", class: "btn btn-form" %> 55 |
56 | <% end %> 57 | 58 | <%= render "devise/shared/links" %> 59 |
60 |
61 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

Login

5 | 6 | <%= simple_form_for(resource, as: resource_name, url: session_path(resource_name), data: { turbo: :false }) do |f| %> 7 |
8 | <%= f.input :email, 9 | required: true, 10 | autofocus: true, 11 | input_html: { autocomplete: "email" } %> 12 | <%= f.input :password, 13 | required: true, 14 | input_html: { autocomplete: "current-password" } %> 15 | <%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %> 16 |
17 | 18 |
19 |
20 | <%= f.button :submit, "Log in", class: "btn btn-form" %> 21 |
22 |
23 | <% end %> 24 | 25 | <%= render "devise/shared/links" %> 26 |
27 |
28 | -------------------------------------------------------------------------------- /app/views/devise/shared/_error_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% if resource.errors.any? %> 2 |
3 |

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

9 | 14 |
15 | <% end %> 16 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name), class: "btn btn-form my-2" %>
3 | <% end %> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name), class: "btn btn-form my-2" %>
7 | <% end %> 8 | 9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> 10 | <%= link_to "Forgot your password?", new_password_path(resource_name), class: "btn btn-form my-2" %>
11 | <% end %> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name), class: "btn btn-form" %>
15 | <% end %> 16 | 17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> 18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name), class: "btn btn-form" %>
19 | <% end %> 20 | 21 | <%- if devise_mapping.omniauthable? %> 22 | <%- resource_class.omniauth_providers.each do |provider| %> 23 | <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post %>
24 | <% end %> 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 | 4 | Elect 5 | 6 | <%= csrf_meta_tags %> 7 | <%= favicon_link_tag "favicon.png", rel: "icon", type: "image/png" %> 8 | <%= csp_meta_tag %> 9 | 10 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> 11 | <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | <%= meta_title %> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | "> 33 | 34 | 35 | "> 36 | 37 | 38 | 39 | 40 | 41 |
42 | <%= render "shared/navbar" %> 43 |
44 | <%= yield %> 45 |
46 | <%# <%= render "shared/flashes" %> 47 | <%= render "shared/footer" %> 48 |
49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /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/pages/home.html.erb: -------------------------------------------------------------------------------- 1 | 8 | -------------------------------------------------------------------------------- /app/views/questions/show.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 | 7 |

<%= @question.content %>

8 | 9 | <%= image_tag @question.photo, class:"question-img my-4"%> 10 | 11 | <%= simple_form_for(UserAnswer.new) do |f| %> 12 | 13 | <%= f.association :answer, as: :radio_buttons, collection: @question.answers, label_method: :content, value_method: 14 | :id, legend_tag: false, wrapper_html: {class: "myfirstclass"} %> 15 | 16 |
17 | <%= f.submit 'Next', class: "btn btn-next" %> 18 |
19 | 20 | <% end %> 21 | 22 |
23 | 24 |
25 | 26 |
27 | -------------------------------------------------------------------------------- /app/views/searches/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 59 | -------------------------------------------------------------------------------- /app/views/searches/show.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_for(:navbar_class, "navbar-home") %> 2 | 3 | 42 | -------------------------------------------------------------------------------- /app/views/shared/_flashes.html.erb: -------------------------------------------------------------------------------- 1 | <% if notice %> 2 | 7 | <% end %> 8 | <% if alert %> 9 | 14 | <% end %> 15 | -------------------------------------------------------------------------------- /app/views/shared/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /app/views/shared/_navbar.html.erb: -------------------------------------------------------------------------------- 1 | 50 | -------------------------------------------------------------------------------- /app/views/users/show.html.erb: -------------------------------------------------------------------------------- 1 | <% content_for :meta_title, "#{@users.name} está em #{DEFAULT_META["meta_product_name"]}" %> 2 | <% content_for :meta_description, @users.orientation %> 3 | 4 |
5 | 6 |
7 |
8 |

According to your answers, we understand that...

9 |

You're inclined to <%= current_user.orientation %> politics!

10 |
11 |
12 | 13 |
14 |
15 | "> 16 |
17 |
18 | "> 19 |
20 |
21 | "> 22 |
23 |
24 | 25 |
26 |
27 |
Left-wing
28 |
29 |
30 |
Center
31 |
32 |
33 |
Right
34 |
35 |
36 | 37 |
38 |
39 | <% if @users.orientation == "left-wing"%> 40 |

Left-wing politics describes the range of political ideologies that support and seek to achieve social equality and egalitarianism, often in opposition to social hierarchy. Left-wing politics typically involve a concern for those in society whom its adherents perceive as disadvantaged relative to others as well as a belief that there are unjustified inequalities that need to be reduced or abolished. Left-wing politics are also associated with popular or state control of major political and economic institutions.

41 | <% elsif @users.orientation == "right-wing"%> 42 |

Right-wing politics describes the range of political ideologies that view certain social orders and hierarchies as inevitable, natural, normal, or desirable, typically supporting this position on the basis of natural law, economics, authority, property or tradition. Hierarchy and inequality may be seen as natural results of traditional social differences or competition in market economies.

43 | <% elsif @users.orientation == "centrist" %> 44 |

Centrism is a political outlook or position involving acceptance or support of a balance of social equality and a degree of social hierarchy while opposing political changes that would result in a significant shift of society strongly to the left or the right.

45 | <% end %> 46 |
47 |
48 | 49 |
50 | 53 |
54 | 55 |
56 | -------------------------------------------------------------------------------- /app/views/users/top.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 |

See who matches your profile!

4 | 5 | <% if current_user.orientation == "left-wing" %> 6 |
7 | <% @users.each do |user| %> 8 | <% if user.role == "candidate" && user.state == current_user.state && (user.party == "PT" || user.party == "PSOL") %> 9 |
10 |
11 | 12 | <%= cl_image_tag user.photo.key %> 13 |
14 | 18 | 22 | 26 |
27 |
28 |
29 | <% end %> 30 | <% end %> 31 |
32 | <% elsif current_user.orientation == "right-wing" %> 33 |
34 | <% @users.each do |user| %> 35 | <% if user.role == "candidate" && user.state == current_user.state && (user.party == "Republicanos" || user.party == "PL") %> 36 |
37 |
38 | 39 | <%= cl_image_tag user.photo.key %> 40 |
41 | 45 | 49 | 53 |
54 |
55 |
56 | <% end %> 57 | <% end %> 58 |
59 | <% elsif current_user.orientation == "centrist" %> 60 |
61 | <% @users.each do |user| %> 62 | <% if user.role == "candidate" && user.state == current_user.state && (user.party == "MDB" || user.party == "PSD") %> 63 |
64 |
65 | 66 | <%= cl_image_tag user.photo.key %> 67 |
68 | 72 | 76 | 80 |
81 |
82 |
83 | <% end %> 84 | <% end %> 85 |
86 | <% else %> 87 |
No candidates match your profile so far.
88 |
Maybe you could answer the questions and come back to check your results later on.
89 |
90 |
91 | <%= link_to "Answer questions", question_path(1), class: "btn btn-flat mb-2 mt-2" %> 92 |
93 |
94 | <% end %> 95 | 96 |
97 | 100 |
101 |
102 | -------------------------------------------------------------------------------- /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 Elect 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: elect_production 11 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | F+olU/jzPZEIXyu9q5kuOQ6ip7rg7x2jK/KeIgU2cq41Zpp9TJYtI4xivhOwgXacgGSHsI1+hmr9jwAf1aEAIIb1jeqrS9YtwfX66n61gN2IOXQnBr1Lil+XXp+otd7Tdas47T6cmDCT7xig4a/Jzzq0iPun+ezPrNTG+9NDyC1w0qQMCbdc1NGpC2QV9ZaP6J1fZ+XBN7McmuX3txSVt7j3UcACvBvmtIiaDR6UpkfPCwcYguUKKaIx6icjSmPYDdANAhD2YoCJbBYeMUhH4APNbD61n6s7pFb82mjDdYWGIgtqrqpKTmrXgUnEzTmSTztbxnJjwPuNmyKxjiKm/C5JGu0MeZQaovU4E4K1RmBkqVYj7RPhDWmkuEDO6kUFjOdcjUl93miAr94MNIFhBtf6BxIihifFh0Gb--ZvSJhXBE9L5ZaeEL--o1c6ydBCyFQ4H0MK872VIA== -------------------------------------------------------------------------------- /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: elect_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: elect 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: elect_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: elect_production 85 | username: elect 86 | password: <%= ENV["ELECT_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 | config.action_mailer.default_url_options = { host: "http://localhost:3000" } 5 | # Settings specified here will take precedence over those in config/application.rb. 6 | 7 | # In the development environment your application's code is reloaded any time 8 | # it changes. This slows down response time but is perfect for development 9 | # since you don't have to restart the web server when you make code changes. 10 | config.cache_classes = false 11 | 12 | # Do not eager load code on boot. 13 | config.eager_load = false 14 | 15 | # Show full error reports. 16 | config.consider_all_requests_local = true 17 | 18 | # Enable server timing 19 | config.server_timing = true 20 | 21 | # Enable/disable caching. By default caching is disabled. 22 | # Run rails dev:cache to toggle caching. 23 | if Rails.root.join("tmp/caching-dev.txt").exist? 24 | config.action_controller.perform_caching = true 25 | config.action_controller.enable_fragment_cache_logging = true 26 | 27 | config.cache_store = :memory_store 28 | config.public_file_server.headers = { 29 | "Cache-Control" => "public, max-age=#{2.days.to_i}" 30 | } 31 | else 32 | config.action_controller.perform_caching = false 33 | 34 | config.cache_store = :null_store 35 | end 36 | 37 | # Store uploaded files on the local file system (see config/storage.yml for options). 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 | config.action_mailer.default_url_options = { host: "http://TODO_PUT_YOUR_DOMAIN_HERE" } 5 | # Settings specified here will take precedence over those in config/application.rb. 6 | 7 | # Code is not reloaded between requests. 8 | config.cache_classes = true 9 | 10 | # Eager load code on boot. This eager loads most of Rails and 11 | # your application in memory, allowing both threaded web servers 12 | # and those relying on copy on write to perform better. 13 | # Rake tasks automatically ignore this option for performance. 14 | config.eager_load = true 15 | 16 | # Full error reports are disabled and caching is turned on. 17 | config.consider_all_requests_local = false 18 | config.action_controller.perform_caching = true 19 | 20 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 21 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 22 | # config.require_master_key = true 23 | 24 | # Disable serving static files from the `/public` folder by default since 25 | # Apache or NGINX already handles this. 26 | config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? 27 | 28 | # Compress CSS using a preprocessor. 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 35 | # config.asset_host = "http://assets.example.com" 36 | 37 | # Specifies the header that your server uses for sending files. 38 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache 39 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX 40 | 41 | # Store uploaded files on the local file system (see config/storage.yml for options). 42 | config.active_storage.service = :cloudinary 43 | 44 | # Mount Action Cable outside main process or domain. 45 | # config.action_cable.mount_path = nil 46 | # config.action_cable.url = "wss://example.com/cable" 47 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] 48 | 49 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 50 | # config.force_ssl = true 51 | 52 | # Include generic and useful information about system operation, but avoid logging too much 53 | # information to avoid inadvertent exposure of personally identifiable information (PII). 54 | config.log_level = :info 55 | 56 | # Prepend all log lines with the following tags. 57 | config.log_tags = [ :request_id ] 58 | 59 | # Use a different cache store in production. 60 | # config.cache_store = :mem_cache_store 61 | 62 | # Use a real queuing backend for Active Job (and separate queues per environment). 63 | # config.active_job.queue_adapter = :resque 64 | # config.active_job.queue_name_prefix = "elect_production" 65 | 66 | config.action_mailer.perform_caching = false 67 | 68 | # Ignore bad email addresses and do not raise email delivery errors. 69 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 70 | # config.action_mailer.raise_delivery_errors = false 71 | 72 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 73 | # the I18n.default_locale when a translation cannot be found). 74 | config.i18n.fallbacks = true 75 | 76 | # Don't log any deprecations. 77 | config.active_support.report_deprecations = false 78 | 79 | # Use default logging formatter so that PID and timestamp are not suppressed. 80 | config.log_formatter = ::Logger::Formatter.new 81 | 82 | # Use a different logger for distributed setups. 83 | # require "syslog/logger" 84 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") 85 | 86 | if ENV["RAILS_LOG_TO_STDOUT"].present? 87 | logger = ActiveSupport::Logger.new(STDOUT) 88 | logger.formatter = config.log_formatter 89 | config.logger = ActiveSupport::TaggedLogging.new(logger) 90 | end 91 | 92 | # Do not dump schema after migrations. 93 | config.active_record.dump_schema_after_migration = false 94 | end 95 | -------------------------------------------------------------------------------- /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 | 15 | Rails.application.config.assets.paths << Rails.root.join("node_modules") 16 | -------------------------------------------------------------------------------- /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/default_meta.rb: -------------------------------------------------------------------------------- 1 | # config/initializers/default_meta.rb 2 | 3 | # Initialize default meta tags. 4 | DEFAULT_META = YAML.load_file(Rails.root.join("config/meta.yml")) 5 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Assuming you have not yet modified this file, each configuration option below 4 | # is set to its default value. Note that some are commented out while others 5 | # are not: uncommented lines are intended to protect your configuration from 6 | # breaking changes in upgrades (i.e., in the event that future versions of 7 | # Devise change the default values for those options). 8 | # 9 | # Use this hook to configure devise mailer, warden hooks and so forth. 10 | # Many of these configuration options can be set straight in your model. 11 | Devise.setup do |config| 12 | # The secret key used by Devise. Devise uses this key to generate 13 | # random tokens. Changing this key will render invalid all existing 14 | # confirmation, reset password and unlock tokens in the database. 15 | # Devise will use the `secret_key_base` as its `secret_key` 16 | # by default. You can change it below and use your own secret key. 17 | # config.secret_key = '7e049113ea4a03562efead6e87ec8c1d5ff885394f7df86ee4e202456d5612968561dd5775bb05533ec1355c31134b7d30eb9fc7cf058e01b9e4439dcb560d56' 18 | 19 | # ==> Controller configuration 20 | # Configure the parent class to the devise controllers. 21 | # config.parent_controller = 'DeviseController' 22 | 23 | # ==> Mailer Configuration 24 | # Configure the e-mail address which will be shown in Devise::Mailer, 25 | # note that it will be overwritten if you use your own mailer class 26 | # with default "from" parameter. 27 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 28 | 29 | # Configure the class responsible to send e-mails. 30 | # config.mailer = 'Devise::Mailer' 31 | 32 | # Configure the parent class responsible to send e-mails. 33 | # config.parent_mailer = 'ActionMailer::Base' 34 | 35 | # ==> ORM configuration 36 | # Load and configure the ORM. Supports :active_record (default) and 37 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 38 | # available as additional gems. 39 | require 'devise/orm/active_record' 40 | 41 | # ==> Configuration for any authentication mechanism 42 | # Configure which keys are used when authenticating a user. The default is 43 | # just :email. You can configure it to use [:username, :subdomain], so for 44 | # authenticating a user, both parameters are required. Remember that those 45 | # parameters are used only when authenticating and not when retrieving from 46 | # session. If you need permissions, you should implement that in a before filter. 47 | # You can also supply a hash where the value is a boolean determining whether 48 | # or not authentication should be aborted when the value is not present. 49 | # config.authentication_keys = [:email] 50 | 51 | # Configure parameters from the request object used for authentication. Each entry 52 | # given should be a request method and it will automatically be passed to the 53 | # find_for_authentication method and considered in your model lookup. For instance, 54 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 55 | # The same considerations mentioned for authentication_keys also apply to request_keys. 56 | # config.request_keys = [] 57 | 58 | # Configure which authentication keys should be case-insensitive. 59 | # These keys will be downcased upon creating or modifying a user and when used 60 | # to authenticate or find a user. Default is :email. 61 | config.case_insensitive_keys = [:email] 62 | 63 | # Configure which authentication keys should have whitespace stripped. 64 | # These keys will have whitespace before and after removed upon creating or 65 | # modifying a user and when used to authenticate or find a user. Default is :email. 66 | config.strip_whitespace_keys = [:email] 67 | 68 | # Tell if authentication through request.params is enabled. True by default. 69 | # It can be set to an array that will enable params authentication only for the 70 | # given strategies, for example, `config.params_authenticatable = [:database]` will 71 | # enable it only for database (email + password) authentication. 72 | # config.params_authenticatable = true 73 | 74 | # Tell if authentication through HTTP Auth is enabled. False by default. 75 | # It can be set to an array that will enable http authentication only for the 76 | # given strategies, for example, `config.http_authenticatable = [:database]` will 77 | # enable it only for database authentication. 78 | # For API-only applications to support authentication "out-of-the-box", you will likely want to 79 | # enable this with :database unless you are using a custom strategy. 80 | # The supported strategies are: 81 | # :database = Support basic authentication with authentication key + password 82 | # config.http_authenticatable = false 83 | 84 | # If 401 status code should be returned for AJAX requests. True by default. 85 | # config.http_authenticatable_on_xhr = true 86 | 87 | # The realm used in Http Basic Authentication. 'Application' by default. 88 | # config.http_authentication_realm = 'Application' 89 | 90 | # It will change confirmation, password recovery and other workflows 91 | # to behave the same regardless if the e-mail provided was right or wrong. 92 | # Does not affect registerable. 93 | # config.paranoid = true 94 | 95 | # By default Devise will store the user in session. You can skip storage for 96 | # particular strategies by setting this option. 97 | # Notice that if you are skipping storage for all authentication paths, you 98 | # may want to disable generating routes to Devise's sessions controller by 99 | # passing skip: :sessions to `devise_for` in your config/routes.rb 100 | config.skip_session_storage = [:http_auth] 101 | 102 | # By default, Devise cleans up the CSRF token on authentication to 103 | # avoid CSRF token fixation attacks. This means that, when using AJAX 104 | # requests for sign in and sign up, you need to get a new CSRF token 105 | # from the server. You can disable this option at your own risk. 106 | # config.clean_up_csrf_token_on_authentication = true 107 | 108 | # When false, Devise will not attempt to reload routes on eager load. 109 | # This can reduce the time taken to boot the app but if your application 110 | # requires the Devise mappings to be loaded during boot time the application 111 | # won't boot properly. 112 | # config.reload_routes = true 113 | 114 | # ==> Configuration for :database_authenticatable 115 | # For bcrypt, this is the cost for hashing the password and defaults to 12. If 116 | # using other algorithms, it sets how many times you want the password to be hashed. 117 | # The number of stretches used for generating the hashed password are stored 118 | # with the hashed password. This allows you to change the stretches without 119 | # invalidating existing passwords. 120 | # 121 | # Limiting the stretches to just one in testing will increase the performance of 122 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 123 | # a value less than 10 in other environments. Note that, for bcrypt (the default 124 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 125 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 126 | config.stretches = Rails.env.test? ? 1 : 12 127 | 128 | # Set up a pepper to generate the hashed password. 129 | # config.pepper = 'fd45cb3d6df3d29242ccbb8da1cd1e06bb4e93d2f1332f5ef8323c8499b9b7eade166ca276008ebd179b6b278aa2ecca7a51035be28d468d2f94bdd2b27ac9ec' 130 | 131 | # Send a notification to the original email when the user's email is changed. 132 | # config.send_email_changed_notification = false 133 | 134 | # Send a notification email when the user's password is changed. 135 | # config.send_password_change_notification = false 136 | 137 | # ==> Configuration for :confirmable 138 | # A period that the user is allowed to access the website even without 139 | # confirming their account. For instance, if set to 2.days, the user will be 140 | # able to access the website for two days without confirming their account, 141 | # access will be blocked just in the third day. 142 | # You can also set it to nil, which will allow the user to access the website 143 | # without confirming their account. 144 | # Default is 0.days, meaning the user cannot access the website without 145 | # confirming their account. 146 | # config.allow_unconfirmed_access_for = 2.days 147 | 148 | # A period that the user is allowed to confirm their account before their 149 | # token becomes invalid. For example, if set to 3.days, the user can confirm 150 | # their account within 3 days after the mail was sent, but on the fourth day 151 | # their account can't be confirmed with the token any more. 152 | # Default is nil, meaning there is no restriction on how long a user can take 153 | # before confirming their account. 154 | # config.confirm_within = 3.days 155 | 156 | # If true, requires any email changes to be confirmed (exactly the same way as 157 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 158 | # db field (see migrations). Until confirmed, new email is stored in 159 | # unconfirmed_email column, and copied to email column on successful confirmation. 160 | config.reconfirmable = true 161 | 162 | # Defines which key will be used when confirming an account 163 | # config.confirmation_keys = [:email] 164 | 165 | # ==> Configuration for :rememberable 166 | # The time the user will be remembered without asking for credentials again. 167 | # config.remember_for = 2.weeks 168 | 169 | # Invalidates all the remember me tokens when the user signs out. 170 | config.expire_all_remember_me_on_sign_out = true 171 | 172 | # If true, extends the user's remember period when remembered via cookie. 173 | # config.extend_remember_period = false 174 | 175 | # Options to be passed to the created cookie. For instance, you can set 176 | # secure: true in order to force SSL only cookies. 177 | # config.rememberable_options = {} 178 | 179 | # ==> Configuration for :validatable 180 | # Range for password length. 181 | config.password_length = 6..128 182 | 183 | # Email regex used to validate email formats. It simply asserts that 184 | # one (and only one) @ exists in the given string. This is mainly 185 | # to give user feedback and not to assert the e-mail validity. 186 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 187 | 188 | # ==> Configuration for :timeoutable 189 | # The time you want to timeout the user session without activity. After this 190 | # time the user will be asked for credentials again. Default is 30 minutes. 191 | # config.timeout_in = 30.minutes 192 | 193 | # ==> Configuration for :lockable 194 | # Defines which strategy will be used to lock an account. 195 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 196 | # :none = No lock strategy. You should handle locking by yourself. 197 | # config.lock_strategy = :failed_attempts 198 | 199 | # Defines which key will be used when locking and unlocking an account 200 | # config.unlock_keys = [:email] 201 | 202 | # Defines which strategy will be used to unlock an account. 203 | # :email = Sends an unlock link to the user email 204 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 205 | # :both = Enables both strategies 206 | # :none = No unlock strategy. You should handle unlocking by yourself. 207 | # config.unlock_strategy = :both 208 | 209 | # Number of authentication tries before locking an account if lock_strategy 210 | # is failed attempts. 211 | # config.maximum_attempts = 20 212 | 213 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 214 | # config.unlock_in = 1.hour 215 | 216 | # Warn on the last attempt before the account is locked. 217 | # config.last_attempt_warning = true 218 | 219 | # ==> Configuration for :recoverable 220 | # 221 | # Defines which key will be used when recovering the password for an account 222 | # config.reset_password_keys = [:email] 223 | 224 | # Time interval you can reset your password with a reset password key. 225 | # Don't put a too small interval or your users won't have the time to 226 | # change their passwords. 227 | config.reset_password_within = 6.hours 228 | 229 | # When set to false, does not sign a user in automatically after their password is 230 | # reset. Defaults to true, so a user is signed in automatically after a reset. 231 | # config.sign_in_after_reset_password = true 232 | 233 | # ==> Configuration for :encryptable 234 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 235 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 236 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 237 | # for default behavior) and :restful_authentication_sha1 (then you should set 238 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 239 | # 240 | # Require the `devise-encryptable` gem when using anything other than bcrypt 241 | # config.encryptor = :sha512 242 | 243 | # ==> Scopes configuration 244 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 245 | # "users/sessions/new". It's turned off by default because it's slower if you 246 | # are using only default views. 247 | # config.scoped_views = false 248 | 249 | # Configure the default scope given to Warden. By default it's the first 250 | # devise role declared in your routes (usually :user). 251 | # config.default_scope = :user 252 | 253 | # Set this configuration to false if you want /users/sign_out to sign out 254 | # only the current scope. By default, Devise signs out all scopes. 255 | # config.sign_out_all_scopes = true 256 | 257 | # ==> Navigation configuration 258 | # Lists the formats that should be treated as navigational. Formats like 259 | # :html, should redirect to the sign in page when the user does not have 260 | # access, but formats like :xml or :json, should return 401. 261 | # 262 | # If you have any extra navigational formats, like :iphone or :mobile, you 263 | # should add them to the navigational formats lists. 264 | # 265 | # The "*/*" below is required to match Internet Explorer requests. 266 | # config.navigational_formats = ['*/*', :html] 267 | 268 | # The default HTTP method used to sign out a resource. Default is :delete. 269 | config.sign_out_via = :delete 270 | 271 | # ==> OmniAuth 272 | # Add a new OmniAuth provider. Check the wiki for more information on setting 273 | # up on your models and hooks. 274 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 275 | 276 | # ==> Warden configuration 277 | # If you want to use other strategies, that are not supported by Devise, or 278 | # change the failure app, you can configure them inside the config.warden block. 279 | # 280 | # config.warden do |manager| 281 | # manager.intercept_401 = false 282 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 283 | # end 284 | 285 | # ==> Mountable engine configurations 286 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 287 | # is mountable, there are some extra configurations to be taken into account. 288 | # The following options are available, assuming the engine is mounted as: 289 | # 290 | # mount MyEngine, at: '/my_engine' 291 | # 292 | # The router that invoked `devise_for`, in the example above, would be: 293 | # config.router_name = :my_engine 294 | # 295 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 296 | # so you need to do it manually. For the users scope, it would be: 297 | # config.omniauth_path_prefix = '/my_engine/users/auth' 298 | 299 | # ==> Turbolinks configuration 300 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: 301 | # 302 | # ActiveSupport.on_load(:devise_failure_app) do 303 | # include Turbolinks::Controller 304 | # end 305 | 306 | # ==> Configuration for :registerable 307 | 308 | # When set to false, does not sign a user in automatically after their password is 309 | # changed. Defaults to true, so a user is signed in automatically after changing a password. 310 | # config.sign_in_after_change_password = true 311 | end 312 | -------------------------------------------------------------------------------- /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/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 form-check-question', item_label_class: 'form-check-label form-check-label-question', 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 form-check-input-question', 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-question form-check-inline', item_label_class: 'form-check-label form-check-label-question', 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 form-check-input-question', 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 form-check-question', item_label_class: 'form-check-label form-check-label-question', 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 form-check-input-question', 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/meta.yml: -------------------------------------------------------------------------------- 1 | meta_product_name: "Elect" 2 | meta_title: "Elect - Who will represent me?" 3 | meta_description: "This app is here to help you identify who are the best candidates to represent your political beliefs!" 4 | meta_image: "background-elect.png" # should exist in `app/assets/images/` 5 | twitter_account: "@product_twitter_account" # required for Twitter Cards 6 | -------------------------------------------------------------------------------- /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 3 | root to: "pages#home" 4 | 5 | get "devise/users", to: "users#show" 6 | resources :questions 7 | resources :user_answers 8 | resources :searches 9 | resources :abouts 10 | 11 | # patch 'questions', to: 'questions#profile_definition' 12 | 13 | resources :users do 14 | collection do 15 | get :top 16 | end 17 | end 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 | cloudinary: 10 | service: Cloudinary 11 | folder: <%= Rails.env %> 12 | 13 | # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 14 | # amazon: 15 | # service: S3 16 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 17 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 18 | # region: us-east-1 19 | # bucket: your_own_bucket-<%= Rails.env %> 20 | 21 | # Remember not to checkin your GCS keyfile to a repository 22 | # google: 23 | # service: GCS 24 | # project: your_project 25 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 26 | # bucket: your_own_bucket-<%= Rails.env %> 27 | 28 | # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 29 | # microsoft: 30 | # service: AzureStorage 31 | # storage_account_name: your_account_name 32 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 33 | # container: your_container_name-<%= Rails.env %> 34 | 35 | # mirror: 36 | # service: Mirror 37 | # primary: local 38 | # mirrors: [ amazon, google, microsoft ] 39 | -------------------------------------------------------------------------------- /db/data/answers.csv: -------------------------------------------------------------------------------- 1 | 'content','profile' 2 | 'Agree','right' 3 | 'I'm Neutral','center' 4 | 'Disagree','left' 5 | -------------------------------------------------------------------------------- /db/data/questions.csv: -------------------------------------------------------------------------------- 1 | content,photo 2 | 1. Racial quotas in universities and contests is a good solution to correct the mistakes that Brazil made in the past against this part of the population.,Question-1.jpg 3 | 2. The defense of Human Rights is fundamental to combat injustices in the society.,Question-2.jpg 4 | 3. The government should promote economic growth using public resources to help companies grow.,Question-3.jpg 5 | 4. The Brazilian government has an obligation to pay permanent cash assistance to the poorest.,Question-4.jpg 6 | 5. It is important to discuss the liberalization of some drugs as an alternative to fight the crime.,Question-5.jpg 7 | 6. The non-violent prisoners should be released from prison to reduce overcrowding.,Question-6.jpg 8 | 7. Religion should not interfere in state decisions.,Question-7.jpg 9 | 8. Abortion is not a matter of ideology but of public health.,Question-8.jpg 10 | 9. Pensions for family members of the armed forces must be reviewed so that there is money left for the Federal Government.,Question-9.jpg 11 | 10. Marriage should always be between people who love each other regardless of gender.,Question-10.jpg 12 | -------------------------------------------------------------------------------- /db/migrate/20221129182412_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DeviseCreateUsers < ActiveRecord::Migration[7.0] 4 | def change 5 | create_table :users do |t| 6 | ## Database authenticatable 7 | t.string :email, null: false, default: "" 8 | t.string :encrypted_password, null: false, default: "" 9 | 10 | ## Recoverable 11 | t.string :reset_password_token 12 | t.datetime :reset_password_sent_at 13 | 14 | ## Rememberable 15 | t.datetime :remember_created_at 16 | 17 | ## Trackable 18 | # t.integer :sign_in_count, default: 0, null: false 19 | # t.datetime :current_sign_in_at 20 | # t.datetime :last_sign_in_at 21 | # t.string :current_sign_in_ip 22 | # t.string :last_sign_in_ip 23 | 24 | ## Confirmable 25 | # t.string :confirmation_token 26 | # t.datetime :confirmed_at 27 | # t.datetime :confirmation_sent_at 28 | # t.string :unconfirmed_email # Only if using reconfirmable 29 | 30 | ## Lockable 31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 32 | # t.string :unlock_token # Only if unlock strategy is :email or :both 33 | # t.datetime :locked_at 34 | 35 | 36 | t.timestamps null: false 37 | end 38 | 39 | add_index :users, :email, unique: true 40 | add_index :users, :reset_password_token, unique: true 41 | # add_index :users, :confirmation_token, unique: true 42 | # add_index :users, :unlock_token, unique: true 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /db/migrate/20221129184113_create_questions.rb: -------------------------------------------------------------------------------- 1 | class CreateQuestions < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :questions do |t| 4 | t.string :content 5 | t.string :photo 6 | t.timestamps 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20221129184123_create_answers.rb: -------------------------------------------------------------------------------- 1 | class CreateAnswers < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :answers do |t| 4 | t.references :question, null: false, foreign_key: true 5 | t.string :content 6 | t.string :profile 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20221129184131_create_user_answers.rb: -------------------------------------------------------------------------------- 1 | class CreateUserAnswers < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :user_answers do |t| 4 | t.references :user, null: false, foreign_key: true 5 | t.references :answer, null: false, foreign_key: true 6 | t.integer :weight 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20221129191406_add_columns_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddColumnsToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :name, :string 4 | add_column :users, :role, :string 5 | add_column :users, :state, :string 6 | add_column :users, :party, :string 7 | add_column :users, :race, :string 8 | add_column :users, :gender, :string 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20221130222019_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/20221201182643_create_searches.rb: -------------------------------------------------------------------------------- 1 | class CreateSearches < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :searches do |t| 4 | t.string :state 5 | t.string :party 6 | t.string :gender 7 | t.string :race 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20221201193312_add_columns_to_searches.rb: -------------------------------------------------------------------------------- 1 | class AddColumnsToSearches < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :searches, :name, :string 4 | add_column :searches, :role, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20221205165541_create_abouts.rb: -------------------------------------------------------------------------------- 1 | class CreateAbouts < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :abouts do |t| 4 | t.string :title 5 | t.string :content 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20221205165810_add_orientation_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddOrientationToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :orientation, :string, default: '' 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_12_05_165810) do 14 | # These are extensions that must be enabled in order to support this database 15 | enable_extension "plpgsql" 16 | 17 | create_table "abouts", force: :cascade do |t| 18 | t.string "title" 19 | t.string "content" 20 | t.datetime "created_at", null: false 21 | t.datetime "updated_at", null: false 22 | end 23 | 24 | create_table "active_storage_attachments", force: :cascade do |t| 25 | t.string "name", null: false 26 | t.string "record_type", null: false 27 | t.bigint "record_id", null: false 28 | t.bigint "blob_id", null: false 29 | t.datetime "created_at", null: false 30 | t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" 31 | t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true 32 | end 33 | 34 | create_table "active_storage_blobs", force: :cascade do |t| 35 | t.string "key", null: false 36 | t.string "filename", null: false 37 | t.string "content_type" 38 | t.text "metadata" 39 | t.string "service_name", null: false 40 | t.bigint "byte_size", null: false 41 | t.string "checksum" 42 | t.datetime "created_at", null: false 43 | t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true 44 | end 45 | 46 | create_table "active_storage_variant_records", force: :cascade do |t| 47 | t.bigint "blob_id", null: false 48 | t.string "variation_digest", null: false 49 | t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true 50 | end 51 | 52 | create_table "answers", force: :cascade do |t| 53 | t.bigint "question_id", null: false 54 | t.string "content" 55 | t.string "profile" 56 | t.datetime "created_at", null: false 57 | t.datetime "updated_at", null: false 58 | t.index ["question_id"], name: "index_answers_on_question_id" 59 | end 60 | 61 | create_table "questions", force: :cascade do |t| 62 | t.string "content" 63 | t.string "photo" 64 | t.datetime "created_at", null: false 65 | t.datetime "updated_at", null: false 66 | end 67 | 68 | create_table "searches", force: :cascade do |t| 69 | t.string "state" 70 | t.string "party" 71 | t.string "gender" 72 | t.string "race" 73 | t.datetime "created_at", null: false 74 | t.datetime "updated_at", null: false 75 | t.string "name" 76 | t.string "role" 77 | end 78 | 79 | create_table "user_answers", force: :cascade do |t| 80 | t.bigint "user_id", null: false 81 | t.bigint "answer_id", null: false 82 | t.integer "weight" 83 | t.datetime "created_at", null: false 84 | t.datetime "updated_at", null: false 85 | t.index ["answer_id"], name: "index_user_answers_on_answer_id" 86 | t.index ["user_id"], name: "index_user_answers_on_user_id" 87 | end 88 | 89 | create_table "users", force: :cascade do |t| 90 | t.string "email", default: "", null: false 91 | t.string "encrypted_password", default: "", null: false 92 | t.string "reset_password_token" 93 | t.datetime "reset_password_sent_at" 94 | t.datetime "remember_created_at" 95 | t.datetime "created_at", null: false 96 | t.datetime "updated_at", null: false 97 | t.string "name" 98 | t.string "role" 99 | t.string "state" 100 | t.string "party" 101 | t.string "race" 102 | t.string "gender" 103 | t.string "orientation", default: "" 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 "answers", "questions" 111 | add_foreign_key "user_answers", "answers" 112 | add_foreign_key "user_answers", "users" 113 | end 114 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/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/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app", 3 | "private": "true", 4 | "dependencies": { 5 | "@hotwired/stimulus": "^3.2.0", 6 | "@hotwired/turbo-rails": "^7.2.4", 7 | "@popperjs/core": "^2.11.6", 8 | "bootstrap": "^5.2.3", 9 | "webpack": "^5.75.0", 10 | "webpack-cli": "^5.0.0" 11 | }, 12 | "scripts": { 13 | "build": "webpack --config webpack.config.js" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 59 | 60 | 61 | 62 | 63 |
64 |
65 |

The page you were looking for doesn't exist.

66 | 67 | 68 | 69 |

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

70 |
71 |

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

72 |
73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /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 | 59 | 60 | 61 | 62 | 63 |
64 |
65 |

We're sorry, but something went wrong.

66 | 67 |
68 |

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

69 |
70 | 71 | 72 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/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/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/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/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/abouts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class AboutsControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/answers_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class AnswersControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/news_policies_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class NewsPoliciesControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/questions_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class QuestionsControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/searches_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class SearchesControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/user_answers_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class UserAnswersControllerTest < 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/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/test/models/.keep -------------------------------------------------------------------------------- /test/models/about_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class AboutTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/answer_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class AnswerTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/news_policy_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class NewsPolicyTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/question_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class QuestionTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/search_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class SearchTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/user_answer_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class UserAnswerTest < 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/system/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/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/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/tmp/.keep -------------------------------------------------------------------------------- /tmp/pids/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/tmp/pids/.keep -------------------------------------------------------------------------------- /tmp/storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lanarosatech/elect/a3971d0f3a97cdf45507ca41e492f2fd6d9d93a6/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 | --------------------------------------------------------------------------------