├── .babelrc ├── .gitignore ├── .postcssrc.yml ├── .ruby-version ├── Gemfile ├── Gemfile.lock ├── Procfile ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ ├── cable.js │ │ ├── channels │ │ │ └── .keep │ │ └── projects.coffee │ └── stylesheets │ │ ├── announcements.scss │ │ ├── application.scss │ │ ├── projects.scss │ │ ├── scaffolds.scss │ │ └── sticky-footer.scss ├── channels │ └── application_cable │ │ ├── channel.rb │ │ └── connection.rb ├── controllers │ ├── admin │ │ ├── announcements_controller.rb │ │ ├── application_controller.rb │ │ ├── notifications_controller.rb │ │ ├── services_controller.rb │ │ └── users_controller.rb │ ├── announcements_controller.rb │ ├── api │ │ └── v1 │ │ │ ├── api_controller.rb │ │ │ └── users_controller.rb │ ├── application_controller.rb │ ├── concerns │ │ └── .keep │ ├── home_controller.rb │ ├── notifications_controller.rb │ ├── projects_controller.rb │ └── users │ │ └── omniauth_callbacks_controller.rb ├── dashboards │ ├── announcement_dashboard.rb │ ├── notification_dashboard.rb │ ├── service_dashboard.rb │ └── user_dashboard.rb ├── helpers │ ├── announcements_helper.rb │ ├── application_helper.rb │ ├── devise_helper.rb │ └── projects_helper.rb ├── javascript │ ├── controllers │ │ └── nested_form_controller.js │ └── packs │ │ └── application.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── announcement.rb │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ ├── notification.rb │ ├── project.rb │ ├── service.rb │ ├── task.rb │ └── user.rb └── views │ ├── admin │ ├── application │ │ └── _navigation.html.erb │ └── users │ │ └── show.html.erb │ ├── announcements │ └── index.html.erb │ ├── api │ └── v1 │ │ └── users │ │ └── me.json.jbuilder │ ├── devise │ ├── confirmations │ │ └── new.html.erb │ ├── mailer │ │ ├── confirmation_instructions.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 │ │ └── _links.html.erb │ └── unlocks │ │ └── new.html.erb │ ├── home │ ├── index.html.erb │ ├── privacy.html.erb │ └── terms.html.erb │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ ├── notifications │ └── index.html.erb │ ├── projects │ ├── _form.html.erb │ ├── _project.json.jbuilder │ ├── _task_fields.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ └── shared │ ├── _footer.html.erb │ ├── _head.html.erb │ ├── _navbar.html.erb │ └── _notices.html.erb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring ├── update ├── webpack ├── webpack-dev-server └── yarn ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── credentials.yml.enc ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── content_security_policy.rb │ ├── cookies_serializer.rb │ ├── devise.rb │ ├── filter_parameter_logging.rb │ ├── friendly_id.rb │ ├── gravatar.rb │ ├── inflections.rb │ ├── mime_types.rb │ └── wrap_parameters.rb ├── locales │ ├── devise.en.yml │ └── en.yml ├── puma.rb ├── routes.rb ├── schedule.rb ├── sitemap.rb ├── spring.rb ├── storage.yml ├── webpack │ ├── development.js │ ├── environment.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── migrate │ ├── 20190206223559_devise_create_users.rb │ ├── 20190206223625_create_announcements.rb │ ├── 20190206223626_create_notifications.rb │ ├── 20190206223627_create_services.rb │ ├── 20190206223628_create_friendly_id_slugs.rb │ ├── 20190206223826_create_projects.rb │ └── 20190206223844_create_tasks.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep ├── tasks │ └── .keep └── templates │ └── erb │ └── scaffold │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.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 ├── controllers │ ├── .keep │ └── projects_controller_test.rb ├── fixtures │ ├── .keep │ ├── announcements.yml │ ├── files │ │ └── .keep │ ├── notifications.yml │ ├── projects.yml │ ├── services.yml │ ├── tasks.yml │ └── users.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── announcement_test.rb │ ├── notification_test.rb │ ├── project_test.rb │ ├── service_test.rb │ ├── task_test.rb │ └── user_test.rb ├── system │ ├── .keep │ └── projects_test.rb └── test_helper.rb ├── tmp └── .keep ├── vendor └── .keep └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": "> 1%", 7 | "uglify": true 8 | }, 9 | "useBuiltIns": true 10 | }] 11 | ], 12 | 13 | "plugins": [ 14 | "syntax-dynamic-import", 15 | "transform-object-rest-spread", 16 | ["transform-class-properties", { "spec": true }] 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /.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 uploaded files in development 17 | /storage/* 18 | !/storage/.keep 19 | 20 | /node_modules 21 | /yarn-error.log 22 | 23 | /public/assets 24 | .byebug_history 25 | 26 | # Ignore master key for decrypting credentials and more. 27 | /config/master.key 28 | /public/packs 29 | /public/packs-test 30 | /node_modules 31 | yarn-debug.log* 32 | .yarn-integrity 33 | -------------------------------------------------------------------------------- /.postcssrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | postcss-import: {} 3 | postcss-cssnext: {} 4 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-2.6.1 -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '2.6.1' 5 | 6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7 | gem 'rails', '~> 5.2.2' 8 | # Use postgresql as the database for Active Record 9 | gem 'pg', '>= 0.18', '< 2.0' 10 | # Use Puma as the app server 11 | gem 'puma', '~> 3.11' 12 | # Use SCSS for stylesheets 13 | gem 'sass-rails', '~> 5.0' 14 | # Use Uglifier as compressor for JavaScript assets 15 | gem 'uglifier', '>= 1.3.0' 16 | # See https://github.com/rails/execjs#readme for more supported runtimes 17 | # gem 'mini_racer', platforms: :ruby 18 | 19 | # Use CoffeeScript for .coffee assets and views 20 | gem 'coffee-rails', '~> 4.2' 21 | # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 22 | gem 'turbolinks', '~> 5' 23 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 24 | gem 'jbuilder', '~> 2.5' 25 | # Use Redis adapter to run Action Cable in production 26 | # gem 'redis', '~> 4.0' 27 | # Use ActiveModel has_secure_password 28 | # gem 'bcrypt', '~> 3.1.7' 29 | 30 | # Use ActiveStorage variant 31 | # gem 'mini_magick', '~> 4.8' 32 | 33 | # Use Capistrano for deployment 34 | # gem 'capistrano-rails', group: :development 35 | 36 | # Reduces boot times through caching; required in config/boot.rb 37 | gem 'bootsnap', '>= 1.1.0', require: false 38 | 39 | group :development, :test do 40 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 41 | gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 42 | end 43 | 44 | group :development do 45 | # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 46 | gem 'web-console', '>= 3.3.0' 47 | gem 'listen', '>= 3.0.5', '< 3.2' 48 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 49 | gem 'spring' 50 | gem 'spring-watcher-listen', '~> 2.0.0' 51 | end 52 | 53 | group :test do 54 | # Adds support for Capybara system testing and selenium driver 55 | gem 'capybara', '>= 2.15' 56 | gem 'selenium-webdriver' 57 | # Easy installation and use of chromedriver to run system tests with Chrome 58 | gem 'chromedriver-helper' 59 | end 60 | 61 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 62 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 63 | 64 | gem 'administrate', '~> 0.10.0' 65 | gem 'bootstrap', '~> 4.2', '>= 4.2.1' 66 | gem 'data-confirm-modal', '~> 1.6', '>= 1.6.2' 67 | gem 'devise', '~> 4.4', '>= 4.4.3' 68 | gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4' 69 | gem 'devise_masquerade', '~> 0.6.2' 70 | gem 'font-awesome-sass', '~> 5.5', '>= 5.5.0.1' 71 | gem 'foreman', '~> 0.84.0' 72 | gem 'friendly_id', '~> 5.2', '>= 5.2.4' 73 | gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag' 74 | gem 'jquery-rails', '~> 4.3.1' 75 | gem 'local_time', '~> 2.0', '>= 2.0.1' 76 | gem 'mini_magick', '~> 4.8' 77 | gem 'name_of_person', '~> 1.0' 78 | gem 'omniauth-facebook', '~> 5.0' 79 | gem 'omniauth-github', '~> 1.3' 80 | gem 'omniauth-twitter', '~> 1.4' 81 | gem 'sidekiq', '~> 5.1', '>= 5.1.3' 82 | gem 'sitemap_generator', '~> 6.0', '>= 6.0.1' 83 | gem 'webpacker', '~> 3.5', '>= 3.5.3' 84 | gem 'whenever', require: false -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: https://github.com/excid3/devise-bootstrapped.git 3 | revision: a963d93052ce0069d050e4615fb06e95dc30ac2b 4 | branch: bootstrap4 5 | specs: 6 | devise-bootstrapped (0.2.0) 7 | 8 | GIT 9 | remote: https://github.com/mdeering/gravatar_image_tag.git 10 | revision: c02351f7d6649e2346394e33164a7154e671ec19 11 | specs: 12 | gravatar_image_tag (1.2.0) 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actioncable (5.2.2) 18 | actionpack (= 5.2.2) 19 | nio4r (~> 2.0) 20 | websocket-driver (>= 0.6.1) 21 | actionmailer (5.2.2) 22 | actionpack (= 5.2.2) 23 | actionview (= 5.2.2) 24 | activejob (= 5.2.2) 25 | mail (~> 2.5, >= 2.5.4) 26 | rails-dom-testing (~> 2.0) 27 | actionpack (5.2.2) 28 | actionview (= 5.2.2) 29 | activesupport (= 5.2.2) 30 | rack (~> 2.0) 31 | rack-test (>= 0.6.3) 32 | rails-dom-testing (~> 2.0) 33 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 34 | actionview (5.2.2) 35 | activesupport (= 5.2.2) 36 | builder (~> 3.1) 37 | erubi (~> 1.4) 38 | rails-dom-testing (~> 2.0) 39 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 40 | activejob (5.2.2) 41 | activesupport (= 5.2.2) 42 | globalid (>= 0.3.6) 43 | activemodel (5.2.2) 44 | activesupport (= 5.2.2) 45 | activerecord (5.2.2) 46 | activemodel (= 5.2.2) 47 | activesupport (= 5.2.2) 48 | arel (>= 9.0) 49 | activestorage (5.2.2) 50 | actionpack (= 5.2.2) 51 | activerecord (= 5.2.2) 52 | marcel (~> 0.3.1) 53 | activesupport (5.2.2) 54 | concurrent-ruby (~> 1.0, >= 1.0.2) 55 | i18n (>= 0.7, < 2) 56 | minitest (~> 5.1) 57 | tzinfo (~> 1.1) 58 | addressable (2.6.0) 59 | public_suffix (>= 2.0.2, < 4.0) 60 | administrate (0.10.0) 61 | actionpack (>= 4.2, < 6.0) 62 | actionview (>= 4.2, < 6.0) 63 | activerecord (>= 4.2, < 6.0) 64 | autoprefixer-rails (>= 6.0) 65 | datetime_picker_rails (~> 0.0.7) 66 | jquery-rails (>= 4.0) 67 | kaminari (>= 1.0) 68 | momentjs-rails (~> 2.8) 69 | sass-rails (~> 5.0) 70 | selectize-rails (~> 0.6) 71 | archive-zip (0.11.0) 72 | io-like (~> 0.3.0) 73 | arel (9.0.0) 74 | autoprefixer-rails (9.4.7) 75 | execjs 76 | bcrypt (3.1.12) 77 | bindex (0.5.0) 78 | bootsnap (1.3.2) 79 | msgpack (~> 1.0) 80 | bootstrap (4.2.1) 81 | autoprefixer-rails (>= 9.1.0) 82 | popper_js (>= 1.14.3, < 2) 83 | sassc-rails (>= 2.0.0) 84 | builder (3.2.3) 85 | byebug (10.0.2) 86 | capybara (3.13.2) 87 | addressable 88 | mini_mime (>= 0.1.3) 89 | nokogiri (~> 1.8) 90 | rack (>= 1.6.0) 91 | rack-test (>= 0.6.3) 92 | regexp_parser (~> 1.2) 93 | xpath (~> 3.2) 94 | childprocess (0.9.0) 95 | ffi (~> 1.0, >= 1.0.11) 96 | chromedriver-helper (2.1.0) 97 | archive-zip (~> 0.10) 98 | nokogiri (~> 1.8) 99 | chronic (0.10.2) 100 | coffee-rails (4.2.2) 101 | coffee-script (>= 2.2.0) 102 | railties (>= 4.0.0) 103 | coffee-script (2.4.1) 104 | coffee-script-source 105 | execjs 106 | coffee-script-source (1.12.2) 107 | concurrent-ruby (1.1.4) 108 | connection_pool (2.2.2) 109 | crass (1.0.4) 110 | data-confirm-modal (1.6.2) 111 | railties (>= 3.0) 112 | datetime_picker_rails (0.0.7) 113 | momentjs-rails (>= 2.8.1) 114 | devise (4.5.0) 115 | bcrypt (~> 3.0) 116 | orm_adapter (~> 0.1) 117 | railties (>= 4.1.0, < 6.0) 118 | responders 119 | warden (~> 1.2.3) 120 | devise_masquerade (0.6.5) 121 | devise (>= 2.1.0) 122 | railties (>= 3.0) 123 | erubi (1.8.0) 124 | execjs (2.7.0) 125 | faraday (0.15.4) 126 | multipart-post (>= 1.2, < 3) 127 | ffi (1.9.25) 128 | font-awesome-sass (5.6.1) 129 | sassc (>= 1.11) 130 | foreman (0.84.0) 131 | thor (~> 0.19.1) 132 | friendly_id (5.2.5) 133 | activerecord (>= 4.0.0) 134 | globalid (0.4.2) 135 | activesupport (>= 4.2.0) 136 | hashie (3.6.0) 137 | i18n (1.5.3) 138 | concurrent-ruby (~> 1.0) 139 | io-like (0.3.0) 140 | jbuilder (2.8.0) 141 | activesupport (>= 4.2.0) 142 | multi_json (>= 1.2) 143 | jquery-rails (4.3.3) 144 | rails-dom-testing (>= 1, < 3) 145 | railties (>= 4.2.0) 146 | thor (>= 0.14, < 2.0) 147 | jwt (2.1.0) 148 | kaminari (1.1.1) 149 | activesupport (>= 4.1.0) 150 | kaminari-actionview (= 1.1.1) 151 | kaminari-activerecord (= 1.1.1) 152 | kaminari-core (= 1.1.1) 153 | kaminari-actionview (1.1.1) 154 | actionview 155 | kaminari-core (= 1.1.1) 156 | kaminari-activerecord (1.1.1) 157 | activerecord 158 | kaminari-core (= 1.1.1) 159 | kaminari-core (1.1.1) 160 | listen (3.1.5) 161 | rb-fsevent (~> 0.9, >= 0.9.4) 162 | rb-inotify (~> 0.9, >= 0.9.7) 163 | ruby_dep (~> 1.2) 164 | local_time (2.1.0) 165 | loofah (2.2.3) 166 | crass (~> 1.0.2) 167 | nokogiri (>= 1.5.9) 168 | mail (2.7.1) 169 | mini_mime (>= 0.1.1) 170 | marcel (0.3.3) 171 | mimemagic (~> 0.3.2) 172 | method_source (0.9.2) 173 | mimemagic (0.3.3) 174 | mini_magick (4.9.2) 175 | mini_mime (1.0.1) 176 | mini_portile2 (2.4.0) 177 | minitest (5.11.3) 178 | momentjs-rails (2.20.1) 179 | railties (>= 3.1) 180 | msgpack (1.2.6) 181 | multi_json (1.13.1) 182 | multi_xml (0.6.0) 183 | multipart-post (2.0.0) 184 | name_of_person (1.1.0) 185 | activesupport (>= 5.2.0) 186 | nio4r (2.3.1) 187 | nokogiri (1.10.1) 188 | mini_portile2 (~> 2.4.0) 189 | oauth (0.5.4) 190 | oauth2 (1.4.1) 191 | faraday (>= 0.8, < 0.16.0) 192 | jwt (>= 1.0, < 3.0) 193 | multi_json (~> 1.3) 194 | multi_xml (~> 0.5) 195 | rack (>= 1.2, < 3) 196 | omniauth (1.9.0) 197 | hashie (>= 3.4.6, < 3.7.0) 198 | rack (>= 1.6.2, < 3) 199 | omniauth-facebook (5.0.0) 200 | omniauth-oauth2 (~> 1.2) 201 | omniauth-github (1.3.0) 202 | omniauth (~> 1.5) 203 | omniauth-oauth2 (>= 1.4.0, < 2.0) 204 | omniauth-oauth (1.1.0) 205 | oauth 206 | omniauth (~> 1.0) 207 | omniauth-oauth2 (1.6.0) 208 | oauth2 (~> 1.1) 209 | omniauth (~> 1.9) 210 | omniauth-twitter (1.4.0) 211 | omniauth-oauth (~> 1.1) 212 | rack 213 | orm_adapter (0.5.0) 214 | pg (1.1.4) 215 | popper_js (1.14.5) 216 | public_suffix (3.0.3) 217 | puma (3.12.0) 218 | rack (2.0.6) 219 | rack-protection (2.0.5) 220 | rack 221 | rack-proxy (0.6.5) 222 | rack 223 | rack-test (1.1.0) 224 | rack (>= 1.0, < 3) 225 | rails (5.2.2) 226 | actioncable (= 5.2.2) 227 | actionmailer (= 5.2.2) 228 | actionpack (= 5.2.2) 229 | actionview (= 5.2.2) 230 | activejob (= 5.2.2) 231 | activemodel (= 5.2.2) 232 | activerecord (= 5.2.2) 233 | activestorage (= 5.2.2) 234 | activesupport (= 5.2.2) 235 | bundler (>= 1.3.0) 236 | railties (= 5.2.2) 237 | sprockets-rails (>= 2.0.0) 238 | rails-dom-testing (2.0.3) 239 | activesupport (>= 4.2.0) 240 | nokogiri (>= 1.6) 241 | rails-html-sanitizer (1.0.4) 242 | loofah (~> 2.2, >= 2.2.2) 243 | railties (5.2.2) 244 | actionpack (= 5.2.2) 245 | activesupport (= 5.2.2) 246 | method_source 247 | rake (>= 0.8.7) 248 | thor (>= 0.19.0, < 2.0) 249 | rake (12.3.2) 250 | rb-fsevent (0.10.3) 251 | rb-inotify (0.10.0) 252 | ffi (~> 1.0) 253 | redis (4.1.0) 254 | regexp_parser (1.3.0) 255 | responders (2.4.1) 256 | actionpack (>= 4.2.0, < 6.0) 257 | railties (>= 4.2.0, < 6.0) 258 | ruby_dep (1.5.0) 259 | rubyzip (1.2.2) 260 | sass (3.7.3) 261 | sass-listen (~> 4.0.0) 262 | sass-listen (4.0.0) 263 | rb-fsevent (~> 0.9, >= 0.9.4) 264 | rb-inotify (~> 0.9, >= 0.9.7) 265 | sass-rails (5.0.7) 266 | railties (>= 4.0.0, < 6) 267 | sass (~> 3.1) 268 | sprockets (>= 2.8, < 4.0) 269 | sprockets-rails (>= 2.0, < 4.0) 270 | tilt (>= 1.1, < 3) 271 | sassc (2.0.0) 272 | ffi (~> 1.9.6) 273 | rake 274 | sassc-rails (2.1.0) 275 | railties (>= 4.0.0) 276 | sassc (>= 2.0) 277 | sprockets (> 3.0) 278 | sprockets-rails 279 | tilt 280 | selectize-rails (0.12.6) 281 | selenium-webdriver (3.141.0) 282 | childprocess (~> 0.5) 283 | rubyzip (~> 1.2, >= 1.2.2) 284 | sidekiq (5.2.5) 285 | connection_pool (~> 2.2, >= 2.2.2) 286 | rack (>= 1.5.0) 287 | rack-protection (>= 1.5.0) 288 | redis (>= 3.3.5, < 5) 289 | sitemap_generator (6.0.2) 290 | builder (~> 3.0) 291 | spring (2.0.2) 292 | activesupport (>= 4.2) 293 | spring-watcher-listen (2.0.1) 294 | listen (>= 2.7, < 4.0) 295 | spring (>= 1.2, < 3.0) 296 | sprockets (3.7.2) 297 | concurrent-ruby (~> 1.0) 298 | rack (> 1, < 3) 299 | sprockets-rails (3.2.1) 300 | actionpack (>= 4.0) 301 | activesupport (>= 4.0) 302 | sprockets (>= 3.0.0) 303 | thor (0.19.4) 304 | thread_safe (0.3.6) 305 | tilt (2.0.9) 306 | turbolinks (5.2.0) 307 | turbolinks-source (~> 5.2) 308 | turbolinks-source (5.2.0) 309 | tzinfo (1.2.5) 310 | thread_safe (~> 0.1) 311 | uglifier (4.1.20) 312 | execjs (>= 0.3.0, < 3) 313 | warden (1.2.8) 314 | rack (>= 2.0.6) 315 | web-console (3.7.0) 316 | actionview (>= 5.0) 317 | activemodel (>= 5.0) 318 | bindex (>= 0.4.0) 319 | railties (>= 5.0) 320 | webpacker (3.5.5) 321 | activesupport (>= 4.2) 322 | rack-proxy (>= 0.6.1) 323 | railties (>= 4.2) 324 | websocket-driver (0.7.0) 325 | websocket-extensions (>= 0.1.0) 326 | websocket-extensions (0.1.3) 327 | whenever (0.10.0) 328 | chronic (>= 0.6.3) 329 | xpath (3.2.0) 330 | nokogiri (~> 1.8) 331 | 332 | PLATFORMS 333 | ruby 334 | 335 | DEPENDENCIES 336 | administrate (~> 0.10.0) 337 | bootsnap (>= 1.1.0) 338 | bootstrap (~> 4.2, >= 4.2.1) 339 | byebug 340 | capybara (>= 2.15) 341 | chromedriver-helper 342 | coffee-rails (~> 4.2) 343 | data-confirm-modal (~> 1.6, >= 1.6.2) 344 | devise (~> 4.4, >= 4.4.3) 345 | devise-bootstrapped! 346 | devise_masquerade (~> 0.6.2) 347 | font-awesome-sass (~> 5.5, >= 5.5.0.1) 348 | foreman (~> 0.84.0) 349 | friendly_id (~> 5.2, >= 5.2.4) 350 | gravatar_image_tag! 351 | jbuilder (~> 2.5) 352 | jquery-rails (~> 4.3.1) 353 | listen (>= 3.0.5, < 3.2) 354 | local_time (~> 2.0, >= 2.0.1) 355 | mini_magick (~> 4.8) 356 | name_of_person (~> 1.0) 357 | omniauth-facebook (~> 5.0) 358 | omniauth-github (~> 1.3) 359 | omniauth-twitter (~> 1.4) 360 | pg (>= 0.18, < 2.0) 361 | puma (~> 3.11) 362 | rails (~> 5.2.2) 363 | sass-rails (~> 5.0) 364 | selenium-webdriver 365 | sidekiq (~> 5.1, >= 5.1.3) 366 | sitemap_generator (~> 6.0, >= 6.0.1) 367 | spring 368 | spring-watcher-listen (~> 2.0.0) 369 | turbolinks (~> 5) 370 | tzinfo-data 371 | uglifier (>= 1.3.0) 372 | web-console (>= 3.3.0) 373 | webpacker (~> 3.5, >= 3.5.3) 374 | whenever 375 | 376 | RUBY VERSION 377 | ruby 2.6.1p33 378 | 379 | BUNDLED WITH 380 | 1.17.2 381 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: rails server 2 | sidekiq: sidekiq 3 | webpack: bin/webpack-dev-server 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's 5 | // vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require jquery 15 | //= require popper 16 | //= require bootstrap 17 | //= require data-confirm-modal 18 | //= require local-time 19 | //= require activestorage 20 | //= require turbolinks 21 | //= require_tree . 22 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the `rails generate channel` command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/app/assets/javascripts/channels/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/projects.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/announcements.scss: -------------------------------------------------------------------------------- 1 | .announcement { 2 | strong { 3 | color: $gray-700; 4 | font-weight: 900; 5 | } 6 | } 7 | 8 | .unread-announcements:before { 9 | -moz-border-radius: 50%; 10 | -webkit-border-radius: 50%; 11 | border-radius: 50%; 12 | -moz-background-clip: padding-box; 13 | -webkit-background-clip: padding-box; 14 | background-clip: padding-box; 15 | background: $red; 16 | content: ''; 17 | display: inline-block; 18 | height: 8px; 19 | width: 8px; 20 | margin-right: 6px; 21 | } 22 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.scss: -------------------------------------------------------------------------------- 1 | // $navbar-default-bg: #312312; 2 | // $light-orange: #ff8c00; 3 | // $navbar-default-color: $light-orange; 4 | 5 | @import "font-awesome-sprockets"; 6 | @import "font-awesome"; 7 | @import "bootstrap"; 8 | @import "sticky-footer"; 9 | @import "announcements"; 10 | 11 | // Fixes bootstrap nav-brand container overlap 12 | @include media-breakpoint-down(xs) { 13 | .container { 14 | margin-left: 0; 15 | margin-right: 0; 16 | } 17 | } 18 | 19 | // Masquerade alert shouldn't have a bottom margin 20 | body > .alert { 21 | margin-bottom: 0; 22 | } 23 | -------------------------------------------------------------------------------- /app/assets/stylesheets/projects.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Projects controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | margin: 33px; 5 | font-family: verdana, arial, helvetica, sans-serif; 6 | font-size: 13px; 7 | line-height: 18px; 8 | } 9 | 10 | p, ol, ul, td { 11 | font-family: verdana, arial, helvetica, sans-serif; 12 | font-size: 13px; 13 | line-height: 18px; 14 | } 15 | 16 | pre { 17 | background-color: #eee; 18 | padding: 10px; 19 | font-size: 11px; 20 | } 21 | 22 | a { 23 | color: #000; 24 | 25 | &:visited { 26 | color: #666; 27 | } 28 | 29 | &:hover { 30 | color: #fff; 31 | background-color: #000; 32 | } 33 | } 34 | 35 | th { 36 | padding-bottom: 5px; 37 | } 38 | 39 | td { 40 | padding: 0 5px 7px; 41 | } 42 | 43 | div { 44 | &.field, &.actions { 45 | margin-bottom: 10px; 46 | } 47 | } 48 | 49 | #notice { 50 | color: green; 51 | } 52 | 53 | .field_with_errors { 54 | padding: 2px; 55 | background-color: red; 56 | display: table; 57 | } 58 | 59 | #error_explanation { 60 | width: 450px; 61 | border: 2px solid red; 62 | padding: 7px 7px 0; 63 | margin-bottom: 20px; 64 | background-color: #f0f0f0; 65 | 66 | h2 { 67 | text-align: left; 68 | font-weight: bold; 69 | padding: 5px 5px 5px 15px; 70 | font-size: 12px; 71 | margin: -7px -7px 0; 72 | background-color: #c00; 73 | color: #fff; 74 | } 75 | 76 | ul li { 77 | font-size: 12px; 78 | list-style: square; 79 | } 80 | } 81 | 82 | label { 83 | display: block; 84 | } 85 | -------------------------------------------------------------------------------- /app/assets/stylesheets/sticky-footer.scss: -------------------------------------------------------------------------------- 1 | /* Sticky footer styles 2 | -------------------------------------------------- */ 3 | html { 4 | position: relative; 5 | min-height: 100%; 6 | } 7 | body { 8 | /* Margin bottom by footer height */ 9 | margin-bottom: 60px; 10 | } 11 | .footer { 12 | position: absolute; 13 | bottom: 0; 14 | width: 100%; 15 | /* Set the fixed height of the footer here */ 16 | height: 60px; 17 | line-height: 60px; /* Vertically center the text there */ 18 | } 19 | 20 | 21 | /* Custom page CSS 22 | -------------------------------------------------- */ 23 | /* Not required for template or sticky footer method. */ 24 | 25 | body > .container { 26 | padding: 40px 15px 0; 27 | } 28 | 29 | .footer > .container { 30 | padding-right: 15px; 31 | padding-left: 15px; 32 | } 33 | -------------------------------------------------------------------------------- /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 | identified_by :current_user 4 | 5 | def connect 6 | self.current_user = find_verified_user 7 | logger.add_tags "ActionCable", "User #{current_user.id}" 8 | end 9 | 10 | protected 11 | 12 | def find_verified_user 13 | if current_user = env['warden'].user 14 | current_user 15 | else 16 | reject_unauthorized_connection 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /app/controllers/admin/announcements_controller.rb: -------------------------------------------------------------------------------- 1 | module Admin 2 | class AnnouncementsController < Admin::ApplicationController 3 | # To customize the behavior of this controller, 4 | # you can overwrite any of the RESTful actions. For example: 5 | # 6 | # def index 7 | # super 8 | # @resources = Announcement. 9 | # page(params[:page]). 10 | # per(10) 11 | # end 12 | 13 | # Define a custom finder by overriding the `find_resource` method: 14 | # def find_resource(param) 15 | # Announcement.find_by!(slug: param) 16 | # end 17 | 18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions 19 | # for more information 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/admin/application_controller.rb: -------------------------------------------------------------------------------- 1 | # All Administrate controllers inherit from this `Admin::ApplicationController`, 2 | # making it the ideal place to put authentication logic or other 3 | # before_actions. 4 | # 5 | # If you want to add pagination or other controller-level concerns, 6 | # you're free to overwrite the RESTful controller actions. 7 | module Admin 8 | class ApplicationController < Administrate::ApplicationController 9 | before_action :authenticate_admin 10 | 11 | def authenticate_admin 12 | redirect_to '/', alert: 'Not authorized.' unless user_signed_in? && current_user.admin? 13 | end 14 | 15 | # Override this value to specify the number of elements to display at a time 16 | # on index pages. Defaults to 20. 17 | # def records_per_page 18 | # params[:per_page] || 20 19 | # end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/admin/notifications_controller.rb: -------------------------------------------------------------------------------- 1 | module Admin 2 | class NotificationsController < Admin::ApplicationController 3 | # To customize the behavior of this controller, 4 | # you can overwrite any of the RESTful actions. For example: 5 | # 6 | # def index 7 | # super 8 | # @resources = Notification. 9 | # page(params[:page]). 10 | # per(10) 11 | # end 12 | 13 | # Define a custom finder by overriding the `find_resource` method: 14 | # def find_resource(param) 15 | # Notification.find_by!(slug: param) 16 | # end 17 | 18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions 19 | # for more information 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/admin/services_controller.rb: -------------------------------------------------------------------------------- 1 | module Admin 2 | class ServicesController < Admin::ApplicationController 3 | # To customize the behavior of this controller, 4 | # you can overwrite any of the RESTful actions. For example: 5 | # 6 | # def index 7 | # super 8 | # @resources = Service. 9 | # page(params[:page]). 10 | # per(10) 11 | # end 12 | 13 | # Define a custom finder by overriding the `find_resource` method: 14 | # def find_resource(param) 15 | # Service.find_by!(slug: param) 16 | # end 17 | 18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions 19 | # for more information 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/admin/users_controller.rb: -------------------------------------------------------------------------------- 1 | module Admin 2 | class UsersController < Admin::ApplicationController 3 | # To customize the behavior of this controller, 4 | # you can overwrite any of the RESTful actions. For example: 5 | # 6 | # def index 7 | # super 8 | # @resources = User. 9 | # page(params[:page]). 10 | # per(10) 11 | # end 12 | 13 | # Define a custom finder by overriding the `find_resource` method: 14 | # def find_resource(param) 15 | # User.find_by!(slug: param) 16 | # end 17 | 18 | # See https://administrate-prototype.herokuapp.com/customizing_controller_actions 19 | # for more information 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /app/controllers/announcements_controller.rb: -------------------------------------------------------------------------------- 1 | class AnnouncementsController < ApplicationController 2 | before_action :mark_as_read, if: :user_signed_in? 3 | 4 | def index 5 | @announcements = Announcement.order(published_at: :desc) 6 | end 7 | 8 | private 9 | 10 | def mark_as_read 11 | current_user.update(announcements_last_read_at: Time.zone.now) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/api/v1/api_controller.rb: -------------------------------------------------------------------------------- 1 | module Api 2 | module V1 3 | class ApiController < ::ApplicationController 4 | private 5 | 6 | def current_resource_owner 7 | User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token 8 | end 9 | helper_method :current_resource_owner 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/controllers/api/v1/users_controller.rb: -------------------------------------------------------------------------------- 1 | module Api 2 | module V1 3 | class UsersController < ApiController 4 | before_action :doorkeeper_authorize! 5 | respond_to :json 6 | 7 | def me 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery with: :exception 3 | 4 | before_action :configure_permitted_parameters, if: :devise_controller? 5 | before_action :masquerade_user! 6 | 7 | protected 8 | 9 | def configure_permitted_parameters 10 | devise_parameter_sanitizer.permit(:sign_up, keys: [:name]) 11 | devise_parameter_sanitizer.permit(:account_update, keys: [:name]) 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | end 4 | 5 | def terms 6 | end 7 | 8 | def privacy 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/notifications_controller.rb: -------------------------------------------------------------------------------- 1 | class NotificationsController < ApplicationController 2 | before_action :authenticate_user! 3 | 4 | def index 5 | @notifications = current_user.notifications 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/projects_controller.rb: -------------------------------------------------------------------------------- 1 | class ProjectsController < ApplicationController 2 | before_action :set_project, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /projects 5 | # GET /projects.json 6 | def index 7 | @projects = Project.all 8 | end 9 | 10 | # GET /projects/1 11 | # GET /projects/1.json 12 | def show 13 | end 14 | 15 | # GET /projects/new 16 | def new 17 | @project = Project.new 18 | @project.tasks.new 19 | end 20 | 21 | # GET /projects/1/edit 22 | def edit 23 | end 24 | 25 | # POST /projects 26 | # POST /projects.json 27 | def create 28 | @project = Project.new(project_params) 29 | 30 | respond_to do |format| 31 | if @project.save 32 | format.html { redirect_to @project, notice: 'Project was successfully created.' } 33 | format.json { render :show, status: :created, location: @project } 34 | else 35 | format.html { render :new } 36 | format.json { render json: @project.errors, status: :unprocessable_entity } 37 | end 38 | end 39 | end 40 | 41 | # PATCH/PUT /projects/1 42 | # PATCH/PUT /projects/1.json 43 | def update 44 | respond_to do |format| 45 | if @project.update(project_params) 46 | format.html { redirect_to @project, notice: 'Project was successfully updated.' } 47 | format.json { render :show, status: :ok, location: @project } 48 | else 49 | format.html { render :edit } 50 | format.json { render json: @project.errors, status: :unprocessable_entity } 51 | end 52 | end 53 | end 54 | 55 | # DELETE /projects/1 56 | # DELETE /projects/1.json 57 | def destroy 58 | @project.destroy 59 | respond_to do |format| 60 | format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' } 61 | format.json { head :no_content } 62 | end 63 | end 64 | 65 | private 66 | # Use callbacks to share common setup or constraints between actions. 67 | def set_project 68 | @project = Project.find(params[:id]) 69 | end 70 | 71 | # Never trust parameters from the scary internet, only allow the white list through. 72 | def project_params 73 | params.require(:project).permit(:name, :description, tasks_attributes: [:id, :description, :_destroy]) 74 | end 75 | end 76 | -------------------------------------------------------------------------------- /app/controllers/users/omniauth_callbacks_controller.rb: -------------------------------------------------------------------------------- 1 | module Users 2 | class OmniauthCallbacksController < Devise::OmniauthCallbacksController 3 | before_action :set_service 4 | before_action :set_user 5 | 6 | attr_reader :service, :user 7 | 8 | def facebook 9 | handle_auth "Facebook" 10 | end 11 | 12 | def twitter 13 | handle_auth "Twitter" 14 | end 15 | 16 | def github 17 | handle_auth "Github" 18 | end 19 | 20 | private 21 | 22 | def handle_auth(kind) 23 | if service.present? 24 | service.update(service_attrs) 25 | else 26 | user.services.create(service_attrs) 27 | end 28 | 29 | if user_signed_in? 30 | flash[:notice] = "Your #{kind} account was connected." 31 | redirect_to edit_user_registration_path 32 | else 33 | sign_in_and_redirect user, event: :authentication 34 | set_flash_message :notice, :success, kind: kind 35 | end 36 | end 37 | 38 | def auth 39 | request.env['omniauth.auth'] 40 | end 41 | 42 | def set_service 43 | @service = Service.where(provider: auth.provider, uid: auth.uid).first 44 | end 45 | 46 | def set_user 47 | if user_signed_in? 48 | @user = current_user 49 | elsif service.present? 50 | @user = service.user 51 | elsif User.where(email: auth.info.email).any? 52 | # 5. User is logged out and they login to a new account which doesn't match their old one 53 | flash[:alert] = "An account with this email already exists. Please sign in with that account before connecting your #{auth.provider.titleize} account." 54 | redirect_to new_user_session_path 55 | else 56 | @user = create_user 57 | end 58 | end 59 | 60 | def service_attrs 61 | expires_at = auth.credentials.expires_at.present? ? Time.at(auth.credentials.expires_at) : nil 62 | { 63 | provider: auth.provider, 64 | uid: auth.uid, 65 | expires_at: expires_at, 66 | access_token: auth.credentials.token, 67 | access_token_secret: auth.credentials.secret, 68 | } 69 | end 70 | 71 | def create_user 72 | User.create( 73 | email: auth.info.email, 74 | #name: auth.info.name, 75 | password: Devise.friendly_token[0,20] 76 | ) 77 | end 78 | 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /app/dashboards/announcement_dashboard.rb: -------------------------------------------------------------------------------- 1 | require "administrate/base_dashboard" 2 | 3 | class AnnouncementDashboard < Administrate::BaseDashboard 4 | # ATTRIBUTE_TYPES 5 | # a hash that describes the type of each of the model's fields. 6 | # 7 | # Each different type represents an Administrate::Field object, 8 | # which determines how the attribute is displayed 9 | # on pages throughout the dashboard. 10 | ATTRIBUTE_TYPES = { 11 | id: Field::Number, 12 | published_at: Field::DateTime, 13 | announcement_type: Field::Select.with_options(collection: Announcement::TYPES), 14 | name: Field::String, 15 | description: Field::Text, 16 | created_at: Field::DateTime, 17 | updated_at: Field::DateTime, 18 | }.freeze 19 | 20 | # COLLECTION_ATTRIBUTES 21 | # an array of attributes that will be displayed on the model's index page. 22 | # 23 | # By default, it's limited to four items to reduce clutter on index pages. 24 | # Feel free to add, remove, or rearrange items. 25 | COLLECTION_ATTRIBUTES = [ 26 | :id, 27 | :published_at, 28 | :announcement_type, 29 | :name, 30 | ].freeze 31 | 32 | # SHOW_PAGE_ATTRIBUTES 33 | # an array of attributes that will be displayed on the model's show page. 34 | SHOW_PAGE_ATTRIBUTES = [ 35 | :id, 36 | :published_at, 37 | :announcement_type, 38 | :name, 39 | :description, 40 | :created_at, 41 | :updated_at, 42 | ].freeze 43 | 44 | # FORM_ATTRIBUTES 45 | # an array of attributes that will be displayed 46 | # on the model's form (`new` and `edit`) pages. 47 | FORM_ATTRIBUTES = [ 48 | :published_at, 49 | :announcement_type, 50 | :name, 51 | :description, 52 | ].freeze 53 | 54 | # Overwrite this method to customize how announcements are displayed 55 | # across all pages of the admin dashboard. 56 | # 57 | # def display_resource(announcement) 58 | # "Announcement ##{announcement.id}" 59 | # end 60 | end 61 | -------------------------------------------------------------------------------- /app/dashboards/notification_dashboard.rb: -------------------------------------------------------------------------------- 1 | require "administrate/base_dashboard" 2 | 3 | class NotificationDashboard < Administrate::BaseDashboard 4 | # ATTRIBUTE_TYPES 5 | # a hash that describes the type of each of the model's fields. 6 | # 7 | # Each different type represents an Administrate::Field object, 8 | # which determines how the attribute is displayed 9 | # on pages throughout the dashboard. 10 | ATTRIBUTE_TYPES = { 11 | recipient: Field::BelongsTo.with_options(class_name: "User"), 12 | actor: Field::BelongsTo.with_options(class_name: "User"), 13 | notifiable: Field::Polymorphic, 14 | id: Field::Number, 15 | recipient_id: Field::Number, 16 | actor_id: Field::Number, 17 | read_at: Field::DateTime, 18 | action: Field::String, 19 | created_at: Field::DateTime, 20 | updated_at: Field::DateTime, 21 | }.freeze 22 | 23 | # COLLECTION_ATTRIBUTES 24 | # an array of attributes that will be displayed on the model's index page. 25 | # 26 | # By default, it's limited to four items to reduce clutter on index pages. 27 | # Feel free to add, remove, or rearrange items. 28 | COLLECTION_ATTRIBUTES = [ 29 | :recipient, 30 | :actor, 31 | :notifiable, 32 | :id, 33 | ].freeze 34 | 35 | # SHOW_PAGE_ATTRIBUTES 36 | # an array of attributes that will be displayed on the model's show page. 37 | SHOW_PAGE_ATTRIBUTES = [ 38 | :recipient, 39 | :actor, 40 | :notifiable, 41 | :id, 42 | :recipient_id, 43 | :actor_id, 44 | :read_at, 45 | :action, 46 | :created_at, 47 | :updated_at, 48 | ].freeze 49 | 50 | # FORM_ATTRIBUTES 51 | # an array of attributes that will be displayed 52 | # on the model's form (`new` and `edit`) pages. 53 | FORM_ATTRIBUTES = [ 54 | :recipient, 55 | :actor, 56 | :notifiable, 57 | :recipient_id, 58 | :actor_id, 59 | :read_at, 60 | :action, 61 | ].freeze 62 | 63 | # Overwrite this method to customize how notifications are displayed 64 | # across all pages of the admin dashboard. 65 | # 66 | # def display_resource(notification) 67 | # "Notification ##{notification.id}" 68 | # end 69 | end 70 | -------------------------------------------------------------------------------- /app/dashboards/service_dashboard.rb: -------------------------------------------------------------------------------- 1 | require "administrate/base_dashboard" 2 | 3 | class ServiceDashboard < Administrate::BaseDashboard 4 | # ATTRIBUTE_TYPES 5 | # a hash that describes the type of each of the model's fields. 6 | # 7 | # Each different type represents an Administrate::Field object, 8 | # which determines how the attribute is displayed 9 | # on pages throughout the dashboard. 10 | ATTRIBUTE_TYPES = { 11 | user: Field::BelongsTo, 12 | id: Field::Number, 13 | provider: Field::String, 14 | uid: Field::String, 15 | access_token: Field::String, 16 | access_token_secret: Field::String, 17 | refresh_token: Field::String, 18 | expires_at: Field::DateTime, 19 | auth: Field::Text, 20 | created_at: Field::DateTime, 21 | updated_at: Field::DateTime, 22 | }.freeze 23 | 24 | # COLLECTION_ATTRIBUTES 25 | # an array of attributes that will be displayed on the model's index page. 26 | # 27 | # By default, it's limited to four items to reduce clutter on index pages. 28 | # Feel free to add, remove, or rearrange items. 29 | COLLECTION_ATTRIBUTES = [ 30 | :user, 31 | :id, 32 | :provider, 33 | :uid, 34 | ].freeze 35 | 36 | # SHOW_PAGE_ATTRIBUTES 37 | # an array of attributes that will be displayed on the model's show page. 38 | SHOW_PAGE_ATTRIBUTES = [ 39 | :user, 40 | :id, 41 | :provider, 42 | :uid, 43 | :access_token, 44 | :access_token_secret, 45 | :refresh_token, 46 | :expires_at, 47 | :auth, 48 | :created_at, 49 | :updated_at, 50 | ].freeze 51 | 52 | # FORM_ATTRIBUTES 53 | # an array of attributes that will be displayed 54 | # on the model's form (`new` and `edit`) pages. 55 | FORM_ATTRIBUTES = [ 56 | :user, 57 | :provider, 58 | :uid, 59 | :access_token, 60 | :access_token_secret, 61 | :refresh_token, 62 | :expires_at, 63 | :auth, 64 | ].freeze 65 | 66 | # Overwrite this method to customize how services are displayed 67 | # across all pages of the admin dashboard. 68 | # 69 | # def display_resource(service) 70 | # "Service ##{service.id}" 71 | # end 72 | end 73 | -------------------------------------------------------------------------------- /app/dashboards/user_dashboard.rb: -------------------------------------------------------------------------------- 1 | require "administrate/base_dashboard" 2 | 3 | class UserDashboard < Administrate::BaseDashboard 4 | # ATTRIBUTE_TYPES 5 | # a hash that describes the type of each of the model's fields. 6 | # 7 | # Each different type represents an Administrate::Field object, 8 | # which determines how the attribute is displayed 9 | # on pages throughout the dashboard. 10 | ATTRIBUTE_TYPES = { 11 | notifications: Field::HasMany, 12 | services: Field::HasMany, 13 | id: Field::Number, 14 | email: Field::String, 15 | password: Field::String.with_options(searchable: false), 16 | encrypted_password: Field::String, 17 | reset_password_token: Field::String, 18 | reset_password_sent_at: Field::DateTime, 19 | remember_created_at: Field::DateTime, 20 | first_name: Field::String, 21 | last_name: Field::String, 22 | announcements_last_read_at: Field::DateTime, 23 | admin: Field::Boolean, 24 | created_at: Field::DateTime, 25 | updated_at: Field::DateTime, 26 | }.freeze 27 | 28 | # COLLECTION_ATTRIBUTES 29 | # an array of attributes that will be displayed on the model's index page. 30 | # 31 | # By default, it's limited to four items to reduce clutter on index pages. 32 | # Feel free to add, remove, or rearrange items. 33 | COLLECTION_ATTRIBUTES = [ 34 | :notifications, 35 | :services, 36 | :id, 37 | :email, 38 | ].freeze 39 | 40 | # SHOW_PAGE_ATTRIBUTES 41 | # an array of attributes that will be displayed on the model's show page. 42 | SHOW_PAGE_ATTRIBUTES = [ 43 | :notifications, 44 | :services, 45 | :id, 46 | :email, 47 | :encrypted_password, 48 | :reset_password_token, 49 | :reset_password_sent_at, 50 | :remember_created_at, 51 | :first_name, 52 | :last_name, 53 | :announcements_last_read_at, 54 | :admin, 55 | :created_at, 56 | :updated_at, 57 | ].freeze 58 | 59 | # FORM_ATTRIBUTES 60 | # an array of attributes that will be displayed 61 | # on the model's form (`new` and `edit`) pages. 62 | FORM_ATTRIBUTES = [ 63 | :password, 64 | :notifications, 65 | :services, 66 | :email, 67 | :encrypted_password, 68 | :reset_password_token, 69 | :reset_password_sent_at, 70 | :remember_created_at, 71 | :first_name, 72 | :last_name, 73 | :announcements_last_read_at, 74 | :admin, 75 | ].freeze 76 | 77 | # Overwrite this method to customize how users are displayed 78 | # across all pages of the admin dashboard. 79 | # 80 | # def display_resource(user) 81 | # "User ##{user.id}" 82 | # end 83 | end 84 | -------------------------------------------------------------------------------- /app/helpers/announcements_helper.rb: -------------------------------------------------------------------------------- 1 | module AnnouncementsHelper 2 | def unread_announcements(user) 3 | last_announcement = Announcement.order(published_at: :desc).first 4 | return if last_announcement.nil? 5 | 6 | # Highlight announcements for anyone not logged in, cuz tempting 7 | if user.nil? || user.announcements_last_read_at.nil? || user.announcements_last_read_at < last_announcement.published_at 8 | "unread-announcements" 9 | end 10 | end 11 | 12 | def announcement_class(type) 13 | { 14 | "new" => "text-success", 15 | "update" => "text-warning", 16 | "fix" => "text-danger", 17 | }.fetch(type, "text-success") 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | def bootstrap_class_for(flash_type) 3 | { 4 | success: "alert-success", 5 | error: "alert-danger", 6 | alert: "alert-warning", 7 | notice: "alert-info" 8 | }.stringify_keys[flash_type.to_s] || flash_type.to_s 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/helpers/devise_helper.rb: -------------------------------------------------------------------------------- 1 | module DeviseHelper 2 | def devise_error_messages! 3 | return '' if resource.errors.empty? 4 | 5 | messages = resource.errors.full_messages.map { |msg| content_tag(:div, msg) }.join 6 | html = <<-HTML 7 |
8 | #{messages} 9 |
10 | HTML 11 | 12 | html.html_safe 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/helpers/projects_helper.rb: -------------------------------------------------------------------------------- 1 | module ProjectsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/javascript/controllers/nested_form_controller.js: -------------------------------------------------------------------------------- 1 | // Visit The Stimulus Handbook for more details 2 | // https://stimulusjs.org/handbook/introduction 3 | // 4 | // This example controller works with specially annotated HTML like: 5 | // 6 | //

Tasks

7 | //
8 | // 13 | // 14 | // <%= form.fields_for :tasks do |task| %> 15 | // <%= render "task_fields", form: task %> 16 | // <% end %> 17 | // 18 | //
19 | // <%= link_to "Add Task", "#", class: "btn btn-outline-primary", data: { action: "click->nested-form#add_association" } %> 20 | //
21 | //
22 | // 23 | // # _task_fields.html.erb 24 | // <%= content_tag :div, class: "nested-fields", data: { new_record: form.object.new_record? } do %> 25 | //
26 | // <%= form.label :description %> 27 | // <%= form.text_field :description, class: 'form-control' %> 28 | // <%= link_to "Remove", "#", data: { action: "click->nested-form#remove_association" } %> 29 | //
30 | // 31 | // <%= form.hidden_field :_destroy %> 32 | // <% end %> 33 | 34 | import { Controller } from "stimulus" 35 | 36 | export default class extends Controller { 37 | static targets = [ "links", "template" ] 38 | 39 | connect() { 40 | this.wrapperClass = this.data.get("wrapperClass") || "nested-fields" 41 | console.log(this.wrapperClass) 42 | } 43 | 44 | add_association(event) { 45 | event.preventDefault() 46 | 47 | var content = this.templateTarget.innerHTML.replace(/NEW_RECORD/g, new Date().getTime()) 48 | this.linksTarget.insertAdjacentHTML('beforebegin', content) 49 | } 50 | 51 | remove_association(event) { 52 | event.preventDefault() 53 | 54 | let wrapper = event.target.closest("." + this.wrapperClass) 55 | 56 | // New records are simply removed from the page 57 | if (wrapper.dataset.newRecord == "true") { 58 | wrapper.remove() 59 | 60 | // Existing records are hidden and flagged for deletion 61 | } else { 62 | wrapper.querySelector("input[name*='_destroy']").value = 1 63 | wrapper.style.display = 'none' 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | /* eslint no-console:0 */ 2 | // This file is automatically compiled by Webpack, along with any other files 3 | // present in this directory. You're encouraged to place your actual application logic in 4 | // a relevant structure within app/javascript and only use these pack files to reference 5 | // that code so it'll be compiled. 6 | // 7 | // To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate 8 | // layout file, like app/views/layouts/application.html.erb 9 | 10 | console.log('Hello World from Webpacker') 11 | 12 | import { Application } from "stimulus" 13 | import { definitionsFromContext } from "stimulus/webpack-helpers" 14 | 15 | const application = Application.start() 16 | const context = require.context("controllers", true, /.js$/) 17 | application.load(definitionsFromContext(context)) 18 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/announcement.rb: -------------------------------------------------------------------------------- 1 | class Announcement < ApplicationRecord 2 | TYPES = %w{ new fix update } 3 | 4 | after_initialize :set_defaults 5 | 6 | validates :announcement_type, :description, :name, :published_at, presence: true 7 | validates :announcement_type, inclusion: { in: TYPES } 8 | 9 | def set_defaults 10 | self.published_at ||= Time.zone.now 11 | self.announcement_type ||= TYPES.first 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/notification.rb: -------------------------------------------------------------------------------- 1 | class Notification < ApplicationRecord 2 | belongs_to :recipient, class_name: "User" 3 | belongs_to :actor, class_name: "User" 4 | belongs_to :notifiable, polymorphic: true 5 | 6 | scope :unread, -> { where(read_at: nil) } 7 | scope :recent, -> { order(created_at: :desc).limit(5) } 8 | 9 | def self.post(to:, from:, action:, notifiable:) 10 | recipients = Array.wrap(to) 11 | notifications = [] 12 | 13 | Notification.transaction do 14 | notifications = recipients.uniq.each do |recipient| 15 | Notification.create( 16 | notifiable: notifiable, 17 | action: action, 18 | recipient: recipient, 19 | actor: from 20 | ) 21 | end 22 | end 23 | notifications 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /app/models/project.rb: -------------------------------------------------------------------------------- 1 | class Project < ApplicationRecord 2 | has_many :tasks, inverse_of: :project 3 | accepts_nested_attributes_for :tasks, reject_if: :all_blank, allow_destroy: true 4 | end 5 | -------------------------------------------------------------------------------- /app/models/service.rb: -------------------------------------------------------------------------------- 1 | class Service < ApplicationRecord 2 | belongs_to :user 3 | 4 | Devise.omniauth_configs.keys.each do |provider| 5 | scope provider, ->{ where(provider: provider) } 6 | end 7 | 8 | def client 9 | send("#{provider}_client") 10 | end 11 | 12 | def expired? 13 | expires_at? && expires_at <= Time.zone.now 14 | end 15 | 16 | def access_token 17 | send("#{provider}_refresh_token!", super) if expired? 18 | super 19 | end 20 | 21 | 22 | def twitter_client 23 | Twitter::REST::Client.new do |config| 24 | config.consumer_key = Rails.application.secrets.twitter_app_id 25 | config.consumer_secret = Rails.application.secrets.twitter_app_secret 26 | config.access_token = access_token 27 | config.access_token_secret = access_token_secret 28 | end 29 | end 30 | 31 | def twitter_refresh_token!(token); end 32 | end 33 | -------------------------------------------------------------------------------- /app/models/task.rb: -------------------------------------------------------------------------------- 1 | class Task < ApplicationRecord 2 | belongs_to :project 3 | end 4 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :masqueradable, :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable, :omniauthable 5 | 6 | has_person_name 7 | 8 | has_many :notifications, foreign_key: :recipient_id 9 | has_many :services 10 | end 11 | -------------------------------------------------------------------------------- /app/views/admin/application/_navigation.html.erb: -------------------------------------------------------------------------------- 1 | <%# 2 | # Navigation 3 | 4 | This partial is used to display the navigation in Administrate. 5 | By default, the navigation contains navigation links 6 | for all resources in the admin dashboard, 7 | as defined by the routes in the `admin/` namespace 8 | %> 9 | 10 | 25 | -------------------------------------------------------------------------------- /app/views/admin/users/show.html.erb: -------------------------------------------------------------------------------- 1 | <%# 2 | # Show 3 | 4 | This view is the template for the show page. 5 | It renders the attributes of a resource, 6 | as well as a link to its edit page. 7 | 8 | ## Local variables: 9 | 10 | - `page`: 11 | An instance of [Administrate::Page::Show][1]. 12 | Contains methods for accessing the resource to be displayed on the page, 13 | as well as helpers for describing how each attribute of the resource 14 | should be displayed. 15 | 16 | [1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show 17 | %> 18 | 19 | <% content_for(:title) { t("administrate.actions.show_resource", {name: page.page_title}) } %> 20 | 21 | 36 | 37 |
38 |
39 | <% page.attributes.each do |attribute| %> 40 |
41 | <%= t( 42 | "helpers.label.#{resource_name}.#{attribute.name}", 43 | default: attribute.name.titleize, 44 | ) %> 45 |
46 | 47 |
<%= render_field attribute %>
49 | <% end %> 50 |
51 |
52 | -------------------------------------------------------------------------------- /app/views/announcements/index.html.erb: -------------------------------------------------------------------------------- 1 |

What's New

2 | 3 |
4 |
5 | <% @announcements.each_with_index do |announcement, index| %> 6 | <% if index != 0 %> 7 |

8 | <% end %> 9 | 10 |
11 |
12 | <%= link_to announcements_path(anchor: dom_id(announcement)) do %> 13 | <%= announcement.published_at.strftime("%b %d") %> 14 | <% end %> 15 |
16 |
17 | <%= announcement.announcement_type.titleize %>: 18 | <%= announcement.name %> 19 | <%= simple_format announcement.description %> 20 |
21 |
22 | <% end %> 23 | 24 | <% if @announcements.empty? %> 25 |
Exciting stuff coming very soon!
26 | <% end %> 27 |
28 |
29 | -------------------------------------------------------------------------------- /app/views/api/v1/users/me.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.id current_resource_owner.id 2 | json.name current_resource_owner.name 3 | json.avatar_url gravatar_image_url(current_resource_owner.email, size: 40) 4 | -------------------------------------------------------------------------------- /app/views/devise/confirmations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Resend confirmation instructions

4 | 5 | <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.label :email %>
10 | <%= f.email_field :email, autofocus: true, class: 'form-control', value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %> 11 |
12 | 13 |
14 | <%= f.submit "Resend confirmation instructions", class: 'btn btn-primary btn-lg btn-block' %> 15 |
16 | <% end %> 17 | 18 |
19 | <%= render "devise/shared/links" %> 20 |
21 | 22 |
23 |
24 | -------------------------------------------------------------------------------- /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/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 |
2 |
3 |

Change your password

4 | 5 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> 6 | <%= devise_error_messages! %> 7 | <%= f.hidden_field :reset_password_token %> 8 | 9 |
10 | <%= f.password_field :password, autofocus: true, autocomplete: "off", class: 'form-control', placeholder: "Password" %> 11 | <% if @minimum_password_length %> 12 |

<%= @minimum_password_length %> characters minimum

13 | <% end %> 14 |
15 | 16 |
17 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: "Confirm Password" %> 18 |
19 | 20 |
21 | <%= f.submit "Change my password", class: 'btn btn-primary btn-block btn-lg' %> 22 |
23 | <% end %> 24 | 25 |
26 | <%= render "devise/shared/links" %> 27 |
28 |
29 |
30 | -------------------------------------------------------------------------------- /app/views/devise/passwords/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Reset your password

4 | <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %> 5 | <%= devise_error_messages! %> 6 |
7 |

Enter your email address below and we will send you a link to reset your password.

8 |
9 | <%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %> 10 |
11 | 12 |
13 | <%= f.submit "Send password reset email", class: 'btn btn-primary btn-block btn-lg' %> 14 |
15 | <% end %> 16 |
17 | <%= render "devise/shared/links" %> 18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /app/views/devise/registrations/edit.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Account

4 | 5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.text_field :name, autofocus: false, class: 'form-control', placeholder: "Full Name" %> 10 |
11 | 12 |
13 | <%= f.email_field :email, class: 'form-control', placeholder: 'Email Address' %> 14 |
15 | 16 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> 17 |
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
18 | <% end %> 19 | 20 |
21 | <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %> 22 |

Leave password blank if you don't want to change it

23 |
24 | 25 |
26 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %> 27 |
28 | 29 |
30 | <%= f.password_field :current_password, autocomplete: "off", class: 'form-control', placeholder: 'Current Password' %> 31 |

We need your current password to confirm your changes

32 |
33 | 34 |
35 | <%= f.submit "Save Changes", class: 'btn btn-lg btn-block btn-primary' %> 36 |
37 | <% end %> 38 |
39 | 40 |

<%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %>

41 |
42 |
43 | -------------------------------------------------------------------------------- /app/views/devise/registrations/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Sign Up

4 | 5 | <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %> 6 | <%= devise_error_messages! %> 7 | 8 |
9 | <%= f.text_field :name, autofocus: true, class: 'form-control', placeholder: "Full Name" %> 10 |
11 | 12 |
13 | <%= f.email_field :email, autofocus: false, class: 'form-control', placeholder: "Email Address" %> 14 |
15 | 16 |
17 | <%= f.password_field :password, autocomplete: "off", class: 'form-control', placeholder: 'Password' %> 18 |
19 | 20 |
21 | <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control', placeholder: 'Confirm Password' %> 22 |
23 | 24 |
25 | <%= f.submit "Sign up", class: "btn btn-primary btn-block btn-lg" %> 26 |
27 | <% end %> 28 | 29 |
30 | <%= render "devise/shared/links" %> 31 |
32 |
33 |
34 | -------------------------------------------------------------------------------- /app/views/devise/sessions/new.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Log in

4 | 5 | <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 6 |
7 | <%= f.email_field :email, autofocus: true, placeholder: 'Email Address', class: 'form-control' %> 8 |
9 | 10 |
11 | <%= f.password_field :password, autocomplete: "off", placeholder: 'Password', class: 'form-control' %> 12 |
13 | 14 | <% if devise_mapping.rememberable? -%> 15 |
16 | 20 |
21 | <% end -%> 22 | 23 |
24 | <%= f.submit "Log in", class: "btn btn-primary btn-block btn-lg" %> 25 |
26 | <% end %> 27 | 28 |
29 | <%= render "devise/shared/links" %> 30 |
31 |
32 |
33 | -------------------------------------------------------------------------------- /app/views/devise/shared/_links.html.erb: -------------------------------------------------------------------------------- 1 | <%- if controller_name != 'sessions' %> 2 | <%= link_to "Log in", new_session_path(resource_name) %>
3 | <% end -%> 4 | 5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %> 6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
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) %>
11 | <% end -%> 12 | 13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> 14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
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) %>
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) %>
24 | <% end -%> 25 | <% end -%> 26 | -------------------------------------------------------------------------------- /app/views/devise/unlocks/new.html.erb: -------------------------------------------------------------------------------- 1 |

Resend unlock instructions

2 | 3 | <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %> 4 | <%= devise_error_messages! %> 5 | 6 |
7 | <%= f.label :email %>
8 | <%= f.email_field :email, autofocus: true %> 9 |
10 | 11 |
12 | <%= f.submit "Resend unlock instructions" %> 13 |
14 | <% end %> 15 | 16 | <%= render "devise/shared/links" %> 17 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome to Jumpstart!

2 |

Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.

3 | -------------------------------------------------------------------------------- /app/views/home/privacy.html.erb: -------------------------------------------------------------------------------- 1 |

Privacy Policy

2 |

Use this for your Privacy Policy

3 | -------------------------------------------------------------------------------- /app/views/home/terms.html.erb: -------------------------------------------------------------------------------- 1 |

Terms of Service

2 |

Use this for your Terms of Service

3 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= render 'shared/head' %> 5 | 6 | 7 | 8 | <%= render 'shared/navbar' %> 9 | <%= render 'shared/notices' %> 10 | 11 |
12 | <%= yield %> 13 |
14 | 15 | <%= render 'shared/footer' %> 16 | 17 | 18 | -------------------------------------------------------------------------------- /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/notifications/index.html.erb: -------------------------------------------------------------------------------- 1 |

Notifications

2 | 3 | 8 | -------------------------------------------------------------------------------- /app/views/projects/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_with(model: project, local: true) do |form| %> 2 | <% if project.errors.any? %> 3 |
4 |

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

5 | 6 | 11 |
12 | <% end %> 13 | 14 |
15 | <%= form.label :name %> 16 | <%= form.text_field :name, class: 'form-control' %> 17 |
18 | 19 |
20 | <%= form.label :description %> 21 | <%= form.text_field :description, class: 'form-control' %> 22 |
23 | 24 |

Tasks

25 |
26 | 31 | 32 | <%= form.fields_for :tasks do |task| %> 33 | <%= render "task_fields", form: task %> 34 | <% end %> 35 | 36 |
37 | <%= link_to "Add Task", "#", class: "btn btn-outline-primary", data: { action: "click->nested-form#add_association" } %> 38 |
39 |
40 | 41 |
42 | <% if project.persisted? %> 43 |
44 | <%= link_to 'Destroy', project, method: :delete, class: "text-danger", data: { confirm: 'Are you sure?' } %> 45 |
46 | <% end %> 47 | 48 | <%= form.submit class: 'btn btn-primary' %> 49 | 50 | <% if project.persisted? %> 51 | <%= link_to "Cancel", project, class: "btn btn-link" %> 52 | <% else %> 53 | <%= link_to "Cancel", projects_path, class: "btn btn-link" %> 54 | <% end %> 55 |
56 | <% end %> 57 | -------------------------------------------------------------------------------- /app/views/projects/_project.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! project, :id, :name, :description, :created_at, :updated_at 2 | json.url project_url(project, format: :json) 3 | -------------------------------------------------------------------------------- /app/views/projects/_task_fields.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_tag :div, class: "nested-fields", data: { new_record: form.object.new_record? } do %> 2 |
3 | <%= form.label :description %> 4 | <%= form.text_field :description, class: 'form-control' %> 5 | <%= link_to "Remove", "#", data: { action: "click->nested-form#remove_association" } %> 6 |
7 | 8 | <%= form.hidden_field :_destroy %> 9 | <% end %> 10 | -------------------------------------------------------------------------------- /app/views/projects/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit Project

2 | 3 | <%= render 'form', project: @project %> 4 | -------------------------------------------------------------------------------- /app/views/projects/index.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 |
6 |

Projects

7 |
8 | 9 |
10 | <%= link_to new_project_path, class: 'btn btn-primary' do %> 11 | Add New Project 12 | <% end %> 13 |
14 |
15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | <% @projects.each do |project| %> 31 | <%= content_tag :tr, id: dom_id(project), class: dom_class(project) do %> 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | <% end %> 40 | <% end %> 41 | 42 |
NameDescription
<%= link_to project.name, project %><%= project.description %>
43 |
44 | -------------------------------------------------------------------------------- /app/views/projects/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array! @projects, partial: 'projects/project', as: :project 2 | -------------------------------------------------------------------------------- /app/views/projects/new.html.erb: -------------------------------------------------------------------------------- 1 |

New project

2 | 3 | <%= render 'form', project: @project %> 4 | -------------------------------------------------------------------------------- /app/views/projects/show.html.erb: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 |
Name:
15 |
<%= @project.name %>
16 | 17 |
Description:
18 |
<%= @project.description %>
19 | 20 |
21 | -------------------------------------------------------------------------------- /app/views/projects/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "projects/project", project: @project 2 | -------------------------------------------------------------------------------- /app/views/shared/_footer.html.erb: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /app/views/shared/_head.html.erb: -------------------------------------------------------------------------------- 1 | <%= Rails.configuration.application_name %> 2 | 3 | 4 | 5 | <%= csrf_meta_tags %> 6 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 7 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 8 | <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %> 9 | -------------------------------------------------------------------------------- /app/views/shared/_navbar.html.erb: -------------------------------------------------------------------------------- 1 | <% if user_masquerade? %> 2 |
3 | You're logged in as <%= current_user.name %> (<%= current_user.email %>) 4 | <%= link_to back_masquerade_path(current_user) do %><%= icon("fas", "times") %> Logout <% end %> 5 |
6 | <% end %> 7 | 8 | 52 | -------------------------------------------------------------------------------- /app/views/shared/_notices.html.erb: -------------------------------------------------------------------------------- 1 | <% flash.each do |msg_type, message| %> 2 |
3 |
4 | 5 | <%= message %> 6 |
7 |
8 | <% end %> 9 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a starting point to setup your application. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | # puts "\n== Copying sample files ==" 24 | # unless File.exist?('config/database.yml') 25 | # cp 'config/database.yml.sample', 'config/database.yml' 26 | # end 27 | 28 | puts "\n== Preparing database ==" 29 | system! 'bin/rails db:setup' 30 | 31 | puts "\n== Removing old logs and tempfiles ==" 32 | system! 'bin/rails log:clear tmp:clear' 33 | 34 | puts "\n== Restarting application server ==" 35 | system! 'bin/rails restart' 36 | end 37 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) 11 | spring = lockfile.specs.detect { |spec| spec.name == "spring" } 12 | if spring 13 | Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 14 | gem 'spring', spring.version 15 | require 'spring/binstub' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | include FileUtils 4 | 5 | # path to your application root. 6 | APP_ROOT = File.expand_path('..', __dir__) 7 | 8 | def system!(*args) 9 | system(*args) || abort("\n== Command #{args} failed ==") 10 | end 11 | 12 | chdir APP_ROOT do 13 | # This script is a way to update your development environment automatically. 14 | # Add necessary update steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # Install JavaScript dependencies if using Yarn 21 | # system('bin/yarn') 22 | 23 | puts "\n== Updating database ==" 24 | system! 'bin/rails db:migrate' 25 | 26 | puts "\n== Removing old logs and tempfiles ==" 27 | system! 'bin/rails log:clear tmp:clear' 28 | 29 | puts "\n== Restarting application server ==" 30 | system! 'bin/rails restart' 31 | end 32 | -------------------------------------------------------------------------------- /bin/webpack: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "rubygems" 11 | require "bundler/setup" 12 | 13 | require "webpacker" 14 | require "webpacker/webpack_runner" 15 | Webpacker::WebpackRunner.run(ARGV) 16 | -------------------------------------------------------------------------------- /bin/webpack-dev-server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" 4 | ENV["NODE_ENV"] ||= "development" 5 | 6 | require "pathname" 7 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 8 | Pathname.new(__FILE__).realpath) 9 | 10 | require "rubygems" 11 | require "bundler/setup" 12 | 13 | require "webpacker" 14 | require "webpacker/dev_server_runner" 15 | Webpacker::DevServerRunner.run(ARGV) 16 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | begin 5 | exec "yarnpkg", *ARGV 6 | rescue Errno::ENOENT 7 | $stderr.puts "Yarn executable was not detected in the system." 8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 9 | exit 1 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module NestedForms 10 | class Application < Rails::Application 11 | # Expose our application's helpers to Administrate 12 | config.to_prepare do 13 | Administrate::ApplicationController.helper NestedForms::Application.helpers 14 | end 15 | config.active_job.queue_adapter = :sidekiq 16 | config.application_name = Rails.application.class.parent_name 17 | # Initialize configuration defaults for originally generated Rails version. 18 | config.load_defaults 5.2 19 | 20 | # Settings in config/environments/* take precedence over those specified here. 21 | # Application configuration can go into files in config/initializers 22 | # -- all .rb files in that directory are automatically loaded after loading 23 | # the framework and any gems in your application. 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /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: redis 3 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 4 | channel_prefix: streaming_logs_dev 5 | 6 | test: 7 | adapter: async 8 | 9 | production: 10 | adapter: redis 11 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 12 | channel_prefix: streaming_logs_production 13 | 14 | -------------------------------------------------------------------------------- /config/credentials.yml.enc: -------------------------------------------------------------------------------- 1 | OvN3/WriQUAj1pMzFJ0IvKcCE5WQf9SRUXL37seXgbqMTX7A4IWssl764ljVqN2zr6i6KDesJcE7Xkd7lhoU2/lOopyiE8NdI03DwNB8EDaJ/RYB5MAJBsDcjO/CRejKvCwwA2Oidl/By28xnz6dAckGy1PtI4aQmhWa1kodvCEoQtZSikcRiQ6B2hSMlqgDOMsNjQgJZYoYD9GEnY9LQGIo3aue/X47Fg2H41E+2Apwg4zBBlfd9f0+h+YWV/FcpsNr5BNgFdpJzKJhZZDIKdt8krY/5bqQUjLXCNMbxanEPiBDHQsdCBwI9qE5NqCkw2pGt3qYOo/R1V0fKT2azkK07YYwpC1uiQwIpzBPXvtz/DF+L98cZMieQYWonlMyoi+RPoc88MKJ6nHNgsKXjuXHKTe53V32IObk--xCsHi9Tuatzhk008--QK9UyTb+aVy9NMOrYfMKCg== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X 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 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: nested_forms_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: nested_forms 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: nested_forms_test 61 | 62 | # As with config/secrets.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: nested_forms_production 84 | username: nested_forms 85 | password: <%= ENV['NESTED_FORMS_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Verifies that versions and hashed value of the package contents in the project's package.json 3 | config.webpacker.check_yarn_integrity = true 4 | config.action_mailer.default_url_options = { host: 'localhost', port: 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 on 8 | # every request. 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/disable caching. By default caching is disabled. 19 | # Run rails dev:cache to toggle caching. 20 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 21 | config.action_controller.perform_caching = true 22 | 23 | config.cache_store = :memory_store 24 | config.public_file_server.headers = { 25 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 26 | } 27 | else 28 | config.action_controller.perform_caching = false 29 | 30 | config.cache_store = :null_store 31 | end 32 | 33 | # Store uploaded files on the local file system (see config/storage.yml for options) 34 | config.active_storage.service = :local 35 | 36 | # Don't care if the mailer can't send. 37 | config.action_mailer.raise_delivery_errors = false 38 | 39 | config.action_mailer.perform_caching = false 40 | 41 | # Print deprecation notices to the Rails logger. 42 | config.active_support.deprecation = :log 43 | 44 | # Raise an error on page load if there are pending migrations. 45 | config.active_record.migration_error = :page_load 46 | 47 | # Highlight code that triggered database queries in logs. 48 | config.active_record.verbose_query_logs = true 49 | 50 | # Debug mode disables concatenation and preprocessing of assets. 51 | # This option may cause significant delays in view rendering with a large 52 | # number of complex assets. 53 | config.assets.debug = true 54 | 55 | # Suppress logger output for asset requests. 56 | config.assets.quiet = true 57 | 58 | # Raises error for missing translations 59 | # config.action_view.raise_on_missing_translations = true 60 | 61 | # Use an evented file watcher to asynchronously detect changes in source code, 62 | # routes, locales, etc. This feature depends on the listen gem. 63 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 64 | end 65 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Verifies that versions and hashed value of the package contents in the project's package.json 3 | config.webpacker.check_yarn_integrity = false 4 | # Settings specified here will take precedence over those in config/application.rb. 5 | 6 | # Code is not reloaded between requests. 7 | config.cache_classes = true 8 | 9 | # Eager load code on boot. This eager loads most of Rails and 10 | # your application in memory, allowing both threaded web servers 11 | # and those relying on copy on write to perform better. 12 | # Rake tasks automatically ignore this option for performance. 13 | config.eager_load = true 14 | 15 | # Full error reports are disabled and caching is turned on. 16 | config.consider_all_requests_local = false 17 | config.action_controller.perform_caching = true 18 | 19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 21 | # config.require_master_key = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 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 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 35 | 36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 37 | # config.action_controller.asset_host = 'http://assets.example.com' 38 | 39 | # Specifies the header that your server uses for sending files. 40 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 41 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 42 | 43 | # Store uploaded files on the local file system (see config/storage.yml for options) 44 | config.active_storage.service = :local 45 | 46 | # Mount Action Cable outside main process or domain 47 | # config.action_cable.mount_path = nil 48 | # config.action_cable.url = 'wss://example.com/cable' 49 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 50 | 51 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 52 | # config.force_ssl = true 53 | 54 | # Use the lowest log level to ensure availability of diagnostic information 55 | # when problems arise. 56 | config.log_level = :debug 57 | 58 | # Prepend all log lines with the following tags. 59 | config.log_tags = [ :request_id ] 60 | 61 | # Use a different cache store in production. 62 | # config.cache_store = :mem_cache_store 63 | 64 | # Use a real queuing backend for Active Job (and separate queues per environment) 65 | # config.active_job.queue_adapter = :resque 66 | # config.active_job.queue_name_prefix = "nested_forms_#{Rails.env}" 67 | 68 | config.action_mailer.perform_caching = false 69 | 70 | # Ignore bad email addresses and do not raise email delivery errors. 71 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 72 | # config.action_mailer.raise_delivery_errors = false 73 | 74 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 75 | # the I18n.default_locale when a translation cannot be found). 76 | config.i18n.fallbacks = true 77 | 78 | # Send deprecation notices to registered listeners. 79 | config.active_support.deprecation = :notify 80 | 81 | # Use default logging formatter so that PID and timestamp are not suppressed. 82 | config.log_formatter = ::Logger::Formatter.new 83 | 84 | # Use a different logger for distributed setups. 85 | # require 'syslog/logger' 86 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 87 | 88 | if ENV["RAILS_LOG_TO_STDOUT"].present? 89 | logger = ActiveSupport::Logger.new(STDOUT) 90 | logger.formatter = config.log_formatter 91 | config.logger = ActiveSupport::TaggedLogging.new(logger) 92 | end 93 | 94 | # Do not dump schema after migrations. 95 | config.active_record.dump_schema_after_migration = false 96 | end 97 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | 31 | # Store uploaded files on the local file system in a temporary directory 32 | config.active_storage.service = :test 33 | 34 | config.action_mailer.perform_caching = false 35 | 36 | # Tell Action Mailer not to deliver emails to the real world. 37 | # The :test delivery method accumulates sent emails in the 38 | # ActionMailer::Base.deliveries array. 39 | config.action_mailer.delivery_method = :test 40 | 41 | # Print deprecation notices to the stderr. 42 | config.active_support.deprecation = :stderr 43 | 44 | # Raises error for missing translations 45 | # config.action_view.raise_on_missing_translations = true 46 | end 47 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | # Add Yarn node_modules folder to the asset load path. 9 | Rails.application.config.assets.paths << Rails.root.join('node_modules') 10 | 11 | # Precompile additional assets. 12 | # application.js, application.css, and all non-JS/CSS in the app/assets 13 | # folder are already added. 14 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 15 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | 19 | # If you are using UJS then enable automatic nonce generation 20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 21 | 22 | # Report CSP violations to a specified URI 23 | # For further information see the following documentation: 24 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 25 | # Rails.application.config.content_security_policy_report_only = true 26 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/devise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Use this hook to configure devise mailer, warden hooks and so forth. 4 | # Many of these configuration options can be set straight in your model. 5 | Devise.setup do |config| 6 | # The secret key used by Devise. Devise uses this key to generate 7 | # random tokens. Changing this key will render invalid all existing 8 | # confirmation, reset password and unlock tokens in the database. 9 | # Devise will use the `secret_key_base` as its `secret_key` 10 | # by default. You can change it below and use your own secret key. 11 | config.secret_key = Rails.application.credentials.secret_key_base 12 | 13 | # ==> Controller configuration 14 | # Configure the parent class to the devise controllers. 15 | # config.parent_controller = 'DeviseController' 16 | 17 | # ==> Mailer Configuration 18 | # Configure the e-mail address which will be shown in Devise::Mailer, 19 | # note that it will be overwritten if you use your own mailer class 20 | # with default "from" parameter. 21 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' 22 | 23 | # Configure the class responsible to send e-mails. 24 | # config.mailer = 'Devise::Mailer' 25 | 26 | # Configure the parent class responsible to send e-mails. 27 | # config.parent_mailer = 'ActionMailer::Base' 28 | 29 | # ==> ORM configuration 30 | # Load and configure the ORM. Supports :active_record (default) and 31 | # :mongoid (bson_ext recommended) by default. Other ORMs may be 32 | # available as additional gems. 33 | require 'devise/orm/active_record' 34 | 35 | # ==> Configuration for any authentication mechanism 36 | # Configure which keys are used when authenticating a user. The default is 37 | # just :email. You can configure it to use [:username, :subdomain], so for 38 | # authenticating a user, both parameters are required. Remember that those 39 | # parameters are used only when authenticating and not when retrieving from 40 | # session. If you need permissions, you should implement that in a before filter. 41 | # You can also supply a hash where the value is a boolean determining whether 42 | # or not authentication should be aborted when the value is not present. 43 | # config.authentication_keys = [:email] 44 | 45 | # Configure parameters from the request object used for authentication. Each entry 46 | # given should be a request method and it will automatically be passed to the 47 | # find_for_authentication method and considered in your model lookup. For instance, 48 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. 49 | # The same considerations mentioned for authentication_keys also apply to request_keys. 50 | # config.request_keys = [] 51 | 52 | # Configure which authentication keys should be case-insensitive. 53 | # These keys will be downcased upon creating or modifying a user and when used 54 | # to authenticate or find a user. Default is :email. 55 | config.case_insensitive_keys = [:email] 56 | 57 | # Configure which authentication keys should have whitespace stripped. 58 | # These keys will have whitespace before and after removed upon creating or 59 | # modifying a user and when used to authenticate or find a user. Default is :email. 60 | config.strip_whitespace_keys = [:email] 61 | 62 | # Tell if authentication through request.params is enabled. True by default. 63 | # It can be set to an array that will enable params authentication only for the 64 | # given strategies, for example, `config.params_authenticatable = [:database]` will 65 | # enable it only for database (email + password) authentication. 66 | # config.params_authenticatable = true 67 | 68 | # Tell if authentication through HTTP Auth is enabled. False by default. 69 | # It can be set to an array that will enable http authentication only for the 70 | # given strategies, for example, `config.http_authenticatable = [:database]` will 71 | # enable it only for database authentication. The supported strategies are: 72 | # :database = Support basic authentication with authentication key + password 73 | # config.http_authenticatable = false 74 | 75 | # If 401 status code should be returned for AJAX requests. True by default. 76 | # config.http_authenticatable_on_xhr = true 77 | 78 | # The realm used in Http Basic Authentication. 'Application' by default. 79 | # config.http_authentication_realm = 'Application' 80 | 81 | # It will change confirmation, password recovery and other workflows 82 | # to behave the same regardless if the e-mail provided was right or wrong. 83 | # Does not affect registerable. 84 | # config.paranoid = true 85 | 86 | # By default Devise will store the user in session. You can skip storage for 87 | # particular strategies by setting this option. 88 | # Notice that if you are skipping storage for all authentication paths, you 89 | # may want to disable generating routes to Devise's sessions controller by 90 | # passing skip: :sessions to `devise_for` in your config/routes.rb 91 | config.skip_session_storage = [:http_auth] 92 | 93 | # By default, Devise cleans up the CSRF token on authentication to 94 | # avoid CSRF token fixation attacks. This means that, when using AJAX 95 | # requests for sign in and sign up, you need to get a new CSRF token 96 | # from the server. You can disable this option at your own risk. 97 | # config.clean_up_csrf_token_on_authentication = true 98 | 99 | # When false, Devise will not attempt to reload routes on eager load. 100 | # This can reduce the time taken to boot the app but if your application 101 | # requires the Devise mappings to be loaded during boot time the application 102 | # won't boot properly. 103 | # config.reload_routes = true 104 | 105 | # ==> Configuration for :database_authenticatable 106 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If 107 | # using other algorithms, it sets how many times you want the password to be hashed. 108 | # 109 | # Limiting the stretches to just one in testing will increase the performance of 110 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use 111 | # a value less than 10 in other environments. Note that, for bcrypt (the default 112 | # algorithm), the cost increases exponentially with the number of stretches (e.g. 113 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). 114 | config.stretches = Rails.env.test? ? 1 : 11 115 | 116 | # Set up a pepper to generate the hashed password. 117 | # config.pepper = 'e3e8ef897a7e4fd305d72d401e799ac07246c2d67532b64d5ce5388b84a329caa8e5649a982e9cffdd7b16bfad927eaf0e9ccfac7809eac9aff32fc6c35e2da1' 118 | 119 | # Send a notification to the original email when the user's email is changed. 120 | # config.send_email_changed_notification = false 121 | 122 | # Send a notification email when the user's password is changed. 123 | # config.send_password_change_notification = false 124 | 125 | # ==> Configuration for :confirmable 126 | # A period that the user is allowed to access the website even without 127 | # confirming their account. For instance, if set to 2.days, the user will be 128 | # able to access the website for two days without confirming their account, 129 | # access will be blocked just in the third day. Default is 0.days, meaning 130 | # the user cannot access the website without confirming their account. 131 | # config.allow_unconfirmed_access_for = 2.days 132 | 133 | # A period that the user is allowed to confirm their account before their 134 | # token becomes invalid. For example, if set to 3.days, the user can confirm 135 | # their account within 3 days after the mail was sent, but on the fourth day 136 | # their account can't be confirmed with the token any more. 137 | # Default is nil, meaning there is no restriction on how long a user can take 138 | # before confirming their account. 139 | # config.confirm_within = 3.days 140 | 141 | # If true, requires any email changes to be confirmed (exactly the same way as 142 | # initial account confirmation) to be applied. Requires additional unconfirmed_email 143 | # db field (see migrations). Until confirmed, new email is stored in 144 | # unconfirmed_email column, and copied to email column on successful confirmation. 145 | config.reconfirmable = true 146 | 147 | # Defines which key will be used when confirming an account 148 | # config.confirmation_keys = [:email] 149 | 150 | # ==> Configuration for :rememberable 151 | # The time the user will be remembered without asking for credentials again. 152 | # config.remember_for = 2.weeks 153 | 154 | # Invalidates all the remember me tokens when the user signs out. 155 | config.expire_all_remember_me_on_sign_out = true 156 | 157 | # If true, extends the user's remember period when remembered via cookie. 158 | # config.extend_remember_period = false 159 | 160 | # Options to be passed to the created cookie. For instance, you can set 161 | # secure: true in order to force SSL only cookies. 162 | # config.rememberable_options = {} 163 | 164 | # ==> Configuration for :validatable 165 | # Range for password length. 166 | config.password_length = 6..128 167 | 168 | # Email regex used to validate email formats. It simply asserts that 169 | # one (and only one) @ exists in the given string. This is mainly 170 | # to give user feedback and not to assert the e-mail validity. 171 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/ 172 | 173 | # ==> Configuration for :timeoutable 174 | # The time you want to timeout the user session without activity. After this 175 | # time the user will be asked for credentials again. Default is 30 minutes. 176 | # config.timeout_in = 30.minutes 177 | 178 | # ==> Configuration for :lockable 179 | # Defines which strategy will be used to lock an account. 180 | # :failed_attempts = Locks an account after a number of failed attempts to sign in. 181 | # :none = No lock strategy. You should handle locking by yourself. 182 | # config.lock_strategy = :failed_attempts 183 | 184 | # Defines which key will be used when locking and unlocking an account 185 | # config.unlock_keys = [:email] 186 | 187 | # Defines which strategy will be used to unlock an account. 188 | # :email = Sends an unlock link to the user email 189 | # :time = Re-enables login after a certain amount of time (see :unlock_in below) 190 | # :both = Enables both strategies 191 | # :none = No unlock strategy. You should handle unlocking by yourself. 192 | # config.unlock_strategy = :both 193 | 194 | # Number of authentication tries before locking an account if lock_strategy 195 | # is failed attempts. 196 | # config.maximum_attempts = 20 197 | 198 | # Time interval to unlock the account if :time is enabled as unlock_strategy. 199 | # config.unlock_in = 1.hour 200 | 201 | # Warn on the last attempt before the account is locked. 202 | # config.last_attempt_warning = true 203 | 204 | # ==> Configuration for :recoverable 205 | # 206 | # Defines which key will be used when recovering the password for an account 207 | # config.reset_password_keys = [:email] 208 | 209 | # Time interval you can reset your password with a reset password key. 210 | # Don't put a too small interval or your users won't have the time to 211 | # change their passwords. 212 | config.reset_password_within = 6.hours 213 | 214 | # When set to false, does not sign a user in automatically after their password is 215 | # reset. Defaults to true, so a user is signed in automatically after a reset. 216 | # config.sign_in_after_reset_password = true 217 | 218 | # ==> Configuration for :encryptable 219 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default). 220 | # You can use :sha1, :sha512 or algorithms from others authentication tools as 221 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20 222 | # for default behavior) and :restful_authentication_sha1 (then you should set 223 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper). 224 | # 225 | # Require the `devise-encryptable` gem when using anything other than bcrypt 226 | # config.encryptor = :sha512 227 | 228 | # ==> Scopes configuration 229 | # Turn scoped views on. Before rendering "sessions/new", it will first check for 230 | # "users/sessions/new". It's turned off by default because it's slower if you 231 | # are using only default views. 232 | # config.scoped_views = false 233 | 234 | # Configure the default scope given to Warden. By default it's the first 235 | # devise role declared in your routes (usually :user). 236 | # config.default_scope = :user 237 | 238 | # Set this configuration to false if you want /users/sign_out to sign out 239 | # only the current scope. By default, Devise signs out all scopes. 240 | # config.sign_out_all_scopes = true 241 | 242 | # ==> Navigation configuration 243 | # Lists the formats that should be treated as navigational. Formats like 244 | # :html, should redirect to the sign in page when the user does not have 245 | # access, but formats like :xml or :json, should return 401. 246 | # 247 | # If you have any extra navigational formats, like :iphone or :mobile, you 248 | # should add them to the navigational formats lists. 249 | # 250 | # The "*/*" below is required to match Internet Explorer requests. 251 | # config.navigational_formats = ['*/*', :html] 252 | 253 | # The default HTTP method used to sign out a resource. Default is :delete. 254 | config.sign_out_via = :delete 255 | 256 | # ==> OmniAuth 257 | # Add a new OmniAuth provider. Check the wiki for more information on setting 258 | # up on your models and hooks. 259 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' 260 | 261 | env_creds = Rails.application.credentials[Rails.env.to_sym] || {} 262 | %w{ facebook twitter github }.each do |provider| 263 | if options = env_creds[provider] 264 | config.omniauth provider, options[:app_id], options[:app_secret], options.fetch(:options, {}) 265 | end 266 | end 267 | 268 | # ==> Warden configuration 269 | # If you want to use other strategies, that are not supported by Devise, or 270 | # change the failure app, you can configure them inside the config.warden block. 271 | # 272 | # config.warden do |manager| 273 | # manager.intercept_401 = false 274 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 275 | # end 276 | 277 | # ==> Mountable engine configurations 278 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 279 | # is mountable, there are some extra configurations to be taken into account. 280 | # The following options are available, assuming the engine is mounted as: 281 | # 282 | # mount MyEngine, at: '/my_engine' 283 | # 284 | # The router that invoked `devise_for`, in the example above, would be: 285 | # config.router_name = :my_engine 286 | # 287 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 288 | # so you need to do it manually. For the users scope, it would be: 289 | # config.omniauth_path_prefix = '/my_engine/users/auth' 290 | 291 | # ==> Turbolinks configuration 292 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: 293 | # 294 | # ActiveSupport.on_load(:devise_failure_app) do 295 | # include Turbolinks::Controller 296 | # end 297 | end 298 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/friendly_id.rb: -------------------------------------------------------------------------------- 1 | # FriendlyId Global Configuration 2 | # 3 | # Use this to set up shared configuration options for your entire application. 4 | # Any of the configuration options shown here can also be applied to single 5 | # models by passing arguments to the `friendly_id` class method or defining 6 | # methods in your model. 7 | # 8 | # To learn more, check out the guide: 9 | # 10 | # http://norman.github.io/friendly_id/file.Guide.html 11 | 12 | FriendlyId.defaults do |config| 13 | # ## Reserved Words 14 | # 15 | # Some words could conflict with Rails's routes when used as slugs, or are 16 | # undesirable to allow as slugs. Edit this list as needed for your app. 17 | config.use :reserved 18 | 19 | config.reserved_words = %w(new edit index session login logout users admin 20 | stylesheets assets javascripts images) 21 | 22 | # This adds an option to treat reserved words as conflicts rather than exceptions. 23 | # When there is no good candidate, a UUID will be appended, matching the existing 24 | # conflict behavior. 25 | 26 | # config.treat_reserved_as_conflict = true 27 | 28 | # ## Friendly Finders 29 | # 30 | # Uncomment this to use friendly finders in all models. By default, if 31 | # you wish to find a record by its friendly id, you must do: 32 | # 33 | # MyModel.friendly.find('foo') 34 | # 35 | # If you uncomment this, you can do: 36 | # 37 | # MyModel.find('foo') 38 | # 39 | # This is significantly more convenient but may not be appropriate for 40 | # all applications, so you must explicity opt-in to this behavior. You can 41 | # always also configure it on a per-model basis if you prefer. 42 | # 43 | # Something else to consider is that using the :finders addon boosts 44 | # performance because it will avoid Rails-internal code that makes runtime 45 | # calls to `Module.extend`. 46 | # 47 | # config.use :finders 48 | # 49 | # ## Slugs 50 | # 51 | # Most applications will use the :slugged module everywhere. If you wish 52 | # to do so, uncomment the following line. 53 | # 54 | # config.use :slugged 55 | # 56 | # By default, FriendlyId's :slugged addon expects the slug column to be named 57 | # 'slug', but you can change it if you wish. 58 | # 59 | # config.slug_column = 'slug' 60 | # 61 | # By default, slug has no size limit, but you can change it if you wish. 62 | # 63 | # config.slug_limit = 255 64 | # 65 | # When FriendlyId can not generate a unique ID from your base method, it appends 66 | # a UUID, separated by a single dash. You can configure the character used as the 67 | # separator. If you're upgrading from FriendlyId 4, you may wish to replace this 68 | # with two dashes. 69 | # 70 | # config.sequence_separator = '-' 71 | # 72 | # Note that you must use the :slugged addon **prior** to the line which 73 | # configures the sequence separator, or else FriendlyId will raise an undefined 74 | # method error. 75 | # 76 | # ## Tips and Tricks 77 | # 78 | # ### Controlling when slugs are generated 79 | # 80 | # As of FriendlyId 5.0, new slugs are generated only when the slug field is 81 | # nil, but if you're using a column as your base method can change this 82 | # behavior by overriding the `should_generate_new_friendly_id?` method that 83 | # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave 84 | # more like 4.0. 85 | # Note: Use(include) Slugged module in the config if using the anonymous module. 86 | # If you have `friendly_id :name, use: slugged` in the model, Slugged module 87 | # is included after the anonymous module defined in the initializer, so it 88 | # overrides the `should_generate_new_friendly_id?` method from the anonymous module. 89 | # 90 | # config.use :slugged 91 | # config.use Module.new { 92 | # def should_generate_new_friendly_id? 93 | # slug.blank? || _changed? 94 | # end 95 | # } 96 | # 97 | # FriendlyId uses Rails's `parameterize` method to generate slugs, but for 98 | # languages that don't use the Roman alphabet, that's not usually sufficient. 99 | # Here we use the Babosa library to transliterate Russian Cyrillic slugs to 100 | # ASCII. If you use this, don't forget to add "babosa" to your Gemfile. 101 | # 102 | # config.use Module.new { 103 | # def normalize_friendly_id(text) 104 | # text.to_slug.normalize! :transliterations => [:russian, :latin] 105 | # end 106 | # } 107 | end 108 | -------------------------------------------------------------------------------- /config/initializers/gravatar.rb: -------------------------------------------------------------------------------- 1 | GravatarImageTag.configure do |config| 2 | config.default_image = "mm" 3 | config.secure = true 4 | end 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/devise.en.yml: -------------------------------------------------------------------------------- 1 | # Additional translations at https://github.com/plataformatec/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 confirm link to confirm your new email address." 46 | updated: "Your account has been updated successfully." 47 | sessions: 48 | signed_in: "Signed in successfully." 49 | signed_out: "Signed out successfully." 50 | already_signed_out: "Signed out successfully." 51 | unlocks: 52 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." 53 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." 54 | unlocked: "Your account has been unlocked successfully. Please sign in to continue." 55 | errors: 56 | messages: 57 | already_confirmed: "was already confirmed, please try signing in" 58 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" 59 | expired: "has expired, please request a new one" 60 | not_found: "not found" 61 | not_locked: "was not locked" 62 | not_saved: 63 | one: "1 error prohibited this %{resource} from being saved:" 64 | other: "%{count} errors prohibited this %{resource} from being saved:" 65 | -------------------------------------------------------------------------------- /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 http://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. 30 | # 31 | # preload_app! 32 | 33 | # Allow puma to be restarted by `rails restart` command. 34 | plugin :tmp_restart 35 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | require 'sidekiq/web' 2 | 3 | Rails.application.routes.draw do 4 | resources :projects 5 | namespace :admin do 6 | resources :users 7 | resources :announcements 8 | resources :notifications 9 | resources :services 10 | 11 | root to: "users#index" 12 | end 13 | get '/privacy', to: 'home#privacy' 14 | get '/terms', to: 'home#terms' 15 | resources :notifications, only: [:index] 16 | resources :announcements, only: [:index] 17 | authenticate :user, lambda { |u| u.admin? } do 18 | mount Sidekiq::Web => '/sidekiq' 19 | end 20 | 21 | devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" } 22 | root to: 'home#index' 23 | # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html 24 | end 25 | -------------------------------------------------------------------------------- /config/schedule.rb: -------------------------------------------------------------------------------- 1 | # Use this file to easily define all of your cron jobs. 2 | # 3 | # It's helpful, but not entirely necessary to understand cron before proceeding. 4 | # http://en.wikipedia.org/wiki/Cron 5 | 6 | # Example: 7 | # 8 | # set :output, "/path/to/my/cron_log.log" 9 | # 10 | # every 2.hours do 11 | # command "/usr/bin/some_great_command" 12 | # runner "MyModel.some_method" 13 | # rake "some:great:rake:task" 14 | # end 15 | # 16 | # every 4.days do 17 | # runner "AnotherModel.prune_old_records" 18 | # end 19 | 20 | # Learn more: http://github.com/javan/whenever 21 | -------------------------------------------------------------------------------- /config/sitemap.rb: -------------------------------------------------------------------------------- 1 | # Set the host name for URL creation 2 | SitemapGenerator::Sitemap.default_host = "http://www.example.com" 3 | 4 | SitemapGenerator::Sitemap.create do 5 | # Put links creation logic here. 6 | # 7 | # The root path '/' and sitemap index file are added automatically for you. 8 | # Links are added to the Sitemap in the order they are specified. 9 | # 10 | # Usage: add(path, options={}) 11 | # (default options are used if you don't specify) 12 | # 13 | # Defaults: :priority => 0.5, :changefreq => 'weekly', 14 | # :lastmod => Time.now, :host => default_host 15 | # 16 | # Examples: 17 | # 18 | # Add '/articles' 19 | # 20 | # add articles_path, :priority => 0.7, :changefreq => 'daily' 21 | # 22 | # Add all articles: 23 | # 24 | # Article.find_each do |article| 25 | # add article_path(article), :lastmod => article.updated_at 26 | # end 27 | end 28 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w[ 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ].each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | 9 | # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) 10 | # amazon: 11 | # service: S3 12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> 13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> 14 | # region: us-east-1 15 | # bucket: your_own_bucket 16 | 17 | # Remember not to checkin your GCS keyfile to a repository 18 | # google: 19 | # service: GCS 20 | # project: your_project 21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> 22 | # bucket: your_own_bucket 23 | 24 | # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) 25 | # microsoft: 26 | # service: AzureStorage 27 | # storage_account_name: your_account_name 28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> 29 | # container: your_container_name 30 | 31 | # mirror: 32 | # service: Mirror 33 | # primary: local 34 | # mirrors: [ amazon, google, microsoft ] 35 | -------------------------------------------------------------------------------- /config/webpack/development.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /config/webpacker.yml: -------------------------------------------------------------------------------- 1 | # Note: You must restart bin/webpack-dev-server for changes to take effect 2 | 3 | default: &default 4 | source_path: app/javascript 5 | source_entry_path: packs 6 | public_output_path: packs 7 | cache_path: tmp/cache/webpacker 8 | 9 | # Additional paths webpack should lookup modules 10 | # ['app/assets', 'engine/foo/app/assets'] 11 | resolved_paths: [] 12 | 13 | # Reload manifest.json on all requests so we reload latest compiled packs 14 | cache_manifest: false 15 | 16 | extensions: 17 | - .js 18 | - .sass 19 | - .scss 20 | - .css 21 | - .module.sass 22 | - .module.scss 23 | - .module.css 24 | - .png 25 | - .svg 26 | - .gif 27 | - .jpeg 28 | - .jpg 29 | 30 | development: 31 | <<: *default 32 | compile: true 33 | 34 | # Reference: https://webpack.js.org/configuration/dev-server/ 35 | dev_server: 36 | https: false 37 | host: localhost 38 | port: 3035 39 | public: localhost:3035 40 | hmr: false 41 | # Inline should be set to true if using HMR 42 | inline: true 43 | overlay: true 44 | compress: true 45 | disable_host_check: true 46 | use_local_ip: false 47 | quiet: false 48 | headers: 49 | 'Access-Control-Allow-Origin': '*' 50 | watch_options: 51 | ignored: /node_modules/ 52 | 53 | 54 | test: 55 | <<: *default 56 | compile: true 57 | 58 | # Compile test packs to a separate directory 59 | public_output_path: packs-test 60 | 61 | production: 62 | <<: *default 63 | 64 | # Production depends on precompilation of packs prior to booting for performance. 65 | compile: false 66 | 67 | # Cache manifest.json for performance 68 | cache_manifest: true 69 | -------------------------------------------------------------------------------- /db/migrate/20190206223559_devise_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DeviseCreateUsers < ActiveRecord::Migration[5.2] 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.inet :current_sign_in_ip 22 | # t.inet :last_sign_in_ip 23 | 24 | ## Confirmable 25 | # t.string :confirmation_token 26 | # t.datetime :confirmed_at 27 | # t.datetime :confirmation_sent_at 28 | # t.string :unconfirmed_email # Only if using reconfirmable 29 | 30 | ## Lockable 31 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts 32 | # t.string :unlock_token # Only if unlock strategy is :email or :both 33 | # t.datetime :locked_at 34 | 35 | t.string :first_name 36 | t.string :last_name 37 | t.datetime :announcements_last_read_at 38 | t.boolean :admin, default: false 39 | 40 | t.timestamps null: false 41 | end 42 | 43 | add_index :users, :email, unique: true 44 | add_index :users, :reset_password_token, unique: true 45 | # add_index :users, :confirmation_token, unique: true 46 | # add_index :users, :unlock_token, unique: true 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /db/migrate/20190206223625_create_announcements.rb: -------------------------------------------------------------------------------- 1 | class CreateAnnouncements < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :announcements do |t| 4 | t.datetime :published_at 5 | t.string :announcement_type 6 | t.string :name 7 | t.text :description 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20190206223626_create_notifications.rb: -------------------------------------------------------------------------------- 1 | class CreateNotifications < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :notifications do |t| 4 | t.bigint :recipient_id 5 | t.bigint :actor_id 6 | t.datetime :read_at 7 | t.string :action 8 | t.bigint :notifiable_id 9 | t.string :notifiable_type 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20190206223627_create_services.rb: -------------------------------------------------------------------------------- 1 | class CreateServices < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :services do |t| 4 | t.references :user, foreign_key: true 5 | t.string :provider 6 | t.string :uid 7 | t.string :access_token 8 | t.string :access_token_secret 9 | t.string :refresh_token 10 | t.datetime :expires_at 11 | t.text :auth 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20190206223628_create_friendly_id_slugs.rb: -------------------------------------------------------------------------------- 1 | MIGRATION_CLASS = 2 | if ActiveRecord::VERSION::MAJOR >= 5 3 | ActiveRecord::Migration[5.2]["#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}"] 4 | else 5 | ActiveRecord::Migration[5.2] 6 | end 7 | 8 | class CreateFriendlyIdSlugs < MIGRATION_CLASS 9 | def change 10 | create_table :friendly_id_slugs do |t| 11 | t.string :slug, :null => false 12 | t.integer :sluggable_id, :null => false 13 | t.string :sluggable_type, :limit => 50 14 | t.string :scope 15 | t.datetime :created_at 16 | end 17 | add_index :friendly_id_slugs, [:sluggable_type, :sluggable_id] 18 | add_index :friendly_id_slugs, [:slug, :sluggable_type], length: { slug: 140, sluggable_type: 50 } 19 | add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope], length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /db/migrate/20190206223826_create_projects.rb: -------------------------------------------------------------------------------- 1 | class CreateProjects < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :projects do |t| 4 | t.string :name 5 | t.string :description 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20190206223844_create_tasks.rb: -------------------------------------------------------------------------------- 1 | class CreateTasks < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :tasks do |t| 4 | t.string :description 5 | t.belongs_to :project, foreign_key: true 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /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 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2019_02_06_223844) do 14 | 15 | # These are extensions that must be enabled in order to support this database 16 | enable_extension "plpgsql" 17 | 18 | create_table "announcements", force: :cascade do |t| 19 | t.datetime "published_at" 20 | t.string "announcement_type" 21 | t.string "name" 22 | t.text "description" 23 | t.datetime "created_at", null: false 24 | t.datetime "updated_at", null: false 25 | end 26 | 27 | create_table "friendly_id_slugs", force: :cascade do |t| 28 | t.string "slug", null: false 29 | t.integer "sluggable_id", null: false 30 | t.string "sluggable_type", limit: 50 31 | t.string "scope" 32 | t.datetime "created_at" 33 | t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true 34 | t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" 35 | t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id" 36 | end 37 | 38 | create_table "notifications", force: :cascade do |t| 39 | t.bigint "recipient_id" 40 | t.bigint "actor_id" 41 | t.datetime "read_at" 42 | t.string "action" 43 | t.bigint "notifiable_id" 44 | t.string "notifiable_type" 45 | t.datetime "created_at", null: false 46 | t.datetime "updated_at", null: false 47 | end 48 | 49 | create_table "projects", force: :cascade do |t| 50 | t.string "name" 51 | t.string "description" 52 | t.datetime "created_at", null: false 53 | t.datetime "updated_at", null: false 54 | end 55 | 56 | create_table "services", force: :cascade do |t| 57 | t.bigint "user_id" 58 | t.string "provider" 59 | t.string "uid" 60 | t.string "access_token" 61 | t.string "access_token_secret" 62 | t.string "refresh_token" 63 | t.datetime "expires_at" 64 | t.text "auth" 65 | t.datetime "created_at", null: false 66 | t.datetime "updated_at", null: false 67 | t.index ["user_id"], name: "index_services_on_user_id" 68 | end 69 | 70 | create_table "tasks", force: :cascade do |t| 71 | t.string "description" 72 | t.bigint "project_id" 73 | t.datetime "created_at", null: false 74 | t.datetime "updated_at", null: false 75 | t.index ["project_id"], name: "index_tasks_on_project_id" 76 | end 77 | 78 | create_table "users", force: :cascade do |t| 79 | t.string "email", default: "", null: false 80 | t.string "encrypted_password", default: "", null: false 81 | t.string "reset_password_token" 82 | t.datetime "reset_password_sent_at" 83 | t.datetime "remember_created_at" 84 | t.string "first_name" 85 | t.string "last_name" 86 | t.datetime "announcements_last_read_at" 87 | t.boolean "admin", default: false 88 | t.datetime "created_at", null: false 89 | t.datetime "updated_at", null: false 90 | t.index ["email"], name: "index_users_on_email", unique: true 91 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true 92 | end 93 | 94 | add_foreign_key "services", "users" 95 | add_foreign_key "tasks", "projects" 96 | end 97 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/lib/tasks/.keep -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %> 2 | <%% if <%= singular_table_name %>.errors.any? %> 3 |
4 |

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

5 | 6 | 11 |
12 | <%% end %> 13 | 14 | <% attributes.each do |attribute| -%> 15 |
16 | <% if attribute.password_digest? -%> 17 | <%%= form.label :password %> 18 | <%%= form.password_field :password, class: 'form-control' %> 19 |
20 | 21 |
22 | <%%= form.label :password_confirmation %> 23 | <%%= form.password_field :password_confirmation, class: 'form-control' %> 24 | <% else -%> 25 | <%%= form.label :<%= attribute.column_name %> %> 26 | <%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %> 27 | <% end -%> 28 |
29 | 30 | <% end -%> 31 |
32 | <%% if <%= model_resource_name %>.persisted? %> 33 |
34 | <%%= link_to 'Destroy', <%= model_resource_name %>, method: :delete, class: "text-danger", data: { confirm: 'Are you sure?' } %> 35 |
36 | <%% end %> 37 | 38 | <%%= form.submit class: 'btn btn-primary' %> 39 | 40 | <%% if <%= model_resource_name %>.persisted? %> 41 | <%%= link_to "Cancel", <%= model_resource_name %>, class: "btn btn-link" %> 42 | <%% else %> 43 | <%%= link_to "Cancel", <%= index_helper %>_path, class: "btn btn-link" %> 44 | <%% end %> 45 |
46 | <%% end %> 47 | -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Edit <%= singular_table_name.capitalize %>

2 | 3 | <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %> 4 | -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/index.html.erb: -------------------------------------------------------------------------------- 1 | <% name_attribute = attributes.find{ |a| a.name == "name" } %> 2 | <% has_name = !!name_attribute %> 3 | 4 |
5 |
6 |

<%= plural_table_name.capitalize %>

7 |
8 | 9 |
10 | <%%= link_to new_<%= singular_table_name %>_path, class: 'btn btn-primary' do %> 11 | Add New <%= human_name %> 12 | <%% end %> 13 |
14 |
15 | 16 |
17 | 18 | 19 | 20 | <% if has_name %> 21 | 22 | <% end %> 23 | 24 | <% attributes.without(name_attribute).each do |attribute| -%> 25 | 26 | <% end -%> 27 | <% unless has_name %> 28 | 29 | <% end %> 30 | 31 | 32 | 33 | 34 | <%% @<%= plural_table_name%>.each do |<%= singular_table_name %>| %> 35 | <%%= content_tag :tr, id: dom_id(<%= singular_table_name %>), class: dom_class(<%= singular_table_name %>) do %> 36 | <% if has_name %> 37 | 38 | <% end %> 39 | 40 | <% attributes.without(name_attribute).each do |attribute| -%> 41 | 42 | <% end -%> 43 | 44 | <% unless has_name %> 45 | 46 | <% end %> 47 | <%% end %> 48 | <%% end %> 49 | 50 |
Name<%= attribute.human_name %>
<%%= link_to <%= singular_table_name %>.name, <%= singular_table_name %> %><%%= <%= singular_table_name %>.<%= attribute.name %> %><%%= link_to 'Show', <%= singular_table_name %> %>
51 |
52 | -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/new.html.erb: -------------------------------------------------------------------------------- 1 |

New <%= singular_table_name %>

2 | 3 | <%%= render 'form', <%= singular_table_name %>: @<%= singular_table_name %> %> 4 | -------------------------------------------------------------------------------- /lib/templates/erb/scaffold/show.html.erb: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | <%- attributes.each do |attribute| -%> 15 |
<%= attribute.human_name %>:
16 |
<%%= @<%= singular_table_name %>.<%= attribute.name %> %>
17 | 18 | <%- end -%> 19 |
20 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/log/.keep -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nested_forms", 3 | "private": true, 4 | "dependencies": { 5 | "@rails/webpacker": "3.5", 6 | "stimulus": "^1.1.1" 7 | }, 8 | "devDependencies": { 9 | "webpack-dev-server": "2.11.2" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

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

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

The change you wanted was rejected.

62 |

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

63 |
64 |

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

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

We're sorry, but something went wrong.

62 |
63 |

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

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | -------------------------------------------------------------------------------- /storage/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/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/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/projects_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProjectsControllerTest < ActionDispatch::IntegrationTest 4 | setup do 5 | @project = projects(:one) 6 | end 7 | 8 | test "should get index" do 9 | get projects_url 10 | assert_response :success 11 | end 12 | 13 | test "should get new" do 14 | get new_project_url 15 | assert_response :success 16 | end 17 | 18 | test "should create project" do 19 | assert_difference('Project.count') do 20 | post projects_url, params: { project: { description: @project.description, name: @project.name } } 21 | end 22 | 23 | assert_redirected_to project_url(Project.last) 24 | end 25 | 26 | test "should show project" do 27 | get project_url(@project) 28 | assert_response :success 29 | end 30 | 31 | test "should get edit" do 32 | get edit_project_url(@project) 33 | assert_response :success 34 | end 35 | 36 | test "should update project" do 37 | patch project_url(@project), params: { project: { description: @project.description, name: @project.name } } 38 | assert_redirected_to project_url(@project) 39 | end 40 | 41 | test "should destroy project" do 42 | assert_difference('Project.count', -1) do 43 | delete project_url(@project) 44 | end 45 | 46 | assert_redirected_to projects_url 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/announcements.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | published_at: 2019-02-06 16:36:25 5 | announcement_type: MyString 6 | name: MyString 7 | description: MyText 8 | 9 | two: 10 | published_at: 2019-02-06 16:36:25 11 | announcement_type: MyString 12 | name: MyString 13 | description: MyText 14 | -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/fixtures/notifications.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | recipient_id: 5 | actor_id: 6 | read_at: 2019-02-06 16:36:25 7 | action: MyString 8 | notifiable_id: 9 | notifiable_type: MyString 10 | 11 | two: 12 | recipient_id: 13 | actor_id: 14 | read_at: 2019-02-06 16:36:25 15 | action: MyString 16 | notifiable_id: 17 | notifiable_type: MyString 18 | -------------------------------------------------------------------------------- /test/fixtures/projects.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | description: MyString 6 | 7 | two: 8 | name: MyString 9 | description: MyString 10 | -------------------------------------------------------------------------------- /test/fixtures/services.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | user: one 5 | provider: MyString 6 | uid: MyString 7 | access_token: MyString 8 | access_token_secret: MyString 9 | refresh_token: MyString 10 | expires_at: 2019-02-06 16:36:26 11 | auth: MyText 12 | 13 | two: 14 | user: two 15 | provider: MyString 16 | uid: MyString 17 | access_token: MyString 18 | access_token_secret: MyString 19 | refresh_token: MyString 20 | expires_at: 2019-02-06 16:36:26 21 | auth: MyText 22 | -------------------------------------------------------------------------------- /test/fixtures/tasks.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | description: MyString 5 | project: one 6 | 7 | two: 8 | description: MyString 9 | project: two 10 | -------------------------------------------------------------------------------- /test/fixtures/users.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | # This model initially had no columns defined. If you add columns to the 4 | # model remove the '{}' from the fixture names and add the columns immediately 5 | # below each fixture, per the syntax in the comments below 6 | # 7 | one: {} 8 | # column: value 9 | # 10 | two: {} 11 | # column: value 12 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/models/.keep -------------------------------------------------------------------------------- /test/models/announcement_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class AnnouncementTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/notification_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class NotificationTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/project_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProjectTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/service_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ServiceTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/task_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class TaskTest < 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/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/test/system/.keep -------------------------------------------------------------------------------- /test/system/projects_test.rb: -------------------------------------------------------------------------------- 1 | require "application_system_test_case" 2 | 3 | class ProjectsTest < ApplicationSystemTestCase 4 | setup do 5 | @project = projects(:one) 6 | end 7 | 8 | test "visiting the index" do 9 | visit projects_url 10 | assert_selector "h1", text: "Projects" 11 | end 12 | 13 | test "creating a Project" do 14 | visit projects_url 15 | click_on "New Project" 16 | 17 | fill_in "Description", with: @project.description 18 | fill_in "Name", with: @project.name 19 | click_on "Create Project" 20 | 21 | assert_text "Project was successfully created" 22 | click_on "Back" 23 | end 24 | 25 | test "updating a Project" do 26 | visit projects_url 27 | click_on "Edit", match: :first 28 | 29 | fill_in "Description", with: @project.description 30 | fill_in "Name", with: @project.name 31 | click_on "Update Project" 32 | 33 | assert_text "Project was successfully updated" 34 | click_on "Back" 35 | end 36 | 37 | test "destroying a Project" do 38 | visit projects_url 39 | page.accept_confirm do 40 | click_on "Destroy", match: :first 41 | end 42 | 43 | assert_text "Project was successfully destroyed" 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /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 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/tmp/.keep -------------------------------------------------------------------------------- /vendor/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/dynamic-nested-forms-with-stimulusjs/06a69e33f81ee24b1042931adcd56148b44e88d8/vendor/.keep --------------------------------------------------------------------------------