Skip to content

Remove coffee script dependency #76

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

Merged
Merged
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
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@ jobs:
- '5.2.0'
- '6.0.0'
activeadmin:
- '1.4.0'
- '2.0.0'
- '2.6.0'
exclude:
- rails: '5.2.0'
activeadmin: '2.6.0'
- rails: '6.0.0'
activeadmin: '1.4.0'
- rails: '6.0.0'
activeadmin: '2.0.0'
env:
Expand Down
3 changes: 1 addition & 2 deletions active_admin_datetimepicker.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency "coffee-rails"
spec.add_dependency "activeadmin", ">= 1.1", "< 3.a"
spec.add_dependency "activeadmin", ">= 2.0", "< 3.a"
spec.add_dependency "xdan-datetimepicker-rails", "~> 2.5.4"
end
25 changes: 25 additions & 0 deletions app/assets/javascripts/active_admin_datetimepicker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//= require jquery.xdan.datetimepicker.full

function setupDateTimePicker(container) {
const defaults = {
formatDate: 'y-m-d',
format: 'Y-m-d H:i',
allowBlank: true,
defaultSelect: false,
validateOnBlur: false
}

$(container).find('input.date-time-picker').each(function(index, entry) {
$(entry).datetimepicker($.extend(defaults, $(entry).data('datepicker-options')));
});
}

function initXdanDateTimePickerPlugin() {
setupDateTimePicker($('body'));
$(document).on('has_many_add:after', '.has_many_container', function(e, fieldset) {
setupDateTimePicker(fieldset);
});
}

$(document).ready(initXdanDateTimePickerPlugin);
$(document).on('turbolinks:load', initXdanDateTimePickerPlugin());
26 changes: 0 additions & 26 deletions app/assets/javascripts/active_admin_datetimepicker.js.coffee

This file was deleted.

12 changes: 3 additions & 9 deletions spec/support/rails_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,9 @@
"@import \"active_admin_datetimepicker\";\n",
after: "@import \"active_admin/base\";\n"

if File.file?("app/assets/javascripts/active_admin.js.coffee")
inject_into_file "app/assets/javascripts/active_admin.js.coffee",
"#= require active_admin_datetimepicker\n",
after: "#= require active_admin/base\n"
else
inject_into_file "app/assets/javascripts/active_admin.js",
"//= require active_admin_datetimepicker\n",
after: "//= require active_admin/base\n"
end
inject_into_file "app/assets/javascripts/active_admin.js",
"//= require active_admin_datetimepicker\n",
after: "//= require active_admin/base\n"

run "rm -r test"
run "rm -r spec"
Expand Down