Skip to content

Make sprockets dependency optional #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7
2.7.0
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ gemspec
gem "activeadmin"
gem "mimemagic", github: "mimemagicrb/mimemagic", ref: "01f92d86d15d85cfd0f20dabd025dcbd36a8a60f"

gem "sassc", require: ENV["SPROCKETS"] == "true"
gem "sassc-rails", require: ENV["SPROCKETS"] == "true"
gem "webpacker", "~> 5.0", require: ENV["SPROCKETS"] != "true"
2 changes: 0 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ PATH
railties
redcarpet
require_all
sassc
sassc-rails
xdan-datetimepicker-rails (~> 2.5.1)

GEM
Expand Down
2 changes: 0 additions & 2 deletions activeadmin_addons.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ Gem::Specification.new do |s|
s.add_dependency "railties"
s.add_dependency "redcarpet"
s.add_dependency "require_all"
s.add_dependency "sassc"
s.add_dependency "sassc-rails"
s.add_dependency "xdan-datetimepicker-rails", "~> 2.5.1"

s.add_development_dependency "aasm"
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/activeadmin_addons/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@
width: width,
multiple: true,
tags: true,
data: collection
data: collection,
tokenSeparators: $(el).data("tokenSeparators") || [ "," ]
};
if (!!isRelation) {
selectOptions.createTag = function() {
Expand Down
5 changes: 4 additions & 1 deletion app/inputs/tags_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def load_control_attributes
load_data_attr(:model, value: model_name)
load_data_attr(:method, value: method)
load_data_attr(:width, default: "80%")
load_data_attr(:token_separators)

if active_record_select?
load_data_attr(:relation, value: true)
Expand All @@ -25,7 +26,9 @@ def load_control_attributes
private

def render_array_tags
render_tags_control { build_hidden_control(prefixed_method, method_to_input_name, input_value) }
render_tags_control {
build_hidden_control(prefixed_method, method_to_input_name, input_value.try(:join, ","))
}
end

def render_collection_tags
Expand Down
1 change: 1 addition & 0 deletions app/javascript/activeadmin_addons/inputs/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var initializer = function() {
multiple: true,
tags: true,
data: collection,
tokenSeparators: $(el).data('tokenSeparators') || [',']
};

if (!!isRelation) {
Expand Down
6 changes: 4 additions & 2 deletions lib/activeadmin_addons/engine.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
module ActiveAdminAddons
module Rails
class Engine < ::Rails::Engine
require 'sassc'
require 'sassc-rails'
if ENV["SPROCKETS"] == "true"
require 'sassc'
require 'sassc-rails'
end
require "xdan-datetimepicker-rails"
require "require_all"
require "active_material"
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "activeadmin_addons",
"name": "@joker-7777/activeadmin_addons",
"version": "1.0.0",
"description": "Set of addons to help with the activeadmin ui",
"main": "src/all.js",
"files": [
"src/*"
],
"repository": "https://github.com/platanus/activeadmin_addons.git",
"author": "Platanus <[email protected]>",
"author": "Johannes Köhler <[email protected]>",
"license": "MIT",
"scripts": {
"build": "rollup --config rollup.config.js",
Expand Down