kowl 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +7 -0
- data/README.md +383 -0
- data/bin/console +14 -0
- data/bin/kowl +106 -0
- data/bin/setup +13 -0
- data/lib/kowl/actions.rb +240 -0
- data/lib/kowl/docker.rb +447 -0
- data/lib/kowl/generators/README.md +5 -0
- data/lib/kowl/generators/action_generator.rb +113 -0
- data/lib/kowl/generators/admin_generator.rb +114 -0
- data/lib/kowl/generators/assets_generator.rb +188 -0
- data/lib/kowl/generators/base.rb +40 -0
- data/lib/kowl/generators/circleci_generator.rb +11 -0
- data/lib/kowl/generators/config_generator.rb +180 -0
- data/lib/kowl/generators/controller_generator.rb +64 -0
- data/lib/kowl/generators/database_generator.rb +42 -0
- data/lib/kowl/generators/decorators_generator.rb +16 -0
- data/lib/kowl/generators/docker_generator.rb +40 -0
- data/lib/kowl/generators/dotfiles_generator.rb +73 -0
- data/lib/kowl/generators/libs_generator.rb +19 -0
- data/lib/kowl/generators/mailer_generator.rb +58 -0
- data/lib/kowl/generators/misc_generator.rb +20 -0
- data/lib/kowl/generators/overrides/app_base.rb +15 -0
- data/lib/kowl/generators/overrides/app_builder.rb +58 -0
- data/lib/kowl/generators/overrides/app_generator.rb +249 -0
- data/lib/kowl/generators/pages_generator.rb +46 -0
- data/lib/kowl/generators/routes_generator.rb +20 -0
- data/lib/kowl/generators/sidekiq_generator.rb +31 -0
- data/lib/kowl/generators/staging_generator.rb +14 -0
- data/lib/kowl/generators/test_generator.rb +42 -0
- data/lib/kowl/generators/text_files_generator.rb +41 -0
- data/lib/kowl/generators/users_and_auth_generator.rb +143 -0
- data/lib/kowl/generators/uuid_generator.rb +39 -0
- data/lib/kowl/generators/views_and_helpers_generator.rb +104 -0
- data/lib/kowl/geodb.rb +96 -0
- data/lib/kowl/helpers.rb +139 -0
- data/lib/kowl/templates/Gemfile.erb.tt +253 -0
- data/lib/kowl/templates/README.md.erb +33 -0
- data/lib/kowl/templates/app/assets/javascripts/semantic.js.tt +26 -0
- data/lib/kowl/templates/app/assets/stylesheets/administrate/application.scss +44 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/_custom_styling.scss +38 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/application-mailer.scss +1 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/application.scss +14 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/components/_alerts.scss +7 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/components/_errors.scss +28 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/components/_navbar.scss +17 -0
- data/lib/kowl/templates/app/assets/stylesheets/bootstrap/variables.scss +6 -0
- data/lib/kowl/templates/app/assets/stylesheets/semantic/_custom_styling.scss +20 -0
- data/lib/kowl/templates/app/assets/stylesheets/semantic/application.scss +24 -0
- data/lib/kowl/templates/app/controllers/admin/application_controller.rb +29 -0
- data/lib/kowl/templates/app/controllers/admin/login_activities_controller.rb +29 -0
- data/lib/kowl/templates/app/controllers/admin/users_controller.rb +37 -0
- data/lib/kowl/templates/app/controllers/concerns/auth/authentication.rb +18 -0
- data/lib/kowl/templates/app/controllers/concerns/auth/authorization.rb +20 -0
- data/lib/kowl/templates/app/controllers/concerns/auth/error_handlers.rb +27 -0
- data/lib/kowl/templates/app/controllers/concerns/noauth/error_handlers.rb +25 -0
- data/lib/kowl/templates/app/controllers/users_controller.rb +17 -0
- data/lib/kowl/templates/app/dashboards/login_activity_dashboard.rb.tt +59 -0
- data/lib/kowl/templates/app/dashboards/rich_text_body_dashboard.rb.tt +17 -0
- data/lib/kowl/templates/app/dashboards/user_dashboard.rb.tt +60 -0
- data/lib/kowl/templates/app/fields/gravatar_field.rb +10 -0
- data/lib/kowl/templates/app/fields/rich_text_area_field.rb +8 -0
- data/lib/kowl/templates/app/inputs/rich_text_area_input.rb +11 -0
- data/lib/kowl/templates/app/javascript/administrate/components/date_time_picker.js.tt +32 -0
- data/lib/kowl/templates/app/javascript/administrate/components/table.js.tt +49 -0
- data/lib/kowl/templates/app/javascript/administrate/index.js +3 -0
- data/lib/kowl/templates/app/javascript/packs/administrate.js.tt +21 -0
- data/lib/kowl/templates/app/javascript/packs/semantic.js +11 -0
- data/lib/kowl/templates/app/mailers/application_mailer.rb +7 -0
- data/lib/kowl/templates/app/mailers/devise_mailer.rb +5 -0
- data/lib/kowl/templates/app/models/login_activity.rb.tt +29 -0
- data/lib/kowl/templates/app/models/user.rb.tt +72 -0
- data/lib/kowl/templates/app/policies/application_policy.rb +38 -0
- data/lib/kowl/templates/app/policies/login_activity_policy.rb +35 -0
- data/lib/kowl/templates/app/policies/user_policy.rb +43 -0
- data/lib/kowl/templates/app/views/admin/templates/navigation.erb.tt +23 -0
- data/lib/kowl/templates/app/views/admin/views/application/_javascript.html.erb +21 -0
- data/lib/kowl/templates/app/views/admin/views/users/_collection.html.erb +102 -0
- data/lib/kowl/templates/app/views/admin/views/users/_form.html.erb +46 -0
- data/lib/kowl/templates/app/views/admin/views/users/edit.html.erb +36 -0
- data/lib/kowl/templates/app/views/admin/views/users/index.html.erb +66 -0
- data/lib/kowl/templates/app/views/fields/gravatar_field/_form.html.erb +6 -0
- data/lib/kowl/templates/app/views/fields/gravatar_field/_index.html.erb +1 -0
- data/lib/kowl/templates/app/views/fields/gravatar_field/_show.html.erb +1 -0
- data/lib/kowl/templates/app/views/fields/rich_text_area_field/_form.html.erb +6 -0
- data/lib/kowl/templates/app/views/fields/rich_text_area_field/_index.html.erb +1 -0
- data/lib/kowl/templates/app/views/fields/rich_text_area_field/_show.html.erb +1 -0
- data/lib/kowl/templates/app/views/layouts/admin.html.erb.tt +47 -0
- data/lib/kowl/templates/app/views/layouts/devise_mailer.html.erb +14 -0
- data/lib/kowl/templates/app/views/pages/welcome/bootstrap.html.erb +18 -0
- data/lib/kowl/templates/app/views/pages/welcome/bootstrap.html.haml +17 -0
- data/lib/kowl/templates/app/views/pages/welcome/bootstrap.html.slim +17 -0
- data/lib/kowl/templates/app/views/pages/welcome/default.html.erb +0 -0
- data/lib/kowl/templates/app/views/pages/welcome/default.html.haml +0 -0
- data/lib/kowl/templates/app/views/pages/welcome/default.html.slim +0 -0
- data/lib/kowl/templates/app/views/pages/welcome/semantic.html.erb +20 -0
- data/lib/kowl/templates/app/views/pages/welcome/semantic.html.haml +17 -0
- data/lib/kowl/templates/app/views/pages/welcome/semantic.html.slim +17 -0
- data/lib/kowl/templates/app/views/shared/footer/bootstrap.html.erb.tt +5 -0
- data/lib/kowl/templates/app/views/shared/footer/bootstrap.html.haml.tt +3 -0
- data/lib/kowl/templates/app/views/shared/footer/bootstrap.html.slim.tt +3 -0
- data/lib/kowl/templates/app/views/shared/footer/semantic.html.erb.tt +7 -0
- data/lib/kowl/templates/app/views/shared/footer/semantic.html.haml.tt +5 -0
- data/lib/kowl/templates/app/views/shared/footer/semantic.html.slim.tt +5 -0
- data/lib/kowl/templates/app/views/shared/navigation/bootstrap.html.erb.tt +51 -0
- data/lib/kowl/templates/app/views/shared/navigation/bootstrap.html.haml.tt +36 -0
- data/lib/kowl/templates/app/views/shared/navigation/bootstrap.html.slim.tt +36 -0
- data/lib/kowl/templates/app/views/shared/navigation/semantic.html.erb.tt +48 -0
- data/lib/kowl/templates/app/views/shared/navigation/semantic.html.haml.tt +36 -0
- data/lib/kowl/templates/app/views/shared/navigation/semantic.html.slim.tt +36 -0
- data/lib/kowl/templates/app/workers/scheduler/pghero_scheduler.rb +11 -0
- data/lib/kowl/templates/config/autoprefixer.yml +4 -0
- data/lib/kowl/templates/config/db/mysql.yml.tt +43 -0
- data/lib/kowl/templates/config/db/oracle.yml.tt +29 -0
- data/lib/kowl/templates/config/db/postgresql.yml.tt +37 -0
- data/lib/kowl/templates/config/db/sqlite3.yml.tt +20 -0
- data/lib/kowl/templates/config/db/sqlserver.yml.tt +28 -0
- data/lib/kowl/templates/config/initializers/administrate.rb.tt +9 -0
- data/lib/kowl/templates/config/initializers/bullet.rb +21 -0
- data/lib/kowl/templates/config/initializers/devise-security.rb +44 -0
- data/lib/kowl/templates/config/initializers/devise_argon2.rb +29 -0
- data/lib/kowl/templates/config/initializers/faker.rb +6 -0
- data/lib/kowl/templates/config/initializers/generators.rb.tt +31 -0
- data/lib/kowl/templates/config/initializers/geocoder.rb +10 -0
- data/lib/kowl/templates/config/initializers/letter_opener.rb +13 -0
- data/lib/kowl/templates/config/initializers/lockbox.rb +11 -0
- data/lib/kowl/templates/config/initializers/logging.rb +6 -0
- data/lib/kowl/templates/config/initializers/lograge.rb +7 -0
- data/lib/kowl/templates/config/initializers/logstop.rb +4 -0
- data/lib/kowl/templates/config/initializers/middleware.rb +9 -0
- data/lib/kowl/templates/config/initializers/oj.rb +7 -0
- data/lib/kowl/templates/config/initializers/pagy.rb.tt +16 -0
- data/lib/kowl/templates/config/initializers/postmark.rb +8 -0
- data/lib/kowl/templates/config/initializers/rack_attack.rb.tt +71 -0
- data/lib/kowl/templates/config/initializers/sass.rb +5 -0
- data/lib/kowl/templates/config/initializers/sidekiq.rb +11 -0
- data/lib/kowl/templates/config/initializers/simpleform/semantic.rb +225 -0
- data/lib/kowl/templates/config/initializers/slim.rb +6 -0
- data/lib/kowl/templates/config/initializers/sparkpost.rb +13 -0
- data/lib/kowl/templates/config/routes.rb.tt +28 -0
- data/lib/kowl/templates/config/sidekiq.yml.tt +17 -0
- data/lib/kowl/templates/db/migrations/create_action_text_tables.action_text.rb.tt +16 -0
- data/lib/kowl/templates/db/migrations/create_active_storage_tables.active_storage.rb.tt +29 -0
- data/lib/kowl/templates/db/migrations/devise.rb.tt +59 -0
- data/lib/kowl/templates/db/migrations/login_activities.rb.tt +41 -0
- data/lib/kowl/templates/db/seeds.rb.tt +14 -0
- data/lib/kowl/templates/docker/Dockerfile.alpine.tt +92 -0
- data/lib/kowl/templates/docker/Dockerfile.debian.tt +133 -0
- data/lib/kowl/templates/docker/docker-compose.yml.tt +55 -0
- data/lib/kowl/templates/docker/mysql/Dockerfile.tt +15 -0
- data/lib/kowl/templates/dotfiles/Aptfile.tt +34 -0
- data/lib/kowl/templates/dotfiles/Brewfile.tt +49 -0
- data/lib/kowl/templates/dotfiles/Procfile.tt +12 -0
- data/lib/kowl/templates/dotfiles/codeclimate.yml +76 -0
- data/lib/kowl/templates/dotfiles/coffeelint.json +10 -0
- data/lib/kowl/templates/dotfiles/coffeelintignore +15 -0
- data/lib/kowl/templates/dotfiles/dockerignore +23 -0
- data/lib/kowl/templates/dotfiles/editorconfig +13 -0
- data/lib/kowl/templates/dotfiles/env.tt +58 -0
- data/lib/kowl/templates/dotfiles/erb-lint.yml +10 -0
- data/lib/kowl/templates/dotfiles/erdconfig.tt +24 -0
- data/lib/kowl/templates/dotfiles/eslintignore +20 -0
- data/lib/kowl/templates/dotfiles/eslintrc.js +31 -0
- data/lib/kowl/templates/dotfiles/fasterer.yml +14 -0
- data/lib/kowl/templates/dotfiles/foreman +1 -0
- data/lib/kowl/templates/dotfiles/gitattributes +15 -0
- data/lib/kowl/templates/dotfiles/gitignore +69 -0
- data/lib/kowl/templates/dotfiles/haml-lint.yml +23 -0
- data/lib/kowl/templates/dotfiles/jsbeautifyrc +15 -0
- data/lib/kowl/templates/dotfiles/jshintrc +3 -0
- data/lib/kowl/templates/dotfiles/mailmap +3 -0
- data/lib/kowl/templates/dotfiles/nvmrc +1 -0
- data/lib/kowl/templates/dotfiles/prettierignore +21 -0
- data/lib/kowl/templates/dotfiles/prettierrc.js +62 -0
- data/lib/kowl/templates/dotfiles/pryrc +7 -0
- data/lib/kowl/templates/dotfiles/rspec +3 -0
- data/lib/kowl/templates/dotfiles/rubocop.yml.tt +78 -0
- data/lib/kowl/templates/dotfiles/scss-lint.yml +132 -0
- data/lib/kowl/templates/dotfiles/simplecov +19 -0
- data/lib/kowl/templates/dotfiles/slim-lint.yml +23 -0
- data/lib/kowl/templates/dotfiles/slugignore +10 -0
- data/lib/kowl/templates/dotfiles/yamllint +7 -0
- data/lib/kowl/templates/dotfiles/yarnclean +46 -0
- data/lib/kowl/templates/lib/tasks/stats.rake +42 -0
- data/lib/kowl/templates/tests/factories/README.md +0 -0
- data/lib/kowl/templates/tests/factories/login_activity.rb +11 -0
- data/lib/kowl/templates/tests/factories/user.rb +11 -0
- data/lib/kowl/templates/tests/minitest/README.md +3 -0
- data/lib/kowl/templates/tests/minitest/application_system_test_case.rb +7 -0
- data/lib/kowl/templates/tests/minitest/controllers/pages_controller_test.rb +10 -0
- data/lib/kowl/templates/tests/minitest/models/login_activity_test.rb +8 -0
- data/lib/kowl/templates/tests/minitest/models/user_test.rb +15 -0
- data/lib/kowl/templates/tests/minitest/policies/login_activity_policy_test.rb +7 -0
- data/lib/kowl/templates/tests/minitest/policies/user_policy_test.rb +7 -0
- data/lib/kowl/templates/tests/minitest/support/capybara.rb +38 -0
- data/lib/kowl/templates/tests/minitest/support/database_cleaner.rb +20 -0
- data/lib/kowl/templates/tests/minitest/support/database_cleaner_support.rb +15 -0
- data/lib/kowl/templates/tests/minitest/support/deferred_garbage_collection.rb +21 -0
- data/lib/kowl/templates/tests/minitest/support/devise.rb +16 -0
- data/lib/kowl/templates/tests/minitest/support/factories.rb +6 -0
- data/lib/kowl/templates/tests/minitest/support/formulaic.rb +8 -0
- data/lib/kowl/templates/tests/minitest/support/helpers/devise_helper.rb +57 -0
- data/lib/kowl/templates/tests/minitest/support/papertrail.rb +17 -0
- data/lib/kowl/templates/tests/minitest/support/pundit.rb +0 -0
- data/lib/kowl/templates/tests/minitest/support/shoulda.rb +11 -0
- data/lib/kowl/templates/tests/minitest/support/simplecov.rb +8 -0
- data/lib/kowl/templates/tests/minitest/test_helper.rb +17 -0
- data/lib/kowl/templates/tests/rspec/README.md +9 -0
- data/lib/kowl/templates/tests/rspec/controllers/admin/application_controller_spec.rb +12 -0
- data/lib/kowl/templates/tests/rspec/controllers/admin/users_controller_spec.rb +14 -0
- data/lib/kowl/templates/tests/rspec/controllers/pages_controller_spec.rb +10 -0
- data/lib/kowl/templates/tests/rspec/features/README.md +15 -0
- data/lib/kowl/templates/tests/rspec/features/visitor_sign_up_spec.rb +25 -0
- data/lib/kowl/templates/tests/rspec/helpers/application_helper_spec.rb +7 -0
- data/lib/kowl/templates/tests/rspec/helpers/pages_helper_spec.rb +15 -0
- data/lib/kowl/templates/tests/rspec/models/login_activity_spec.rb +11 -0
- data/lib/kowl/templates/tests/rspec/models/user_spec.rb +21 -0
- data/lib/kowl/templates/tests/rspec/policies/login_activity_policy_spec.rb +59 -0
- data/lib/kowl/templates/tests/rspec/policies/user_policy_spec.rb +56 -0
- data/lib/kowl/templates/tests/rspec/rails_helper.rb +72 -0
- data/lib/kowl/templates/tests/rspec/requests/pages_spec.rb +11 -0
- data/lib/kowl/templates/tests/rspec/spec_helper.rb +96 -0
- data/lib/kowl/templates/tests/rspec/support/bullet.rb +17 -0
- data/lib/kowl/templates/tests/rspec/support/capybara.rb +37 -0
- data/lib/kowl/templates/tests/rspec/support/controller_testing.rb +10 -0
- data/lib/kowl/templates/tests/rspec/support/database_cleaner.rb +55 -0
- data/lib/kowl/templates/tests/rspec/support/deferred_garbage_collection.rb +32 -0
- data/lib/kowl/templates/tests/rspec/support/devise.rb +21 -0
- data/lib/kowl/templates/tests/rspec/support/factories.rb +5 -0
- data/lib/kowl/templates/tests/rspec/support/formulaic.rb +8 -0
- data/lib/kowl/templates/tests/rspec/support/helpers/devise_helpers.rb +56 -0
- data/lib/kowl/templates/tests/rspec/support/papertrail.rb +5 -0
- data/lib/kowl/templates/tests/rspec/support/pi_ci.rb +6 -0
- data/lib/kowl/templates/tests/rspec/support/pundit.rb +6 -0
- data/lib/kowl/templates/tests/rspec/support/shoulda.rb +10 -0
- data/lib/kowl/templates/tests/rspec/support/sidekiq.rb +10 -0
- data/lib/kowl/templates/tests/rspec/support/simplecov.rb +7 -0
- data/lib/kowl/templates/tests/rspec/support/warden.rb +8 -0
- data/lib/kowl/templates/text_files/AUTHORS.md +4 -0
- data/lib/kowl/templates/text_files/CHANGELOG.md.tt +12 -0
- data/lib/kowl/templates/text_files/CODE_OF_CONDUCT.md +76 -0
- data/lib/kowl/templates/text_files/TODO.md +7 -0
- data/lib/kowl/templates/text_files/VERSION +1 -0
- data/lib/kowl/templates/text_files/humans.txt.tt +15 -0
- data/lib/kowl/templates/text_files/robots.txt.tt +6 -0
- data/lib/kowl/templates/text_files/security.txt +6 -0
- data/lib/kowl/version.rb +9 -0
- data/lib/kowl.rb +18 -0
- metadata +404 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
@charset 'utf-8';
|
2
|
+
|
3
|
+
@import 'reset/normalize';
|
4
|
+
@import 'selectize';
|
5
|
+
@import 'datetime_picker';
|
6
|
+
|
7
|
+
@import 'library/clearfix';
|
8
|
+
@import 'library/data-label';
|
9
|
+
@import 'library/variables';
|
10
|
+
|
11
|
+
@import 'base/forms';
|
12
|
+
@import 'base/layout';
|
13
|
+
@import 'base/lists';
|
14
|
+
@import 'base/tables';
|
15
|
+
@import 'base/typography';
|
16
|
+
|
17
|
+
@import 'components/app-container';
|
18
|
+
@import 'components/attributes';
|
19
|
+
@import 'components/buttons';
|
20
|
+
@import 'components/cells';
|
21
|
+
@import 'components/field-unit';
|
22
|
+
@import 'components/flashes';
|
23
|
+
@import 'components/form-actions';
|
24
|
+
@import 'components/main-content';
|
25
|
+
@import 'components/navigation';
|
26
|
+
@import 'components/pagination';
|
27
|
+
@import 'components/search';
|
28
|
+
|
29
|
+
@import 'utilities/text-color';
|
30
|
+
|
31
|
+
// Plugins and additional Components
|
32
|
+
@import 'font-awesome-sprockets';
|
33
|
+
@import 'font-awesome';
|
34
|
+
|
35
|
+
// Smooth out the fonts and text displayed on the dashboard
|
36
|
+
body {
|
37
|
+
/* Antialias the font for smooth text rendering */
|
38
|
+
text-rendering: optimizeLegibility;
|
39
|
+
-webkit-font-smoothing: antialiased;
|
40
|
+
-moz-font-smoothing: grayscale;
|
41
|
+
-moz-osx-font-smoothing: grayscale;
|
42
|
+
font-smoothing: antialiased;
|
43
|
+
font-smooth: always;
|
44
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
html {
|
2
|
+
position: relative;
|
3
|
+
min-height: 100%;
|
4
|
+
}
|
5
|
+
|
6
|
+
body {
|
7
|
+
/* Antialias the font for smooth text rendering */
|
8
|
+
text-rendering: optimizeLegibility;
|
9
|
+
-webkit-font-smoothing: antialiased;
|
10
|
+
-moz-font-smoothing: grayscale;
|
11
|
+
-moz-osx-font-smoothing: grayscale;
|
12
|
+
font-smoothing: antialiased;
|
13
|
+
font-smooth: always;
|
14
|
+
// Margin bottom by footer height
|
15
|
+
margin-bottom: 60px;
|
16
|
+
}
|
17
|
+
|
18
|
+
h1, h2, h3, h4, h5 {
|
19
|
+
.text-muted {
|
20
|
+
color: #969ea5 !important;
|
21
|
+
font-size: 90% !important;
|
22
|
+
font-style: italic;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
/* Sticky footer styles
|
27
|
+
-------------------------------------------------- */
|
28
|
+
// => https://getbootstrap.com/docs/4.1/examples/sticky-footer-navbar/sticky-footer-navbar.css
|
29
|
+
.footer {
|
30
|
+
background-color: #f5f5f5;
|
31
|
+
bottom: 0;
|
32
|
+
/* Vertically center the text there */
|
33
|
+
/* Set the fixed height of the footer here */
|
34
|
+
height: 60px;
|
35
|
+
line-height: 60px;
|
36
|
+
position: absolute;
|
37
|
+
width: 100%;
|
38
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'bootstrap-email';
|
@@ -0,0 +1,14 @@
|
|
1
|
+
@import 'variables';
|
2
|
+
@import 'bootstrap';
|
3
|
+
@import 'font-awesome-sprockets';
|
4
|
+
@import 'font-awesome';
|
5
|
+
@import 'custom_styling';
|
6
|
+
|
7
|
+
|
8
|
+
// equivalent to 'require_tree .' if required
|
9
|
+
// @import '/\*';
|
10
|
+
|
11
|
+
//////////////////////////////////////////////////
|
12
|
+
// Components
|
13
|
+
//////////////////////////////////////////////////
|
14
|
+
@import 'components/errors';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
// Form error messages
|
2
|
+
#error_explanation {
|
3
|
+
color: #f00;
|
4
|
+
|
5
|
+
ul {
|
6
|
+
list-style: none;
|
7
|
+
margin: 0 0 18px;
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
.field_with_errors label,
|
12
|
+
.field_with_errors .form-control-feedback,
|
13
|
+
.field_with_errors .form-control-label,
|
14
|
+
.field_with_errors .col-form-label,
|
15
|
+
.field_with_errors .form-check-label,
|
16
|
+
.field_with_errors .custom-control {
|
17
|
+
color: $softcherry;
|
18
|
+
}
|
19
|
+
|
20
|
+
.field_with_errors .form-control {
|
21
|
+
color: $softcherry;
|
22
|
+
}
|
23
|
+
|
24
|
+
.field_with_errors .input-group-addon {
|
25
|
+
background-color: #fdf7f7;
|
26
|
+
border-color: $softcherry;
|
27
|
+
color: $softcherry;
|
28
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// Overrride the default navbar styles to let links be a little more visible
|
2
|
+
// .navbar {
|
3
|
+
// a.nav-link {
|
4
|
+
// color: rgba($white, 0.65) !important;
|
5
|
+
//
|
6
|
+
// &:hover { color: rgba($white, 0.85) !important; }
|
7
|
+
// }
|
8
|
+
//
|
9
|
+
// // link styling when you're logged in as another user
|
10
|
+
// .current_user {
|
11
|
+
// a {
|
12
|
+
// color: lighten($black, 20%) !important;
|
13
|
+
//
|
14
|
+
// &:hover { color: $black !important; }
|
15
|
+
// }
|
16
|
+
// }
|
17
|
+
// }
|
@@ -0,0 +1,20 @@
|
|
1
|
+
html { min-height: 100%; margin: 0; padding: 0; position: relative; }
|
2
|
+
body { background-color: #FFFFFF; }
|
3
|
+
|
4
|
+
.ui.menu .item img.logo { margin-right: 1.5em; }
|
5
|
+
.main.container { min-height: 90%; padding-top: 5em; }
|
6
|
+
.wireframe { margin-top: 2em; }
|
7
|
+
// spacing add, otherwise form buttons will end up right along the bottom of previous input
|
8
|
+
.form-actions { margin: 1em 0; }
|
9
|
+
|
10
|
+
// NAVBAR
|
11
|
+
a.header.item { margin-right: 1rem !important; }
|
12
|
+
|
13
|
+
// link styling when you're logged in
|
14
|
+
span.current_user {
|
15
|
+
color: darken(#26d4cb, 7%) !important;
|
16
|
+
|
17
|
+
&:hover {
|
18
|
+
color: #26d4cb !important;
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@import 'semantic-ui';
|
2
|
+
@import 'font-awesome-sprockets';
|
3
|
+
@import 'font-awesome';
|
4
|
+
@import 'custom_styling';
|
5
|
+
|
6
|
+
body {
|
7
|
+
/* Antialias the font for smooth text rendering */
|
8
|
+
text-rendering: optimizeLegibility;
|
9
|
+
-webkit-font-smoothing: antialiased;
|
10
|
+
-moz-font-smoothing: grayscale;
|
11
|
+
-moz-osx-font-smoothing: grayscale;
|
12
|
+
font-smoothing: antialiased;
|
13
|
+
font-smooth: always;
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
|
18
|
+
.footer {
|
19
|
+
background-color: #f5f5f5;
|
20
|
+
bottom: 0;
|
21
|
+
height: 1.5rem;
|
22
|
+
position: absolute;
|
23
|
+
width: 100%;
|
24
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# All Administrate controllers inherit from this `Admin::ApplicationController`,
|
4
|
+
# making it the ideal place to put authentication logic or other
|
5
|
+
# before_actions.
|
6
|
+
#
|
7
|
+
# If you want to add pagination or other controller-level concerns,
|
8
|
+
# you're free to overwrite the RESTful controller actions.
|
9
|
+
module Admin
|
10
|
+
class ApplicationController < Administrate::ApplicationController
|
11
|
+
protect_from_forgery with: :exception
|
12
|
+
before_action :authenticate_user!
|
13
|
+
before_action :ensure_admin!
|
14
|
+
impersonates :user
|
15
|
+
include Pundit
|
16
|
+
include Administrate::Punditize
|
17
|
+
include ErrorHandlers
|
18
|
+
|
19
|
+
# Override this value to specify the number of elements to display at a time
|
20
|
+
# on index pages. Defaults to 20.
|
21
|
+
# def records_per_page
|
22
|
+
# params[:per_page] || 20
|
23
|
+
# end
|
24
|
+
# Used to ensure only superusers and staff members can access the admin dashboards
|
25
|
+
def ensure_admin!
|
26
|
+
redirect_to root_path, notice: 'Not authorized!' unless current_user.present? && current_user.staff_member?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class LoginActivitiesController < Admin::ApplicationController
|
5
|
+
# To customize the behavior of this controller,
|
6
|
+
# you can overwrite any of the RESTful actions. For example:
|
7
|
+
#
|
8
|
+
# def index
|
9
|
+
# super
|
10
|
+
# @resources = LoginActivity.
|
11
|
+
# page(params[:page]).
|
12
|
+
# per(10)
|
13
|
+
# end
|
14
|
+
|
15
|
+
# Define a custom finder by overriding the `find_resource` method:
|
16
|
+
# def find_resource(param)
|
17
|
+
# LoginActivity.find_by!(slug: param)
|
18
|
+
# end
|
19
|
+
|
20
|
+
# See https://administrate-prototype.herokuapp.com/customizing_controller_actions
|
21
|
+
# for more information
|
22
|
+
def order
|
23
|
+
@order ||= Administrate::Order.new(
|
24
|
+
params.fetch(resource_name, {}).fetch(:order, 'created_at'),
|
25
|
+
params.fetch(resource_name, {}).fetch(:direction, 'desc')
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Admin
|
4
|
+
class UsersController < Admin::ApplicationController
|
5
|
+
# This is because we want to allow the admins to log out of user accounts that aren't admins
|
6
|
+
# To customize the behavior of this controller,
|
7
|
+
# you can overwrite any of the RESTful actions. For example:
|
8
|
+
#
|
9
|
+
# def index
|
10
|
+
# super
|
11
|
+
# @resources = User.
|
12
|
+
# page(params[:page]).
|
13
|
+
# per(10)
|
14
|
+
# end
|
15
|
+
|
16
|
+
# Define a custom finder by overriding the `find_resource` method:
|
17
|
+
# def find_resource(param)
|
18
|
+
# User.find_by!(slug: param)
|
19
|
+
# end
|
20
|
+
|
21
|
+
# See https://administrate-prototype.herokuapp.com/customizing_controller_actions
|
22
|
+
# for more information
|
23
|
+
|
24
|
+
# This is used in the users dashboard to limit assigning roles
|
25
|
+
# => because an admin should be able to assign any role to any user
|
26
|
+
# => but someone with a staff role should not be able to assign themselves or anyone else as an admin
|
27
|
+
|
28
|
+
# Used for setting a default sort for the users
|
29
|
+
# => https://github.com/thoughtbot/administrate/issues/442
|
30
|
+
def order
|
31
|
+
@order ||= Administrate::Order.new(
|
32
|
+
params.fetch(resource_name, {}).fetch(:order, 'created_at'),
|
33
|
+
params.fetch(resource_name, {}).fetch(:direction, 'desc')
|
34
|
+
)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Authentication
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
before_action :configure_permitted_parameters, if: :devise_controller?
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# If you want to add custom attributes to the devise to be editable (ie: username)
|
13
|
+
def configure_permitted_parameters
|
14
|
+
# devise_parameter_sanitizer.permit(:username)
|
15
|
+
# devise_parameter_sanitizer.permit(:username)
|
16
|
+
# devise_parameter_sanitizer.permit(:username)
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Authorization
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
include Pundit
|
6
|
+
|
7
|
+
included do
|
8
|
+
# after_action :verify_authorized, unless: :skip_auth_controllers
|
9
|
+
end
|
10
|
+
|
11
|
+
def pundit_useies
|
12
|
+
current_user
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def skip_auth_controllers
|
18
|
+
devise_controller? || controller_path == 'pages'
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErrorHandlers
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
rescue_from ActiveRecord::RecordInvalid, with: :render_not_found
|
8
|
+
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
|
9
|
+
# rescue_from ActionController::RoutingError, with: :render_not_found
|
10
|
+
rescue_from ActionView::MissingTemplate do
|
11
|
+
render plain: '404 Not found', status: :not_found
|
12
|
+
end
|
13
|
+
# Pundit Authorization
|
14
|
+
rescue_from Pundit::NotAuthorizedError, with: :not_authorized
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def not_authorized
|
20
|
+
flash[:alert] = 'You are not authorized to access this page.'
|
21
|
+
redirect_to(request.referer || root_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
def render_not_found
|
25
|
+
render template: 'errors/404', status: :not_found
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ErrorHandlers
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
rescue_from ActiveRecord::RecordInvalid, with: :render_not_found
|
8
|
+
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
|
9
|
+
# rescue_from ActionController::RoutingError, with: :render_not_found
|
10
|
+
rescue_from ActionView::MissingTemplate do
|
11
|
+
render plain: '404 Not found', status: 404
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def not_authorized
|
18
|
+
flash[:alert] = 'You are not authorized to access this page.'
|
19
|
+
redirect_to(request.referer || root_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def render_not_found
|
23
|
+
render template: 'errors/404', status: 404
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UsersController < ApplicationController
|
4
|
+
include Pundit
|
5
|
+
|
6
|
+
def impersonate
|
7
|
+
user = User.find(params[:id])
|
8
|
+
authorize user
|
9
|
+
impersonate_user(user)
|
10
|
+
redirect_to root_path
|
11
|
+
end
|
12
|
+
|
13
|
+
def stop_impersonating
|
14
|
+
stop_impersonating_user
|
15
|
+
redirect_to(request.referer || root_path)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'administrate/base_dashboard'
|
4
|
+
class LoginActivityDashboard < Administrate::BaseDashboard
|
5
|
+
# ATTRIBUTE_TYPES
|
6
|
+
# a hash that describes the type of each of the model's fields.
|
7
|
+
#
|
8
|
+
# Each different type represents an Administrate::Field object,
|
9
|
+
# which determines how the attribute is displayed
|
10
|
+
# on pages throughout the dashboard.
|
11
|
+
ATTRIBUTE_TYPES = {
|
12
|
+
# user: Field::Polymorphic,
|
13
|
+
user: Field::BelongsTo,
|
14
|
+
<%- if options[:uuid] -%>
|
15
|
+
id: Field::String,
|
16
|
+
<%- else -%>
|
17
|
+
id: Field::Number,
|
18
|
+
<%- end -%>
|
19
|
+
scope: Field::String,
|
20
|
+
strategy: Field::String,
|
21
|
+
identity: Field::String,
|
22
|
+
success: Field::Boolean,
|
23
|
+
failure_reason: Field::String,
|
24
|
+
context: Field::String,
|
25
|
+
ip: Field::String,
|
26
|
+
user_agent: Field::Text,
|
27
|
+
referrer: Field::Text,
|
28
|
+
city: Field::String,
|
29
|
+
region: Field::String,
|
30
|
+
country: Field::String,
|
31
|
+
latitude: Field::Number.with_options(decimals: 2),
|
32
|
+
longitude: Field::Number.with_options(decimals: 2),
|
33
|
+
created_at: Field::DateTime
|
34
|
+
}.freeze
|
35
|
+
|
36
|
+
# COLLECTION_ATTRIBUTES
|
37
|
+
# an array of attributes that will be displayed on the model's index page.
|
38
|
+
#
|
39
|
+
# By default, it's limited to four items to reduce clutter on index pages.
|
40
|
+
# Feel free to add, remove, or rearrange items.
|
41
|
+
COLLECTION_ATTRIBUTES = %i[id identity scope strategy].freeze
|
42
|
+
|
43
|
+
# SHOW_PAGE_ATTRIBUTES
|
44
|
+
# an array of attributes that will be displayed on the model's show page.
|
45
|
+
SHOW_PAGE_ATTRIBUTES = %i[user id scope strategy identity success failure_reason context ip user_agent referrer
|
46
|
+
city region country latitude longitude created_at].freeze
|
47
|
+
|
48
|
+
# FORM_ATTRIBUTES
|
49
|
+
# an array of attributes that will be displayed
|
50
|
+
# on the model's form (`new` and `edit`) pages.
|
51
|
+
FORM_ATTRIBUTES = %i[user scope strategy identity success failure_reason context ip user_agent referrer city region country latitude longitude].freeze
|
52
|
+
|
53
|
+
# Overwrite this method to customize how login activities are displayed
|
54
|
+
# across all pages of the admin dashboard.
|
55
|
+
#
|
56
|
+
# def display_resource(login_activity)
|
57
|
+
# "LoginActivity ##{login_activity.id}"
|
58
|
+
# end
|
59
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'administrate/base_dashboard'
|
4
|
+
class RichTextBodyDashboard < Administrate::BaseDashboard
|
5
|
+
ATTRIBUTE_TYPES = {
|
6
|
+
name: Field::String,
|
7
|
+
body: Field::Text,
|
8
|
+
<%- if options[:uuid] -%>
|
9
|
+
record_id: Field::String,
|
10
|
+
<%- else -%>
|
11
|
+
record_id: Field::BelongsTo,
|
12
|
+
<%- end -%>
|
13
|
+
record_type: Field::String
|
14
|
+
}.freeze
|
15
|
+
|
16
|
+
FORM_ATTRIBUTES = %i[body].freeze
|
17
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'administrate/base_dashboard'
|
4
|
+
class UserDashboard < Administrate::BaseDashboard
|
5
|
+
# ATTRIBUTE_TYPES
|
6
|
+
# a hash that describes the type of each of the model's fields.
|
7
|
+
#
|
8
|
+
# Each different type represents an Administrate::Field object,
|
9
|
+
# which determines how the attribute is displayed
|
10
|
+
# on pages throughout the dashboard.
|
11
|
+
ATTRIBUTE_TYPES = {
|
12
|
+
login_activities: Field::HasMany,
|
13
|
+
<%- if options[:uuid] -%>
|
14
|
+
id: Field::String,
|
15
|
+
<%- else -%>
|
16
|
+
id: Field::Number,
|
17
|
+
<%- end -%>
|
18
|
+
avatar: GravatarField,
|
19
|
+
email: Field::String,
|
20
|
+
encrypted_password: Field::String,
|
21
|
+
reset_password_token: Field::String,
|
22
|
+
reset_password_sent_at: Field::DateTime,
|
23
|
+
remember_created_at: Field::DateTime,
|
24
|
+
sign_in_count: Field::Number,
|
25
|
+
current_sign_in_at: Field::DateTime,
|
26
|
+
last_sign_in_at: Field::DateTime,
|
27
|
+
current_sign_in_ip: Field::String,
|
28
|
+
last_sign_in_ip: Field::String,
|
29
|
+
failed_attempts: Field::Number,
|
30
|
+
unlock_token: Field::String,
|
31
|
+
locked_at: Field::DateTime,
|
32
|
+
role: Field::Select.with_options(collection: User.roles.keys),
|
33
|
+
created_at: Field::DateTime,
|
34
|
+
updated_at: Field::DateTime
|
35
|
+
}.freeze
|
36
|
+
|
37
|
+
# COLLECTION_ATTRIBUTES
|
38
|
+
# an array of attributes that will be displayed on the model's index page.
|
39
|
+
#
|
40
|
+
# By default, it's limited to four items to reduce clutter on index pages.
|
41
|
+
# Feel free to add, remove, or rearrange items.
|
42
|
+
COLLECTION_ATTRIBUTES = %i[id avatar email last_sign_in_at role].freeze
|
43
|
+
|
44
|
+
# SHOW_PAGE_ATTRIBUTES
|
45
|
+
# an array of attributes that will be displayed on the model's show page.
|
46
|
+
SHOW_PAGE_ATTRIBUTES = %i[id email sign_in_count current_sign_in_at current_sign_in_ip failed_attempts
|
47
|
+
locked_at role created_at updated_at login_activities].freeze
|
48
|
+
|
49
|
+
# FORM_ATTRIBUTES
|
50
|
+
# an array of attributes that will be displayed
|
51
|
+
# on the model's form (`new` and `edit`) pages.
|
52
|
+
FORM_ATTRIBUTES = %i[email locked_at role].freeze
|
53
|
+
|
54
|
+
# Overwrite this method to customize how users are displayed
|
55
|
+
# across all pages of the admin dashboard.
|
56
|
+
#
|
57
|
+
# def display_resource(user)
|
58
|
+
# "User ##{user.id}"
|
59
|
+
# end
|
60
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Enable RichTextArea input type for simple_form
|
4
|
+
# => https://github.com/plataformatec/simple_form/issues/1638
|
5
|
+
class RichTextAreaInput < SimpleForm::Inputs::Base
|
6
|
+
def input(wrapper_options = nil)
|
7
|
+
merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
|
8
|
+
|
9
|
+
@builder.rich_text_area(attribute_name, merged_input_options)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import flatpickr from 'flatpickr'
|
2
|
+
|
3
|
+
function bindDateTimePickers() {
|
4
|
+
[...document.querySelectorAll('[data-type="time"]')].forEach((time) => {
|
5
|
+
flatpickr(time, {
|
6
|
+
enableTime: true,
|
7
|
+
enableSeconds: true,
|
8
|
+
noCalendar: true,
|
9
|
+
altInput: true,
|
10
|
+
altFormat: ' h:i:S K',
|
11
|
+
dateFormat: 'H:i:S' // H:i
|
12
|
+
})
|
13
|
+
});
|
14
|
+
|
15
|
+
[...document.querySelectorAll('[data-type="datetime"]')].forEach((time) => {
|
16
|
+
flatpickr(time, {
|
17
|
+
enableTime: true,
|
18
|
+
altInput: true,
|
19
|
+
altFormat: 'F J (D), Y - h:i:S K',
|
20
|
+
dateFormat: 'Z' // Y-m-d H:i
|
21
|
+
})
|
22
|
+
})
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
<%- if options[:skip_turbolinks] -%>
|
27
|
+
$(document).ready(function () {
|
28
|
+
<%- else -%>
|
29
|
+
document.addEventListener('turbolinks:load', function () {
|
30
|
+
<%- end -%>
|
31
|
+
bindDateTimePickers()
|
32
|
+
})
|