-
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 |
├── .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 │ │ ├── comments.coffee │ │ ├── discussions.coffee │ │ └── sites.coffee │ └── stylesheets │ │ ├── announcements.scss │ │ ├── application.scss │ │ ├── comments.scss │ │ ├── discussions.scss │ │ ├── scaffolds.scss │ │ ├── sites.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 │ │ │ ├── comments_controller.rb │ │ │ ├── discussions_controller.rb │ │ │ └── users_controller.rb │ ├── application_controller.rb │ ├── comments_controller.rb │ ├── concerns │ │ └── .keep │ ├── discussions_controller.rb │ ├── embed_controller.rb │ ├── embeds_controller.rb │ ├── home_controller.rb │ ├── notifications_controller.rb │ ├── sites_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 │ ├── comments_helper.rb │ ├── devise_helper.rb │ ├── discussions_helper.rb │ └── sites_helper.rb ├── javascript │ ├── app.vue │ ├── discussion.vue │ ├── packs │ │ ├── application.js │ │ └── embed.js │ └── store.js ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── announcement.rb │ ├── application_record.rb │ ├── comment.rb │ ├── concerns │ │ └── .keep │ ├── discussion.rb │ ├── notification.rb │ ├── service.rb │ ├── site.rb │ └── user.rb └── views │ ├── admin │ ├── application │ │ └── _navigation.html.erb │ └── users │ │ └── show.html.erb │ ├── announcements │ └── index.html.erb │ ├── api │ └── v1 │ │ └── users │ │ └── me.json.jbuilder │ ├── comments │ ├── _comment.json.jbuilder │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.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 │ ├── discussions │ ├── _discussion.json.jbuilder │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder │ ├── home │ ├── index.html.erb │ ├── privacy.html.erb │ └── terms.html.erb │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ ├── notifications │ └── index.html.erb │ ├── shared │ ├── _footer.html.erb │ ├── _head.html.erb │ ├── _navbar.html.erb │ └── _notices.html.erb │ └── sites │ ├── _form.html.erb │ ├── _site.json.jbuilder │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder ├── 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 │ ├── loaders │ │ └── vue.js │ ├── production.js │ └── test.js └── webpacker.yml ├── db ├── migrate │ ├── 20181114160012_devise_create_users.rb │ ├── 20181114160057_create_announcements.rb │ ├── 20181114160058_create_notifications.rb │ ├── 20181114160059_create_services.rb │ ├── 20181114160060_create_friendly_id_slugs.rb │ ├── 20181114160443_create_discussions.rb │ ├── 20181114160618_create_comments.rb │ ├── 20181203152002_create_sites.rb │ └── 20181203152013_add_site_to_discussions.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 │ ├── comments_controller_test.rb │ ├── discussions_controller_test.rb │ └── sites_controller_test.rb ├── fixtures │ ├── .keep │ ├── announcements.yml │ ├── comments.yml │ ├── discussions.yml │ ├── files │ │ └── .keep │ ├── notifications.yml │ ├── services.yml │ ├── sites.yml │ └── users.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── announcement_test.rb │ ├── comment_test.rb │ ├── discussion_test.rb │ ├── notification_test.rb │ ├── service_test.rb │ ├── site_test.rb │ └── user_test.rb ├── system │ ├── .keep │ ├── comments_test.rb │ ├── discussions_test.rb │ └── sites_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 the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | /tmp/* 17 | !/log/.keep 18 | !/tmp/.keep 19 | 20 | # Ignore uploaded files in development 21 | /storage/* 22 | !/storage/.keep 23 | 24 | /node_modules 25 | /yarn-error.log 26 | 27 | /public/assets 28 | .byebug_history 29 | 30 | # Ignore master key for decrypting credentials and more. 31 | /config/master.key 32 | /public/packs 33 | /public/packs-test 34 | /node_modules 35 | yarn-debug.log* 36 | .yarn-integrity 37 | -------------------------------------------------------------------------------- /.postcssrc.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | postcss-import: {} 3 | postcss-cssnext: {} 4 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.5.3 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 | 4 | ruby '2.5.3' 5 | 6 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7 | gem 'rails', '~> 5.2.1' 8 | # Use sqlite3 as the database for Active Record 9 | gem 'sqlite3' 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.1', '>= 4.1.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.0', '>= 5.0.13' 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 85 | 86 | 87 | gem 'rack-cors', require: 'rack/cors' 88 | 89 | -------------------------------------------------------------------------------- /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.1) 18 | actionpack (= 5.2.1) 19 | nio4r (~> 2.0) 20 | websocket-driver (>= 0.6.1) 21 | actionmailer (5.2.1) 22 | actionpack (= 5.2.1) 23 | actionview (= 5.2.1) 24 | activejob (= 5.2.1) 25 | mail (~> 2.5, >= 2.5.4) 26 | rails-dom-testing (~> 2.0) 27 | actionpack (5.2.1) 28 | actionview (= 5.2.1) 29 | activesupport (= 5.2.1) 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.1) 35 | activesupport (= 5.2.1) 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.1) 41 | activesupport (= 5.2.1) 42 | globalid (>= 0.3.6) 43 | activemodel (5.2.1) 44 | activesupport (= 5.2.1) 45 | activerecord (5.2.1) 46 | activemodel (= 5.2.1) 47 | activesupport (= 5.2.1) 48 | arel (>= 9.0) 49 | activestorage (5.2.1) 50 | actionpack (= 5.2.1) 51 | activerecord (= 5.2.1) 52 | marcel (~> 0.3.1) 53 | activesupport (5.2.1) 54 | concurrent-ruby (~> 1.0, >= 1.0.2) 55 | i18n (>= 0.7, < 2) 56 | minitest (~> 5.1) 57 | tzinfo (~> 1.1) 58 | addressable (2.5.2) 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.3.1) 75 | execjs 76 | bcrypt (3.1.12) 77 | bindex (0.5.0) 78 | bootsnap (1.3.2) 79 | msgpack (~> 1.0) 80 | bootstrap (4.1.3) 81 | autoprefixer-rails (>= 6.0.3) 82 | popper_js (>= 1.12.9, < 2) 83 | sass (>= 3.5.2) 84 | builder (3.2.3) 85 | byebug (10.0.2) 86 | capybara (3.10.1) 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.3) 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.7.1) 124 | execjs (2.7.0) 125 | faraday (0.15.3) 126 | multipart-post (>= 1.2, < 3) 127 | ffi (1.9.25) 128 | font-awesome-sass (5.5.0.1) 129 | sassc (>= 1.11) 130 | foreman (0.84.0) 131 | thor (~> 0.19.1) 132 | friendly_id (5.2.4) 133 | activerecord (>= 4.0.0) 134 | globalid (0.4.1) 135 | activesupport (>= 4.2.0) 136 | hashie (3.5.7) 137 | i18n (1.1.1) 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.2) 174 | mini_magick (4.9.2) 175 | mini_mime (1.0.1) 176 | mini_portile2 (2.3.0) 177 | minitest (5.11.3) 178 | momentjs-rails (2.20.1) 179 | railties (>= 3.1) 180 | msgpack (1.2.4) 181 | multi_json (1.13.1) 182 | multi_xml (0.6.0) 183 | multipart-post (2.0.0) 184 | name_of_person (1.0.0) 185 | activesupport (>= 5.2.0) 186 | nio4r (2.3.1) 187 | nokogiri (1.8.5) 188 | mini_portile2 (~> 2.3.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.8.1) 197 | hashie (>= 3.4.6, < 3.6.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.5.0) 208 | oauth2 (~> 1.1) 209 | omniauth (~> 1.2) 210 | omniauth-twitter (1.4.0) 211 | omniauth-oauth (~> 1.1) 212 | rack 213 | orm_adapter (0.5.0) 214 | popper_js (1.14.5) 215 | public_suffix (3.0.3) 216 | puma (3.12.0) 217 | rack (2.0.6) 218 | rack-cors (1.0.2) 219 | rack-protection (2.0.4) 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.1) 226 | actioncable (= 5.2.1) 227 | actionmailer (= 5.2.1) 228 | actionpack (= 5.2.1) 229 | actionview (= 5.2.1) 230 | activejob (= 5.2.1) 231 | activemodel (= 5.2.1) 232 | activerecord (= 5.2.1) 233 | activestorage (= 5.2.1) 234 | activesupport (= 5.2.1) 235 | bundler (>= 1.3.0) 236 | railties (= 5.2.1) 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.1) 244 | actionpack (= 5.2.1) 245 | activesupport (= 5.2.1) 246 | method_source 247 | rake (>= 0.8.7) 248 | thor (>= 0.19.0, < 2.0) 249 | rake (12.3.1) 250 | rb-fsevent (0.10.3) 251 | rb-inotify (0.9.10) 252 | ffi (>= 0.5.0, < 2) 253 | redis (4.0.3) 254 | regexp_parser (1.2.0) 255 | responders (2.4.0) 256 | actionpack (>= 4.2.0, < 5.3) 257 | railties (>= 4.2.0, < 5.3) 258 | ruby_dep (1.5.0) 259 | rubyzip (1.2.2) 260 | sass (3.7.2) 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 | selectize-rails (0.12.6) 275 | selenium-webdriver (3.141.0) 276 | childprocess (~> 0.5) 277 | rubyzip (~> 1.2, >= 1.2.2) 278 | sidekiq (5.2.3) 279 | connection_pool (~> 2.2, >= 2.2.2) 280 | rack-protection (>= 1.5.0) 281 | redis (>= 3.3.5, < 5) 282 | sitemap_generator (6.0.1) 283 | builder (~> 3.0) 284 | spring (2.0.2) 285 | activesupport (>= 4.2) 286 | spring-watcher-listen (2.0.1) 287 | listen (>= 2.7, < 4.0) 288 | spring (>= 1.2, < 3.0) 289 | sprockets (3.7.2) 290 | concurrent-ruby (~> 1.0) 291 | rack (> 1, < 3) 292 | sprockets-rails (3.2.1) 293 | actionpack (>= 4.0) 294 | activesupport (>= 4.0) 295 | sprockets (>= 3.0.0) 296 | sqlite3 (1.3.13) 297 | thor (0.19.4) 298 | thread_safe (0.3.6) 299 | tilt (2.0.8) 300 | turbolinks (5.2.0) 301 | turbolinks-source (~> 5.2) 302 | turbolinks-source (5.2.0) 303 | tzinfo (1.2.5) 304 | thread_safe (~> 0.1) 305 | uglifier (4.1.19) 306 | execjs (>= 0.3.0, < 3) 307 | warden (1.2.7) 308 | rack (>= 1.0) 309 | web-console (3.7.0) 310 | actionview (>= 5.0) 311 | activemodel (>= 5.0) 312 | bindex (>= 0.4.0) 313 | railties (>= 5.0) 314 | webpacker (3.5.5) 315 | activesupport (>= 4.2) 316 | rack-proxy (>= 0.6.1) 317 | railties (>= 4.2) 318 | websocket-driver (0.7.0) 319 | websocket-extensions (>= 0.1.0) 320 | websocket-extensions (0.1.3) 321 | whenever (0.10.0) 322 | chronic (>= 0.6.3) 323 | xpath (3.2.0) 324 | nokogiri (~> 1.8) 325 | 326 | PLATFORMS 327 | ruby 328 | 329 | DEPENDENCIES 330 | administrate (~> 0.10.0) 331 | bootsnap (>= 1.1.0) 332 | bootstrap (~> 4.1, >= 4.1.1) 333 | byebug 334 | capybara (>= 2.15) 335 | chromedriver-helper 336 | coffee-rails (~> 4.2) 337 | data-confirm-modal (~> 1.6, >= 1.6.2) 338 | devise (~> 4.4, >= 4.4.3) 339 | devise-bootstrapped! 340 | devise_masquerade (~> 0.6.2) 341 | font-awesome-sass (~> 5.0, >= 5.0.13) 342 | foreman (~> 0.84.0) 343 | friendly_id (~> 5.2, >= 5.2.4) 344 | gravatar_image_tag! 345 | jbuilder (~> 2.5) 346 | jquery-rails (~> 4.3.1) 347 | listen (>= 3.0.5, < 3.2) 348 | local_time (~> 2.0, >= 2.0.1) 349 | mini_magick (~> 4.8) 350 | name_of_person (~> 1.0) 351 | omniauth-facebook (~> 5.0) 352 | omniauth-github (~> 1.3) 353 | omniauth-twitter (~> 1.4) 354 | puma (~> 3.11) 355 | rack-cors 356 | rails (~> 5.2.1) 357 | sass-rails (~> 5.0) 358 | selenium-webdriver 359 | sidekiq (~> 5.1, >= 5.1.3) 360 | sitemap_generator (~> 6.0, >= 6.0.1) 361 | spring 362 | spring-watcher-listen (~> 2.0.0) 363 | sqlite3 364 | turbolinks (~> 5) 365 | tzinfo-data 366 | uglifier (>= 1.3.0) 367 | web-console (>= 3.3.0) 368 | webpacker (~> 3.5, >= 3.5.3) 369 | whenever 370 | 371 | RUBY VERSION 372 | ruby 2.5.3p105 373 | 374 | BUNDLED WITH 375 | 1.17.1 376 | -------------------------------------------------------------------------------- /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/embeddable-javascript-widget-with-rails/6deba433825f69eeca2ebc792e453af46d22e877/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/embeddable-javascript-widget-with-rails/6deba433825f69eeca2ebc792e453af46d22e877/app/assets/javascripts/channels/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/comments.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/javascripts/discussions.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/javascripts/sites.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/comments.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Comments 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/discussions.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Discussions 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/sites.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Sites 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/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/comments_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::CommentsController < ApplicationController 2 | skip_before_action :verify_authenticity_token 3 | before_action :set_discussion 4 | 5 | def create 6 | @comment = @discussion.comments.new(comment_params) 7 | @comment.user_agent = request.user_agent 8 | @comment.ip_address = request.remote_ip 9 | 10 | if @comment.save 11 | render "comments/show" 12 | else 13 | render json: { errors: @comment.errors.full_messages } 14 | end 15 | end 16 | 17 | private 18 | 19 | def comment_params 20 | params.require(:comment).permit(:name, :email, :body) 21 | end 22 | 23 | def set_discussion 24 | @discussion = Discussion.by_url(params[:discussion_id]) 25 | end 26 | end 27 | 28 | -------------------------------------------------------------------------------- /app/controllers/api/v1/discussions_controller.rb: -------------------------------------------------------------------------------- 1 | class Api::V1::DiscussionsController < ApplicationController 2 | def show 3 | @site = Site.by_url(params[:id]) 4 | 5 | if @site.present? 6 | @discussion = @site.discussions.by_url(params[:id]) 7 | render "discussions/show" 8 | else 9 | render json: { error: "Site has not been registered." } 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/comments_controller.rb: -------------------------------------------------------------------------------- 1 | class CommentsController < ApplicationController 2 | before_action :set_comment, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /comments 5 | # GET /comments.json 6 | def index 7 | @comments = Comment.all 8 | end 9 | 10 | # GET /comments/1 11 | # GET /comments/1.json 12 | def show 13 | end 14 | 15 | # GET /comments/new 16 | def new 17 | @comment = Comment.new 18 | end 19 | 20 | # GET /comments/1/edit 21 | def edit 22 | end 23 | 24 | # POST /comments 25 | # POST /comments.json 26 | def create 27 | @comment = Comment.new(comment_params) 28 | 29 | respond_to do |format| 30 | if @comment.save 31 | format.html { redirect_to @comment, notice: 'Comment was successfully created.' } 32 | format.json { render :show, status: :created, location: @comment } 33 | else 34 | format.html { render :new } 35 | format.json { render json: @comment.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /comments/1 41 | # PATCH/PUT /comments/1.json 42 | def update 43 | respond_to do |format| 44 | if @comment.update(comment_params) 45 | format.html { redirect_to @comment, notice: 'Comment was successfully updated.' } 46 | format.json { render :show, status: :ok, location: @comment } 47 | else 48 | format.html { render :edit } 49 | format.json { render json: @comment.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /comments/1 55 | # DELETE /comments/1.json 56 | def destroy 57 | @comment.destroy 58 | respond_to do |format| 59 | format.html { redirect_to comments_url, notice: 'Comment was successfully destroyed.' } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_comment 67 | @comment = Comment.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def comment_params 72 | params.require(:comment).permit(:discussion_id, :name, :email, :body, :ip_address, :user_agent) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/embeddable-javascript-widget-with-rails/6deba433825f69eeca2ebc792e453af46d22e877/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/discussions_controller.rb: -------------------------------------------------------------------------------- 1 | class DiscussionsController < ApplicationController 2 | before_action :set_discussion, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /discussions 5 | # GET /discussions.json 6 | def index 7 | @discussions = Discussion.all 8 | end 9 | 10 | # GET /discussions/1 11 | # GET /discussions/1.json 12 | def show 13 | end 14 | 15 | # GET /discussions/new 16 | def new 17 | @discussion = Discussion.new 18 | end 19 | 20 | # GET /discussions/1/edit 21 | def edit 22 | end 23 | 24 | # POST /discussions 25 | # POST /discussions.json 26 | def create 27 | @discussion = Discussion.new(discussion_params) 28 | 29 | respond_to do |format| 30 | if @discussion.save 31 | format.html { redirect_to @discussion, notice: 'Discussion was successfully created.' } 32 | format.json { render :show, status: :created, location: @discussion } 33 | else 34 | format.html { render :new } 35 | format.json { render json: @discussion.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /discussions/1 41 | # PATCH/PUT /discussions/1.json 42 | def update 43 | respond_to do |format| 44 | if @discussion.update(discussion_params) 45 | format.html { redirect_to @discussion, notice: 'Discussion was successfully updated.' } 46 | format.json { render :show, status: :ok, location: @discussion } 47 | else 48 | format.html { render :edit } 49 | format.json { render json: @discussion.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /discussions/1 55 | # DELETE /discussions/1.json 56 | def destroy 57 | @discussion.destroy 58 | respond_to do |format| 59 | format.html { redirect_to discussions_url, notice: 'Discussion was successfully destroyed.' } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_discussion 67 | @discussion = Discussion.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def discussion_params 72 | params.require(:discussion).permit(:url, :title, :comments_count) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/controllers/embed_controller.rb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorails-screencasts/embeddable-javascript-widget-with-rails/6deba433825f69eeca2ebc792e453af46d22e877/app/controllers/embed_controller.rb -------------------------------------------------------------------------------- /app/controllers/embeds_controller.rb: -------------------------------------------------------------------------------- 1 | class EmbedsController < ApplicationController 2 | include ActionView::Helpers::AssetUrlHelper 3 | include Webpacker::Helper 4 | 5 | protect_from_forgery except: :show 6 | 7 | def show 8 | respond_to do |format| 9 | format.js { redirect_to sources_from_pack_manifest(["embed"], type: :javascript).first } 10 | format.css { redirect_to sources_from_pack_manifest(["embed"], type: :stylesheet).first } 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /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/sites_controller.rb: -------------------------------------------------------------------------------- 1 | class SitesController < ApplicationController 2 | before_action :set_site, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /sites 5 | # GET /sites.json 6 | def index 7 | @sites = Site.all 8 | end 9 | 10 | # GET /sites/1 11 | # GET /sites/1.json 12 | def show 13 | end 14 | 15 | # GET /sites/new 16 | def new 17 | @site = Site.new 18 | end 19 | 20 | # GET /sites/1/edit 21 | def edit 22 | end 23 | 24 | # POST /sites 25 | # POST /sites.json 26 | def create 27 | @site = current_user.sites.new(site_params) 28 | 29 | respond_to do |format| 30 | if @site.save 31 | format.html { redirect_to @site, notice: 'Site was successfully created.' } 32 | format.json { render :show, status: :created, location: @site } 33 | else 34 | format.html { render :new } 35 | format.json { render json: @site.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /sites/1 41 | # PATCH/PUT /sites/1.json 42 | def update 43 | respond_to do |format| 44 | if @site.update(site_params) 45 | format.html { redirect_to @site, notice: 'Site was successfully updated.' } 46 | format.json { render :show, status: :ok, location: @site } 47 | else 48 | format.html { render :edit } 49 | format.json { render json: @site.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /sites/1 55 | # DELETE /sites/1.json 56 | def destroy 57 | @site.destroy 58 | respond_to do |format| 59 | format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_site 67 | @site = current_user.sites.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def site_params 72 | params.require(:site).permit(:user_id, :domain) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /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/comments_helper.rb: -------------------------------------------------------------------------------- 1 | module CommentsHelper 2 | end 3 | -------------------------------------------------------------------------------- /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 |
Name | 22 | 23 | 24 |Discussion | 25 |Body | 27 |Ip address | 28 |User agent | 29 | 30 |<%= link_to comment.name, comment %> | 38 | 39 | 40 |<%= comment.discussion %> | 41 |<%= comment.email %> | 42 |<%= comment.body %> | 43 |<%= comment.ip_address %> | 44 |<%= comment.user_agent %> | 45 | 46 | 47 | <% end %> 48 | <% end %> 49 | 50 |
---|
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 |<%= @minimum_password_length %> characters minimum
13 | <% end %> 14 |Enter your email address below and we will send you a link to reset your password.
8 |Leave password blank if you don't want to change it
23 |We need your current password to confirm your changes
32 |<%= link_to "Deactivate my account", registration_path(resource_name), data: { confirm: "Are you sure? You cannot undo this." }, method: :delete %>
41 |Site | 18 |Url | 19 |Title | 20 |Comments count | 21 |22 | | <%= discussion.site.domain %> | 29 |<%= discussion.url %> | 30 |<%= discussion.title %> | 31 |<%= discussion.comments_count %> | 32 |<%= link_to 'Show', discussion %> | 33 | <% end %> 34 | <% end %> 35 | 36 |
---|
Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.
Use this for your Privacy Policy
3 | -------------------------------------------------------------------------------- /app/views/home/terms.html.erb: -------------------------------------------------------------------------------- 1 |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 |Domain | 18 | 19 |20 | 21 | | <%= site.domain %> | 28 | 29 |<%= link_to 'Show', site %> | 30 | 31 | <% end %> 32 | <% end %> 33 | 34 |
---|
20 | <div id="comments"></div> 21 | <script src="<%= embed_url(format: :js) %>"></script> 22 | <link rel="stylesheet" type="text/css" href="<%= embed_url(format: :css) %>"> 23 |24 | -------------------------------------------------------------------------------- /app/views/sites/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "sites/site", site: @site 2 | -------------------------------------------------------------------------------- /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 EmbeddableComments 10 | class Application < Rails::Application 11 | # Expose our application's helpers to Administrate 12 | config.to_prepare do 13 | Administrate::ApplicationController.helper EmbeddableComments::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 | 25 | config.middleware.insert_before 0, Rack::Cors do 26 | allow do 27 | origins '*' 28 | resource '*', headers: :any, methods: [:get, :post, :options] 29 | end 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /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 | 4LHU1TxI4sjUSydjx2yEwADr/cXJIe16tnif8yNEFu0XFmpnOejW5dVnLoUBbc7PV44XipO7Eph7DfyuWZBb/ML6ip+gEkXAxZt6dQf9i2JcN1bhqX2LpRyLxSz+iNotpqfx4y7zs/d6sMxSELSTbtKHDXzUxiNcFxbykBdDQV3EHvsfTyqWE0+EwV8XTIAZBlLCIN8MYb2TyD35N1e8720uAblh1BGMDN9zdarnXUVjVn4VqhvtWcVpBcWcUFXVgAEN4r9Fzbl/1TWJBLE88+HUxSG12jXw0RUagS05Sr3eQw0bmyTGguz92oyos9UC/9n2fZqjiJKB3HwS0EpkVjCuF4c9BGc9yBmYvSl88Hx8+Z8o58NViffCF0BhjcsyqB/gZHU8ltZgLO6dmVr0uf8i/6RMQpEyxFrz--TQKjlGwsxMHV8Qrl--9l2EqVvqK78JQiAwbOF5/Q== -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /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 = "embeddable_comments_#{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 = 'f5f47bb432c1a07bca0a3bfb9d65fd0a93dfa911a1d2b9a19764fe7f869258cafa9ddfb89b1aa13a45acd363e37fedc8ef9d93ae2437b0840a08889f0f096186' 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 | if Rails.application.secrets.facebook_app_id.present? && Rails.application.secrets.facebook_app_secret.present? 262 | config.omniauth :facebook, Rails.application.secrets.facebook_app_id, Rails.application.secrets.facebook_app_secret, scope: 'email,user_posts' 263 | end 264 | 265 | if Rails.application.secrets.twitter_app_id.present? && Rails.application.secrets.twitter_app_secret.present? 266 | config.omniauth :twitter, Rails.application.secrets.twitter_app_id, Rails.application.secrets.twitter_app_secret 267 | end 268 | 269 | if Rails.application.secrets.github_app_id.present? && Rails.application.secrets.github_app_secret.present? 270 | config.omniauth :github, Rails.application.secrets.github_app_id, Rails.application.secrets.github_app_secret 271 | end 272 | 273 | # ==> Warden configuration 274 | # If you want to use other strategies, that are not supported by Devise, or 275 | # change the failure app, you can configure them inside the config.warden block. 276 | # 277 | # config.warden do |manager| 278 | # manager.intercept_401 = false 279 | # manager.default_strategies(scope: :user).unshift :some_external_strategy 280 | # end 281 | 282 | # ==> Mountable engine configurations 283 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine 284 | # is mountable, there are some extra configurations to be taken into account. 285 | # The following options are available, assuming the engine is mounted as: 286 | # 287 | # mount MyEngine, at: '/my_engine' 288 | # 289 | # The router that invoked `devise_for`, in the example above, would be: 290 | # config.router_name = :my_engine 291 | # 292 | # When using OmniAuth, Devise cannot automatically set OmniAuth path, 293 | # so you need to do it manually. For the users scope, it would be: 294 | # config.omniauth_path_prefix = '/my_engine/users/auth' 295 | 296 | # ==> Turbolinks configuration 297 | # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly: 298 | # 299 | # ActiveSupport.on_load(:devise_failure_app) do 300 | # include Turbolinks::Controller 301 | # end 302 | end 303 | -------------------------------------------------------------------------------- /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 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? ||
Name | 22 | <% end %> 23 | 24 | <% attributes.without(name_attribute).each do |attribute| -%> 25 |<%= attribute.human_name %> | 26 | <% end -%> 27 | <% unless has_name %> 28 |29 | <% end %> 30 | | <%%= link_to <%= singular_table_name %>.name, <%= singular_table_name %> %> | 38 | <% end %> 39 | 40 | <% attributes.without(name_attribute).each do |attribute| -%> 41 |<%%= <%= singular_table_name %>.<%= attribute.name %> %> | 42 | <% end -%> 43 | 44 | <% unless has_name %> 45 |<%%= link_to 'Show', <%= singular_table_name %> %> | 46 | <% end %> 47 | <%% end %> 48 | <%% end %> 49 | 50 |
---|
You may have mistyped the address or the page may have moved.
63 |If you are the application owner check the logs for more information.
65 |Maybe you tried to change something you didn't have access to.
63 |If you are the application owner check the logs for more information.
65 |If you are the application owner check the logs for more information.
64 |