schienenzeppelin 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +17 -0
  3. data/.github/workflows/outdated.yml +20 -0
  4. data/.gitignore +282 -0
  5. data/.rspec_status +3 -0
  6. data/.rubocop.yml +28 -0
  7. data/.tool-versions +1 -0
  8. data/CODE_OF_CONDUCT.md +84 -0
  9. data/GALLERY.md +29 -0
  10. data/Gemfile +13 -0
  11. data/Gemfile.lock +184 -0
  12. data/LICENSE +21 -0
  13. data/LICENSE.txt +21 -0
  14. data/README.md +174 -0
  15. data/Rakefile +12 -0
  16. data/TODO.md +32 -0
  17. data/bin/console +15 -0
  18. data/bin/setup +8 -0
  19. data/exe/sz +25 -0
  20. data/images/create.png +0 -0
  21. data/images/error.png +0 -0
  22. data/images/home.png +0 -0
  23. data/images/index.png +0 -0
  24. data/images/login.png +0 -0
  25. data/images/mobile.png +0 -0
  26. data/lib/schienenzeppelin.rb +18 -0
  27. data/lib/schienenzeppelin/app_builder.rb +88 -0
  28. data/lib/schienenzeppelin/app_generator.rb +95 -0
  29. data/lib/schienenzeppelin/helper_base.rb +28 -0
  30. data/lib/schienenzeppelin/helpers/annotate.rb +11 -0
  31. data/lib/schienenzeppelin/helpers/capistrano.rb +35 -0
  32. data/lib/schienenzeppelin/helpers/continuous_integration.rb +12 -0
  33. data/lib/schienenzeppelin/helpers/credentials.rb +49 -0
  34. data/lib/schienenzeppelin/helpers/devise.rb +45 -0
  35. data/lib/schienenzeppelin/helpers/errors.rb +67 -0
  36. data/lib/schienenzeppelin/helpers/factory_bot.rb +13 -0
  37. data/lib/schienenzeppelin/helpers/generators.rb +26 -0
  38. data/lib/schienenzeppelin/helpers/high_voltage.rb +11 -0
  39. data/lib/schienenzeppelin/helpers/home.rb +17 -0
  40. data/lib/schienenzeppelin/helpers/hotwire.rb +11 -0
  41. data/lib/schienenzeppelin/helpers/pundit.rb +12 -0
  42. data/lib/schienenzeppelin/helpers/rspec.rb +13 -0
  43. data/lib/schienenzeppelin/helpers/rubocop.rb +11 -0
  44. data/lib/schienenzeppelin/helpers/scaffold.rb +11 -0
  45. data/lib/schienenzeppelin/helpers/services.rb +11 -0
  46. data/lib/schienenzeppelin/helpers/sidekiq.rb +13 -0
  47. data/lib/schienenzeppelin/helpers/stimulus.rb +11 -0
  48. data/lib/schienenzeppelin/helpers/stimulus_components.rb +29 -0
  49. data/lib/schienenzeppelin/helpers/tailwind.rb +18 -0
  50. data/lib/schienenzeppelin/version.rb +7 -0
  51. data/schienenzeppelin.gemspec +37 -0
  52. data/schienenzeppelin.jpg +0 -0
  53. data/script.md +104 -0
  54. data/templates/.dockerignore.erb +51 -0
  55. data/templates/.entrypoint.sh.erb +16 -0
  56. data/templates/.env.development.erb +3 -0
  57. data/templates/.foreman.erb +1 -0
  58. data/templates/.github/workflows/build.yml.erb +49 -0
  59. data/templates/.gitignore.erb +285 -0
  60. data/templates/.irbrc.erb +12 -0
  61. data/templates/.rubocop.yml.erb +37 -0
  62. data/templates/.tool-versions.erb +1 -0
  63. data/templates/Capfile.erb +24 -0
  64. data/templates/Dockerfile.erb +45 -0
  65. data/templates/Gemfile.erb +122 -0
  66. data/templates/Procfile.dev.erb +6 -0
  67. data/templates/Procfile.erb +2 -0
  68. data/templates/README.md.erb +43 -0
  69. data/templates/app/controllers/authorized_controller.rb.erb +10 -0
  70. data/templates/app/controllers/errors_controller.rb.erb +24 -0
  71. data/templates/app/javascript/images/checkmark.svg +1 -0
  72. data/templates/app/javascript/images/logo.svg +1 -0
  73. data/templates/app/javascript/stylesheets/components.scss +206 -0
  74. data/templates/app/policies/application_policy.rb +55 -0
  75. data/templates/app/services/application_service.rb +14 -0
  76. data/templates/app/views/devise/confirmations/new.html.erb +24 -0
  77. data/templates/app/views/devise/passwords/edit.html.erb +34 -0
  78. data/templates/app/views/devise/passwords/new.html.erb +23 -0
  79. data/templates/app/views/devise/registrations/edit.html.erb +62 -0
  80. data/templates/app/views/devise/registrations/new.html.erb +45 -0
  81. data/templates/app/views/devise/sessions/new.html.erb +33 -0
  82. data/templates/app/views/devise/shared/_error_messages.html.erb +15 -0
  83. data/templates/app/views/devise/shared/_form_wrap.html.erb +5 -0
  84. data/templates/app/views/devise/shared/_links.html.erb +25 -0
  85. data/templates/app/views/devise/unlocks/new.html.erb +22 -0
  86. data/templates/app/views/errors/internal_error.html.erb +14 -0
  87. data/templates/app/views/errors/not_found.html.erb +14 -0
  88. data/templates/app/views/errors/unacceptable.html.erb +14 -0
  89. data/templates/app/views/layouts/application.html.erb.tt +30 -0
  90. data/templates/app/views/pages/home.html.erb.tt +20 -0
  91. data/templates/app/views/shared/_flashes.html.erb.tt +12 -0
  92. data/templates/app/views/shared/_footer.html.erb.tt +21 -0
  93. data/templates/app/views/shared/_navbar.html.erb.tt +40 -0
  94. data/templates/bin/setup.erb +146 -0
  95. data/templates/config/credentials.yml.erb +7 -0
  96. data/templates/config/initializers/high_voltage.rb +6 -0
  97. data/templates/config/initializers/lograge.rb +5 -0
  98. data/templates/config/initializers/sidekiq.rb +10 -0
  99. data/templates/config/postgresql.yml.erb +23 -0
  100. data/templates/docker-compose.yml.erb +21 -0
  101. data/templates/lib/capistrano/tasks/seeds.rake +12 -0
  102. data/templates/lib/capistrano/tasks/sidekiq.rake +36 -0
  103. data/templates/lib/generators/rails/navigation/USAGE +6 -0
  104. data/templates/lib/generators/rails/navigation/navigation_generator.rb +15 -0
  105. data/templates/lib/generators/rails/scaffold_controller_generator.rb +12 -0
  106. data/templates/lib/tasks/auto_annotate_models.rake +58 -0
  107. data/templates/lib/templates/erb/scaffold/_form.html.erb +39 -0
  108. data/templates/lib/templates/erb/scaffold/edit.html.erb +7 -0
  109. data/templates/lib/templates/erb/scaffold/index.html.erb +34 -0
  110. data/templates/lib/templates/erb/scaffold/new.html.erb +7 -0
  111. data/templates/lib/templates/erb/scaffold/show.html.erb +18 -0
  112. data/templates/public/500.html.erb +26 -0
  113. data/templates/spec/rails_helper.rb +26 -0
  114. data/templates/spec/spec_helper.rb +61 -0
  115. data/templates/spec/support/factory_bot.rb +5 -0
  116. data/templates/spec/support/shoulda_matchers.rb +8 -0
  117. metadata +179 -0
@@ -0,0 +1 @@
1
+ ruby <%= RUBY_VERSION %>
@@ -0,0 +1,24 @@
1
+ # Load DSL and set up stages
2
+ require 'capistrano/setup'
3
+
4
+ # Include default deployment tasks
5
+ require 'capistrano/deploy'
6
+
7
+ require 'capistrano/scm/git'
8
+ install_plugin Capistrano::SCM::Git
9
+
10
+ require 'capistrano/rails'
11
+ require 'capistrano/rbenv'
12
+ require 'capistrano/passenger'
13
+
14
+ # Load custom tasks from `lib/capistrano/tasks` if you have any defined
15
+ Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
16
+ set :rbenv_type, :user
17
+ set :rbenv_ruby, '<%= RUBY_VERSION %>'
18
+
19
+ # Sidekiq lifecycle tasks
20
+ after 'deploy:starting', 'sidekiq:quiet'
21
+ after 'deploy:updated', 'sidekiq:stop'
22
+ after 'deploy:published', 'sidekiq:start'
23
+ after 'deploy:failed', 'sidekiq:restart'
24
+
@@ -0,0 +1,45 @@
1
+ FROM ruby:3.0-slim as cache
2
+
3
+ RUN apt-get update -qq && apt-get install -y \
4
+ curl \
5
+ build-essential \
6
+ libpq-dev \
7
+ postgresql-client
8
+ RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
9
+
10
+ RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
11
+ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
12
+
13
+ RUN apt-get update -qq && apt-get install -y yarn
14
+
15
+ WORKDIR /bookstore
16
+ COPY Gemfile /<%= app_name %>/Gemfile
17
+ COPY Gemfile.lock /<%= app_name %>/Gemfile.lock
18
+ COPY package.json /<%= app_name %>/package.json
19
+ COPY yarn.lock /<%= app_name %>/yarn.lock
20
+
21
+ RUN bundle install --without development
22
+ RUN yarn install
23
+
24
+ FROM cache
25
+ COPY . /bookstore
26
+
27
+ ARG DATABASE_HOST=db
28
+ ARG RAILS_ENV=production
29
+
30
+ ENV DATABASE_HOST=$DATABASE_HOST
31
+ ENV RAILS_ENV=$RAILS_ENV
32
+
33
+ ENV RAILS_LOG_TO_STDOUT=true
34
+ ENV RAILS_SERVE_STATIC_FILES=true
35
+
36
+ RUN bundle exec rails assets:precompile
37
+
38
+ COPY entrypoint.sh /usr/bin/
39
+ RUN chmod +x /usr/bin/entrypoint.sh
40
+ ENTRYPOINT ["entrypoint.sh"]
41
+
42
+ EXPOSE 3000
43
+
44
+ # Start the main process.
45
+ CMD ["rails", "server", "-b", "0.0.0.0"]
@@ -0,0 +1,122 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ ruby <%= "'#{RUBY_VERSION}'" -%>
5
+
6
+ <% unless gemfile_entries.first&.comment -%>
7
+
8
+ <% end -%>
9
+ <% gemfile_entries.each do |gem| -%>
10
+ <% if gem.comment -%>
11
+
12
+ # <%= gem.comment %>
13
+ <% end -%>
14
+ <%= gem.commented_out ? '# ' : '' %>gem '<%= gem.name %>'<%= %(, '#{gem.version}') if gem.version -%>
15
+ <% if gem.options.any? -%>
16
+ , <%= gem.options.map { |k,v|
17
+ "#{k}: #{v.inspect.gsub('"', '\'')}" }.join(', ') %>
18
+ <% end -%>
19
+ <% end -%>
20
+
21
+ # Use Active Model has_secure_password
22
+ # gem 'bcrypt', '~> 3.1.7'
23
+ <% unless skip_active_storage? -%>
24
+
25
+ # Use Active Storage variant
26
+ # gem 'image_processing', '~> 1.2'
27
+ <% end -%>
28
+
29
+ # Jb is a faster alternative to jbuilder"
30
+ gem 'jb', '~> 0.8'
31
+ # A fast JSON parser and Object marshaller
32
+ gem 'oj', '~> 3.11'
33
+ # An attempt to tame noisy Rails logs
34
+ gem "lograge"
35
+ # Minimal and simple authorization through OO
36
+ gem 'pundit', '~> 2.1'
37
+ # Flexible authentication solution for Rails with Warden
38
+ gem 'devise', '~> 4.7'
39
+
40
+ # A Rails engine for static pages
41
+ gem 'high_voltage', '~> 3.1'
42
+ # Hotwire is an alternative approach to building modern web applications
43
+ gem 'hotwire-rails'
44
+ # Add javascript sprinkles to your views
45
+ gem 'stimulus-rails'
46
+ # Tailwind CSS for Rails
47
+ gem 'tailwindcss-rails'
48
+ # Embedded SVGs for easy styling
49
+ gem 'inline_svg'
50
+
51
+ # Simple, efficient background processing alternative to ActiveJob
52
+ gem 'sidekiq', '~> 6.1'
53
+
54
+ <% if depend_on_bootsnap? -%>
55
+ # Reduces boot times through caching; required in config/boot.rb
56
+ gem 'bootsnap', '>= 1.4.4', require: false
57
+
58
+ <%- end -%>
59
+ <%- if options.api? -%>
60
+ # Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
61
+ # gem 'rack-cors'
62
+
63
+ <%- end -%>
64
+ <% if RUBY_ENGINE == 'ruby' -%>
65
+ group :development, :test do
66
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
67
+ gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
68
+ # A convenient way to manage environment variables
69
+ gem 'dotenv-rails'
70
+ gem 'rubocop', '~> 1.10', require: false
71
+ <%- unless options[:skip_rspec] -%>
72
+ gem "rspec-rails"
73
+ <% end -%>
74
+ <%- unless options[:skip_factory_bot] -%>
75
+ gem "factory_bot_rails"
76
+ <% end -%>
77
+ end
78
+
79
+ <% end -%>
80
+ group :development do
81
+ # Add a comment summarizing the current schema to your code
82
+ gem 'annotate', '~> 3.1'
83
+ <%- unless options.api? || options.skip_dev_gems? -%>
84
+ # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
85
+ <%- if options.dev? || options.edge? || options.main? -%>
86
+ gem 'web-console', github: 'rails/web-console'
87
+ <%- else -%>
88
+ gem 'web-console', '>= 4.1.0'
89
+ <%- end -%>
90
+ # Display performance information such as SQL time and flame graphs for each request in your browser.
91
+ # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
92
+ gem 'rack-mini-profiler', '~> 2.0'
93
+ <%- end -%>
94
+ <% if depend_on_listen? -%>
95
+ gem 'listen', '~> 3.3'
96
+ <% end -%>
97
+ <% if spring_install? -%>
98
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
99
+ gem 'spring'
100
+ <% end -%>
101
+ # Capistrano is used to deploy your application
102
+ gem "capistrano", "~> 3.15", require: false
103
+ gem "capistrano-rails", "~> 1.6", require: false
104
+ gem 'capistrano-passenger', '~> 0.2.0', require: false
105
+ gem 'capistrano-rbenv', '~> 2.2', '>= 2.1.4', require: false
106
+ end
107
+
108
+ group :test do
109
+ <%- unless options[:skip_shoulda] -%>
110
+ gem "shoulda-matchers"
111
+ <% end -%>
112
+ <%- if depends_on_system_test? -%>
113
+ # Adds support for Capybara system testing and selenium driver
114
+ gem 'capybara', '>= 3.26'
115
+ gem 'selenium-webdriver'
116
+ # Easy installation and use of web drivers to run system tests with browsers
117
+ gem 'webdrivers'
118
+ <%- end -%>
119
+ end
120
+
121
+ # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
122
+ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -0,0 +1,6 @@
1
+ docker: docker-compose up --scale <%= app_name %>=0
2
+ <%- unless options[:skip_sidekiq] -%>
3
+ sidekiq: bundle exec sidekiq
4
+ <% end -%>
5
+ webpack: bundle exec bin/webpack-dev-server
6
+ web: bundle exec rails server -p 3000
@@ -0,0 +1,2 @@
1
+ web: rails server
2
+ worker: sidekiq
@@ -0,0 +1,43 @@
1
+ # <%= app_name.humanize %>
2
+
3
+ ## Running your App
4
+
5
+ The simplest way to start this up is by using [docker-compose](https://docs.docker.com/compose/):
6
+
7
+ ```bash
8
+ docker-compose up
9
+ ```
10
+
11
+ ```
12
+ rails db:setup
13
+ rails db:migrate
14
+ rails server
15
+ ```
16
+
17
+ Open your browser on [localhost:3000](http://localhost:3000).
18
+
19
+ ## Development
20
+
21
+ This app was generated using [Schienenzeppelin](https://github.com/hschne/schienenzeppelin) - there are tons of little tweaks to simplify your development workflow.
22
+
23
+ For more details refer to the [Documentation](https://github.com/hschne/schienenzeppelin)
24
+
25
+ ## Deployment
26
+
27
+ Deploy this application using Capistrano. Make sure you have a server set up and edit [deploy.rb](./config/deploy.rb) and [config/production.rb](./config/deploy/production.rb).
28
+
29
+ ``` ruby
30
+ # deploy.rb
31
+ set :repo_url, "git@github.com:user/your-project.git"
32
+
33
+ # production.rb
34
+ server "myserver.com", user: "deploy", roles: %w{app db web}
35
+ ```
36
+
37
+ Then run:
38
+
39
+ ```bash
40
+ cap production deploy
41
+ ```
42
+
43
+ For more information on how to prepare a server for deployment you can follow [this guide](https://gorails.com/deploy/ubuntu/20.04).
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AuthorizedController < ApplicationController
4
+ include Pundit
5
+
6
+ before_action :authenticate_user!
7
+
8
+ after_action :verify_authorized, except: :index
9
+ after_action :verify_policy_scoped, only: :index
10
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ErrorsController < ApplicationController
4
+ def not_found
5
+ respond_to do |format|
6
+ format.html { render status: 404 }
7
+ format.json { render json: { error: 'Resource not found' }, status: 404 }
8
+ end
9
+ end
10
+
11
+ def unacceptable
12
+ respond_to do |format|
13
+ format.html { render status: 422 }
14
+ format.json { render json: { error: 'Params unacceptable' }, status: 422 }
15
+ end
16
+ end
17
+
18
+ def internal_error
19
+ respond_to do |format|
20
+ format.html { render status: 500 }
21
+ format.json { render json: { error: 'Internal server error' }, status: 500 }
22
+ end
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ <svg fill="#fff" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 92.81 122.88" style="enable-background:new 0 0 92.81 122.88" xml:space="preserve"><style type="text/css">.st0{fill-rule:evenodd;clip-rule:evenodd;}</style><g><path class="st0" d="M66.69,101.35H26.68l-4.7,6.94h49.24L66.69,101.35L66.69,101.35z M17.56,114.81l-5.47,8.07H0l19.64-29.46 h-3.49c-4.76,0-8.66-3.9-8.66-8.66V8.66C7.5,3.9,11.39,0,16.15,0h61.22c4.76,0,8.66,3.9,8.66,8.66v76.1c0,4.76-3.9,8.66-8.66,8.66 h-3.4l18.83,29.04H80.45l-4.99-7.65H17.56L17.56,114.81z M62.97,67.66h10.48c1.14,0,2.07,0.93,2.07,2.07V80.2 c0,1.14-0.93,2.07-2.07,2.07H62.97c-1.14,0-2.07-0.93-2.07-2.07V69.72C60.9,68.59,61.83,67.66,62.97,67.66L62.97,67.66z M18.98,67.66h10.48c1.14,0,2.07,0.93,2.07,2.07V80.2c0,1.14-0.93,2.07-2.07,2.07H18.98c-1.14,0-2.07-0.93-2.07-2.07V69.72 C16.91,68.59,17.84,67.66,18.98,67.66L18.98,67.66z M25.1,16.7h42.81c4.6,0,8.36,3.76,8.36,8.37v13.17c0,4.6-3.76,8.36-8.36,8.36 H25.1c-4.6,0-8.36-3.76-8.36-8.36V25.07C16.74,20.47,20.5,16.7,25.1,16.7L25.1,16.7z M38.33,3.8h16.2C55.34,3.8,56,4.46,56,5.27 v6.38c0,0.81-0.66,1.47-1.47,1.47h-16.2c-0.81,0-1.47-0.66-1.47-1.47V5.27C36.85,4.46,37.51,3.8,38.33,3.8L38.33,3.8z"/></g></svg>
@@ -0,0 +1,206 @@
1
+
2
+ .btn {
3
+ @apply font-normal text-base rounded cursor-pointer border border-transparent appearance-none inline-block select-none leading-normal antialiased align-baseline;
4
+
5
+ padding: 0.35rem 0.75rem;
6
+ transition: 0.15s ease;
7
+
8
+ }
9
+
10
+ .btn-default {
11
+ @apply bg-white border border-gray-400 text-gray-700;
12
+
13
+ &:hover,
14
+ &:focus {
15
+ @apply border-gray-700;
16
+ }
17
+ }
18
+
19
+ .btn-blue {
20
+ @apply bg-blue-600 text-white;
21
+
22
+ &:hover,
23
+ &:focus {
24
+ @apply bg-blue-700;
25
+ }
26
+
27
+ &.btn-outline {
28
+ @apply bg-transparent text-blue-600 border border-blue-600;
29
+
30
+ &:hover,
31
+ &:focus {
32
+ @apply bg-blue-600 text-white;
33
+ }
34
+ }
35
+ }
36
+
37
+ .btn-group {
38
+ .btn {
39
+ @apply rounded-none;
40
+
41
+ &:first-child {
42
+ @apply rounded-tr-none rounded-br-none border-r-0 rounded-tl rounded-bl;
43
+ }
44
+
45
+ &:last-child {
46
+ @apply rounded-tl-none rounded-bl-none border-l-0 rounded-tr rounded-br;
47
+ }
48
+ }
49
+ }
50
+
51
+ %focus-style {
52
+ @apply shadow outline-none border-gray-500;
53
+
54
+ box-shadow: 0 0 0 0.2rem theme("colors.gray.200");
55
+ background-clip: padding-box;
56
+ }
57
+
58
+ .input {
59
+ @apply appearance-none block w-full text-gray-700 border border-gray-400 rounded px-3 leading-tight bg-white shadow-inner;
60
+ padding-top: .65rem;
61
+ padding-bottom: .65rem;
62
+ }
63
+
64
+ .input:focus,
65
+ .input:hover {
66
+ @extend %focus-style;
67
+ }
68
+
69
+ .label {
70
+ @apply block text-gray-700 text-sm font-bold mb-2;
71
+ }
72
+
73
+ .select {
74
+ @apply appearance-none py-3 px-4 pr-8 block w-full bg-white border border-gray-300 text-gray-700 rounded leading-tight;
75
+ -webkit-appearance: none;
76
+
77
+ }
78
+
79
+ .select:focus {
80
+ @apply outline-none border-gray-400;
81
+
82
+ box-shadow: 0 0 0 0.2rem theme("colors.gray.100");
83
+ background-clip: padding-box;
84
+ }
85
+
86
+ .caret {
87
+ @apply pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-800;
88
+ }
89
+
90
+ .input-group {
91
+ @apply mb-6;
92
+ }
93
+
94
+ .input-file {
95
+ height: auto;
96
+ z-index: 2;
97
+ cursor: pointer;
98
+
99
+ @apply inline-block opacity-0 pl-0 pr-0 py-3 px-3 overflow-hidden absolute border-none;
100
+
101
+ + label {
102
+ @extend .btn;
103
+ @extend .btn-default;
104
+
105
+ @apply cursor-pointer inline-flex items-center justify-start w-auto;
106
+
107
+ * {
108
+ pointer-events: none;
109
+ }
110
+
111
+ &:focus {
112
+ outline: 1px dotted #000;
113
+ outline: -webkit-focus-ring-color auto 5px;
114
+ }
115
+ }
116
+ }
117
+
118
+ .input-checkbox {
119
+ @apply flex items-center justify-start;
120
+
121
+ input[type="checkbox"] {
122
+ @apply hidden appearance-none;
123
+
124
+ &:checked ~ label:before {
125
+ content: "";
126
+ background-image: url('~images/checkmark.svg');
127
+ background-size: 10px 10px;
128
+ border-radius: 2px;
129
+ @apply bg-blue-500 border-transparent text-white bg-no-repeat bg-center transition ease-in-out duration-100 shadow-none;
130
+ }
131
+
132
+ &:disabled {
133
+ @apply pointer-events-none opacity-50;
134
+ }
135
+ }
136
+
137
+ label {
138
+ @apply cursor-pointer appearance-none;
139
+
140
+ &:before {
141
+ border-radius: 2px;
142
+ border: 1px solid rgb(209, 209, 209);
143
+ box-shadow: inset 0 1px 1px rgba(#ddd, .8);
144
+ content: "";
145
+ height: 16px;
146
+ margin-right: 10px;
147
+ top: -5px;
148
+ width: 16px;
149
+
150
+ @apply bg-white inline-flex items-center justify-center relative transition ease-in-out duration-200;
151
+
152
+ }
153
+
154
+ &:hover::before {
155
+ @apply bg-gray-100 border-gray-500;
156
+ }
157
+ }
158
+ }
159
+
160
+ .input-radio {
161
+ @apply flex items-center justify-start;
162
+
163
+ input[type="radio"] {
164
+ @apply hidden appearance-none;
165
+
166
+ &:checked ~ label:before {
167
+ content: "";
168
+ @apply bg-blue-500 border-transparent text-white transition ease-in-out duration-100 shadow-none;
169
+ }
170
+
171
+ &:checked ~ label:after {
172
+ @apply bg-white rounded-full;
173
+ content: "";
174
+ width: 6px;
175
+ height: 6px;
176
+ position: absolute;
177
+ top: 8px;
178
+ left: 5px;
179
+ box-shadow: 0 1px 1px rgba(#2B6CB0, .9);
180
+ }
181
+
182
+ &:disabled {
183
+ @apply pointer-events-none opacity-50;
184
+ }
185
+ }
186
+
187
+ label {
188
+ @apply cursor-pointer appearance-none relative;
189
+
190
+ &:before {
191
+ border: 1px solid rgb(209, 209, 209);
192
+ box-shadow: inset 0 1px 1px rgba(#ddd, .8);
193
+ content: "";
194
+ height: 16px;
195
+ margin-right: 4px;
196
+ top: -5px;
197
+ width: 16px;
198
+
199
+ @apply bg-white inline-flex items-center justify-center relative transition ease-in-out duration-200 rounded-full;
200
+ }
201
+
202
+ &:hover::before {
203
+ @apply bg-gray-100 border-gray-500;
204
+ }
205
+ }
206
+ }