├── spec ├── dummy │ ├── lib │ │ └── assets │ │ │ └── .keep │ ├── public │ │ ├── favicon.ico │ │ ├── apple-touch-icon.png │ │ ├── apple-touch-icon-precomposed.png │ │ ├── 500.html │ │ ├── 422.html │ │ └── 404.html │ ├── app │ │ ├── assets │ │ │ ├── images │ │ │ │ └── .keep │ │ │ ├── config │ │ │ │ └── manifest.js │ │ │ ├── javascripts │ │ │ │ └── active_admin.js │ │ │ └── stylesheets │ │ │ │ ├── active_admin.scss │ │ │ │ └── application.css │ │ ├── models │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ ├── application_record.rb │ │ │ ├── tag.rb │ │ │ ├── post_tag.rb │ │ │ ├── profile.rb │ │ │ ├── post.rb │ │ │ └── author.rb │ │ ├── controllers │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ └── application_controller.rb │ │ ├── views │ │ │ └── layouts │ │ │ │ ├── mailer.text.erb │ │ │ │ ├── mailer.html.erb │ │ │ │ └── application.html.erb │ │ ├── helpers │ │ │ └── application_helper.rb │ │ ├── admin │ │ │ ├── tags.rb │ │ │ ├── dashboard.rb │ │ │ ├── posts.rb │ │ │ └── authors.rb │ │ ├── channels │ │ │ └── application_cable │ │ │ │ ├── channel.rb │ │ │ │ └── connection.rb │ │ ├── mailers │ │ │ └── application_mailer.rb │ │ ├── jobs │ │ │ └── application_job.rb │ │ └── javascript │ │ │ └── packs │ │ │ └── application.js │ ├── .ruby-version │ ├── .tool-versions │ ├── config │ │ ├── routes.rb │ │ ├── spring.rb │ │ ├── environment.rb │ │ ├── storage.yml │ │ ├── database.yml │ │ ├── initializers │ │ │ ├── mime_types.rb │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── application_controller_renderer.rb │ │ │ ├── cookies_serializer.rb │ │ │ ├── backtrace_silencers.rb │ │ │ ├── assets.rb │ │ │ ├── wrap_parameters.rb │ │ │ ├── inflections.rb │ │ │ ├── content_security_policy.rb │ │ │ └── active_admin.rb │ │ ├── cable.yml │ │ ├── boot.rb │ │ ├── application.rb │ │ ├── locales │ │ │ └── en.yml │ │ ├── puma.rb │ │ └── environments │ │ │ ├── test.rb │ │ │ ├── development.rb │ │ │ └── production.rb │ ├── bin │ │ ├── rake │ │ ├── rails │ │ └── setup │ ├── config.ru │ ├── Rakefile │ └── db │ │ ├── migrate │ │ ├── 20180607053255_create_tags.rb │ │ ├── 20180607053251_create_authors.rb │ │ ├── 20180607053257_create_post_tags.rb │ │ ├── 20180607053254_create_profiles.rb │ │ ├── 20180607053739_create_posts.rb │ │ ├── 20180101010101_create_active_admin_comments.rb │ │ └── 20170806125915_create_active_storage_tables.active_storage.rb │ │ └── schema.rb ├── support │ ├── capybara.rb │ └── drivers.rb ├── spec_helper.rb ├── rails_helper.rb └── system │ └── selectize_inputs_spec.rb ├── .rspec ├── lib ├── activeadmin │ ├── selectize.rb │ └── selectize │ │ ├── version.rb │ │ └── engine.rb ├── activeadmin_selectize.rb └── formtastic │ └── inputs │ └── selectize_input.rb ├── .reek.yml ├── .fasterer.yml ├── .gitignore ├── .reviewdog.yml ├── Rakefile ├── app └── assets │ ├── stylesheets │ └── activeadmin │ │ ├── _selectize_input.scss │ │ └── selectize │ │ ├── selectize.css │ │ ├── selectize.bootstrap3.css │ │ ├── selectize.default.css │ │ ├── selectize.bootstrap4.css │ │ ├── selectize.legacy.css │ │ └── selectize.bootstrap2.css │ └── javascripts │ └── activeadmin │ ├── selectize_input.js │ └── selectize │ └── selectize.js ├── Gemfile ├── .github ├── FUNDING.yml └── workflows │ ├── specs.yml │ └── linters.yml ├── .rubocop.yml ├── bin ├── rake ├── reek ├── rails ├── rspec ├── rubocop ├── brakeman ├── fasterer └── code_climate_reek ├── activeadmin_selectize.gemspec ├── LICENSE.txt └── README.md /spec/dummy/lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/public/apple-touch-icon.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/.ruby-version: -------------------------------------------------------------------------------- 1 | ruby-2.7.1 2 | -------------------------------------------------------------------------------- /spec/dummy/.tool-versions: -------------------------------------------------------------------------------- 1 | ruby 2.6.6 2 | -------------------------------------------------------------------------------- /spec/dummy/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/dummy/public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --require rails_helper 2 | --format documentation 3 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /spec/dummy/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /spec/support/capybara.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Capybara.server = :puma 4 | -------------------------------------------------------------------------------- /spec/dummy/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | ActiveAdmin.routes(self) 3 | end 4 | -------------------------------------------------------------------------------- /spec/dummy/app/admin/tags.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ActiveAdmin.register Tag do 4 | end 5 | -------------------------------------------------------------------------------- /lib/activeadmin/selectize.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'activeadmin/selectize/engine' 4 | -------------------------------------------------------------------------------- /.reek.yml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_paths: 3 | - bin/* 4 | - db/schema.rb 5 | - spec/dummy/**/* 6 | - vendor/**/* 7 | -------------------------------------------------------------------------------- /spec/dummy/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | end 3 | -------------------------------------------------------------------------------- /.fasterer.yml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_paths: 3 | - bin/* 4 | - db/schema.rb 5 | - spec/dummy/**/* 6 | - vendor/**/* 7 | -------------------------------------------------------------------------------- /spec/dummy/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /spec/dummy/app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Channel < ActionCable::Channel::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy/config/spring.rb: -------------------------------------------------------------------------------- 1 | Spring.watch( 2 | ".ruby-version", 3 | ".rbenv-vars", 4 | "tmp/restart.txt", 5 | "tmp/caching-dev.txt" 6 | ) 7 | -------------------------------------------------------------------------------- /lib/activeadmin_selectize.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'activeadmin/selectize' 4 | 5 | require 'formtastic/inputs/selectize_input' 6 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../stylesheets .css 3 | // OFF link active_storage_db_manifest.js 4 | -------------------------------------------------------------------------------- /spec/dummy/app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | module ApplicationCable 2 | class Connection < ActionCable::Connection::Base 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /spec/dummy/app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /lib/activeadmin/selectize/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ActiveAdmin 4 | module Selectize 5 | VERSION = '0.3.0' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /spec/dummy/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/javascripts/active_admin.js: -------------------------------------------------------------------------------- 1 | //= require active_admin/base 2 | 3 | //= require activeadmin/selectize/selectize 4 | //= require activeadmin/selectize_input 5 | -------------------------------------------------------------------------------- /spec/dummy/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /spec/dummy/config/storage.yml: -------------------------------------------------------------------------------- 1 | test: 2 | service: Disk 3 | root: <%= Rails.root.join("tmp/storage") %> 4 | 5 | local: 6 | service: Disk 7 | root: <%= Rails.root.join("storage") %> 8 | -------------------------------------------------------------------------------- /spec/support/drivers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |config| 4 | config.before(:each, type: :system) do 5 | driven_by(:selenium_chrome_headless) 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy/app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationRecord < ActiveRecord::Base 4 | self.abstract_class = true 5 | 6 | scope :published, -> {} 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy/app/models/tag.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Tag < ApplicationRecord 4 | has_many :post_tags, inverse_of: :tag, dependent: :destroy 5 | has_many :posts, through: :post_tags 6 | end 7 | -------------------------------------------------------------------------------- /spec/dummy/config/database.yml: -------------------------------------------------------------------------------- 1 | default: &default 2 | adapter: sqlite3 3 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 4 | timeout: 5000 5 | 6 | test: 7 | <<: *default 8 | database: db/test.sqlite3 9 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.orig 3 | 4 | /.rspec_failures 5 | /.rubocop-* 6 | /Gemfile.lock 7 | 8 | /_misc/ 9 | /coverage/ 10 | /spec/dummy/db/*.sqlite3* 11 | /spec/dummy/log/ 12 | /spec/dummy/storage/ 13 | /spec/dummy/tmp/ 14 | -------------------------------------------------------------------------------- /spec/dummy/config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: test 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: dummy_production 11 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /spec/dummy/Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /spec/dummy/config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__) 6 | -------------------------------------------------------------------------------- /lib/activeadmin/selectize/engine.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'active_admin' 4 | 5 | module ActiveAdmin 6 | module Selectize 7 | class Engine < ::Rails::Engine 8 | engine_name 'activeadmin_selectize' 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /.reviewdog.yml: -------------------------------------------------------------------------------- 1 | --- 2 | runner: 3 | brakeman: 4 | cmd: bin/brakeman 5 | level: info 6 | fasterer: 7 | cmd: bin/fasterer 8 | level: info 9 | reek: 10 | cmd: bin/reek 11 | level: info 12 | rubocop: 13 | cmd: bin/rubocop 14 | level: info 15 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20180607053255_create_tags.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateTags < ActiveRecord::Migration[5.2] 4 | def change 5 | create_table :tags do |t| 6 | t.string :name 7 | 8 | t.timestamps 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy/app/models/post_tag.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PostTag < ApplicationRecord 4 | belongs_to :post, inverse_of: :post_tags 5 | belongs_to :tag, inverse_of: :post_tags 6 | 7 | validates :post, presence: true 8 | validates :tag, presence: true 9 | end 10 | -------------------------------------------------------------------------------- /spec/dummy/app/models/profile.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Profile < ApplicationRecord 4 | belongs_to :author, inverse_of: :profile, touch: true 5 | 6 | enum status: { basic: 0, advanced: 1, premium: 2 } 7 | 8 | def to_s 9 | description 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ActiveSupport::Reloader.to_prepare do 4 | # ApplicationController.renderer.defaults.merge!( 5 | # http_host: 'example.org', 6 | # https: false 7 | # ) 8 | # end 9 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /spec/dummy/app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | # Automatically retry jobs that encountered a deadlock 3 | # retry_on ActiveRecord::Deadlocked 4 | 5 | # Most jobs are safe to ignore if the underlying records are no longer available 6 | # discard_on ActiveJob::DeserializationError 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dummy 5 | <%= csrf_meta_tags %> 6 | <%= csp_meta_tag %> 7 | 8 | <%= stylesheet_link_tag 'application', media: 'all' %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20180607053251_create_authors.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateAuthors < ActiveRecord::Migration[5.2] 4 | def change 5 | create_table :authors do |t| 6 | t.string :name 7 | t.integer :age 8 | t.string :email 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20180607053257_create_post_tags.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreatePostTags < ActiveRecord::Migration[5.2] 4 | def change 5 | create_table :post_tags do |t| 6 | t.belongs_to :post, foreign_key: true 7 | t.belongs_to :tag, foreign_key: true 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/formtastic/inputs/selectize_input.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Formtastic 4 | module Inputs 5 | class SelectizeInput < Formtastic::Inputs::SelectInput 6 | include Formtastic::Inputs::Base 7 | 8 | def input_html_options 9 | super.merge('data-selectize-input': '1') 10 | end 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20180607053254_create_profiles.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateProfiles < ActiveRecord::Migration[5.2] 4 | def change 5 | create_table :profiles do |t| 6 | t.integer :status 7 | t.text :description 8 | t.belongs_to :author, foreign_key: true 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bundler/gem_tasks' 4 | 5 | begin 6 | require 'rspec/core/rake_task' 7 | 8 | RSpec::Core::RakeTask.new(:spec) do |t| 9 | # t.ruby_opts = %w[-w] 10 | t.rspec_opts = ['--color', '--format documentation'] 11 | end 12 | 13 | task default: :spec 14 | rescue LoadError 15 | puts '! LoadError: no RSpec available' 16 | end 17 | -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/_selectize_input.scss: -------------------------------------------------------------------------------- 1 | @import 'activeadmin/selectize/selectize'; 2 | 3 | .selectize-control { 4 | .selectize-input { 5 | width: calc(80% - 22px); 6 | } 7 | &.multi .selectize-input, .selectize-input { 8 | padding: 0 5px; 9 | &.has-items { 10 | padding: 0 5px; 11 | } 12 | } 13 | &.plugin-remove_button .remove-single { 14 | font-size: 16px; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20180607053739_create_posts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreatePosts < ActiveRecord::Migration[5.2] 4 | def change 5 | create_table :posts do |t| 6 | t.string :title 7 | t.text :description 8 | t.belongs_to :author, foreign_key: true 9 | t.string :category 10 | t.datetime :dt 11 | t.float :position 12 | t.boolean :published 13 | 14 | t.timestamps 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20180101010101_create_active_admin_comments.rb: -------------------------------------------------------------------------------- 1 | class CreateActiveAdminComments < ActiveRecord::Migration[6.0] 2 | def self.up 3 | create_table :active_admin_comments do |t| 4 | t.string :namespace 5 | t.text :body 6 | t.references :resource, polymorphic: true 7 | t.references :author, polymorphic: true 8 | t.timestamps 9 | end 10 | add_index :active_admin_comments, [:namespace] 11 | end 12 | 13 | def self.down 14 | drop_table :active_admin_comments 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path. 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in the app/assets 11 | # folder are already added. 12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css ) 13 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /spec/dummy/config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | Bundler.require(*Rails.groups) 6 | 7 | module Dummy 8 | class Application < Rails::Application 9 | # Initialize configuration defaults for originally generated Rails version. 10 | config.load_defaults 6.0 11 | 12 | # Settings in config/environments/* take precedence over those specified here. 13 | # Application configuration can go into files in config/initializers 14 | # -- all .rb files in that directory are automatically loaded after loading 15 | # the framework and any gems in your application. 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | gemspec 6 | 7 | group :development, :test do 8 | gem 'activestorage', '~> 6.0' 9 | gem 'capybara', '~> 3.33' 10 | gem 'puma', '~> 4.3' 11 | gem 'rspec_junit_formatter', '~> 0.4' 12 | gem 'rspec-rails', '~> 4.0' 13 | gem 'selenium-webdriver', '~> 3.142' 14 | gem 'simplecov', '~> 0.19' 15 | gem 'sprockets-rails', '~> 3.2' 16 | gem 'sqlite3', '~> 1.4' 17 | 18 | # Linters 19 | gem 'brakeman' 20 | gem 'fasterer' 21 | gem 'reek' 22 | gem 'rubocop' 23 | gem 'rubocop-packaging' 24 | gem 'rubocop-performance' 25 | gem 'rubocop-rails' 26 | gem 'rubocop-rspec' 27 | 28 | # Tools 29 | gem 'pry-rails' 30 | end 31 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |config| 4 | config.disable_monkey_patching! 5 | config.filter_run focus: true 6 | config.filter_run_excluding changes_filesystem: true 7 | config.run_all_when_everything_filtered = true 8 | config.color = true 9 | config.order = :random 10 | config.example_status_persistence_file_path = '.rspec_failures' 11 | 12 | config.shared_context_metadata_behavior = :apply_to_host_groups 13 | 14 | config.expect_with :rspec do |expectations| 15 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true 16 | end 17 | config.mock_with :rspec do |mocks| 18 | mocks.verify_partial_doubles = true 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /spec/dummy/app/models/post.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Post < ApplicationRecord 4 | enum state: %i[available unavailable arriving] 5 | 6 | belongs_to :author, inverse_of: :posts, autosave: true 7 | 8 | has_one :author_profile, through: :author, source: :profile 9 | 10 | has_many :post_tags, inverse_of: :post, dependent: :destroy 11 | has_many :tags, through: :post_tags 12 | 13 | validates :title, allow_blank: false, presence: true 14 | 15 | scope :published, -> { where(published: true) } 16 | scope :recents, -> { where('created_at > ?', Date.today - 8.month) } 17 | 18 | def short_title 19 | title.truncate 10 20 | end 21 | 22 | def upper_title 23 | title.upcase 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/stylesheets/active_admin.scss: -------------------------------------------------------------------------------- 1 | // SASS variable overrides must be declared before loading up Active Admin's styles. 2 | // 3 | // To view the variables that Active Admin provides, take a look at 4 | // `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the 5 | // Active Admin source. 6 | // 7 | // For example, to change the sidebar width: 8 | // $sidebar-width: 242px; 9 | 10 | // Active Admin's got SASS! 11 | @import 'active_admin/mixins'; 12 | @import 'active_admin/base'; 13 | 14 | @import 'activeadmin/selectize_input'; 15 | 16 | // Overriding any non-variable SASS must be done after the fact. 17 | // For example, to change the default status-tag color: 18 | // 19 | // .status_tag { background: #6090DB; } 20 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /spec/dummy/app/models/author.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Author < ApplicationRecord 4 | has_many :posts 5 | has_many :published_posts, -> { published }, class_name: 'Post' 6 | has_many :recent_posts, -> { recents }, class_name: 'Post' 7 | 8 | has_many :tags, through: :posts 9 | 10 | has_one :profile, inverse_of: :author, dependent: :destroy 11 | 12 | has_one_attached :avatar 13 | 14 | accepts_nested_attributes_for :profile, allow_destroy: true 15 | 16 | validates :email, format: { with: /\A[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\z/i, message: 'Invalid email' } 17 | 18 | validate -> { 19 | errors.add( :base, 'Invalid age' ) if !age || age.to_i % 3 == 1 20 | } 21 | 22 | def to_s 23 | "#{name} (#{age})" 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [blocknotes] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /spec/dummy/app/javascript/packs/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require rails-ujs 14 | //= require activestorage 15 | //= require_tree . 16 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | --- 2 | inherit_from: 3 | - https://relaxed.ruby.style/rubocop.yml 4 | 5 | require: 6 | - rubocop-packaging 7 | - rubocop-performance 8 | - rubocop-rails 9 | - rubocop-rspec 10 | 11 | AllCops: 12 | Exclude: 13 | - bin/* 14 | - db/schema.rb 15 | - spec/dummy/**/* 16 | - vendor/**/* 17 | NewCops: enable 18 | 19 | Gemspec/RequiredRubyVersion: 20 | Enabled: false 21 | 22 | Naming/FileName: 23 | Enabled: false 24 | 25 | Layout/LineLength: 26 | Enabled: true 27 | Max: 120 28 | 29 | RSpec/ExampleLength: 30 | Max: 10 31 | 32 | RSpec/MultipleExpectations: 33 | Max: 12 34 | 35 | RSpec/MultipleMemoizedHelpers: 36 | Max: 6 37 | 38 | Style/HashEachMethods: 39 | Enabled: true 40 | 41 | Style/HashTransformKeys: 42 | Enabled: true 43 | 44 | Style/HashTransformValues: 45 | Enabled: true 46 | -------------------------------------------------------------------------------- /.github/workflows/specs.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Specs 3 | 4 | on: 5 | push: 6 | branches: [master] 7 | pull_request: 8 | branches: [master] 9 | 10 | jobs: 11 | test: 12 | runs-on: ubuntu-latest 13 | 14 | strategy: 15 | matrix: 16 | ruby: ['2.5', '2.6', '2.7'] 17 | 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v2 21 | 22 | - name: Set up Ruby 23 | uses: ruby/setup-ruby@v1 24 | with: 25 | ruby-version: ${{ matrix.ruby }} 26 | bundler-cache: true 27 | 28 | - name: Run tests 29 | run: bundle exec rake 30 | 31 | - name: Archive screenshots for failed tests 32 | uses: actions/upload-artifact@v2 33 | if: failure() 34 | with: 35 | name: test-failed-screenshots 36 | path: spec/dummy/tmp/screenshots 37 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rake' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rake", "rake") 30 | -------------------------------------------------------------------------------- /bin/reek: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'reek' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("reek", "reek") 30 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rails' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("railties", "rails") 30 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rspec' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rspec-core", "rspec") 30 | -------------------------------------------------------------------------------- /bin/rubocop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rubocop' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rubocop", "rubocop") 30 | -------------------------------------------------------------------------------- /bin/brakeman: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'brakeman' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("brakeman", "brakeman") 30 | -------------------------------------------------------------------------------- /bin/fasterer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'fasterer' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("fasterer", "fasterer") 30 | -------------------------------------------------------------------------------- /bin/code_climate_reek: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'code_climate_reek' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("reek", "code_climate_reek") 30 | -------------------------------------------------------------------------------- /activeadmin_selectize.gemspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | lib = File.expand_path('lib', __dir__) 4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 5 | require 'activeadmin/selectize/version' 6 | 7 | Gem::Specification.new do |spec| 8 | spec.name = 'activeadmin_selectize' 9 | spec.version = ActiveAdmin::Selectize::VERSION 10 | spec.summary = 'Selectize for ActiveAdmin' 11 | spec.description = 'An Active Admin plugin to use Selectize.js (jQuery required)' 12 | spec.license = 'MIT' 13 | spec.authors = ['Mattia Roccoberton'] 14 | spec.email = 'mat@blocknot.es' 15 | spec.homepage = 'https://github.com/blocknotes/activeadmin_selectize' 16 | 17 | spec.files = Dir['{app,lib}/**/*', 'LICENSE.txt', 'Rakefile', 'README.md'] 18 | spec.require_paths = ['lib'] 19 | 20 | spec.add_runtime_dependency 'activeadmin', '~> 2.0' 21 | spec.add_runtime_dependency 'sassc', '~> 2.4' 22 | end 23 | -------------------------------------------------------------------------------- /spec/dummy/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # The following keys must be escaped otherwise they will not be retrieved by 20 | # the default I18n backend: 21 | # 22 | # true, false, on, off, yes, no 23 | # 24 | # Instead, surround them with single quotes. 25 | # 26 | # en: 27 | # 'true': 'foo' 28 | # 29 | # To learn more, please read the Rails Internationalization guide 30 | # available at https://guides.rubyonrails.org/i18n.html. 31 | 32 | en: 33 | hello: "Hello world" 34 | -------------------------------------------------------------------------------- /.github/workflows/linters.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Linters 3 | 4 | on: 5 | push: 6 | branches: 7 | - master 8 | pull_request: 9 | 10 | jobs: 11 | reviewdog: 12 | name: reviewdog 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Check out code 17 | uses: actions/checkout@v2 18 | 19 | - name: Set up Ruby 20 | uses: ruby/setup-ruby@v1 21 | with: 22 | ruby-version: '2.7' 23 | bundler-cache: true # runs 'bundle install' and caches installed gems automatically 24 | 25 | - uses: reviewdog/action-setup@v1 26 | with: 27 | reviewdog_version: latest 28 | 29 | - name: Run reviewdog 30 | env: 31 | REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | run: | 33 | reviewdog -fail-on-error -reporter=github-pr-review -runners=brakeman,fasterer,reek,rubocop 34 | 35 | # NOTE: check with: reviewdog -fail-on-error -reporter=github-pr-review -runners=fasterer -diff="git diff" -tee 36 | -------------------------------------------------------------------------------- /spec/dummy/app/admin/dashboard.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.register_page "Dashboard" do 2 | menu priority: 1, label: proc { I18n.t("active_admin.dashboard") } 3 | 4 | content title: proc { I18n.t("active_admin.dashboard") } do 5 | div class: "blank_slate_container", id: "dashboard_default_message" do 6 | span class: "blank_slate" do 7 | span I18n.t("active_admin.dashboard_welcome.welcome") 8 | small I18n.t("active_admin.dashboard_welcome.call_to_action") 9 | end 10 | end 11 | 12 | # Here is an example of a simple dashboard with columns and panels. 13 | # 14 | # columns do 15 | # column do 16 | # panel "Recent Posts" do 17 | # ul do 18 | # Post.recent(5).map do |post| 19 | # li link_to(post.title, admin_post_path(post)) 20 | # end 21 | # end 22 | # end 23 | # end 24 | 25 | # column do 26 | # panel "Info" do 27 | # para "Welcome to ActiveAdmin." 28 | # end 29 | # end 30 | # end 31 | end # content 32 | end 33 | -------------------------------------------------------------------------------- /spec/dummy/app/admin/posts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ActiveAdmin.register Post do 4 | permit_params :author_id, :title, :description, :category, :dt, :position, :published, tag_ids: [] 5 | 6 | index do 7 | selectable_column 8 | id_column 9 | column :title 10 | column :author 11 | column :published 12 | column :created_at 13 | actions 14 | end 15 | 16 | show do 17 | attributes_table do 18 | row :author 19 | row :title 20 | row :description 21 | row :category 22 | row :dt 23 | row :position 24 | row :published 25 | row :tags 26 | row :created_at 27 | row :updated_at 28 | end 29 | active_admin_comments 30 | end 31 | 32 | form do |f| 33 | f.inputs 'Post' do 34 | f.input :author, as: :selectize 35 | f.input :title 36 | f.input :description 37 | f.input :category 38 | f.input :dt 39 | f.input :position 40 | f.input :published 41 | end 42 | 43 | f.inputs 'Tags' do 44 | f.input :tags, as: :selectize 45 | end 46 | 47 | f.actions 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Mattia Roccoberton 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /spec/dummy/db/migrate/20170806125915_create_active_storage_tables.active_storage.rb: -------------------------------------------------------------------------------- 1 | # This migration comes from active_storage (originally 20170806125915) 2 | class CreateActiveStorageTables < ActiveRecord::Migration[5.2] 3 | def change 4 | create_table :active_storage_blobs do |t| 5 | t.string :key, null: false 6 | t.string :filename, null: false 7 | t.string :content_type 8 | t.text :metadata 9 | t.bigint :byte_size, null: false 10 | t.string :checksum, null: false 11 | t.datetime :created_at, null: false 12 | 13 | t.index [ :key ], unique: true 14 | end 15 | 16 | create_table :active_storage_attachments do |t| 17 | t.string :name, null: false 18 | t.references :record, null: false, polymorphic: true, index: false 19 | t.references :blob, null: false 20 | 21 | t.datetime :created_at, null: false 22 | 23 | t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true 24 | t.foreign_key :active_storage_blobs, column: :blob_id 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /spec/dummy/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'fileutils' 3 | 4 | # path to your application root. 5 | APP_ROOT = File.expand_path('..', __dir__) 6 | 7 | def system!(*args) 8 | system(*args) || abort("\n== Command #{args} failed ==") 9 | end 10 | 11 | FileUtils.chdir APP_ROOT do 12 | # This script is a way to setup or update your development environment automatically. 13 | # This script is idempotent, so that you can run it at anytime and get an expectable outcome. 14 | # Add necessary setup steps to this file. 15 | 16 | puts '== Installing dependencies ==' 17 | system! 'gem install bundler --conservative' 18 | system('bundle check') || system!('bundle install') 19 | 20 | # puts "\n== Copying sample files ==" 21 | # unless File.exist?('config/database.yml') 22 | # FileUtils.cp 'config/database.yml.sample', 'config/database.yml' 23 | # end 24 | 25 | puts "\n== Preparing database ==" 26 | system! 'bin/rails db:prepare' 27 | 28 | puts "\n== Removing old logs and tempfiles ==" 29 | system! 'bin/rails log:clear tmp:clear' 30 | 31 | puts "\n== Restarting application server ==" 32 | system! 'bin/rails restart' 33 | end 34 | -------------------------------------------------------------------------------- /spec/dummy/app/admin/authors.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | ActiveAdmin.register Author do 4 | menu priority: 1 5 | 6 | permit_params :name, :email, :age, :avatar, profile_attributes: %i[id description status _destroy] 7 | 8 | index do 9 | selectable_column 10 | id_column 11 | column :name 12 | column :email 13 | column :created_at 14 | actions 15 | end 16 | 17 | filter :name 18 | filter :created_at 19 | 20 | show do 21 | attributes_table do 22 | row :name 23 | row :email 24 | row :age 25 | row :avatar do |record| 26 | image_tag url_for(record.avatar), style: 'max-width:800px;max-height:500px' if record.avatar.attached? 27 | end 28 | row :created_at 29 | row :updated_at 30 | row :profile 31 | end 32 | active_admin_comments 33 | end 34 | 35 | form do |f| 36 | f.inputs do 37 | f.input :name 38 | f.input :email 39 | f.input :age 40 | f.input :avatar, 41 | as: :file, 42 | hint: (object.avatar.attached? ? "Current: #{object.avatar.filename}" : nil) 43 | end 44 | f.has_many :profile, allow_destroy: true do |ff| 45 | ff.input :status 46 | ff.input :description 47 | end 48 | f.actions 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'spec_helper' 4 | 5 | ENV['RAILS_ENV'] = 'test' 6 | 7 | require File.expand_path('dummy/config/environment.rb', __dir__) 8 | 9 | abort('The Rails environment is running in production mode!') if Rails.env.production? 10 | 11 | require 'rspec/rails' 12 | require 'capybara/rails' 13 | 14 | Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f } 15 | 16 | require 'simplecov' 17 | SimpleCov.start :rails do 18 | filters.clear 19 | add_filter %r{^/spec/} 20 | end 21 | 22 | # Force deprecations to raise an exception. 23 | ActiveSupport::Deprecation.behavior = :raise 24 | 25 | # Checks for pending migrations and applies them before tests are run. 26 | # If you are not using ActiveRecord, you can remove these lines. 27 | begin 28 | ActiveRecord::Migration.maintain_test_schema! 29 | rescue ActiveRecord::PendingMigrationError => e 30 | puts e.to_s.strip 31 | exit 1 32 | end 33 | 34 | RSpec.configure do |config| 35 | config.fixture_path = "#{::Rails.root}/spec/fixtures" 36 | config.infer_spec_type_from_file_location! 37 | config.filter_rails_from_backtrace! 38 | 39 | config.use_transactional_fixtures = true 40 | config.use_instantiated_fixtures = false 41 | config.render_views = false 42 | end 43 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Define an application-wide content security policy 4 | # For further information see the following documentation 5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy 6 | 7 | # Rails.application.config.content_security_policy do |policy| 8 | # policy.default_src :self, :https 9 | # policy.font_src :self, :https, :data 10 | # policy.img_src :self, :https, :data 11 | # policy.object_src :none 12 | # policy.script_src :self, :https 13 | # policy.style_src :self, :https 14 | 15 | # # Specify URI for violation reports 16 | # # policy.report_uri "/csp-violation-report-endpoint" 17 | # end 18 | 19 | # If you are using UJS then enable automatic nonce generation 20 | # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } 21 | 22 | # Set the nonce only to specific directives 23 | # Rails.application.config.content_security_policy_nonce_directives = %w(script-src) 24 | 25 | # Report CSP violations to a specified URI 26 | # For further information see the following documentation: 27 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only 28 | # Rails.application.config.content_security_policy_report_only = true 29 | -------------------------------------------------------------------------------- /spec/dummy/config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers: a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum; this matches the default thread size of Active Record. 6 | # 7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } 8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } 9 | threads min_threads_count, max_threads_count 10 | 11 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000. 12 | # 13 | port ENV.fetch("PORT") { 3000 } 14 | 15 | # Specifies the `environment` that Puma will run in. 16 | # 17 | environment ENV.fetch("RAILS_ENV") { "development" } 18 | 19 | # Specifies the `pidfile` that Puma will use. 20 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } 21 | 22 | # Specifies the number of `workers` to boot in clustered mode. 23 | # Workers are forked web server processes. If using threads and workers together 24 | # the concurrency of the application would be max `threads` * `workers`. 25 | # Workers do not work on JRuby or Windows (both of which do not support 26 | # processes). 27 | # 28 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 29 | 30 | # Use the `preload_app!` method when specifying a `workers` number. 31 | # This directive tells Puma to first boot the application and load code 32 | # before forking the application. This takes advantage of Copy On Write 33 | # process behavior so workers use less memory. 34 | # 35 | # preload_app! 36 | 37 | # Allow puma to be restarted by `rails restart` command. 38 | plugin :tmp_restart 39 | -------------------------------------------------------------------------------- /spec/dummy/public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

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

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

The change you wanted was rejected.

62 |

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

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /spec/dummy/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

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

63 |
64 |

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

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /app/assets/javascripts/activeadmin/selectize_input.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict' 3 | 4 | // --- functions ------------------------------------------------------------ 5 | function initSelectizeInputs() { 6 | $('[data-selectize-input]').each(function () { 7 | var remote = $(this).attr('data-opt-remote') ? $(this).attr('data-opt-remote') : ''; 8 | var field_text = $(this).attr('data-opt-text') ? $(this).attr('data-opt-text') : 'name'; 9 | var field_value = $(this).attr('data-opt-value') ? $(this).attr('data-opt-value') : 'id'; 10 | var opts = { 11 | closeAfterSelect: true, 12 | create: false, 13 | hideSelected: true, 14 | labelField: field_text, 15 | options: [], 16 | plugins: ['remove_button'], 17 | searchField: field_text, 18 | valueField: field_value 19 | }; 20 | 21 | if (!$(this).data('opts')) { 22 | $.each(this.attributes, function (i, attr) { 23 | if (attr.name.startsWith('data-opt-')) { 24 | var name = attr.name.substr(9); 25 | if (name != 'remote' && name != 'text' && name != 'value') opts[name] = (attr.value == 'true') ? true : ((attr.value == 'false') ? false : attr.value); 26 | } 27 | }); 28 | } else { 29 | opts = $.extend({}, opts, $(this).data('opts')); 30 | } 31 | 32 | opts['load'] = function (query, callback) { 33 | if (!query.length) return callback(); 34 | $.ajax({ 35 | url: remote + '?q[' + field_text + '_contains]=' + encodeURIComponent(query), 36 | type: 'GET', 37 | error: function () { 38 | callback(); 39 | }, 40 | success: function (res) { 41 | callback(res.slice(0, 10)); 42 | } 43 | }); 44 | }; 45 | $(this).selectize(opts); 46 | }); 47 | } 48 | 49 | // --- events --------------------------------------------------------------- 50 | $(document).ready(initSelectizeInputs); 51 | $(document).on('has_many_add:after', initSelectizeInputs); 52 | $(document).on('turbolinks:load', initSelectizeInputs); 53 | })() 54 | -------------------------------------------------------------------------------- /spec/dummy/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | # The test environment is used exclusively to run your application's 2 | # test suite. You never need to work with it otherwise. Remember that 3 | # your test database is "scratch space" for the test suite and is wiped 4 | # and recreated between test runs. Don't rely on the data there! 5 | 6 | Rails.application.configure do 7 | # Settings specified here will take precedence over those in config/application.rb. 8 | 9 | config.cache_classes = false 10 | config.action_view.cache_template_loading = true 11 | 12 | # Do not eager load code on boot. This avoids loading your whole application 13 | # just for the purpose of running a single test. If you are using a tool that 14 | # preloads Rails for running tests, you may have to set it to true. 15 | config.eager_load = false 16 | 17 | # Configure public file server for tests with Cache-Control for performance. 18 | config.public_file_server.enabled = true 19 | config.public_file_server.headers = { 20 | 'Cache-Control' => "public, max-age=#{1.hour.to_i}" 21 | } 22 | 23 | # Show full error reports and disable caching. 24 | config.consider_all_requests_local = true 25 | config.action_controller.perform_caching = false 26 | config.cache_store = :null_store 27 | 28 | # Raise exceptions instead of rendering exception templates. 29 | config.action_dispatch.show_exceptions = false 30 | 31 | # Disable request forgery protection in test environment. 32 | config.action_controller.allow_forgery_protection = false 33 | 34 | # Store uploaded files on the local file system in a temporary directory. 35 | config.active_storage.service = :test 36 | 37 | # config.action_mailer.perform_caching = false 38 | 39 | # Tell Action Mailer not to deliver emails to the real world. 40 | # The :test delivery method accumulates sent emails in the 41 | # ActionMailer::Base.deliveries array. 42 | # config.action_mailer.delivery_method = :test 43 | 44 | # Print deprecation notices to the stderr. 45 | config.active_support.deprecation = :stderr 46 | 47 | # Raises error for missing translations. 48 | # config.action_view.raise_on_missing_translations = true 49 | end 50 | -------------------------------------------------------------------------------- /spec/dummy/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | # Run rails dev:cache to toggle caching. 17 | if Rails.root.join('tmp', 'caching-dev.txt').exist? 18 | config.action_controller.perform_caching = true 19 | config.action_controller.enable_fragment_cache_logging = true 20 | 21 | config.cache_store = :memory_store 22 | config.public_file_server.headers = { 23 | 'Cache-Control' => "public, max-age=#{2.days.to_i}" 24 | } 25 | else 26 | config.action_controller.perform_caching = false 27 | 28 | config.cache_store = :null_store 29 | end 30 | 31 | # Store uploaded files on the local file system (see config/storage.yml for options). 32 | config.active_storage.service = :local 33 | 34 | # # Don't care if the mailer can't send. 35 | # config.action_mailer.raise_delivery_errors = false 36 | 37 | # config.action_mailer.perform_caching = false 38 | 39 | # Print deprecation notices to the Rails logger. 40 | config.active_support.deprecation = :log 41 | 42 | # Raise an error on page load if there are pending migrations. 43 | config.active_record.migration_error = :page_load 44 | 45 | # Highlight code that triggered database queries in logs. 46 | config.active_record.verbose_query_logs = true 47 | 48 | # Debug mode disables concatenation and preprocessing of assets. 49 | # This option may cause significant delays in view rendering with a large 50 | # number of complex assets. 51 | config.assets.debug = true 52 | 53 | # Suppress logger output for asset requests. 54 | config.assets.quiet = true 55 | 56 | # Raises error for missing translations. 57 | # config.action_view.raise_on_missing_translations = true 58 | 59 | # Use an evented file watcher to asynchronously detect changes in source code, 60 | # routes, locales, etc. This feature depends on the listen gem. 61 | # config.file_watcher = ActiveSupport::EventedFileUpdateChecker 62 | end 63 | -------------------------------------------------------------------------------- /spec/system/selectize_inputs_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.describe 'Selectize inputs', type: :system do 4 | let(:authors) do 5 | Array.new(3) do |i| 6 | Author.create!(email: "some_email_#{i}@example.com", name: "John #{i}", age: 30 + i * 3) 7 | end 8 | end 9 | let(:post) { Post.create!(title: 'Test', author: authors.last) } 10 | let(:tags) do 11 | Array.new(3) do |i| 12 | Tag.create!(name: "A tag #{i}") 13 | end 14 | end 15 | 16 | before do 17 | post.tags << tags.last 18 | end 19 | 20 | after do 21 | post.destroy 22 | authors.each(&:destroy) 23 | tags.each(&:destroy) 24 | end 25 | 26 | context 'with a single value selectize input' do 27 | let(:hidden_input) { '#post_author_input [data-selectize-input]' } 28 | let(:selectize_control) { '#post_author_input .selectize-control.single' } 29 | let(:selectize_input) { '#post_author_input .selectize-input' } 30 | 31 | it 'includes the hidden select and the selectize-input element' do 32 | visit "/admin/posts/#{post.id}/edit" 33 | 34 | expect(page).to have_select('post[author_id]', visible: :hidden, selected: authors.last.name) 35 | expect(page).to have_css(selectize_input) 36 | end 37 | 38 | it 'updates the entity association' do 39 | visit "/admin/posts/#{post.id}/edit" 40 | 41 | find(selectize_input).click 42 | find("#{selectize_control} .selectize-dropdown-content", text: 'John 1').click 43 | find('[type="submit"]').click 44 | expect(page).to have_content('was successfully updated') 45 | expect(post.reload.author).to eq(authors.find { |item| item.name == 'John 1' }) 46 | end 47 | end 48 | 49 | context 'with a multiple values selectize input' do 50 | let(:hidden_input) { '#post_tags_input [data-selectize-input]' } 51 | let(:selectize_control) { '#post_tags_input .selectize-control.multi' } 52 | let(:selectize_input) { '#post_tags_input .selectize-input' } 53 | 54 | it 'includes the hidden select and the selectize-input element' do 55 | visit "/admin/posts/#{post.id}/edit" 56 | 57 | expect(page).to have_select('post[tag_ids][]', visible: :hidden, selected: tags.last.name) 58 | expect(page).to have_css(selectize_input) 59 | end 60 | 61 | it 'updates the entity association' do 62 | visit "/admin/posts/#{post.id}/edit" 63 | 64 | find(selectize_input).click 65 | find('#post_tags_input .option', text: 'A tag 1').click 66 | scroll_to(find('#post_submit_action')) 67 | find('[type="submit"]').click 68 | expect(page).to have_content('was successfully updated') 69 | expect(post.reload.tags).to include(tags.find { |item| item.name == 'A tag 1' }) 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /spec/dummy/db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # This file is the source Rails uses to define your schema when running `rails 6 | # db:schema:load`. When creating a new database, `rails db:schema:load` tends to 7 | # be faster and is potentially less error prone than running all of your 8 | # migrations from scratch. Old migrations may fail to apply correctly if those 9 | # migrations use external dependencies or application code. 10 | # 11 | # It's strongly recommended that you check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(version: 2018_06_07_053739) do 14 | 15 | create_table "active_admin_comments", force: :cascade do |t| 16 | t.string "namespace" 17 | t.text "body" 18 | t.string "resource_type" 19 | t.integer "resource_id" 20 | t.string "author_type" 21 | t.integer "author_id" 22 | t.datetime "created_at", precision: 6, null: false 23 | t.datetime "updated_at", precision: 6, null: false 24 | t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id" 25 | t.index ["namespace"], name: "index_active_admin_comments_on_namespace" 26 | t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" 27 | end 28 | 29 | create_table "active_storage_attachments", force: :cascade do |t| 30 | t.string "name", null: false 31 | t.string "record_type", null: false 32 | t.integer "record_id", null: false 33 | t.integer "blob_id", null: false 34 | t.datetime "created_at", null: false 35 | t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" 36 | t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true 37 | end 38 | 39 | create_table "active_storage_blobs", force: :cascade do |t| 40 | t.string "key", null: false 41 | t.string "filename", null: false 42 | t.string "content_type" 43 | t.text "metadata" 44 | t.bigint "byte_size", null: false 45 | t.string "checksum", null: false 46 | t.datetime "created_at", null: false 47 | t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true 48 | end 49 | 50 | create_table "authors", force: :cascade do |t| 51 | t.string "name" 52 | t.integer "age" 53 | t.string "email" 54 | t.datetime "created_at", null: false 55 | t.datetime "updated_at", null: false 56 | end 57 | 58 | create_table "post_tags", force: :cascade do |t| 59 | t.integer "post_id" 60 | t.integer "tag_id" 61 | t.datetime "created_at", null: false 62 | t.datetime "updated_at", null: false 63 | t.index ["post_id"], name: "index_post_tags_on_post_id" 64 | t.index ["tag_id"], name: "index_post_tags_on_tag_id" 65 | end 66 | 67 | create_table "posts", force: :cascade do |t| 68 | t.string "title" 69 | t.text "description" 70 | t.integer "author_id" 71 | t.string "category" 72 | t.datetime "dt" 73 | t.float "position" 74 | t.boolean "published" 75 | t.datetime "created_at", null: false 76 | t.datetime "updated_at", null: false 77 | t.index ["author_id"], name: "index_posts_on_author_id" 78 | end 79 | 80 | create_table "profiles", force: :cascade do |t| 81 | t.text "description" 82 | t.integer "author_id" 83 | t.datetime "created_at", null: false 84 | t.datetime "updated_at", null: false 85 | t.index ["author_id"], name: "index_profiles_on_author_id" 86 | end 87 | 88 | create_table "tags", force: :cascade do |t| 89 | t.string "name" 90 | t.datetime "created_at", null: false 91 | t.datetime "updated_at", null: false 92 | end 93 | 94 | add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" 95 | add_foreign_key "post_tags", "posts" 96 | add_foreign_key "post_tags", "tags" 97 | add_foreign_key "posts", "authors" 98 | add_foreign_key "profiles", "authors" 99 | end 100 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PROJECT UNMAINTAINED 2 | 3 | > *This project is not maintained anymore* 4 | > 5 | > *If you like it or continue to use it fork it please.* 6 | 7 | --- 8 | 9 | # ActiveAdmin Selectize 10 | [![gem version](https://badge.fury.io/rb/activeadmin_selectize.svg)](https://badge.fury.io/rb/activeadmin_selectize) [![gem downloads](https://badgen.net/rubygems/dt/activeadmin_selectize)](https://rubygems.org/gems/activeadmin_selectize) [![linters](https://github.com/blocknotes/activeadmin_selectize/actions/workflows/linters.yml/badge.svg)](https://github.com/blocknotes/activeadmin_selectize/actions/workflows/linters.yml) [![specs](https://github.com/blocknotes/activeadmin_selectize/actions/workflows/specs.yml/badge.svg)](https://github.com/blocknotes/activeadmin_selectize/actions/workflows/specs.yml) 11 | 12 | An Active Admin plugin to use [Selectize.js](http://selectize.github.io/selectize.js) (jQuery required). 13 | 14 | Features: 15 | - nice select inputs; 16 | - items search; 17 | - AJAX content loading; 18 | - improve many-to-many / one-to-many selection. 19 | 20 | ## Install 21 | 22 | - Add to your Gemfile: 23 | `gem 'activeadmin_selectize'` 24 | - Execute bundle 25 | - Add at the end of your ActiveAdmin styles (_app/assets/stylesheets/active_admin.scss_): 26 | `@import 'activeadmin/selectize_input';` 27 | - Add at the end of your ActiveAdmin javascripts (_app/assets/javascripts/active_admin.js_): 28 | ```css 29 | //= require activeadmin/selectize/selectize 30 | //= require activeadmin/selectize_input 31 | ``` 32 | - Use the input with `as: :selectize` in Active Admin model conf 33 | 34 | Why 2 separated scripts? In this way you can include a different version of Selectize.js if you like. 35 | 36 | ## Examples 37 | 38 | Example 1: an Article model with a many-to-many relation with Tag model: 39 | 40 | ```ruby 41 | class Article < ApplicationRecord 42 | has_and_belongs_to_many :tags 43 | accepts_nested_attributes_for :tags 44 | end 45 | ``` 46 | 47 | ```ruby 48 | # ActiveAdmin article form conf: 49 | form do |f| 50 | f.inputs 'Article' do 51 | f.input :title 52 | f.input :description 53 | f.input :published 54 | f.input :tags, as: :selectize, collection: f.object.tags, input_html: { 'data-opt-remote': admin_tags_path( format: :json ), 'data-opt-text': 'name', 'data-opt-value': 'id', 'data-opt-highlight': 'true', placeholder: 'Search a tag...' } 55 | end 56 | f.actions 57 | end 58 | ``` 59 | 60 | Example 2: using selectize in filters: 61 | 62 | ```ruby 63 | # Without remote items (no AJAX): 64 | filter :name_eq, as: :selectize, collection: Author.all.pluck( :name, :name ) 65 | # With remote items: 66 | filter :tags_id_eq, as: :selectize, collection: [], input_html: { 'data-opt-remote': '/admin/tags.json', 'data-opt-text': 'name', 'data-opt-value': 'id', 'data-opts': '{"dropdownParent":"body"}', placeholder: 'Search a tag...' } 67 | ``` 68 | 69 | ## Notes 70 | 71 | - In ActiveAdmin json routes should be enabled by default, this behavior is controlled by *download_links* option for index action. Example: 72 | 73 | ```rb 74 | index download_links: [:csv, :json] do 75 | # ... 76 | end 77 | ``` 78 | 79 | You can customize the JSON response overriding the *as_json* method of the model: 80 | 81 | ```rb 82 | def as_json( options = nil ) 83 | super({ only: [:id], methods: [:fullname] }.merge(options || {})) 84 | end 85 | ``` 86 | 87 | - If the select items "gets cut" by the container try adding: `'data-opts': '{"dropdownParent":"body"}'` 88 | 89 | - Alternative syntax to pass data attributes: `input_html: { data: { opts: '{}' } }` 90 | 91 | - To use this plugins with ActiveAdmin 1.x please use the version 0.1.6 92 | 93 | ## Options 94 | 95 | Pass the required options using `input_html`. 96 | 97 | - **data-opt-remote**: URL used for AJAX search requests (method GET) 98 | - **data-opt-text**: field to use as option label 99 | - **data-opt-value**: field to use as select value 100 | - **data-opt-NAME**: option _NAME_ passed directly to Selectize.js - see [options](https://github.com/selectize/selectize.js/blob/master/docs/usage.md#configuration) 101 | 102 | Alternative syntax: 103 | 104 | - **data-opts**: overrides Selectize options - example: `'data-opts': '{"highlight":true,"plugins":[]}'` 105 | 106 | ## Do you like it? Star it! 107 | 108 | If you use this component just star it. A developer is more motivated to improve a project when there is some interest. My other [Active Admin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source). 109 | 110 | Or consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me). 111 | 112 | ## Contributors 113 | 114 | - [Mattia Roccoberton](http://blocknot.es): author 115 | 116 | ## License 117 | 118 | [MIT](LICENSE.txt) 119 | -------------------------------------------------------------------------------- /spec/dummy/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] 18 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). 19 | # config.require_master_key = true 20 | 21 | # Disable serving static files from the `/public` folder by default since 22 | # Apache or NGINX already handles this. 23 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 24 | 25 | # Compress CSS using a preprocessor. 26 | # config.assets.css_compressor = :sass 27 | 28 | # Do not fallback to assets pipeline if a precompiled asset is missed. 29 | config.assets.compile = false 30 | 31 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 32 | # config.action_controller.asset_host = 'http://assets.example.com' 33 | 34 | # Specifies the header that your server uses for sending files. 35 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 36 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 37 | 38 | # Store uploaded files on the local file system (see config/storage.yml for options). 39 | config.active_storage.service = :local 40 | 41 | # Mount Action Cable outside main process or domain. 42 | # config.action_cable.mount_path = nil 43 | # config.action_cable.url = 'wss://example.com/cable' 44 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 45 | 46 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 47 | # config.force_ssl = true 48 | 49 | # Use the lowest log level to ensure availability of diagnostic information 50 | # when problems arise. 51 | config.log_level = :debug 52 | 53 | # Prepend all log lines with the following tags. 54 | config.log_tags = [ :request_id ] 55 | 56 | # Use a different cache store in production. 57 | # config.cache_store = :mem_cache_store 58 | 59 | # Use a real queuing backend for Active Job (and separate queues per environment). 60 | # config.active_job.queue_adapter = :resque 61 | # config.active_job.queue_name_prefix = "dummy_production" 62 | 63 | # config.action_mailer.perform_caching = false 64 | 65 | # Ignore bad email addresses and do not raise email delivery errors. 66 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 67 | # config.action_mailer.raise_delivery_errors = false 68 | 69 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 70 | # the I18n.default_locale when a translation cannot be found). 71 | config.i18n.fallbacks = true 72 | 73 | # Send deprecation notices to registered listeners. 74 | config.active_support.deprecation = :notify 75 | 76 | # Use default logging formatter so that PID and timestamp are not suppressed. 77 | config.log_formatter = ::Logger::Formatter.new 78 | 79 | # Use a different logger for distributed setups. 80 | # require 'syslog/logger' 81 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 82 | 83 | if ENV["RAILS_LOG_TO_STDOUT"].present? 84 | logger = ActiveSupport::Logger.new(STDOUT) 85 | logger.formatter = config.log_formatter 86 | config.logger = ActiveSupport::TaggedLogging.new(logger) 87 | end 88 | 89 | # Do not dump schema after migrations. 90 | config.active_record.dump_schema_after_migration = false 91 | 92 | # Inserts middleware to perform automatic connection switching. 93 | # The `database_selector` hash is used to pass options to the DatabaseSelector 94 | # middleware. The `delay` is used to determine how long to wait after a write 95 | # to send a subsequent read to the primary. 96 | # 97 | # The `database_resolver` class is used by the middleware to determine which 98 | # database is appropriate to use based on the time delay. 99 | # 100 | # The `database_resolver_context` class is used by the middleware to set 101 | # timestamps for the last write to the primary. The resolver uses the context 102 | # class timestamps to determine how long to wait before reading from the 103 | # replica. 104 | # 105 | # By default Rails will store a last write timestamp in the session. The 106 | # DatabaseSelector middleware is designed as such you can define your own 107 | # strategy for connection switching and pass that into the middleware through 108 | # these configuration options. 109 | # config.active_record.database_selector = { delay: 2.seconds } 110 | # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver 111 | # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session 112 | end 113 | -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/selectize/selectize.css: -------------------------------------------------------------------------------- 1 | /** 2 | * selectize.css (v0.13.3) 3 | * Copyright (c) 2013–2015 Brian Reavis & contributors 4 | * Copyright (c) 2020 Selectize Team & contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 7 | * file except in compliance with the License. You may obtain a copy of the License at: 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. 14 | * 15 | * @author Brian Reavis 16 | * @author Ris Adams 17 | */ 18 | 19 | .selectize-control.plugin-drag_drop.multi>.selectize-input>div.ui-sortable-placeholder{visibility:visible !important;background:#f2f2f2 !important;background:rgba(0,0,0,.06) !important;border:0 none !important;box-shadow:inset 0 0 12px 4px #fff}.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after{content:"!";visibility:hidden}.selectize-control.plugin-drag_drop .ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.selectize-control .dropdown-header{position:relative;padding:10px 8px;border-bottom:1px solid #d0d0d0;background:#f8f8f8;border-radius:3px 3px 0 0}.selectize-control .dropdown-header-close{position:absolute;right:8px;top:50%;color:#303030;opacity:.4;margin-top:-12px;line-height:20px;font-size:20px !important}.selectize-control .dropdown-header-close:hover{color:#000}.selectize-dropdown.plugin-optgroup_columns .selectize-dropdown-content{display:flex}.selectize-dropdown.plugin-optgroup_columns .optgroup{border-right:1px solid #f2f2f2;border-top:0 none;flex-grow:1;flex-basis:0;min-width:0}.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child{border-right:0 none}.selectize-dropdown.plugin-optgroup_columns .optgroup:before{display:none}.selectize-dropdown.plugin-optgroup_columns .optgroup-header{border-top:0 none}.selectize-control.plugin-remove_button .item{display:inline-flex;align-items:center;padding-right:0 !important}.selectize-control.plugin-remove_button .item .remove{color:inherit;text-decoration:none;vertical-align:middle;display:inline-block;padding:2px 6px;border-left:1px solid #d0d0d0;border-radius:0 2px 2px 0;box-sizing:border-box;margin-left:6px}.selectize-control.plugin-remove_button .item .remove:hover{background:rgba(0,0,0,.05)}.selectize-control.plugin-remove_button .item.active .remove{border-left-color:#cacaca}.selectize-control.plugin-remove_button .disabled .item .remove:hover{background:none}.selectize-control.plugin-remove_button .disabled .item .remove{border-left-color:#fff}.selectize-control.plugin-remove_button .remove-single{position:absolute;right:0;top:0;font-size:23px}.selectize-control{position:relative}.selectize-dropdown,.selectize-input,.selectize-input input{color:#303030;font-family:inherit;font-size:13px;line-height:18px;font-smoothing:inherit}.selectize-input,.selectize-control.single .selectize-input.input-active{background:#fff;cursor:text;display:inline-block}.selectize-input{border:1px solid #d0d0d0;padding:8px 8px;display:inline-block;width:100%;overflow:hidden;position:relative;z-index:1;box-sizing:border-box;box-shadow:inset 0 1px 1px rgba(0,0,0,.1);border-radius:3px}.selectize-control.multi .selectize-input.has-items{padding:calc( 8px - 2px - 0 ) 8px calc( 8px - 2px - 3px - 0 )}.selectize-input.full{background-color:#fff}.selectize-input.disabled,.selectize-input.disabled *{cursor:default !important}.selectize-input.focus{box-shadow:inset 0 1px 2px rgba(0,0,0,.15)}.selectize-input.dropdown-active{border-radius:3px 3px 0 0}.selectize-input>*{vertical-align:baseline;display:inline-block;zoom:1}.selectize-control.multi .selectize-input>div{cursor:pointer;margin:0 3px 3px 0;padding:2px 6px;background:#f2f2f2;color:#303030;border:0 solid #d0d0d0}.selectize-control.multi .selectize-input>div.active{background:#e8e8e8;color:#303030;border:0 solid #cacaca}.selectize-control.multi .selectize-input.disabled>div,.selectize-control.multi .selectize-input.disabled>div.active{color:#7d7d7d;background:#fff;border:0 solid #fff}.selectize-input>input{display:inline-block !important;padding:0 !important;min-height:0 !important;max-height:none !important;max-width:100% !important;margin:0 !important;text-indent:0 !important;border:0 none !important;background:none !important;line-height:inherit !important;user-select:auto !important;box-shadow:none !important}.selectize-input>input::-ms-clear{display:none}.selectize-input>input:focus{outline:none !important}.selectize-input>input[placeholder]{box-sizing:initial}.selectize-input.has-items>input{margin:0 4px !important}.selectize-input::after{content:" ";display:block;clear:left}.selectize-input.dropdown-active::before{content:" ";display:block;position:absolute;background:#f0f0f0;height:1px;bottom:0;left:0;right:0}.selectize-dropdown{position:absolute;top:100%;left:0;width:100%;z-index:10;border:1px solid #d0d0d0;background:#fff;margin:-1px 0 0 0;border-top:0 none;box-sizing:border-box;box-shadow:0 1px 3px rgba(0,0,0,.1);border-radius:0 0 3px 3px}.selectize-dropdown [data-selectable]{cursor:pointer;overflow:hidden}.selectize-dropdown [data-selectable] .highlight{background:rgba(125,168,208,.2);border-radius:1px}.selectize-dropdown .option,.selectize-dropdown .optgroup-header,.selectize-dropdown .no-results,.selectize-dropdown .create{padding:5px 8px}.selectize-dropdown .option,.selectize-dropdown [data-disabled],.selectize-dropdown [data-disabled] [data-selectable].option{cursor:inherit;opacity:.5}.selectize-dropdown [data-selectable].option{opacity:1;cursor:pointer}.selectize-dropdown .optgroup:first-child .optgroup-header{border-top:0 none}.selectize-dropdown .optgroup-header{color:#303030;background:#fff;cursor:default}.selectize-dropdown .active{background-color:#f5fafd;color:#495c68}.selectize-dropdown .active.create{color:#495c68}.selectize-dropdown .create{color:rgba(48,48,48,.5)}.selectize-dropdown-content{overflow-y:auto;overflow-x:hidden;max-height:200px;overflow-scrolling:touch}.selectize-dropdown .spinner{display:inline-block;width:30px;height:30px;margin:5px 8px}.selectize-dropdown .spinner:after{content:" ";display:block;width:24px;height:24px;margin:3px;border-radius:50%;border:5px solid #d0d0d0;border-color:#d0d0d0 transparent #d0d0d0 transparent;animation:lds-dual-ring 1.2s linear infinite}@keyframes lds-dual-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.selectize-control.single .selectize-input,.selectize-control.single .selectize-input input{cursor:pointer}.selectize-control.single .selectize-input.input-active,.selectize-control.single .selectize-input.input-active input{cursor:text}.selectize-control.single .selectize-input:after{content:" ";display:block;position:absolute;top:50%;right:15px;margin-top:-3px;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:gray transparent transparent transparent}.selectize-control.single .selectize-input.dropdown-active:after{margin-top:-4px;border-width:0 5px 5px 5px;border-color:transparent transparent gray transparent}.selectize-control.rtl{text-align:right}.selectize-control.rtl.single .selectize-input:after{left:15px;right:auto}.selectize-control.rtl .selectize-input>input{margin:0 4px 0 -2px !important}.selectize-control .selectize-input.disabled{opacity:.5;background-color:#fafafa} -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/selectize/selectize.bootstrap3.css: -------------------------------------------------------------------------------- 1 | .selectize-control.plugin-drag_drop.multi>.selectize-input>div.ui-sortable-placeholder{visibility:visible !important;background:#f2f2f2 !important;background:rgba(0,0,0,.06) !important;border:0 none !important;box-shadow:inset 0 0 12px 4px #fff}.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after{content:"!";visibility:hidden}.selectize-control.plugin-drag_drop .ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.selectize-control .dropdown-header{position:relative;padding:6px 12px;border-bottom:1px solid #d0d0d0;background:#f8f8f8;border-radius:4px 4px 0 0}.selectize-control .dropdown-header-close{position:absolute;right:12px;top:50%;color:#333;opacity:.4;margin-top:-12px;line-height:20px;font-size:20px !important}.selectize-control .dropdown-header-close:hover{color:#000}.selectize-dropdown.plugin-optgroup_columns .selectize-dropdown-content{display:flex}.selectize-dropdown.plugin-optgroup_columns .optgroup{border-right:1px solid #f2f2f2;border-top:0 none;flex-grow:1;flex-basis:0;min-width:0}.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child{border-right:0 none}.selectize-dropdown.plugin-optgroup_columns .optgroup:before{display:none}.selectize-dropdown.plugin-optgroup_columns .optgroup-header{border-top:0 none}.selectize-control.plugin-remove_button .item{display:inline-flex;align-items:center;padding-right:0 !important}.selectize-control.plugin-remove_button .item .remove{color:inherit;text-decoration:none;vertical-align:middle;display:inline-block;padding:1px 5px;border-left:1px solid rgba(0,0,0,0);border-radius:0 2px 2px 0;box-sizing:border-box;margin-left:5px}.selectize-control.plugin-remove_button .item .remove:hover{background:rgba(0,0,0,.05)}.selectize-control.plugin-remove_button .item.active .remove{border-left-color:rgba(0,0,0,0)}.selectize-control.plugin-remove_button .disabled .item .remove:hover{background:none}.selectize-control.plugin-remove_button .disabled .item .remove{border-left-color:rgba(77,77,77,0)}.selectize-control.plugin-remove_button .remove-single{position:absolute;right:0;top:0;font-size:23px}.selectize-control{position:relative}.selectize-dropdown,.selectize-input,.selectize-input input{color:#333;font-family:inherit;font-size:inherit;line-height:20px;font-smoothing:inherit}.selectize-input,.selectize-control.single .selectize-input.input-active{background:#fff;cursor:text;display:inline-block}.selectize-input{border:1px solid #ccc;padding:6px 12px;display:inline-block;width:100%;overflow:hidden;position:relative;z-index:1;box-sizing:border-box;box-shadow:none;border-radius:4px}.selectize-control.multi .selectize-input.has-items{padding:calc( 6px - 1px - 0 ) 12px calc( 6px - 1px - 3px - 0 )}.selectize-input.full{background-color:#fff}.selectize-input.disabled,.selectize-input.disabled *{cursor:default !important}.selectize-input.focus{box-shadow:inset 0 1px 2px rgba(0,0,0,.15)}.selectize-input.dropdown-active{border-radius:4px 4px 0 0}.selectize-input>*{vertical-align:baseline;display:inline-block;zoom:1}.selectize-control.multi .selectize-input>div{cursor:pointer;margin:0 3px 3px 0;padding:1px 5px;background:#efefef;color:#333;border:0 solid rgba(0,0,0,0)}.selectize-control.multi .selectize-input>div.active{background:#337ab7;color:#fff;border:0 solid rgba(0,0,0,0)}.selectize-control.multi .selectize-input.disabled>div,.selectize-control.multi .selectize-input.disabled>div.active{color:gray;background:#fff;border:0 solid rgba(77,77,77,0)}.selectize-input>input{display:inline-block !important;padding:0 !important;min-height:0 !important;max-height:none !important;max-width:100% !important;margin:0 !important;text-indent:0 !important;border:0 none !important;background:none !important;line-height:inherit !important;user-select:auto !important;box-shadow:none !important}.selectize-input>input::-ms-clear{display:none}.selectize-input>input:focus{outline:none !important}.selectize-input>input[placeholder]{box-sizing:initial}.selectize-input.has-items>input{margin:0 4px !important}.selectize-input::after{content:" ";display:block;clear:left}.selectize-input.dropdown-active::before{content:" ";display:block;position:absolute;background:#fff;height:1px;bottom:0;left:0;right:0}.selectize-dropdown{position:absolute;top:100%;left:0;width:100%;z-index:10;border:1px solid #d0d0d0;background:#fff;margin:-1px 0 0 0;border-top:0 none;box-sizing:border-box;box-shadow:0 1px 3px rgba(0,0,0,.1);border-radius:0 0 4px 4px}.selectize-dropdown [data-selectable]{cursor:pointer;overflow:hidden}.selectize-dropdown [data-selectable] .highlight{background:rgba(255,237,40,.4);border-radius:1px}.selectize-dropdown .option,.selectize-dropdown .optgroup-header,.selectize-dropdown .no-results,.selectize-dropdown .create{padding:3px 12px}.selectize-dropdown .option,.selectize-dropdown [data-disabled],.selectize-dropdown [data-disabled] [data-selectable].option{cursor:inherit;opacity:.5}.selectize-dropdown [data-selectable].option{opacity:1;cursor:pointer}.selectize-dropdown .optgroup:first-child .optgroup-header{border-top:0 none}.selectize-dropdown .optgroup-header{color:#777;background:#fff;cursor:default}.selectize-dropdown .active{background-color:#f5f5f5;color:#262626}.selectize-dropdown .active.create{color:#262626}.selectize-dropdown .create{color:rgba(51,51,51,.5)}.selectize-dropdown-content{overflow-y:auto;overflow-x:hidden;max-height:200px;overflow-scrolling:touch}.selectize-dropdown .spinner{display:inline-block;width:30px;height:30px;margin:3px 12px}.selectize-dropdown .spinner:after{content:" ";display:block;width:24px;height:24px;margin:3px;border-radius:50%;border:5px solid #d0d0d0;border-color:#d0d0d0 transparent #d0d0d0 transparent;animation:lds-dual-ring 1.2s linear infinite}@keyframes lds-dual-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.selectize-control.single .selectize-input,.selectize-control.single .selectize-input input{cursor:pointer}.selectize-control.single .selectize-input.input-active,.selectize-control.single .selectize-input.input-active input{cursor:text}.selectize-control.single .selectize-input:after{content:" ";display:block;position:absolute;top:50%;right:17px;margin-top:-3px;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#333 transparent transparent transparent}.selectize-control.single .selectize-input.dropdown-active:after{margin-top:-4px;border-width:0 5px 5px 5px;border-color:transparent transparent #333 transparent}.selectize-control.rtl{text-align:right}.selectize-control.rtl.single .selectize-input:after{left:17px;right:auto}.selectize-control.rtl .selectize-input>input{margin:0 4px 0 -2px !important}.selectize-control .selectize-input.disabled{opacity:.5;background-color:#fff}.selectize-dropdown,.selectize-dropdown.form-control{height:auto;padding:0;margin:2px 0 0 0;z-index:1000;background:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;box-shadow:0 6px 12px rgba(0,0,0,.175)}.selectize-dropdown .optgroup-header{font-size:12px;line-height:1.428571429}.selectize-dropdown .optgroup:first-child:before{display:none}.selectize-dropdown .optgroup:before{content:" ";display:block;height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5;margin-left:-12px;margin-right:-12px}.selectize-dropdown-content{padding:5px 0}.selectize-input{min-height:34px}.selectize-input.dropdown-active{border-radius:4px}.selectize-input.dropdown-active::before{display:none}.selectize-input.focus{border-color:#66afe9;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.has-error .selectize-input{border-color:#a94442;box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .selectize-input:focus{border-color:#843534;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.selectize-control.multi .selectize-input.has-items{padding-left:7px;padding-right:7px}.selectize-control.multi .selectize-input>div{border-radius:3px}.form-control.selectize-control{padding:0;height:auto;border:none;background:none;box-shadow:none;border-radius:0} -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/selectize/selectize.default.css: -------------------------------------------------------------------------------- 1 | .selectize-control.plugin-drag_drop.multi>.selectize-input>div.ui-sortable-placeholder{visibility:visible !important;background:#f2f2f2 !important;background:rgba(0,0,0,.06) !important;border:0 none !important;box-shadow:inset 0 0 12px 4px #fff}.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after{content:"!";visibility:hidden}.selectize-control.plugin-drag_drop .ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.selectize-control .dropdown-header{position:relative;padding:10px 8px;border-bottom:1px solid #d0d0d0;background:#f8f8f8;border-radius:3px 3px 0 0}.selectize-control .dropdown-header-close{position:absolute;right:8px;top:50%;color:#303030;opacity:.4;margin-top:-12px;line-height:20px;font-size:20px !important}.selectize-control .dropdown-header-close:hover{color:#000}.selectize-dropdown.plugin-optgroup_columns .selectize-dropdown-content{display:flex}.selectize-dropdown.plugin-optgroup_columns .optgroup{border-right:1px solid #f2f2f2;border-top:0 none;flex-grow:1;flex-basis:0;min-width:0}.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child{border-right:0 none}.selectize-dropdown.plugin-optgroup_columns .optgroup:before{display:none}.selectize-dropdown.plugin-optgroup_columns .optgroup-header{border-top:0 none}.selectize-control.plugin-remove_button .item{display:inline-flex;align-items:center;padding-right:0 !important}.selectize-control.plugin-remove_button .item .remove{color:inherit;text-decoration:none;vertical-align:middle;display:inline-block;padding:2px 6px;border-left:1px solid #0073bb;border-radius:0 2px 2px 0;box-sizing:border-box;margin-left:6px}.selectize-control.plugin-remove_button .item .remove:hover{background:rgba(0,0,0,.05)}.selectize-control.plugin-remove_button .item.active .remove{border-left-color:#00578d}.selectize-control.plugin-remove_button .disabled .item .remove:hover{background:none}.selectize-control.plugin-remove_button .disabled .item .remove{border-left-color:#aaa}.selectize-control.plugin-remove_button .remove-single{position:absolute;right:0;top:0;font-size:23px}.selectize-control{position:relative}.selectize-dropdown,.selectize-input,.selectize-input input{color:#303030;font-family:inherit;font-size:13px;line-height:18px;font-smoothing:inherit}.selectize-input,.selectize-control.single .selectize-input.input-active{background:#fff;cursor:text;display:inline-block}.selectize-input{border:1px solid #d0d0d0;padding:8px 8px;display:inline-block;width:100%;overflow:hidden;position:relative;z-index:1;box-sizing:border-box;box-shadow:inset 0 1px 1px rgba(0,0,0,.1);border-radius:3px}.selectize-control.multi .selectize-input.has-items{padding:calc( 8px - 2px - 1px ) 8px calc( 8px - 2px - 3px - 1px )}.selectize-input.full{background-color:#fff}.selectize-input.disabled,.selectize-input.disabled *{cursor:default !important}.selectize-input.focus{box-shadow:inset 0 1px 2px rgba(0,0,0,.15)}.selectize-input.dropdown-active{border-radius:3px 3px 0 0}.selectize-input>*{vertical-align:baseline;display:inline-block;zoom:1}.selectize-control.multi .selectize-input>div{cursor:pointer;margin:0 3px 3px 0;padding:2px 6px;background:#1da7ee;color:#fff;border:1px solid #0073bb}.selectize-control.multi .selectize-input>div.active{background:#92c836;color:#fff;border:1px solid #00578d}.selectize-control.multi .selectize-input.disabled>div,.selectize-control.multi .selectize-input.disabled>div.active{color:#fff;background:#d2d2d2;border:1px solid #aaa}.selectize-input>input{display:inline-block !important;padding:0 !important;min-height:0 !important;max-height:none !important;max-width:100% !important;margin:0 !important;text-indent:0 !important;border:0 none !important;background:none !important;line-height:inherit !important;user-select:auto !important;box-shadow:none !important}.selectize-input>input::-ms-clear{display:none}.selectize-input>input:focus{outline:none !important}.selectize-input>input[placeholder]{box-sizing:initial}.selectize-input.has-items>input{margin:0 4px !important}.selectize-input::after{content:" ";display:block;clear:left}.selectize-input.dropdown-active::before{content:" ";display:block;position:absolute;background:#f0f0f0;height:1px;bottom:0;left:0;right:0}.selectize-dropdown{position:absolute;top:100%;left:0;width:100%;z-index:10;border:1px solid #d0d0d0;background:#fff;margin:-1px 0 0 0;border-top:0 none;box-sizing:border-box;box-shadow:0 1px 3px rgba(0,0,0,.1);border-radius:0 0 3px 3px}.selectize-dropdown [data-selectable]{cursor:pointer;overflow:hidden}.selectize-dropdown [data-selectable] .highlight{background:rgba(125,168,208,.2);border-radius:1px}.selectize-dropdown .option,.selectize-dropdown .optgroup-header,.selectize-dropdown .no-results,.selectize-dropdown .create{padding:5px 8px}.selectize-dropdown .option,.selectize-dropdown [data-disabled],.selectize-dropdown [data-disabled] [data-selectable].option{cursor:inherit;opacity:.5}.selectize-dropdown [data-selectable].option{opacity:1;cursor:pointer}.selectize-dropdown .optgroup:first-child .optgroup-header{border-top:0 none}.selectize-dropdown .optgroup-header{color:#303030;background:#fff;cursor:default}.selectize-dropdown .active{background-color:#f5fafd;color:#495c68}.selectize-dropdown .active.create{color:#495c68}.selectize-dropdown .create{color:rgba(48,48,48,.5)}.selectize-dropdown-content{overflow-y:auto;overflow-x:hidden;max-height:200px;overflow-scrolling:touch}.selectize-dropdown .spinner{display:inline-block;width:30px;height:30px;margin:5px 8px}.selectize-dropdown .spinner:after{content:" ";display:block;width:24px;height:24px;margin:3px;border-radius:50%;border:5px solid #d0d0d0;border-color:#d0d0d0 transparent #d0d0d0 transparent;animation:lds-dual-ring 1.2s linear infinite}@keyframes lds-dual-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.selectize-control.single .selectize-input,.selectize-control.single .selectize-input input{cursor:pointer}.selectize-control.single .selectize-input.input-active,.selectize-control.single .selectize-input.input-active input{cursor:text}.selectize-control.single .selectize-input:after{content:" ";display:block;position:absolute;top:50%;right:15px;margin-top:-3px;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:gray transparent transparent transparent}.selectize-control.single .selectize-input.dropdown-active:after{margin-top:-4px;border-width:0 5px 5px 5px;border-color:transparent transparent gray transparent}.selectize-control.rtl{text-align:right}.selectize-control.rtl.single .selectize-input:after{left:15px;right:auto}.selectize-control.rtl .selectize-input>input{margin:0 4px 0 -2px !important}.selectize-control .selectize-input.disabled{opacity:.5;background-color:#fafafa}.selectize-control.multi .selectize-input.has-items{padding-left:5px;padding-right:5px}.selectize-control.multi .selectize-input.disabled [data-value]{color:#999;text-shadow:none;background:none;box-shadow:none}.selectize-control.multi .selectize-input.disabled [data-value],.selectize-control.multi .selectize-input.disabled [data-value] .remove{border-color:#e6e6e6}.selectize-control.multi .selectize-input.disabled [data-value] .remove{background:none}.selectize-control.multi .selectize-input [data-value]{text-shadow:0 1px 0 rgba(0,51,83,.3);border-radius:3px;background-color:#1b9dec;background-image:linear-gradient(to bottom, #1da7ee, #178ee9);background-repeat:repeat-x;box-shadow:0 1px 0 rgba(0,0,0,.2),inset 0 1px rgba(255,255,255,.03)}.selectize-control.multi .selectize-input [data-value].active{background-color:#0085d4;background-image:linear-gradient(to bottom, #008fd8, #0075cf);background-repeat:repeat-x}.selectize-control.single .selectize-input{box-shadow:0 1px 0 rgba(0,0,0,.05),inset 0 1px 0 rgba(255,255,255,.8);background-color:#f9f9f9;background-image:linear-gradient(to bottom, #fefefe, #f2f2f2);background-repeat:repeat-x}.selectize-control.single .selectize-input,.selectize-dropdown.single{border-color:#b8b8b8}.selectize-dropdown .optgroup-header{padding-top:7px;font-weight:bold;font-size:.85em}.selectize-dropdown .optgroup{border-top:1px solid #f0f0f0}.selectize-dropdown .optgroup:first-child{border-top:0 none} -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/selectize/selectize.bootstrap4.css: -------------------------------------------------------------------------------- 1 | .selectize-control.plugin-drag_drop.multi>.selectize-input>div.ui-sortable-placeholder{visibility:visible !important;background:#f2f2f2 !important;background:rgba(0,0,0,.06) !important;border:0 none !important;box-shadow:inset 0 0 12px 4px #fff}.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after{content:"!";visibility:hidden}.selectize-control.plugin-drag_drop .ui-sortable-helper{box-shadow:0 2px 5px rgba(0,0,0,.2)}.selectize-control .dropdown-header{position:relative;padding:6px .75rem;border-bottom:1px solid #d0d0d0;background:#f8f8f8;border-radius:.25rem .25rem 0 0}.selectize-control .dropdown-header-close{position:absolute;right:.75rem;top:50%;color:#343a40;opacity:.4;margin-top:-12px;line-height:20px;font-size:20px !important}.selectize-control .dropdown-header-close:hover{color:#000}.selectize-dropdown.plugin-optgroup_columns .selectize-dropdown-content{display:flex}.selectize-dropdown.plugin-optgroup_columns .optgroup{border-right:1px solid #f2f2f2;border-top:0 none;flex-grow:1;flex-basis:0;min-width:0}.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child{border-right:0 none}.selectize-dropdown.plugin-optgroup_columns .optgroup:before{display:none}.selectize-dropdown.plugin-optgroup_columns .optgroup-header{border-top:0 none}.selectize-control.plugin-remove_button .item{display:inline-flex;align-items:center;padding-right:0 !important}.selectize-control.plugin-remove_button .item .remove{color:inherit;text-decoration:none;vertical-align:middle;display:inline-block;padding:1px 5px;border-left:1px solid #dee2e6;border-radius:0 2px 2px 0;box-sizing:border-box;margin-left:5px}.selectize-control.plugin-remove_button .item .remove:hover{background:rgba(0,0,0,.05)}.selectize-control.plugin-remove_button .item.active .remove{border-left-color:rgba(0,0,0,0)}.selectize-control.plugin-remove_button .disabled .item .remove:hover{background:none}.selectize-control.plugin-remove_button .disabled .item .remove{border-left-color:#fff}.selectize-control.plugin-remove_button .remove-single{position:absolute;right:0;top:0;font-size:23px}.selectize-control{position:relative}.selectize-dropdown,.selectize-input,.selectize-input input{color:#343a40;font-family:inherit;font-size:inherit;line-height:1.5;font-smoothing:inherit}.selectize-input,.selectize-control.single .selectize-input.input-active{background:#fff;cursor:text;display:inline-block}.selectize-input{border:1px solid #ced4da;padding:.375rem .75rem;display:inline-block;width:100%;overflow:hidden;position:relative;z-index:1;box-sizing:border-box;box-shadow:none;border-radius:.25rem}.selectize-control.multi .selectize-input.has-items{padding:calc( 0.375rem - 1px - 0px ) .75rem calc( 0.375rem - 1px - 3px - 0px )}.selectize-input.full{background-color:#fff}.selectize-input.disabled,.selectize-input.disabled *{cursor:default !important}.selectize-input.focus{box-shadow:inset 0 1px 2px rgba(0,0,0,.15)}.selectize-input.dropdown-active{border-radius:.25rem .25rem 0 0}.selectize-input>*{vertical-align:baseline;display:inline-block;zoom:1}.selectize-control.multi .selectize-input>div{cursor:pointer;margin:0 3px 3px 0;padding:1px 5px;background:#efefef;color:#343a40;border:0px solid #dee2e6}.selectize-control.multi .selectize-input>div.active{background:#007bff;color:#fff;border:0px solid rgba(0,0,0,0)}.selectize-control.multi .selectize-input.disabled>div,.selectize-control.multi .selectize-input.disabled>div.active{color:#878787;background:#fff;border:0px solid #fff}.selectize-input>input{display:inline-block !important;padding:0 !important;min-height:0 !important;max-height:none !important;max-width:100% !important;margin:0 !important;text-indent:0 !important;border:0 none !important;background:none !important;line-height:inherit !important;user-select:auto !important;box-shadow:none !important}.selectize-input>input::-ms-clear{display:none}.selectize-input>input:focus{outline:none !important}.selectize-input>input[placeholder]{box-sizing:initial}.selectize-input.has-items>input{margin:0 4px !important}.selectize-input::after{content:" ";display:block;clear:left}.selectize-input.dropdown-active::before{content:" ";display:block;position:absolute;background:#fff;height:1px;bottom:0;left:0;right:0}.selectize-dropdown{position:absolute;top:100%;left:0;width:100%;z-index:10;border:1px solid #d0d0d0;background:#fff;margin:-1px 0 0 0;border-top:0 none;box-sizing:border-box;box-shadow:0 1px 3px rgba(0,0,0,.1);border-radius:0 0 .25rem .25rem}.selectize-dropdown [data-selectable]{cursor:pointer;overflow:hidden}.selectize-dropdown [data-selectable] .highlight{background:rgba(255,237,40,.4);border-radius:1px}.selectize-dropdown .option,.selectize-dropdown .optgroup-header,.selectize-dropdown .no-results,.selectize-dropdown .create{padding:3px .75rem}.selectize-dropdown .option,.selectize-dropdown [data-disabled],.selectize-dropdown [data-disabled] [data-selectable].option{cursor:inherit;opacity:.5}.selectize-dropdown [data-selectable].option{opacity:1;cursor:pointer}.selectize-dropdown .optgroup:first-child .optgroup-header{border-top:0 none}.selectize-dropdown .optgroup-header{color:#6c757d;background:#fff;cursor:default}.selectize-dropdown .active{background-color:#f8f9fa;color:#16181b}.selectize-dropdown .active.create{color:#16181b}.selectize-dropdown .create{color:rgba(52,58,64,.5)}.selectize-dropdown-content{overflow-y:auto;overflow-x:hidden;max-height:200px;overflow-scrolling:touch}.selectize-dropdown .spinner{display:inline-block;width:30px;height:30px;margin:3px .75rem}.selectize-dropdown .spinner:after{content:" ";display:block;width:24px;height:24px;margin:3px;border-radius:50%;border:5px solid #d0d0d0;border-color:#d0d0d0 transparent #d0d0d0 transparent;animation:lds-dual-ring 1.2s linear infinite}@keyframes lds-dual-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.selectize-control.single .selectize-input,.selectize-control.single .selectize-input input{cursor:pointer}.selectize-control.single .selectize-input.input-active,.selectize-control.single .selectize-input.input-active input{cursor:text}.selectize-control.single .selectize-input:after{content:" ";display:block;position:absolute;top:50%;right:calc(0.75rem + 5px);margin-top:-3px;width:0;height:0;border-style:solid;border-width:5px 5px 0 5px;border-color:#343a40 transparent transparent transparent}.selectize-control.single .selectize-input.dropdown-active:after{margin-top:-4px;border-width:0 5px 5px 5px;border-color:transparent transparent #343a40 transparent}.selectize-control.rtl{text-align:right}.selectize-control.rtl.single .selectize-input:after{left:calc(0.75rem + 5px);right:auto}.selectize-control.rtl .selectize-input>input{margin:0 4px 0 -2px !important}.selectize-control .selectize-input.disabled{opacity:.5;background-color:#fff}.selectize-dropdown,.selectize-dropdown.form-control{height:auto;padding:0;margin:2px 0 0 0;z-index:1000;background:#fff;border:1px solid rgba(0,0,0,.15);border-radius:.25rem;box-shadow:0 6px 12px rgba(0,0,0,.175)}.selectize-dropdown .optgroup-header{font-size:.875rem;line-height:1.5}.selectize-dropdown .optgroup:first-child:before{display:none}.selectize-dropdown .optgroup:before{content:" ";display:block;height:0;margin:.5rem 0;overflow:hidden;border-top:1px solid #e9ecef;margin-left:-0.75rem;margin-right:-0.75rem}.selectize-dropdown .create{padding-left:.75rem}.selectize-dropdown-content{padding:5px 0}.selectize-input{min-height:calc(1.5em + 0.75rem + 2px);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out}@media(prefers-reduced-motion: reduce){.selectize-input{transition:none}}.selectize-input.dropdown-active{border-radius:.25rem}.selectize-input.dropdown-active::before{display:none}.selectize-input.focus{border-color:#80bdff;outline:0;box-shadow:0 0 0 .2rem rgba(0,123,255,.25)}.is-invalid .selectize-input{border-color:#dc3545;box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.is-invalid .selectize-input:focus{border-color:#bd2130;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #eb8c95}.selectize-control.form-control-sm .selectize-input.has-items{min-height:calc(1.5em + 0.5rem + 2px) !important;height:calc(1.5em + 0.5rem + 2px);padding:.25rem .5rem !important;font-size:.875rem;line-height:1.5}.selectize-control.multi .selectize-input.has-items{height:auto;padding-left:calc(0.75rem - 5px);padding-right:calc(0.75rem - 5px)}.selectize-control.multi .selectize-input>div{border-radius:calc(0.25rem - 1px)}.form-control.selectize-control{padding:0;height:auto;border:none;background:none;box-shadow:none;border-radius:0}.input-group .selectize-input{overflow:unset;border-radius:0 .25rem .25rem 0} -------------------------------------------------------------------------------- /spec/dummy/config/initializers/active_admin.rb: -------------------------------------------------------------------------------- 1 | ActiveAdmin.setup do |config| 2 | # == Site Title 3 | # 4 | # Set the title that is displayed on the main layout 5 | # for each of the active admin pages. 6 | # 7 | config.site_title = "Dummy" 8 | 9 | # Set the link url for the title. For example, to take 10 | # users to your main site. Defaults to no link. 11 | # 12 | # config.site_title_link = "/" 13 | 14 | # Set an optional image to be displayed for the header 15 | # instead of a string (overrides :site_title) 16 | # 17 | # Note: Aim for an image that's 21px high so it fits in the header. 18 | # 19 | # config.site_title_image = "logo.png" 20 | 21 | # == Default Namespace 22 | # 23 | # Set the default namespace each administration resource 24 | # will be added to. 25 | # 26 | # eg: 27 | # config.default_namespace = :hello_world 28 | # 29 | # This will create resources in the HelloWorld module and 30 | # will namespace routes to /hello_world/* 31 | # 32 | # To set no namespace by default, use: 33 | # config.default_namespace = false 34 | # 35 | # Default: 36 | # config.default_namespace = :admin 37 | # 38 | # You can customize the settings for each namespace by using 39 | # a namespace block. For example, to change the site title 40 | # within a namespace: 41 | # 42 | # config.namespace :admin do |admin| 43 | # admin.site_title = "Custom Admin Title" 44 | # end 45 | # 46 | # This will ONLY change the title for the admin section. Other 47 | # namespaces will continue to use the main "site_title" configuration. 48 | 49 | # == User Authentication 50 | # 51 | # Active Admin will automatically call an authentication 52 | # method in a before filter of all controller actions to 53 | # ensure that there is a currently logged in admin user. 54 | # 55 | # This setting changes the method which Active Admin calls 56 | # within the application controller. 57 | # config.authentication_method = :authenticate_admin_user! 58 | 59 | # == User Authorization 60 | # 61 | # Active Admin will automatically call an authorization 62 | # method in a before filter of all controller actions to 63 | # ensure that there is a user with proper rights. You can use 64 | # CanCanAdapter or make your own. Please refer to documentation. 65 | # config.authorization_adapter = ActiveAdmin::CanCanAdapter 66 | 67 | # In case you prefer Pundit over other solutions you can here pass 68 | # the name of default policy class. This policy will be used in every 69 | # case when Pundit is unable to find suitable policy. 70 | # config.pundit_default_policy = "MyDefaultPunditPolicy" 71 | 72 | # If you wish to maintain a separate set of Pundit policies for admin 73 | # resources, you may set a namespace here that Pundit will search 74 | # within when looking for a resource's policy. 75 | # config.pundit_policy_namespace = :admin 76 | 77 | # You can customize your CanCan Ability class name here. 78 | # config.cancan_ability_class = "Ability" 79 | 80 | # You can specify a method to be called on unauthorized access. 81 | # This is necessary in order to prevent a redirect loop which happens 82 | # because, by default, user gets redirected to Dashboard. If user 83 | # doesn't have access to Dashboard, he'll end up in a redirect loop. 84 | # Method provided here should be defined in application_controller.rb. 85 | # config.on_unauthorized_access = :access_denied 86 | 87 | # == Current User 88 | # 89 | # Active Admin will associate actions with the current 90 | # user performing them. 91 | # 92 | # This setting changes the method which Active Admin calls 93 | # (within the application controller) to return the currently logged in user. 94 | # config.current_user_method = :current_admin_user 95 | 96 | # == Logging Out 97 | # 98 | # Active Admin displays a logout link on each screen. These 99 | # settings configure the location and method used for the link. 100 | # 101 | # This setting changes the path where the link points to. If it's 102 | # a string, the strings is used as the path. If it's a Symbol, we 103 | # will call the method to return the path. 104 | # 105 | # Default: 106 | config.logout_link_path = :destroy_admin_user_session_path 107 | 108 | # This setting changes the http method used when rendering the 109 | # link. For example :get, :delete, :put, etc.. 110 | # 111 | # Default: 112 | # config.logout_link_method = :get 113 | 114 | # == Root 115 | # 116 | # Set the action to call for the root path. You can set different 117 | # roots for each namespace. 118 | # 119 | # Default: 120 | # config.root_to = 'dashboard#index' 121 | 122 | # == Admin Comments 123 | # 124 | # This allows your users to comment on any resource registered with Active Admin. 125 | # 126 | # You can completely disable comments: 127 | # config.comments = false 128 | # 129 | # You can change the name under which comments are registered: 130 | # config.comments_registration_name = 'AdminComment' 131 | # 132 | # You can change the order for the comments and you can change the column 133 | # to be used for ordering: 134 | # config.comments_order = 'created_at ASC' 135 | # 136 | # You can disable the menu item for the comments index page: 137 | # config.comments_menu = false 138 | # 139 | # You can customize the comment menu: 140 | # config.comments_menu = { parent: 'Admin', priority: 1 } 141 | 142 | # == Batch Actions 143 | # 144 | # Enable and disable Batch Actions 145 | # 146 | config.batch_actions = true 147 | 148 | # == Controller Filters 149 | # 150 | # You can add before, after and around filters to all of your 151 | # Active Admin resources and pages from here. 152 | # 153 | # config.before_action :do_something_awesome 154 | 155 | # == Attribute Filters 156 | # 157 | # You can exclude possibly sensitive model attributes from being displayed, 158 | # added to forms, or exported by default by ActiveAdmin 159 | # 160 | config.filter_attributes = [:encrypted_password, :password, :password_confirmation] 161 | 162 | # == Localize Date/Time Format 163 | # 164 | # Set the localize format to display dates and times. 165 | # To understand how to localize your app with I18n, read more at 166 | # https://guides.rubyonrails.org/i18n.html 167 | # 168 | # You can run `bin/rails runner 'puts I18n.t("date.formats")'` to see the 169 | # available formats in your application. 170 | # 171 | config.localize_format = :long 172 | 173 | # == Setting a Favicon 174 | # 175 | # config.favicon = 'favicon.ico' 176 | 177 | # == Meta Tags 178 | # 179 | # Add additional meta tags to the head element of active admin pages. 180 | # 181 | # Add tags to all pages logged in users see: 182 | # config.meta_tags = { author: 'My Company' } 183 | 184 | # By default, sign up/sign in/recover password pages are excluded 185 | # from showing up in search engine results by adding a robots meta 186 | # tag. You can reset the hash of meta tags included in logged out 187 | # pages: 188 | # config.meta_tags_for_logged_out_pages = {} 189 | 190 | # == Removing Breadcrumbs 191 | # 192 | # Breadcrumbs are enabled by default. You can customize them for individual 193 | # resources or you can disable them globally from here. 194 | # 195 | # config.breadcrumb = false 196 | 197 | # == Create Another Checkbox 198 | # 199 | # Create another checkbox is disabled by default. You can customize it for individual 200 | # resources or you can enable them globally from here. 201 | # 202 | # config.create_another = true 203 | 204 | # == Register Stylesheets & Javascripts 205 | # 206 | # We recommend using the built in Active Admin layout and loading 207 | # up your own stylesheets / javascripts to customize the look 208 | # and feel. 209 | # 210 | # To load a stylesheet: 211 | # config.register_stylesheet 'my_stylesheet.css' 212 | # 213 | # You can provide an options hash for more control, which is passed along to stylesheet_link_tag(): 214 | # config.register_stylesheet 'my_print_stylesheet.css', media: :print 215 | # 216 | # To load a javascript file: 217 | # config.register_javascript 'my_javascript.js' 218 | 219 | # == CSV options 220 | # 221 | # Set the CSV builder separator 222 | # config.csv_options = { col_sep: ';' } 223 | # 224 | # Force the use of quotes 225 | # config.csv_options = { force_quotes: true } 226 | 227 | # == Menu System 228 | # 229 | # You can add a navigation menu to be used in your application, or configure a provided menu 230 | # 231 | # To change the default utility navigation to show a link to your website & a logout btn 232 | # 233 | # config.namespace :admin do |admin| 234 | # admin.build_menu :utility_navigation do |menu| 235 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } 236 | # admin.add_logout_button_to_menu menu 237 | # end 238 | # end 239 | # 240 | # If you wanted to add a static menu item to the default menu provided: 241 | # 242 | # config.namespace :admin do |admin| 243 | # admin.build_menu :default do |menu| 244 | # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank } 245 | # end 246 | # end 247 | 248 | # == Download Links 249 | # 250 | # You can disable download links on resource listing pages, 251 | # or customize the formats shown per namespace/globally 252 | # 253 | # To disable/customize for the :admin namespace: 254 | # 255 | # config.namespace :admin do |admin| 256 | # 257 | # # Disable the links entirely 258 | # admin.download_links = false 259 | # 260 | # # Only show XML & PDF options 261 | # admin.download_links = [:xml, :pdf] 262 | # 263 | # # Enable/disable the links based on block 264 | # # (for example, with cancan) 265 | # admin.download_links = proc { can?(:view_download_links) } 266 | # 267 | # end 268 | 269 | # == Pagination 270 | # 271 | # Pagination is enabled by default for all resources. 272 | # You can control the default per page count for all resources here. 273 | # 274 | # config.default_per_page = 30 275 | # 276 | # You can control the max per page count too. 277 | # 278 | # config.max_per_page = 10_000 279 | 280 | # == Filters 281 | # 282 | # By default the index screen includes a "Filters" sidebar on the right 283 | # hand side with a filter for each attribute of the registered model. 284 | # You can enable or disable them for all resources here. 285 | # 286 | # config.filters = true 287 | # 288 | # By default the filters include associations in a select, which means 289 | # that every record will be loaded for each association (up 290 | # to the value of config.maximum_association_filter_arity). 291 | # You can enabled or disable the inclusion 292 | # of those filters by default here. 293 | # 294 | # config.include_default_association_filters = true 295 | 296 | # config.maximum_association_filter_arity = 256 # default value of :unlimited will change to 256 in a future version 297 | # config.filter_columns_for_large_association, [ 298 | # :display_name, 299 | # :full_name, 300 | # :name, 301 | # :username, 302 | # :login, 303 | # :title, 304 | # :email, 305 | # ] 306 | # config.filter_method_for_large_association, '_starts_with' 307 | 308 | # == Head 309 | # 310 | # You can add your own content to the site head like analytics. Make sure 311 | # you only pass content you trust. 312 | # 313 | # config.head = ''.html_safe 314 | 315 | # == Footer 316 | # 317 | # By default, the footer shows the current Active Admin version. You can 318 | # override the content of the footer here. 319 | # 320 | # config.footer = 'my custom footer text' 321 | 322 | # == Sorting 323 | # 324 | # By default ActiveAdmin::OrderClause is used for sorting logic 325 | # You can inherit it with own class and inject it for all resources 326 | # 327 | # config.order_clause = MyOrderClause 328 | 329 | # == Webpacker 330 | # 331 | # By default, Active Admin uses Sprocket's asset pipeline. 332 | # You can switch to using Webpacker here. 333 | # 334 | # config.use_webpacker = true 335 | end 336 | -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/selectize/selectize.legacy.css: -------------------------------------------------------------------------------- 1 | /** 2 | * selectize.css (v0.13.3) 3 | * Copyright (c) 2013–2015 Brian Reavis & contributors 4 | * Copyright (c) 2020 Selectize Team & contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 7 | * file except in compliance with the License. You may obtain a copy of the License at: 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. 14 | * 15 | * @author Brian Reavis 16 | * @author Ris Adams 17 | */ 18 | .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { 19 | visibility: visible !important; 20 | background: #f2f2f2 !important; 21 | background: rgba(0, 0, 0, 0.06) !important; 22 | border: 0 none !important; 23 | -webkit-box-shadow: inset 0 0 12px 4px #fff; 24 | box-shadow: inset 0 0 12px 4px #fff; 25 | } 26 | .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { 27 | content: '!'; 28 | visibility: hidden; 29 | } 30 | .selectize-control.plugin-drag_drop .ui-sortable-helper { 31 | -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 32 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 33 | } 34 | .selectize-dropdown-header { 35 | position: relative; 36 | padding: 7px 10px; 37 | border-bottom: 1px solid #d0d0d0; 38 | background: #f8f8f8; 39 | -webkit-border-radius: 3px 3px 0 0; 40 | -moz-border-radius: 3px 3px 0 0; 41 | border-radius: 3px 3px 0 0; 42 | } 43 | .selectize-dropdown-header-close { 44 | position: absolute; 45 | right: 10px; 46 | top: 50%; 47 | color: #303030; 48 | opacity: 0.4; 49 | margin-top: -12px; 50 | line-height: 20px; 51 | font-size: 20px !important; 52 | } 53 | .selectize-dropdown-header-close:hover { 54 | color: #000000; 55 | } 56 | .selectize-dropdown.plugin-optgroup_columns .optgroup { 57 | border-right: 1px solid #f2f2f2; 58 | border-top: 0 none; 59 | float: left; 60 | -webkit-box-sizing: border-box; 61 | -moz-box-sizing: border-box; 62 | box-sizing: border-box; 63 | } 64 | .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { 65 | border-right: 0 none; 66 | } 67 | .selectize-dropdown.plugin-optgroup_columns .optgroup:before { 68 | display: none; 69 | } 70 | .selectize-dropdown.plugin-optgroup_columns .optgroup-header { 71 | border-top: 0 none; 72 | } 73 | .selectize-control.plugin-remove_button [data-value] { 74 | position: relative; 75 | padding-right: 24px !important; 76 | } 77 | .selectize-control.plugin-remove_button [data-value] .remove { 78 | z-index: 1; 79 | /* fixes ie bug (see #392) */ 80 | position: absolute; 81 | top: 0; 82 | right: 0; 83 | bottom: 0; 84 | width: 17px; 85 | text-align: center; 86 | font-weight: bold; 87 | font-size: 12px; 88 | color: inherit; 89 | text-decoration: none; 90 | vertical-align: middle; 91 | display: inline-block; 92 | padding: 1px 0 0 0; 93 | border-left: 1px solid #74b21e; 94 | -webkit-border-radius: 0 2px 2px 0; 95 | -moz-border-radius: 0 2px 2px 0; 96 | border-radius: 0 2px 2px 0; 97 | -webkit-box-sizing: border-box; 98 | -moz-box-sizing: border-box; 99 | box-sizing: border-box; 100 | } 101 | .selectize-control.plugin-remove_button [data-value] .remove:hover { 102 | background: rgba(0, 0, 0, 0.05); 103 | } 104 | .selectize-control.plugin-remove_button [data-value].active .remove { 105 | border-left-color: #6f9839; 106 | } 107 | .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { 108 | background: none; 109 | } 110 | .selectize-control.plugin-remove_button .disabled [data-value] .remove { 111 | border-left-color: #b4b4b4; 112 | } 113 | .selectize-control.plugin-remove_button .remove-single { 114 | position: absolute; 115 | right: 0; 116 | top: 0; 117 | font-size: 23px; 118 | } 119 | .selectize-control { 120 | position: relative; 121 | } 122 | .selectize-dropdown, 123 | .selectize-input, 124 | .selectize-input input { 125 | color: #303030; 126 | font-family: inherit; 127 | font-size: 13px; 128 | line-height: 20px; 129 | -webkit-font-smoothing: inherit; 130 | } 131 | .selectize-input, 132 | .selectize-control.single .selectize-input.input-active { 133 | background: #fff; 134 | cursor: text; 135 | display: inline-block; 136 | } 137 | .selectize-input { 138 | border: 1px solid #d0d0d0; 139 | padding: 10px 10px; 140 | display: inline-block; 141 | width: 100%; 142 | overflow: hidden; 143 | position: relative; 144 | z-index: 1; 145 | -webkit-box-sizing: border-box; 146 | -moz-box-sizing: border-box; 147 | box-sizing: border-box; 148 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); 149 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.1); 150 | -webkit-border-radius: 3px; 151 | -moz-border-radius: 3px; 152 | border-radius: 3px; 153 | } 154 | .selectize-control.multi .selectize-input.has-items { 155 | padding: 8px 10px 4px; 156 | } 157 | .selectize-input.full { 158 | background-color: #f2f2f2; 159 | } 160 | .selectize-input.disabled, 161 | .selectize-input.disabled * { 162 | cursor: default !important; 163 | } 164 | .selectize-input.focus { 165 | -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); 166 | box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); 167 | } 168 | .selectize-input.dropdown-active { 169 | -webkit-border-radius: 3px 3px 0 0; 170 | -moz-border-radius: 3px 3px 0 0; 171 | border-radius: 3px 3px 0 0; 172 | } 173 | .selectize-input > * { 174 | vertical-align: baseline; 175 | display: -moz-inline-stack; 176 | display: inline-block; 177 | zoom: 1; 178 | *display: inline; 179 | } 180 | .selectize-control.multi .selectize-input > div { 181 | cursor: pointer; 182 | margin: 0 4px 4px 0; 183 | padding: 1px 5px; 184 | background: #b8e76f; 185 | color: #3d5d18; 186 | border: 1px solid #74b21e; 187 | } 188 | .selectize-control.multi .selectize-input > div.active { 189 | background: #92c836; 190 | color: #303030; 191 | border: 1px solid #6f9839; 192 | } 193 | .selectize-control.multi .selectize-input.disabled > div, 194 | .selectize-control.multi .selectize-input.disabled > div.active { 195 | color: #878787; 196 | background: #f8f8f8; 197 | border: 1px solid #b4b4b4; 198 | } 199 | .selectize-input > input { 200 | display: inline-block !important; 201 | padding: 0 !important; 202 | min-height: 0 !important; 203 | max-height: none !important; 204 | max-width: 100% !important; 205 | margin: 0 2px 0 0 !important; 206 | text-indent: 0 !important; 207 | border: 0 none !important; 208 | background: none !important; 209 | line-height: inherit !important; 210 | -webkit-user-select: auto !important; 211 | -webkit-box-shadow: none !important; 212 | box-shadow: none !important; 213 | } 214 | .selectize-input > input::-ms-clear { 215 | display: none; 216 | } 217 | .selectize-input > input:focus { 218 | outline: none !important; 219 | } 220 | .selectize-input > input[placeholder] { 221 | box-sizing: initial; 222 | } 223 | .selectize-input::after { 224 | content: ' '; 225 | display: block; 226 | clear: left; 227 | } 228 | .selectize-input.dropdown-active::before { 229 | content: ' '; 230 | display: block; 231 | position: absolute; 232 | background: #f0f0f0; 233 | height: 1px; 234 | bottom: 0; 235 | left: 0; 236 | right: 0; 237 | } 238 | .selectize-dropdown { 239 | position: absolute; 240 | z-index: 10; 241 | border: 1px solid #d0d0d0; 242 | background: #fff; 243 | margin: -1px 0 0 0; 244 | border-top: 0 none; 245 | -webkit-box-sizing: border-box; 246 | -moz-box-sizing: border-box; 247 | box-sizing: border-box; 248 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 249 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 250 | -webkit-border-radius: 0 0 3px 3px; 251 | -moz-border-radius: 0 0 3px 3px; 252 | border-radius: 0 0 3px 3px; 253 | } 254 | .selectize-dropdown [data-selectable] { 255 | cursor: pointer; 256 | overflow: hidden; 257 | } 258 | .selectize-dropdown [data-selectable] .highlight { 259 | background: rgba(255, 237, 40, 0.4); 260 | -webkit-border-radius: 1px; 261 | -moz-border-radius: 1px; 262 | border-radius: 1px; 263 | } 264 | .selectize-dropdown .option, 265 | .selectize-dropdown .optgroup-header { 266 | padding: 7px 10px; 267 | } 268 | .selectize-dropdown .option, 269 | .selectize-dropdown [data-disabled], 270 | .selectize-dropdown [data-disabled] [data-selectable].option { 271 | cursor: inherit; 272 | opacity: 0.5; 273 | } 274 | .selectize-dropdown [data-selectable].option { 275 | opacity: 1; 276 | } 277 | .selectize-dropdown .optgroup:first-child .optgroup-header { 278 | border-top: 0 none; 279 | } 280 | .selectize-dropdown .optgroup-header { 281 | color: #303030; 282 | background: #f8f8f8; 283 | cursor: default; 284 | } 285 | .selectize-dropdown .active { 286 | background-color: #fffceb; 287 | color: #303030; 288 | } 289 | .selectize-dropdown .active.create { 290 | color: #303030; 291 | } 292 | .selectize-dropdown .create { 293 | color: rgba(48, 48, 48, 0.5); 294 | } 295 | .selectize-dropdown-content { 296 | overflow-y: auto; 297 | overflow-x: hidden; 298 | max-height: 200px; 299 | -webkit-overflow-scrolling: touch; 300 | } 301 | .selectize-control.single .selectize-input, 302 | .selectize-control.single .selectize-input input { 303 | cursor: pointer; 304 | } 305 | .selectize-control.single .selectize-input.input-active, 306 | .selectize-control.single .selectize-input.input-active input { 307 | cursor: text; 308 | } 309 | .selectize-control.single .selectize-input:after { 310 | content: ' '; 311 | display: block; 312 | position: absolute; 313 | top: 50%; 314 | right: 15px; 315 | margin-top: -3px; 316 | width: 0; 317 | height: 0; 318 | border-style: solid; 319 | border-width: 5px 5px 0 5px; 320 | border-color: #808080 transparent transparent transparent; 321 | } 322 | .selectize-control.single .selectize-input.dropdown-active:after { 323 | margin-top: -4px; 324 | border-width: 0 5px 5px 5px; 325 | border-color: transparent transparent #808080 transparent; 326 | } 327 | .selectize-control.rtl.single .selectize-input:after { 328 | left: 15px; 329 | right: auto; 330 | } 331 | .selectize-control.rtl .selectize-input > input { 332 | margin: 0 4px 0 -2px !important; 333 | } 334 | .selectize-control .selectize-input.disabled { 335 | opacity: 0.5; 336 | background-color: #fafafa; 337 | } 338 | .selectize-control.multi .selectize-input [data-value] { 339 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1); 340 | -webkit-border-radius: 3px; 341 | -moz-border-radius: 3px; 342 | border-radius: 3px; 343 | background-color: #b2e567; 344 | background-image: -moz-linear-gradient(top, #b8e76f, #a9e25c); 345 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#b8e76f), to(#a9e25c)); 346 | background-image: -webkit-linear-gradient(top, #b8e76f, #a9e25c); 347 | background-image: -o-linear-gradient(top, #b8e76f, #a9e25c); 348 | background-image: linear-gradient(to bottom, #b8e76f, #a9e25c); 349 | background-repeat: repeat-x; 350 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffb8e76f', endColorstr='#ffa9e25c', GradientType=0); 351 | -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); 352 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); 353 | } 354 | .selectize-control.multi .selectize-input [data-value].active { 355 | background-color: #88c332; 356 | background-image: -moz-linear-gradient(top, #92c836, #7abc2c); 357 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#92c836), to(#7abc2c)); 358 | background-image: -webkit-linear-gradient(top, #92c836, #7abc2c); 359 | background-image: -o-linear-gradient(top, #92c836, #7abc2c); 360 | background-image: linear-gradient(to bottom, #92c836, #7abc2c); 361 | background-repeat: repeat-x; 362 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff92c836', endColorstr='#ff7abc2c', GradientType=0); 363 | } 364 | .selectize-control.single .selectize-input { 365 | -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 0 #e0e0e0, 0 3px 0 #c8c8c8, 0 4px 1px rgba(0,0,0,0.1); 366 | box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 0 #e0e0e0, 0 3px 0 #c8c8c8, 0 4px 1px rgba(0,0,0,0.1); 367 | background-color: #f3f3f3; 368 | background-image: -moz-linear-gradient(top, #f5f5f5, #efefef); 369 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#efefef)); 370 | background-image: -webkit-linear-gradient(top, #f5f5f5, #efefef); 371 | background-image: -o-linear-gradient(top, #f5f5f5, #efefef); 372 | background-image: linear-gradient(to bottom, #f5f5f5, #efefef); 373 | background-repeat: repeat-x; 374 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffefefef', GradientType=0); 375 | } 376 | .selectize-control.single .selectize-input, 377 | .selectize-dropdown.single { 378 | border-color: #b8b8b8; 379 | } 380 | .selectize-dropdown .optgroup-header { 381 | font-weight: bold; 382 | font-size: 0.8em; 383 | border-bottom: 1px solid #f0f0f0; 384 | border-top: 1px solid #f0f0f0; 385 | } 386 | -------------------------------------------------------------------------------- /app/assets/stylesheets/activeadmin/selectize/selectize.bootstrap2.css: -------------------------------------------------------------------------------- 1 | /** 2 | * selectize.css (v0.13.3) 3 | * Copyright (c) 2013–2015 Brian Reavis & contributors 4 | * Copyright (c) 2020 Selectize Team & contributors 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this 7 | * file except in compliance with the License. You may obtain a copy of the License at: 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software distributed under 11 | * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 12 | * ANY KIND, either express or implied. See the License for the specific language 13 | * governing permissions and limitations under the License. 14 | * 15 | * @author Brian Reavis 16 | * @author Ris Adams 17 | */ 18 | .selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder { 19 | visibility: visible !important; 20 | background: #f2f2f2 !important; 21 | background: rgba(0, 0, 0, 0.06) !important; 22 | border: 0 none !important; 23 | -webkit-box-shadow: inset 0 0 12px 4px #fff; 24 | box-shadow: inset 0 0 12px 4px #fff; 25 | } 26 | .selectize-control.plugin-drag_drop .ui-sortable-placeholder::after { 27 | content: '!'; 28 | visibility: hidden; 29 | } 30 | .selectize-control.plugin-drag_drop .ui-sortable-helper { 31 | -webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 32 | box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); 33 | } 34 | .selectize-dropdown-header { 35 | position: relative; 36 | padding: 3px 10px; 37 | border-bottom: 1px solid #d0d0d0; 38 | background: #f8f8f8; 39 | -webkit-border-radius: 4px 4px 0 0; 40 | -moz-border-radius: 4px 4px 0 0; 41 | border-radius: 4px 4px 0 0; 42 | } 43 | .selectize-dropdown-header-close { 44 | position: absolute; 45 | right: 10px; 46 | top: 50%; 47 | color: #333; 48 | opacity: 0.4; 49 | margin-top: -12px; 50 | line-height: 20px; 51 | font-size: 20px !important; 52 | } 53 | .selectize-dropdown-header-close:hover { 54 | color: #000000; 55 | } 56 | .selectize-dropdown.plugin-optgroup_columns .optgroup { 57 | border-right: 1px solid #f2f2f2; 58 | border-top: 0 none; 59 | float: left; 60 | -webkit-box-sizing: border-box; 61 | -moz-box-sizing: border-box; 62 | box-sizing: border-box; 63 | } 64 | .selectize-dropdown.plugin-optgroup_columns .optgroup:last-child { 65 | border-right: 0 none; 66 | } 67 | .selectize-dropdown.plugin-optgroup_columns .optgroup:before { 68 | display: none; 69 | } 70 | .selectize-dropdown.plugin-optgroup_columns .optgroup-header { 71 | border-top: 0 none; 72 | } 73 | .selectize-control.plugin-remove_button [data-value] { 74 | position: relative; 75 | padding-right: 24px !important; 76 | } 77 | .selectize-control.plugin-remove_button [data-value] .remove { 78 | z-index: 1; 79 | /* fixes ie bug (see #392) */ 80 | position: absolute; 81 | top: 0; 82 | right: 0; 83 | bottom: 0; 84 | width: 17px; 85 | text-align: center; 86 | font-weight: bold; 87 | font-size: 12px; 88 | color: inherit; 89 | text-decoration: none; 90 | vertical-align: middle; 91 | display: inline-block; 92 | padding: 1px 0 0 0; 93 | border-left: 1px solid #ccc; 94 | -webkit-border-radius: 0 2px 2px 0; 95 | -moz-border-radius: 0 2px 2px 0; 96 | border-radius: 0 2px 2px 0; 97 | -webkit-box-sizing: border-box; 98 | -moz-box-sizing: border-box; 99 | box-sizing: border-box; 100 | } 101 | .selectize-control.plugin-remove_button [data-value] .remove:hover { 102 | background: rgba(0, 0, 0, 0.05); 103 | } 104 | .selectize-control.plugin-remove_button [data-value].active .remove { 105 | border-left-color: #0077b3; 106 | } 107 | .selectize-control.plugin-remove_button .disabled [data-value] .remove:hover { 108 | background: none; 109 | } 110 | .selectize-control.plugin-remove_button .disabled [data-value] .remove { 111 | border-left-color: #e0e0e0; 112 | } 113 | .selectize-control.plugin-remove_button .remove-single { 114 | position: absolute; 115 | right: 0; 116 | top: 0; 117 | font-size: 23px; 118 | } 119 | .selectize-control { 120 | position: relative; 121 | } 122 | .selectize-dropdown, 123 | .selectize-input, 124 | .selectize-input input { 125 | color: #333; 126 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 127 | font-size: 14px; 128 | line-height: 20px; 129 | -webkit-font-smoothing: inherit; 130 | } 131 | .selectize-input, 132 | .selectize-control.single .selectize-input.input-active { 133 | background: #fff; 134 | cursor: text; 135 | display: inline-block; 136 | } 137 | .selectize-input { 138 | border: 1px solid #d0d0d0; 139 | padding: 7px 10px; 140 | display: inline-block; 141 | width: 100%; 142 | overflow: hidden; 143 | position: relative; 144 | z-index: 1; 145 | -webkit-box-sizing: border-box; 146 | -moz-box-sizing: border-box; 147 | box-sizing: border-box; 148 | -webkit-box-shadow: none; 149 | box-shadow: none; 150 | -webkit-border-radius: 4px; 151 | -moz-border-radius: 4px; 152 | border-radius: 4px; 153 | } 154 | .selectize-control.multi .selectize-input.has-items { 155 | padding: 5px 10px 2px; 156 | } 157 | .selectize-input.full { 158 | background-color: #fff; 159 | } 160 | .selectize-input.disabled, 161 | .selectize-input.disabled * { 162 | cursor: default !important; 163 | } 164 | .selectize-input.focus { 165 | -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); 166 | box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15); 167 | } 168 | .selectize-input.dropdown-active { 169 | -webkit-border-radius: 4px 4px 0 0; 170 | -moz-border-radius: 4px 4px 0 0; 171 | border-radius: 4px 4px 0 0; 172 | } 173 | .selectize-input > * { 174 | vertical-align: baseline; 175 | display: -moz-inline-stack; 176 | display: inline-block; 177 | zoom: 1; 178 | *display: inline; 179 | } 180 | .selectize-control.multi .selectize-input > div { 181 | cursor: pointer; 182 | margin: 0 3px 3px 0; 183 | padding: 1px 3px; 184 | background: #e6e6e6; 185 | color: #333; 186 | border: 1px solid #ccc; 187 | } 188 | .selectize-control.multi .selectize-input > div.active { 189 | background: #08c; 190 | color: #fff; 191 | border: 1px solid #0077b3; 192 | } 193 | .selectize-control.multi .selectize-input.disabled > div, 194 | .selectize-control.multi .selectize-input.disabled > div.active { 195 | color: #474747; 196 | background: #fafafa; 197 | border: 1px solid #e0e0e0; 198 | } 199 | .selectize-input > input { 200 | display: inline-block !important; 201 | padding: 0 !important; 202 | min-height: 0 !important; 203 | max-height: none !important; 204 | max-width: 100% !important; 205 | margin: 0 !important; 206 | text-indent: 0 !important; 207 | border: 0 none !important; 208 | background: none !important; 209 | line-height: inherit !important; 210 | -webkit-user-select: auto !important; 211 | -webkit-box-shadow: none !important; 212 | box-shadow: none !important; 213 | } 214 | .selectize-input > input::-ms-clear { 215 | display: none; 216 | } 217 | .selectize-input > input:focus { 218 | outline: none !important; 219 | } 220 | .selectize-input > input[placeholder] { 221 | box-sizing: initial; 222 | } 223 | .selectize-input::after { 224 | content: ' '; 225 | display: block; 226 | clear: left; 227 | } 228 | .selectize-input.dropdown-active::before { 229 | content: ' '; 230 | display: block; 231 | position: absolute; 232 | background: #e5e5e5; 233 | height: 1px; 234 | bottom: 0; 235 | left: 0; 236 | right: 0; 237 | } 238 | .selectize-dropdown { 239 | position: absolute; 240 | z-index: 10; 241 | border: 1px solid #ccc; 242 | background: #fff; 243 | margin: -1px 0 0 0; 244 | border-top: 0 none; 245 | -webkit-box-sizing: border-box; 246 | -moz-box-sizing: border-box; 247 | box-sizing: border-box; 248 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 249 | box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 250 | -webkit-border-radius: 0 0 4px 4px; 251 | -moz-border-radius: 0 0 4px 4px; 252 | border-radius: 0 0 4px 4px; 253 | } 254 | .selectize-dropdown [data-selectable] { 255 | cursor: pointer; 256 | overflow: hidden; 257 | } 258 | .selectize-dropdown [data-selectable] .highlight { 259 | background: rgba(255, 237, 40, 0.4); 260 | -webkit-border-radius: 1px; 261 | -moz-border-radius: 1px; 262 | border-radius: 1px; 263 | } 264 | .selectize-dropdown .option, 265 | .selectize-dropdown .optgroup-header { 266 | padding: 3px 10px; 267 | } 268 | .selectize-dropdown .option, 269 | .selectize-dropdown [data-disabled], 270 | .selectize-dropdown [data-disabled] [data-selectable].option { 271 | cursor: inherit; 272 | opacity: 0.5; 273 | } 274 | .selectize-dropdown [data-selectable].option { 275 | opacity: 1; 276 | } 277 | .selectize-dropdown .optgroup:first-child .optgroup-header { 278 | border-top: 0 none; 279 | } 280 | .selectize-dropdown .optgroup-header { 281 | color: #999; 282 | background: #fff; 283 | cursor: default; 284 | } 285 | .selectize-dropdown .active { 286 | background-color: #08c; 287 | color: #fff; 288 | } 289 | .selectize-dropdown .active.create { 290 | color: #fff; 291 | } 292 | .selectize-dropdown .create { 293 | color: rgba(51, 51, 51, 0.5); 294 | } 295 | .selectize-dropdown-content { 296 | overflow-y: auto; 297 | overflow-x: hidden; 298 | max-height: 200px; 299 | -webkit-overflow-scrolling: touch; 300 | } 301 | .selectize-control.single .selectize-input, 302 | .selectize-control.single .selectize-input input { 303 | cursor: pointer; 304 | } 305 | .selectize-control.single .selectize-input.input-active, 306 | .selectize-control.single .selectize-input.input-active input { 307 | cursor: text; 308 | } 309 | .selectize-control.single .selectize-input:after { 310 | content: ' '; 311 | display: block; 312 | position: absolute; 313 | top: 50%; 314 | right: 15px; 315 | margin-top: -3px; 316 | width: 0; 317 | height: 0; 318 | border-style: solid; 319 | border-width: 5px 5px 0 5px; 320 | border-color: #000 transparent transparent transparent; 321 | } 322 | .selectize-control.single .selectize-input.dropdown-active:after { 323 | margin-top: -4px; 324 | border-width: 0 5px 5px 5px; 325 | border-color: transparent transparent #000 transparent; 326 | } 327 | .selectize-control.rtl.single .selectize-input:after { 328 | left: 15px; 329 | right: auto; 330 | } 331 | .selectize-control.rtl .selectize-input > input { 332 | margin: 0 4px 0 -2px !important; 333 | } 334 | .selectize-control .selectize-input.disabled { 335 | opacity: 0.5; 336 | background-color: #fff; 337 | } 338 | .selectize-dropdown { 339 | margin: 2px 0 0 0; 340 | z-index: 1000; 341 | border: 1px solid rgba(0, 0, 0, 0.2); 342 | border-radius: 4px; 343 | -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 344 | -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 345 | box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2); 346 | } 347 | .selectize-dropdown .optgroup-header { 348 | font-size: 11px; 349 | font-weight: bold; 350 | text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); 351 | text-transform: uppercase; 352 | } 353 | .selectize-dropdown .optgroup:first-child:before { 354 | display: none; 355 | } 356 | .selectize-dropdown .optgroup:before { 357 | content: ' '; 358 | display: block; 359 | *width: 100%; 360 | height: 1px; 361 | margin: 9px 1px; 362 | *margin: -5px 0 5px; 363 | overflow: hidden; 364 | background-color: #e5e5e5; 365 | border-bottom: 1px solid #fff; 366 | margin-left: -10px; 367 | margin-right: -10px; 368 | } 369 | .selectize-dropdown [data-selectable].active { 370 | background-color: #0081c2; 371 | background-image: -moz-linear-gradient(top, #08c, #0077b3); 372 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#0077b3)); 373 | background-image: -webkit-linear-gradient(top, #08c, #0077b3); 374 | background-image: -o-linear-gradient(top, #08c, #0077b3); 375 | background-image: linear-gradient(to bottom, #08c, #0077b3); 376 | background-repeat: repeat-x; 377 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); 378 | } 379 | .selectize-dropdown-content { 380 | padding: 5px 0; 381 | } 382 | .selectize-dropdown-header { 383 | padding: 6px 10px; 384 | } 385 | .selectize-input { 386 | -webkit-transition: border linear .2s, box-shadow linear .2s; 387 | -moz-transition: border linear .2s, box-shadow linear .2s; 388 | -o-transition: border linear .2s, box-shadow linear .2s; 389 | transition: border linear .2s, box-shadow linear .2s; 390 | } 391 | .selectize-input.dropdown-active { 392 | -webkit-border-radius: 4px; 393 | -moz-border-radius: 4px; 394 | border-radius: 4px; 395 | } 396 | .selectize-input.dropdown-active::before { 397 | display: none; 398 | } 399 | .selectize-input.input-active, 400 | .selectize-input.input-active:hover, 401 | .selectize-control.multi .selectize-input.focus { 402 | background: #fff !important; 403 | border-color: rgba(82, 168, 236, 0.8) !important; 404 | outline: 0 !important; 405 | outline: thin dotted \9 !important; 406 | -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important; 407 | -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important; 408 | box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6) !important; 409 | } 410 | .selectize-control.single .selectize-input { 411 | color: #333; 412 | text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); 413 | background-color: #f5f5f5; 414 | background-image: -moz-linear-gradient(top, #fff, #e6e6e6); 415 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#e6e6e6)); 416 | background-image: -webkit-linear-gradient(top, #fff, #e6e6e6); 417 | background-image: -o-linear-gradient(top, #fff, #e6e6e6); 418 | background-image: linear-gradient(to bottom, #fff, #e6e6e6); 419 | background-repeat: repeat-x; 420 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); 421 | border-color: #e6e6e6 #e6e6e6 #bfbfbf; 422 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 423 | *background-color: #e6e6e6; 424 | /* Darken IE7 buttons by default so they stand out more given they won't have borders */ 425 | filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); 426 | -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 427 | -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 428 | box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 429 | } 430 | .selectize-control.single .selectize-input:hover, 431 | .selectize-control.single .selectize-input:focus, 432 | .selectize-control.single .selectize-input:active, 433 | .selectize-control.single .selectize-input.active, 434 | .selectize-control.single .selectize-input.disabled, 435 | .selectize-control.single .selectize-input[disabled] { 436 | color: #333; 437 | background-color: #e6e6e6; 438 | *background-color: #d9d9d9; 439 | } 440 | .selectize-control.single .selectize-input:active, 441 | .selectize-control.single .selectize-input.active { 442 | background-color: #cccccc \9; 443 | } 444 | .selectize-control.single .selectize-input:hover { 445 | color: #333; 446 | text-decoration: none; 447 | background-position: 0 -15px; 448 | -webkit-transition: background-position 0.1s linear; 449 | -moz-transition: background-position 0.1s linear; 450 | -o-transition: background-position 0.1s linear; 451 | transition: background-position 0.1s linear; 452 | } 453 | .selectize-control.single .selectize-input.disabled { 454 | background: #e6e6e6 !important; 455 | -webkit-box-shadow: none; 456 | -moz-box-shadow: none; 457 | box-shadow: none; 458 | } 459 | .selectize-control.multi .selectize-input { 460 | -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); 461 | -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); 462 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); 463 | } 464 | .selectize-control.multi .selectize-input.has-items { 465 | padding-left: 7px; 466 | padding-right: 7px; 467 | } 468 | .selectize-control.multi .selectize-input > div { 469 | color: #333; 470 | text-shadow: none; 471 | background-color: #f5f5f5; 472 | background-image: -moz-linear-gradient(top, #fff, #e6e6e6); 473 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#e6e6e6)); 474 | background-image: -webkit-linear-gradient(top, #fff, #e6e6e6); 475 | background-image: -o-linear-gradient(top, #fff, #e6e6e6); 476 | background-image: linear-gradient(to bottom, #fff, #e6e6e6); 477 | background-repeat: repeat-x; 478 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); 479 | border-color: #e6e6e6 #e6e6e6 #bfbfbf; 480 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 481 | *background-color: #e6e6e6; 482 | border: 1px solid #ccc; 483 | -webkit-border-radius: 4px; 484 | -moz-border-radius: 4px; 485 | border-radius: 4px; 486 | -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 487 | -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 488 | box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 489 | } 490 | .selectize-control.multi .selectize-input > div.active { 491 | -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05); 492 | -moz-box-shadow: 0 1px 2px rgba(0,0,0,.05); 493 | box-shadow: 0 1px 2px rgba(0,0,0,.05); 494 | color: #fff; 495 | text-shadow: none; 496 | background-color: #0081c2; 497 | background-image: -moz-linear-gradient(top, #08c, #0077b3); 498 | background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#08c), to(#0077b3)); 499 | background-image: -webkit-linear-gradient(top, #08c, #0077b3); 500 | background-image: -o-linear-gradient(top, #08c, #0077b3); 501 | background-image: linear-gradient(to bottom, #08c, #0077b3); 502 | background-repeat: repeat-x; 503 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0); 504 | border-color: #0077b3 #0077b3 #004466; 505 | border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); 506 | *background-color: #08c; 507 | border: 1px solid #08c; 508 | } 509 | -------------------------------------------------------------------------------- /app/assets/javascripts/activeadmin/selectize/selectize.js: -------------------------------------------------------------------------------- 1 | /*! selectize.js - v0.13.3 | https://github.com/selectize/selectize.js | Apache License (v2) */ 2 | 3 | !function(root,factory){"function"==typeof define&&define.amd?define("sifter",factory):"object"==typeof exports?module.exports=factory():root.Sifter=factory()}(this,function(){function Sifter(items,settings){this.items=items,this.settings=settings||{diacritics:!0}}Sifter.prototype.tokenize=function(query){if(!(query=trim(String(query||"").toLowerCase()))||!query.length)return[];for(var regex,letter,tokens=[],words=query.split(/ +/),i=0,n=words.length;i/g,">").replace(/"/g,""")}function debounce_events(self,types,fn){var type,trigger=self.trigger,event_args={};for(type in self.trigger=function(){var type=arguments[0];if(-1===types.indexOf(type))return trigger.apply(self,arguments);event_args[type]=arguments},fn.apply(self,[]),self.trigger=trigger,event_args)event_args.hasOwnProperty(type)&&trigger.apply(self,event_args[type])}function getSelection(input){var sel,selLen,result={};return void 0===input?console.warn("WARN getSelection cannot locate input control"):"selectionStart"in input?(result.start=input.selectionStart,result.length=input.selectionEnd-result.start):document.selection&&(input.focus(),sel=document.selection.createRange(),selLen=document.selection.createRange().text.length,sel.moveStart("character",-input.value.length),result.start=sel.text.length-selLen,result.length=selLen),result}function measureString(str,$parent){return str?(Selectize.$testInput||(Selectize.$testInput=$("").css({position:"absolute",width:"auto",padding:0,whiteSpace:"pre"}),$("
").css({position:"absolute",width:0,height:0,overflow:"hidden"}).append(Selectize.$testInput).appendTo("body")),Selectize.$testInput.text(str),function($from,$to,properties){var i,n,styles={};if(properties)for(i=0,n=properties.length;i").addClass(settings.wrapperClass).addClass(classes).addClass(event),$control=$("
").addClass(settings.inputClass).addClass("items").appendTo($wrapper),$control_input=$('').appendTo($control).attr("tabindex",$input.is(":disabled")?"-1":self.tabIndex),inputId=$(settings.dropdownParent||$wrapper),selector=$("
").addClass(settings.dropdownClass).addClass(event).hide().appendTo(inputId),event=$("
").addClass(settings.dropdownContentClass).attr("tabindex","-1").appendTo(selector);(inputId=$input.attr("id"))&&($control_input.attr("id",inputId+"-selectized"),$("label[for='"+inputId+"']").attr("for",inputId+"-selectized")),self.settings.copyClassesToDropdown&&selector.addClass(classes),$wrapper.css({width:$input[0].style.width}),self.plugins.names.length&&(delimiterEscaped="plugin-"+self.plugins.names.join(" plugin-"),$wrapper.addClass(delimiterEscaped),selector.addClass(delimiterEscaped)),(null===settings.maxItems||1[data-selectable]",function(e){e.stopImmediatePropagation()}),selector.on("mouseenter","[data-selectable]",function(){return self.onOptionHover.apply(self,arguments)}),selector.on("mousedown click","[data-selectable]",function(){return self.onOptionSelect.apply(self,arguments)}),event="mousedown",selector="*:not(input)",fn=function(){return self.onItemSelect.apply(self,arguments)},($parent=$control).on(event,selector,function(e){for(var child=e.target;child&&child.parentNode!==$parent[0];)child=child.parentNode;return e.currentTarget=child,fn.apply(this,[e])}),autoGrow($control_input),$control.on({mousedown:function(){return self.onMouseDown.apply(self,arguments)},click:function(){return self.onClick.apply(self,arguments)}}),$control_input.on({mousedown:function(e){e.stopPropagation()},keydown:function(){return self.onKeyDown.apply(self,arguments)},keyup:function(){return self.onKeyUp.apply(self,arguments)},keypress:function(){return self.onKeyPress.apply(self,arguments)},resize:function(){self.positionDropdown.apply(self,[])},blur:function(){return self.onBlur.apply(self,arguments)},focus:function(){return self.ignoreBlur=!1,self.onFocus.apply(self,arguments)},paste:function(){return self.onPaste.apply(self,arguments)}}),$document.on("keydown"+eventNS,function(e){self.isCmdDown=e[IS_MAC?"metaKey":"ctrlKey"],self.isCtrlDown=e[IS_MAC?"altKey":"ctrlKey"],self.isShiftDown=e.shiftKey}),$document.on("keyup"+eventNS,function(e){e.keyCode===KEY_CTRL&&(self.isCtrlDown=!1),16===e.keyCode&&(self.isShiftDown=!1),e.keyCode===KEY_CMD&&(self.isCmdDown=!1)}),$document.on("mousedown"+eventNS,function(e){if(self.isFocused){if(e.target===self.$dropdown[0]||e.target.parentNode===self.$dropdown[0])return!1;self.$control.has(e.target).length||e.target===self.$control[0]||self.blur(e.target)}}),$window.on(["scroll"+eventNS,"resize"+eventNS].join(" "),function(){self.isOpen&&self.positionDropdown.apply(self,arguments)}),$window.on("mousemove"+eventNS,function(){self.ignoreHover=!1}),this.revertSettings={$children:$input.children().detach(),tabindex:$input.attr("tabindex")},$input.attr("tabindex",-1).hide().after(self.$wrapper),$.isArray(settings.items)&&(self.lastValidValue=settings.items,self.setValue(settings.items),delete settings.items),SUPPORTS_VALIDITY_API&&$input.on("invalid"+eventNS,function(e){e.preventDefault(),self.isInvalid=!0,self.refreshState()}),self.updateOriginalInput(),self.refreshItems(),self.refreshState(),self.updatePlaceholder(),self.isSetup=!0,$input.is(":disabled")&&self.disable(),self.on("change",this.onChange),$input.data("selectize",self),$input.addClass("selectized"),self.trigger("initialize"),!0===settings.preload&&self.onSearchChange("")},setupTemplates:function(){var field_label=this.settings.labelField,field_optgroup=this.settings.optgroupLabelField,templates={optgroup:function(data){return'
'+data.html+"
"},optgroup_header:function(data,escape){return'
'+escape(data[field_optgroup])+"
"},option:function(data,escape){return'
'+escape(data[field_label])+"
"},item:function(data,escape){return'
'+escape(data[field_label])+"
"},option_create:function(data,escape){return'
Add '+escape(data.input)+"
"}};this.settings.render=$.extend({},templates,this.settings.render)},setupCallbacks:function(){var key,fn,callbacks={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur",dropdown_item_activate:"onDropdownItemActivate",dropdown_item_deactivate:"onDropdownItemDeactivate"};for(key in callbacks)callbacks.hasOwnProperty(key)&&(fn=this.settings[callbacks[key]])&&this.on(key,fn)},onClick:function(e){this.isFocused&&this.isOpen||(this.focus(),e.preventDefault())},onMouseDown:function(e){var self=this,defaultPrevented=e.isDefaultPrevented();$(e.target);if(self.isFocused){if(e.target!==self.$control_input[0])return"single"===self.settings.mode?self.isOpen?self.close():self.open():defaultPrevented||self.setActiveItem(null),!1}else defaultPrevented||window.setTimeout(function(){self.focus()},0)},onChange:function(){""!==this.getValue()&&(this.lastValidValue=this.getValue()),this.$input.trigger("input"),this.$input.trigger("change")},onPaste:function(e){var self=this;self.isFull()||self.isInputHidden||self.isLocked?e.preventDefault():self.settings.splitOn&&setTimeout(function(){var pastedText=self.$control_input.val();if(pastedText.match(self.settings.splitOn))for(var splitInput=$.trim(pastedText).split(self.settings.splitOn),i=0,n=splitInput.length;i=this.settings.maxItems},updateOriginalInput:function(opts){var i,n,options,label;if(opts=opts||{},1===this.tagType){for(options=[],i=0,n=this.items.length;i'+escape_html(label)+"");options.length||this.$input.attr("multiple")||options.push(''),this.$input.html(options.join(""))}else this.$input.val(this.getValue()),this.$input.attr("value",this.$input.val());this.isSetup&&(opts.silent||this.trigger("change",this.$input.val()))},updatePlaceholder:function(){var $input;this.settings.placeholder&&($input=this.$control_input,this.items.length?$input.removeAttr("placeholder"):$input.attr("placeholder",this.settings.placeholder),$input.triggerHandler("update",{force:!0}))},open:function(){this.isLocked||this.isOpen||"multi"===this.settings.mode&&this.isFull()||(this.focus(),this.isOpen=!0,this.refreshState(),this.$dropdown.css({visibility:"hidden",display:"block"}),this.positionDropdown(),this.$dropdown.css({visibility:"visible"}),this.trigger("dropdown_open",this.$dropdown))},close:function(){var trigger=this.isOpen;"single"===this.settings.mode&&this.items.length&&(this.hideInput(),this.isBlurring&&this.$control_input.blur()),this.isOpen=!1,this.$dropdown.hide(),this.setActiveOption(null),this.refreshState(),trigger&&this.trigger("dropdown_close",this.$dropdown)},positionDropdown:function(){var $control=this.$control,offset="body"===this.settings.dropdownParent?$control.offset():$control.position();offset.top+=$control.outerHeight(!0),this.$dropdown.css({width:$control[0].getBoundingClientRect().width,top:offset.top,left:offset.left})},clear:function(silent){this.items.length&&(this.$control.children(":not(input)").remove(),this.items=[],this.lastQuery=null,this.setCaret(0),this.setActiveItem(null),this.updatePlaceholder(),this.updateOriginalInput({silent:silent}),this.refreshState(),this.showInput(),this.trigger("clear"))},insertAtCaret:function(target){var caret=Math.min(this.caretPos,this.items.length),el=target[0],target=this.buffer||this.$control[0];0===caret?target.insertBefore(el,target.firstChild):target.insertBefore(el,target.childNodes[caret]),this.setCaret(caret+1)},deleteSelection:function(e){var i,n,values,option_select,$option_select,caret,direction=e&&8===e.keyCode?-1:1,selection=getSelection(this.$control_input[0]);if(this.$activeOption&&!this.settings.hideSelected&&(option_select=this.getAdjacentOption(this.$activeOption,-1).attr("data-value")),values=[],this.$activeItems.length){for(caret=this.$control.children(".active:"+(0
'+data.title+'×
'}},options),self.setup=(original=self.setup,function(){original.apply(self,arguments),self.$dropdown_header=$(options.html(options)),self.$dropdown.prepend(self.$dropdown_header)})}),Selectize.define("optgroup_columns",function(options){var original,self=this;options=$.extend({equalizeWidth:!0,equalizeHeight:!0},options),this.getAdjacentOption=function($option,index){var $options=$option.closest("[data-group]").find("[data-selectable]"),index=$options.index($option)+index;return 0<=index&&index<$options.length?$options.eq(index):$()},this.onKeyDown=(original=self.onKeyDown,function(e){var $option,$options;return!this.isOpen||37!==e.keyCode&&39!==e.keyCode?original.apply(this,arguments):(self.ignoreHover=!0,$option=($options=this.$activeOption.closest("[data-group]")).find("[data-selectable]").index(this.$activeOption),void(($option=($options=($options=37===e.keyCode?$options.prev("[data-group]"):$options.next("[data-group]")).find("[data-selectable]")).eq(Math.min($options.length-1,$option))).length&&this.setActiveOption($option)))});function equalizeSizes(){var i,height_max,width_last,width_parent,$optgroups=$("[data-group]",self.$dropdown_content),n=$optgroups.length;if(n&&self.$dropdown_content.width()){if(options.equalizeHeight){for(i=height_max=0;i
',div=div.firstChild,doc.body.appendChild(div),width=getScrollbarWidth.width=div.offsetWidth-div.clientWidth,doc.body.removeChild(div)),width};(options.equalizeHeight||options.equalizeWidth)&&(hook.after(this,"positionDropdown",equalizeSizes),hook.after(this,"refreshOptions",equalizeSizes))}),Selectize.define("remove_button",function(options){options=$.extend({label:"×",title:"Remove",className:"remove",append:!0},options);("single"===this.settings.mode?function(thisRef,options){options.className="remove-single";var original,self=thisRef,html=''+options.label+"";thisRef.setup=(original=self.setup,function(){var id,render_item;options.append&&(id=$(self.$input.context).attr("id"),$("#"+id),render_item=self.settings.render.item,self.settings.render.item=function(data){return html_container=render_item.apply(thisRef,arguments),html_element=html,$("").append(html_container).append(html_element);var html_container,html_element}),original.apply(thisRef,arguments),thisRef.$control.on("click","."+options.className,function(e){e.preventDefault(),self.isLocked||self.clear()})})}:function(thisRef,options){var original,self=thisRef,html=''+options.label+"";thisRef.setup=(original=self.setup,function(){var render_item;options.append&&(render_item=self.settings.render.item,self.settings.render.item=function(data){return html_container=render_item.apply(thisRef,arguments),html_element=html,pos=html_container.search(/(<\/[^>]+>\s*)$/),html_container.substring(0,pos)+html_element+html_container.substring(pos);var html_container,html_element,pos}),original.apply(thisRef,arguments),thisRef.$control.on("click","."+options.className,function($item){if($item.preventDefault(),!self.isLocked){$item=$($item.currentTarget).parent();return self.setActiveItem($item),self.deleteSelection()&&self.setCaret(self.items.length),!1}})})})(this,options)}),Selectize.define("restore_on_backspace",function(options){var original,self=this;options.text=options.text||function(option){return option[this.settings.labelField]},this.onKeyDown=(original=self.onKeyDown,function(e){var option;return 8===e.keyCode&&""===this.$control_input.val()&&!this.$activeItems.length&&0<=(option=this.caretPos-1)&&option