rails_bootstrap_form 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/assets/stylesheets/rails_bootstrap_form.css +1 -0
- data/demo/.ruby-version +1 -0
- data/demo/Rakefile +10 -0
- data/demo/app/assets/config/manifest.js +1 -0
- data/demo/app/assets/stylesheets/application.scss +3 -0
- data/demo/app/channels/application_cable/channel.rb +8 -0
- data/demo/app/channels/application_cable/connection.rb +8 -0
- data/demo/app/controllers/application_controller.rb +6 -0
- data/demo/app/helpers/application_helper.rb +6 -0
- data/demo/app/jobs/application_job.rb +6 -0
- data/demo/app/mailers/application_mailer.rb +8 -0
- data/demo/app/models/application_record.rb +7 -0
- data/demo/app/views/layouts/application.html.erb +15 -0
- data/demo/bin/bundle +111 -0
- data/demo/bin/rails +8 -0
- data/demo/bin/rake +8 -0
- data/demo/bin/setup +37 -0
- data/demo/config/application.rb +28 -0
- data/demo/config/boot.rb +9 -0
- data/demo/config/cable.yml +10 -0
- data/demo/config/database.yml +25 -0
- data/demo/config/environment.rb +9 -0
- data/demo/config/environments/development.rb +74 -0
- data/demo/config/environments/production.rb +97 -0
- data/demo/config/environments/test.rb +64 -0
- data/demo/config/initializers/assets.rb +16 -0
- data/demo/config/initializers/content_security_policy.rb +29 -0
- data/demo/config/initializers/filter_parameter_logging.rb +12 -0
- data/demo/config/initializers/inflections.rb +20 -0
- data/demo/config/initializers/permissions_policy.rb +17 -0
- data/demo/config/initializers/rails_bootstrap_form.rb +10 -0
- data/demo/config/locales/en.rb +16 -0
- data/demo/config/puma.rb +47 -0
- data/demo/config/routes.rb +6 -0
- data/demo/config/storage.yml +34 -0
- data/demo/config.ru +10 -0
- data/demo/db/seeds.rb +3 -0
- data/demo/public/favicon.ico +0 -0
- data/lib/generators/rails_bootstrap_form/install_generator.rb +25 -0
- data/lib/generators/rails_bootstrap_form/templates/install.rb +10 -0
- data/lib/rails_bootstrap_form/configuration.rb +26 -0
- data/lib/rails_bootstrap_form/version.rb +1 -1
- data/lib/rails_bootstrap_form.rb +9 -1
- metadata +42 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2ee7dc67b6fc5b01acdcdda6bb86a228a3aaffa3279e4f13b512d806483a972
|
4
|
+
data.tar.gz: 86387e4cf163ee56a24793b8ec4ac185b6faccd4862faeca3a652fd4b89144aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05f729ca9e103345b2f8d0dc95f0ed9e5a9e442c690a6a1b885162d9c31ae3b77fdd321d48aa8af7b23358e4e5bce8747e005bf88f6b2988e53ce5a97f71ea80
|
7
|
+
data.tar.gz: 9cb29fb1b803ca07e28c033c1ece4b3116593c4438c646aef8f4c1b2b2ba7e2c1768b27086334cea66b2acf71cd9e20ccf6a4f91548beb90e8edaafb5e2f6985
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/demo/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-3.2.2
|
data/demo/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
6
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
7
|
+
|
8
|
+
require_relative "config/application"
|
9
|
+
|
10
|
+
Rails.application.load_tasks
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets .css
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>RailsBootstrapForms - Demo Application</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
<%= stylesheet_link_tag "application" %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="container-fluid p-3">
|
12
|
+
<%= yield %>
|
13
|
+
</div>
|
14
|
+
</body>
|
15
|
+
</html>
|
data/demo/bin/bundle
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# -*- frozen_string_literal: true -*-
|
4
|
+
# -*- warn_indent: true -*-
|
5
|
+
|
6
|
+
#
|
7
|
+
# This file was generated by Bundler.
|
8
|
+
#
|
9
|
+
# The application 'bundle' is installed as part of a gem, and
|
10
|
+
# this file is here to facilitate running it.
|
11
|
+
#
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
|
15
|
+
m = Module.new do
|
16
|
+
module_function
|
17
|
+
|
18
|
+
def invoked_as_script?
|
19
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
20
|
+
end
|
21
|
+
|
22
|
+
def env_var_version
|
23
|
+
ENV["BUNDLER_VERSION"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def cli_arg_version
|
27
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
28
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
29
|
+
bundler_version = nil
|
30
|
+
update_index = nil
|
31
|
+
ARGV.each_with_index do |a, i|
|
32
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
33
|
+
bundler_version = a
|
34
|
+
end
|
35
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
36
|
+
bundler_version = $1
|
37
|
+
update_index = i
|
38
|
+
end
|
39
|
+
bundler_version
|
40
|
+
end
|
41
|
+
|
42
|
+
def gemfile
|
43
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
44
|
+
return gemfile if gemfile && !gemfile.empty?
|
45
|
+
|
46
|
+
File.expand_path("../Gemfile", __dir__)
|
47
|
+
end
|
48
|
+
|
49
|
+
def lockfile
|
50
|
+
lockfile =
|
51
|
+
case File.basename(gemfile)
|
52
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
53
|
+
else "#{gemfile}.lock"
|
54
|
+
end
|
55
|
+
File.expand_path(lockfile)
|
56
|
+
end
|
57
|
+
|
58
|
+
def lockfile_version
|
59
|
+
return unless File.file?(lockfile)
|
60
|
+
lockfile_contents = File.read(lockfile)
|
61
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
62
|
+
Regexp.last_match(1)
|
63
|
+
end
|
64
|
+
|
65
|
+
def bundler_requirement
|
66
|
+
@bundler_requirement ||=
|
67
|
+
env_var_version ||
|
68
|
+
cli_arg_version ||
|
69
|
+
bundler_requirement_for(lockfile_version)
|
70
|
+
end
|
71
|
+
|
72
|
+
def bundler_requirement_for(version)
|
73
|
+
return "#{Gem::Requirement.default}.a" unless version
|
74
|
+
|
75
|
+
bundler_gem_version = Gem::Version.new(version)
|
76
|
+
|
77
|
+
bundler_gem_version.approximate_recommendation
|
78
|
+
end
|
79
|
+
|
80
|
+
def load_bundler!
|
81
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
82
|
+
|
83
|
+
activate_bundler
|
84
|
+
end
|
85
|
+
|
86
|
+
def activate_bundler
|
87
|
+
gem_error = activation_error_handling do
|
88
|
+
gem "bundler", bundler_requirement
|
89
|
+
end
|
90
|
+
return if gem_error.nil?
|
91
|
+
require_error = activation_error_handling do
|
92
|
+
require "bundler/version"
|
93
|
+
end
|
94
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
95
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
96
|
+
exit 42
|
97
|
+
end
|
98
|
+
|
99
|
+
def activation_error_handling
|
100
|
+
yield
|
101
|
+
nil
|
102
|
+
rescue StandardError, LoadError => e
|
103
|
+
e
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
m.load_bundler!
|
108
|
+
|
109
|
+
if m.invoked_as_script?
|
110
|
+
load Gem.bin_path("bundler", "bundle")
|
111
|
+
end
|
data/demo/bin/rails
ADDED
data/demo/bin/rake
ADDED
data/demo/bin/setup
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# -*- frozen_string_literal: true -*-
|
4
|
+
# -*- warn_indent: true -*-
|
5
|
+
|
6
|
+
require "fileutils"
|
7
|
+
|
8
|
+
# path to your application root.
|
9
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
10
|
+
|
11
|
+
def system!(*args)
|
12
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
13
|
+
end
|
14
|
+
|
15
|
+
FileUtils.chdir APP_ROOT do
|
16
|
+
# This script is a way to set up or update your development environment automatically.
|
17
|
+
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
18
|
+
# Add necessary setup steps to this file.
|
19
|
+
|
20
|
+
puts "== Installing dependencies =="
|
21
|
+
system! "gem install bundler --conservative"
|
22
|
+
system("bundle check") || system!("bundle install")
|
23
|
+
|
24
|
+
# puts "\n== Copying sample files =="
|
25
|
+
# unless File.exist?("config/database.yml")
|
26
|
+
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
27
|
+
# end
|
28
|
+
|
29
|
+
puts "\n== Preparing database =="
|
30
|
+
system! "bin/rails db:prepare"
|
31
|
+
|
32
|
+
puts "\n== Removing old logs and tempfiles =="
|
33
|
+
system! "bin/rails log:clear tmp:clear"
|
34
|
+
|
35
|
+
puts "\n== Restarting application server =="
|
36
|
+
system! "bin/rails restart"
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
require_relative "boot"
|
6
|
+
|
7
|
+
require "rails/all"
|
8
|
+
|
9
|
+
# Require the gems listed in Gemfile, including any gems
|
10
|
+
# you've limited to :test, :development, or :production.
|
11
|
+
Bundler.require(*Rails.groups)
|
12
|
+
|
13
|
+
module Demo
|
14
|
+
class Application < Rails::Application
|
15
|
+
# Initialize configuration defaults for originally generated Rails version.
|
16
|
+
config.load_defaults 7.0
|
17
|
+
|
18
|
+
# Configuration for the application, engines, and railties goes here.
|
19
|
+
#
|
20
|
+
# These settings can be overridden in specific environments using the files
|
21
|
+
# in config/environments, which are processed later.
|
22
|
+
#
|
23
|
+
# config.time_zone = "Central Time (US & Canada)"
|
24
|
+
# config.eager_load_paths << Rails.root.join("extras")
|
25
|
+
|
26
|
+
config.i18n.load_path += Dir[Rails.root.join("config", "locales", "**", "*.{rb,yml,yaml}")]
|
27
|
+
end
|
28
|
+
end
|
data/demo/config/boot.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Set up gems listed in the Gemfile.
|
6
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__)
|
7
|
+
|
8
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
9
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite. Versions 3.8.0 and up are supported.
|
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
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
require "active_support/core_ext/integer/time"
|
6
|
+
|
7
|
+
Rails.application.configure do
|
8
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
9
|
+
|
10
|
+
# In the development environment your application's code is reloaded any time
|
11
|
+
# it changes. This slows down response time but is perfect for development
|
12
|
+
# since you don't have to restart the web server when you make code changes.
|
13
|
+
config.cache_classes = false
|
14
|
+
|
15
|
+
# Do not eager load code on boot.
|
16
|
+
config.eager_load = false
|
17
|
+
|
18
|
+
# Show full error reports.
|
19
|
+
config.consider_all_requests_local = true
|
20
|
+
|
21
|
+
# Enable server timing
|
22
|
+
config.server_timing = true
|
23
|
+
|
24
|
+
# Enable/disable caching. By default caching is disabled.
|
25
|
+
# Run rails dev:cache to toggle caching.
|
26
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
27
|
+
config.action_controller.perform_caching = true
|
28
|
+
config.action_controller.enable_fragment_cache_logging = true
|
29
|
+
|
30
|
+
config.cache_store = :memory_store
|
31
|
+
config.public_file_server.headers = {
|
32
|
+
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
33
|
+
}
|
34
|
+
else
|
35
|
+
config.action_controller.perform_caching = false
|
36
|
+
|
37
|
+
config.cache_store = :null_store
|
38
|
+
end
|
39
|
+
|
40
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
41
|
+
config.active_storage.service = :local
|
42
|
+
|
43
|
+
# Don't care if the mailer can't send.
|
44
|
+
config.action_mailer.raise_delivery_errors = false
|
45
|
+
|
46
|
+
config.action_mailer.perform_caching = false
|
47
|
+
|
48
|
+
# Print deprecation notices to the Rails logger.
|
49
|
+
config.active_support.deprecation = :log
|
50
|
+
|
51
|
+
# Raise exceptions for disallowed deprecations.
|
52
|
+
config.active_support.disallowed_deprecation = :raise
|
53
|
+
|
54
|
+
# Tell Active Support which deprecation messages to disallow.
|
55
|
+
config.active_support.disallowed_deprecation_warnings = []
|
56
|
+
|
57
|
+
# Raise an error on page load if there are pending migrations.
|
58
|
+
config.active_record.migration_error = :page_load
|
59
|
+
|
60
|
+
# Highlight code that triggered database queries in logs.
|
61
|
+
config.active_record.verbose_query_logs = true
|
62
|
+
|
63
|
+
# Suppress logger output for asset requests.
|
64
|
+
config.assets.quiet = true
|
65
|
+
|
66
|
+
# Raises error for missing translations.
|
67
|
+
# config.i18n.raise_on_missing_translations = true
|
68
|
+
|
69
|
+
# Annotate rendered view with file names.
|
70
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
71
|
+
|
72
|
+
# Uncomment if you wish to allow Action Cable access from any origin.
|
73
|
+
# config.action_cable.disable_request_forgery_protection = true
|
74
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
require "active_support/core_ext/integer/time"
|
6
|
+
|
7
|
+
Rails.application.configure do
|
8
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
9
|
+
|
10
|
+
# Code is not reloaded between requests.
|
11
|
+
config.cache_classes = true
|
12
|
+
|
13
|
+
# Eager load code on boot. This eager loads most of Rails and
|
14
|
+
# your application in memory, allowing both threaded web servers
|
15
|
+
# and those relying on copy on write to perform better.
|
16
|
+
# Rake tasks automatically ignore this option for performance.
|
17
|
+
config.eager_load = true
|
18
|
+
|
19
|
+
# Full error reports are disabled and caching is turned on.
|
20
|
+
config.consider_all_requests_local = false
|
21
|
+
config.action_controller.perform_caching = true
|
22
|
+
|
23
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
24
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
25
|
+
# config.require_master_key = true
|
26
|
+
|
27
|
+
# Disable serving static files from the `/public` folder by default since
|
28
|
+
# Apache or NGINX already handles this.
|
29
|
+
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
|
30
|
+
|
31
|
+
# Compress CSS using a preprocessor.
|
32
|
+
# config.assets.css_compressor = :sass
|
33
|
+
|
34
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
35
|
+
config.assets.compile = false
|
36
|
+
|
37
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
38
|
+
# config.asset_host = "http://assets.example.com"
|
39
|
+
|
40
|
+
# Specifies the header that your server uses for sending files.
|
41
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
|
42
|
+
# config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
|
43
|
+
|
44
|
+
# Store uploaded files on the local file system (see config/storage.yml for options).
|
45
|
+
config.active_storage.service = :local
|
46
|
+
|
47
|
+
# Mount Action Cable outside main process or domain.
|
48
|
+
# config.action_cable.mount_path = nil
|
49
|
+
# config.action_cable.url = "wss://example.com/cable"
|
50
|
+
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
|
51
|
+
|
52
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
53
|
+
# config.force_ssl = true
|
54
|
+
|
55
|
+
# Include generic and useful information about system operation, but avoid logging too much
|
56
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII).
|
57
|
+
config.log_level = :info
|
58
|
+
|
59
|
+
# Prepend all log lines with the following tags.
|
60
|
+
config.log_tags = [ :request_id ]
|
61
|
+
|
62
|
+
# Use a different cache store in production.
|
63
|
+
# config.cache_store = :mem_cache_store
|
64
|
+
|
65
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
66
|
+
# config.active_job.queue_adapter = :resque
|
67
|
+
# config.active_job.queue_name_prefix = "demo_production"
|
68
|
+
|
69
|
+
config.action_mailer.perform_caching = false
|
70
|
+
|
71
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
72
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
73
|
+
# config.action_mailer.raise_delivery_errors = false
|
74
|
+
|
75
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
76
|
+
# the I18n.default_locale when a translation cannot be found).
|
77
|
+
config.i18n.fallbacks = true
|
78
|
+
|
79
|
+
# Don't log any deprecations.
|
80
|
+
config.active_support.report_deprecations = false
|
81
|
+
|
82
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
83
|
+
config.log_formatter = ::Logger::Formatter.new
|
84
|
+
|
85
|
+
# Use a different logger for distributed setups.
|
86
|
+
# require "syslog/logger"
|
87
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
|
88
|
+
|
89
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
90
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
91
|
+
logger.formatter = config.log_formatter
|
92
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Do not dump schema after migrations.
|
96
|
+
config.active_record.dump_schema_after_migration = false
|
97
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
require "active_support/core_ext/integer/time"
|
6
|
+
|
7
|
+
# The test environment is used exclusively to run your application's
|
8
|
+
# test suite. You never need to work with it otherwise. Remember that
|
9
|
+
# your test database is "scratch space" for the test suite and is wiped
|
10
|
+
# and recreated between test runs. Don't rely on the data there!
|
11
|
+
|
12
|
+
Rails.application.configure do
|
13
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
14
|
+
|
15
|
+
# Turn false under Spring and add config.action_view.cache_template_loading = true.
|
16
|
+
config.cache_classes = true
|
17
|
+
|
18
|
+
# Eager loading loads your whole application. When running a single test locally,
|
19
|
+
# this probably isn't necessary. It's a good idea to do in a continuous integration
|
20
|
+
# system, or in some way before deploying your code.
|
21
|
+
config.eager_load = ENV["CI"].present?
|
22
|
+
|
23
|
+
# Configure public file server for tests with Cache-Control for performance.
|
24
|
+
config.public_file_server.enabled = true
|
25
|
+
config.public_file_server.headers = {
|
26
|
+
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
27
|
+
}
|
28
|
+
|
29
|
+
# Show full error reports and disable caching.
|
30
|
+
config.consider_all_requests_local = true
|
31
|
+
config.action_controller.perform_caching = false
|
32
|
+
config.cache_store = :null_store
|
33
|
+
|
34
|
+
# Raise exceptions instead of rendering exception templates.
|
35
|
+
config.action_dispatch.show_exceptions = false
|
36
|
+
|
37
|
+
# Disable request forgery protection in test environment.
|
38
|
+
config.action_controller.allow_forgery_protection = false
|
39
|
+
|
40
|
+
# Store uploaded files on the local file system in a temporary directory.
|
41
|
+
config.active_storage.service = :test
|
42
|
+
|
43
|
+
config.action_mailer.perform_caching = false
|
44
|
+
|
45
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
46
|
+
# The :test delivery method accumulates sent emails in the
|
47
|
+
# ActionMailer::Base.deliveries array.
|
48
|
+
config.action_mailer.delivery_method = :test
|
49
|
+
|
50
|
+
# Print deprecation notices to the stderr.
|
51
|
+
config.active_support.deprecation = :stderr
|
52
|
+
|
53
|
+
# Raise exceptions for disallowed deprecations.
|
54
|
+
config.active_support.disallowed_deprecation = :raise
|
55
|
+
|
56
|
+
# Tell Active Support which deprecation messages to disallow.
|
57
|
+
config.active_support.disallowed_deprecation_warnings = []
|
58
|
+
|
59
|
+
# Raises error for missing translations.
|
60
|
+
# config.i18n.raise_on_missing_translations = true
|
61
|
+
|
62
|
+
# Annotate rendered view with file names.
|
63
|
+
# config.action_view.annotate_rendered_view_with_filenames = true
|
64
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
# Version of your assets, change this if you want to expire all your assets.
|
8
|
+
Rails.application.config.assets.version = "1.0"
|
9
|
+
|
10
|
+
# Add additional assets to the asset load path.
|
11
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
12
|
+
|
13
|
+
# Precompile additional assets.
|
14
|
+
# application.js, application.css, and all non-JS/CSS in the app/assets
|
15
|
+
# folder are already added.
|
16
|
+
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
# Define an application-wide content security policy.
|
8
|
+
# See the Securing Rails Applications Guide for more information:
|
9
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
10
|
+
|
11
|
+
# Rails.application.configure do
|
12
|
+
# config.content_security_policy do |policy|
|
13
|
+
# policy.default_src :self, :https
|
14
|
+
# policy.font_src :self, :https, :data
|
15
|
+
# policy.img_src :self, :https, :data
|
16
|
+
# policy.object_src :none
|
17
|
+
# policy.script_src :self, :https
|
18
|
+
# policy.style_src :self, :https
|
19
|
+
# # Specify URI for violation reports
|
20
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# # Generate session nonces for permitted importmap and inline scripts
|
24
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
25
|
+
# config.content_security_policy_nonce_directives = %w(script-src)
|
26
|
+
#
|
27
|
+
# # Report violations without enforcing the policy.
|
28
|
+
# # config.content_security_policy_report_only = true
|
29
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
|
8
|
+
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
|
9
|
+
# notations and behaviors.
|
10
|
+
Rails.application.config.filter_parameters += [
|
11
|
+
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
12
|
+
]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
# Add new inflection rules using the following format. Inflections
|
8
|
+
# are locale specific, and you may define rules for as many different
|
9
|
+
# locales as you wish. All of these examples are active by default:
|
10
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
11
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
12
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
13
|
+
# inflect.irregular "person", "people"
|
14
|
+
# inflect.uncountable %w( fish sheep )
|
15
|
+
# end
|
16
|
+
|
17
|
+
# These inflection rules are supported but not enabled by default:
|
18
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
19
|
+
# inflect.acronym "RESTful"
|
20
|
+
# end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
# Define an application-wide HTTP permissions policy. For further
|
8
|
+
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
9
|
+
#
|
10
|
+
# Rails.application.config.permissions_policy do |f|
|
11
|
+
# f.camera :none
|
12
|
+
# f.gyroscope :none
|
13
|
+
# f.microphone :none
|
14
|
+
# f.usb :none
|
15
|
+
# f.fullscreen :self
|
16
|
+
# f.payment :self, "https://secure.example.com"
|
17
|
+
# end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
RailsBootstrapForm.configure do |config|
|
8
|
+
# to make forms non-compliant with W3C.
|
9
|
+
config.default_form_attributes = {role: "form", novalidate: true}
|
10
|
+
end
|
data/demo/config/puma.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
6
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
7
|
+
# Any libraries that use thread pools should be configured to match
|
8
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
9
|
+
# and maximum; this matches the default thread size of Active Record.
|
10
|
+
#
|
11
|
+
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
12
|
+
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
|
13
|
+
threads min_threads_count, max_threads_count
|
14
|
+
|
15
|
+
# Specifies the `worker_timeout` threshold that Puma will use to wait before
|
16
|
+
# terminating a worker in development environments.
|
17
|
+
#
|
18
|
+
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
|
19
|
+
|
20
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
21
|
+
#
|
22
|
+
port ENV.fetch("PORT") { 3000 }
|
23
|
+
|
24
|
+
# Specifies the `environment` that Puma will run in.
|
25
|
+
#
|
26
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
27
|
+
|
28
|
+
# Specifies the `pidfile` that Puma will use.
|
29
|
+
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
30
|
+
|
31
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
32
|
+
# Workers are forked web server processes. If using threads and workers together
|
33
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
34
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
35
|
+
# processes).
|
36
|
+
#
|
37
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
38
|
+
|
39
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
40
|
+
# This directive tells Puma to first boot the application and load code
|
41
|
+
# before forking the application. This takes advantage of Copy On Write
|
42
|
+
# process behavior so workers use less memory.
|
43
|
+
#
|
44
|
+
# preload_app!
|
45
|
+
|
46
|
+
# Allow puma to be restarted by `bin/rails restart` command.
|
47
|
+
plugin :tmp_restart
|
@@ -0,0 +1,34 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket-<%= Rails.env %>
|
23
|
+
|
24
|
+
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# storage_account_name: your_account_name
|
28
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
29
|
+
# container: your_container_name-<%= Rails.env %>
|
30
|
+
|
31
|
+
# mirror:
|
32
|
+
# service: Mirror
|
33
|
+
# primary: local
|
34
|
+
# mirrors: [ amazon, google, microsoft ]
|
data/demo/config.ru
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# This file is used by Rack-based servers to start the application.
|
6
|
+
|
7
|
+
require_relative "config/environment"
|
8
|
+
|
9
|
+
run Rails.application
|
10
|
+
Rails.application.load_server
|
data/demo/db/seeds.rb
ADDED
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
require "rails/generators"
|
6
|
+
|
7
|
+
module RailsBootstrapForm
|
8
|
+
module Generators
|
9
|
+
class InstallGenerator < Rails::Generators::Base
|
10
|
+
desc "This generator creates an initializer file for configuration of RailsBootstrapForm"
|
11
|
+
|
12
|
+
source_root File.expand_path("../templates", __FILE__)
|
13
|
+
|
14
|
+
def create_initializer_file
|
15
|
+
template "install.rb", initializer_path
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def initializer_path
|
21
|
+
File.join("config/initializers", "rails_bootstrap_form.rb")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
# Be sure to restart your server when you modify this file.
|
6
|
+
|
7
|
+
RailsBootstrapForm.configure do |config|
|
8
|
+
# to make forms non-compliant with W3C.
|
9
|
+
config.default_form_attributes = {role: "form", novalidate: true}
|
10
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
# -*- frozen_string_literal: true -*-
|
3
|
+
# -*- warn_indent: true -*-
|
4
|
+
|
5
|
+
module RailsBootstrapForm
|
6
|
+
class Configuration
|
7
|
+
# Default HTML attributes which will applied to all forms build
|
8
|
+
# using RailsBootstrapForm.
|
9
|
+
def default_form_attributes=(attributes)
|
10
|
+
case attributes
|
11
|
+
when nil
|
12
|
+
@default_form_attributes = {}
|
13
|
+
when Hash
|
14
|
+
@default_form_attributes = attributes
|
15
|
+
else
|
16
|
+
raise ArgumentError, "Unsupported default_form_attributes #{attributes.inspect}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def default_form_attributes
|
21
|
+
return @default_form_attributes if defined?(@default_form_attributes)
|
22
|
+
|
23
|
+
{}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/rails_bootstrap_form.rb
CHANGED
@@ -9,13 +9,21 @@ module RailsBootstrapForm
|
|
9
9
|
extend ActiveSupport::Autoload
|
10
10
|
|
11
11
|
eager_autoload do
|
12
|
-
|
12
|
+
autoload :Configuration
|
13
13
|
end
|
14
14
|
|
15
15
|
class << self
|
16
16
|
def eager_load!
|
17
17
|
super
|
18
18
|
end
|
19
|
+
|
20
|
+
def config
|
21
|
+
@config ||= RailsBootstrapForm::Configuration.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def configure
|
25
|
+
yield config
|
26
|
+
end
|
19
27
|
end
|
20
28
|
end
|
21
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_bootstrap_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harshal LADHE (shivam091)
|
@@ -40,9 +40,50 @@ files:
|
|
40
40
|
- LICENSE.txt
|
41
41
|
- README.md
|
42
42
|
- Rakefile
|
43
|
+
- app/assets/stylesheets/rails_bootstrap_form.css
|
44
|
+
- demo/.ruby-version
|
45
|
+
- demo/Rakefile
|
46
|
+
- demo/app/assets/config/manifest.js
|
47
|
+
- demo/app/assets/stylesheets/application.scss
|
48
|
+
- demo/app/channels/application_cable/channel.rb
|
49
|
+
- demo/app/channels/application_cable/connection.rb
|
50
|
+
- demo/app/controllers/application_controller.rb
|
51
|
+
- demo/app/helpers/application_helper.rb
|
52
|
+
- demo/app/jobs/application_job.rb
|
53
|
+
- demo/app/mailers/application_mailer.rb
|
54
|
+
- demo/app/models/application_record.rb
|
55
|
+
- demo/app/views/layouts/application.html.erb
|
56
|
+
- demo/bin/bundle
|
57
|
+
- demo/bin/rails
|
58
|
+
- demo/bin/rake
|
59
|
+
- demo/bin/setup
|
60
|
+
- demo/config.ru
|
61
|
+
- demo/config/application.rb
|
62
|
+
- demo/config/boot.rb
|
63
|
+
- demo/config/cable.yml
|
64
|
+
- demo/config/database.yml
|
65
|
+
- demo/config/environment.rb
|
66
|
+
- demo/config/environments/development.rb
|
67
|
+
- demo/config/environments/production.rb
|
68
|
+
- demo/config/environments/test.rb
|
69
|
+
- demo/config/initializers/assets.rb
|
70
|
+
- demo/config/initializers/content_security_policy.rb
|
71
|
+
- demo/config/initializers/filter_parameter_logging.rb
|
72
|
+
- demo/config/initializers/inflections.rb
|
73
|
+
- demo/config/initializers/permissions_policy.rb
|
74
|
+
- demo/config/initializers/rails_bootstrap_form.rb
|
75
|
+
- demo/config/locales/en.rb
|
76
|
+
- demo/config/puma.rb
|
77
|
+
- demo/config/routes.rb
|
78
|
+
- demo/config/storage.yml
|
79
|
+
- demo/db/seeds.rb
|
80
|
+
- demo/public/favicon.ico
|
43
81
|
- gemfiles/7.0.gemfile
|
44
82
|
- gemfiles/common.gemfile
|
83
|
+
- lib/generators/rails_bootstrap_form/install_generator.rb
|
84
|
+
- lib/generators/rails_bootstrap_form/templates/install.rb
|
45
85
|
- lib/rails_bootstrap_form.rb
|
86
|
+
- lib/rails_bootstrap_form/configuration.rb
|
46
87
|
- lib/rails_bootstrap_form/engine.rb
|
47
88
|
- lib/rails_bootstrap_form/version.rb
|
48
89
|
- sig/rails_bootstrap_form.rbs
|