dkniffin / activeadmin_reorderable Goto Github PK
View Code? Open in Web Editor NEWAdds drag and drop reordering to your ActiveAdmin tables
License: MIT License
Adds drag and drop reordering to your ActiveAdmin tables
License: MIT License
I encountered an error when trying to use the activeadmin_reorderable gem in my ActiveAdmin project. After following the installation instructions and adding @import "activeadmin_reorderable"; as the last @import statement in my active_admin.css.scss file, I received the following error:
Error: no mixin named light-button on line 3:14 of ../usr/local/bundle/ruby/2.6.0/gems/activeadmin_reorderable-.2.1/app/assets/stylesheets/activeadmin_reorderable.scss
from line 18:9 of app/assets/stylesheets/active_admin.scss
>> @include light-button;
Steps to Reproduce:
activeadmin_reorderable
gem and specify the correct version in the Gemfile
.@import "activeadmin_reorderable";
as the last @import
statement in the active_admin.css.scss
file.activeadmin_reorderable
functionality.Expected Behavior:
The activeadmin_reorderable
gem should work as expected without any errors, and the pages should render correctly.
Actual Behavior:
The light-button
mixin is referenced in the activeadmin_reorderable.scss
file but seems to be missing or undefined. This leads to the error mentioned above when trying to use the activeadmin_reorderable
functionality.
Additional Information:
Notes:
I have verified that the light-button
mixin is not defined in the activeadmin_reorderable
gem itself. I have also checked my project's custom stylesheets and mixins, but couldn't find any reference to the light-button
mixin.
Please let me know if there's any additional information or steps I can provide to help resolve this issue. Thank you!
Add live reload of position value after no error thrown
Rails 6 requires webpacker. AA supports webpacker now, but in order for this gem to work on Rails 6, it needs an npm equivalent.
It looks like Viget is no longer supporting this gem. I would be interested in taking over ownership of it and maintaining it.
https://activeadmin.info/2-resource-customization.html#belongs-to
is would it be possible?
I am trying to use activeadmin_reorderable
to reorder table listing, it allows me to drag and drop and change the position but it's not saving.
When i refresh the page, the order did not change
Does anyone know what could be the issue?
ActiveAdmin.register PromoList do
menu priority: 10
permit_params :name, :position,
reorderable
index as: :reorderable_table do
ModelName.column_names.each do |name|
column name.to_sym
end
actions
end
end
Hi :)
We were testing the upgrade to the 0.3.0 version and we're hitting a snag, it looks like an actual but but I wanted to run by you.
The short version is:
Cannot read properties of undefined (reading '0') / at HTMLTableRowElement.<anonymous> (activeadmin_reorderable.source.js:33:1)
tBodies
on a div
, not a table
setupReorderableTable
by looking for elements with the aa-reorderable
class and in index as: :reorderable_table
pages both the div and table have the classAssuming I didn't miss a beat, I guess either adding the class onto the table or, probably more to the point, making sure the table
element is targeted explicitly is the fix.
Either way, kinda weird, I'm unsure if we're doing something wrong
I have a HelpCategory resource:
ActiveAdmin.register HelpCategory, namespace: :admin do
reorderable
And nested HelpAnswer resource:
ActiveAdmin.register HelpAnswer, namespace: :admin do
belongs_to :help_category
reorderable
And when i get into /admin/help_categories/1/help_answers
page I getting this error:
undefined method `reorder_admin_help_answer_path'
Simply, it should use reorder_admin_help_category_help_answer_path, but it doesn't
ryby: 2.7.1
rails: 6.1.4
active_admin: 2.9.0
admin/tour.rb
# frozen_string_literal: true
include ToursHelper
ActiveAdmin.register Tour do
reorderable
scope t2('tours.all'), :all, default: true
scope(t2('tours.star')) { |scope| scope.where(star: true) }
config.sort_order = 'position_asc'
config.paginate = false
menu label: proc { I18n.t 'tours.tours' }
includes :region, :country, :from_city, :to_city, :meat_type, :room_type
controller do
def scoped_collection
super.add_night
end
end
filter :country, label: I18n.t('tours.country')
filter :region, label: I18n.t('tours.region')
filter :hotel, label: I18n.t('tours.hotel')
filter :hotel_review_rating, label: I18n.t('tours.review_rations')
filter :room_type, label: I18n.t('tours.room_type')
filter :meat_type, label: I18n.t('tours.meat_type')
filter :from_city, label: I18n.t('tours.from_city')
filter :from_date, label: I18n.t('tours.from_date')
filter :to_city, label: I18n.t('tours.to_city')
filter :to_date, label: I18n.t('tours.to_date')
filter :last_min_price, label: I18n.t('tours.last_min_price')
index title: I18n.t('tours.tours'), as: :reorderable_table do
selectable_column
column t('tours.id'), :id
column :position
column t('tours.country'), :country, sortable: 'countries.name'
column t('tours.region'), :region, sortable: 'regions.name'
column t('tours.hotel'), :hotel
column t2('tours.review_rations'), :hotel_review_rating
column t2('tours.review_count'), :hotel_review_count
column t('tours.meat_type'), :meat_type, sortable: 'meat_types.short_name'
column t('tours.room_type'), :room_type, sortable: 'room_types.name'
column t('tours.from_city'), :from_city, sortable: 'cities.name'
column t('tours.from_date'), :from_date
column t('tours.to_city'), :to_city, sortable: 'cities.name'
column t('tours.to_date'), :to_date
column t('tours.last_min_price'), :last_min_price
column t('tours.night'), :night, sortable: true
end
end
Visually dragging works, but nothing is saved after dragging.
If you look in a browser, calling
Request URL: http://0.0.0.0:3000/uk/admin/tours/1/reorder
responce
NoMethodError in Admin::ToursController#reorder
undefined method `insert_at' for #<Tour:0x00005562acc67230>
Extracted source (around line #469):
#467 else
#468 match = matched_attribute_method(method.to_s)
*469 match ? attribute_missing(match, *args, &block) : super
#470 end
#471 end
#472 ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
Extracted source (around line #8):
#6 def reorderable(&block)
#7 body = proc do
*8 resource.insert_at(params[:position].to_i)
#9 head :ok
#10 end
#11
Extracted source (around line #6):
#4 module BasicImplicitRender # :nodoc:
#5 def send_action(method, *args)
*6 super.tap { default_render unless performed? }
#7 end
#8
#9 def default_render
Rails.root: /home/shaman/RubymineProjects/joinup
Application Trace
app/controllers/application_controller.rb:7:in `switch_locale'
Framework Trace
activemodel (6.1.4) lib/active_model/attribute_methods.rb:469:in `method_missing'
activeadmin_reorderable (0.1.5) lib/active_admin/reorderable/dsl.rb:8:in `block in reorderable'
actionpack (6.1.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.4) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.4) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.4) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
i18n (1.8.10) lib/i18n.rb:314:in `with_locale'
activesupport (6.1.4) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
actiontext (6.1.4) lib/action_text/rendering.rb:20:in `with_renderer'
actiontext (6.1.4) lib/action_text/engine.rb:59:in `block (4 levels) in <class:Engine>'
activesupport (6.1.4) lib/active_support/callbacks.rb:126:in `instance_exec'
activesupport (6.1.4) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.4) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.4) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.4) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.4) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.4) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.4) lib/action_view/rendering.rb:39:in `process'
actionpack (6.1.4) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.4) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.4) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.4) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.4) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.4) lib/action_dispatch/routing/route_set.rb:842:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/etag.rb:27:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.1.4) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
actionpack (6.1.4) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/cookies.rb:689:in `call'
activerecord (6.1.4) lib/active_record/migration.rb:601:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.4) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
web-console (4.1.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.1.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.1.0) lib/web_console/middleware.rb:17:in `catch'
web-console (4.1.0) lib/web_console/middleware.rb:17:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.1.4) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.4) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.1.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (6.1.4) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (6.1.4) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (6.1.4) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (6.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/static.rb:24:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/host_authorization.rb:98:in `call'
rack-mini-profiler (2.3.2) lib/mini_profiler/profiler.rb:384:in `call'
webpacker (5.4.0) lib/webpacker/dev_server_proxy.rb:25:in `perform_request'
rack-proxy (0.7.0) lib/rack/proxy.rb:63:in `call'
railties (6.1.4) lib/rails/engine.rb:539:in `call'
puma (5.3.2) lib/puma/configuration.rb:249:in `call'
puma (5.3.2) lib/puma/request.rb:77:in `block in handle_request'
puma (5.3.2) lib/puma/thread_pool.rb:338:in `with_force_shutdown'
puma (5.3.2) lib/puma/request.rb:76:in `handle_request'
puma (5.3.2) lib/puma/server.rb:438:in `process_client'
puma (5.3.2) lib/puma/thread_pool.rb:145:in `block in spawn_thread'
Full Trace
activemodel (6.1.4) lib/active_model/attribute_methods.rb:469:in `method_missing'
activeadmin_reorderable (0.1.5) lib/active_admin/reorderable/dsl.rb:8:in `block in reorderable'
actionpack (6.1.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.1.4) lib/abstract_controller/base.rb:228:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.1.4) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.1.4) lib/active_support/callbacks.rb:117:in `block in run_callbacks'
i18n (1.8.10) lib/i18n.rb:314:in `with_locale'
app/controllers/application_controller.rb:7:in `switch_locale'
activesupport (6.1.4) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
actiontext (6.1.4) lib/action_text/rendering.rb:20:in `with_renderer'
actiontext (6.1.4) lib/action_text/engine.rb:59:in `block (4 levels) in <class:Engine>'
activesupport (6.1.4) lib/active_support/callbacks.rb:126:in `instance_exec'
activesupport (6.1.4) lib/active_support/callbacks.rb:126:in `block in run_callbacks'
activesupport (6.1.4) lib/active_support/callbacks.rb:137:in `run_callbacks'
actionpack (6.1.4) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (6.1.4) lib/active_support/notifications.rb:203:in `block in instrument'
activesupport (6.1.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.1.4) lib/active_support/notifications.rb:203:in `instrument'
actionpack (6.1.4) lib/action_controller/metal/instrumentation.rb:33:in `process_action'
actionpack (6.1.4) lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
activerecord (6.1.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.1.4) lib/abstract_controller/base.rb:165:in `process'
actionview (6.1.4) lib/action_view/rendering.rb:39:in `process'
actionpack (6.1.4) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (6.1.4) lib/action_controller/metal.rb:254:in `dispatch'
actionpack (6.1.4) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (6.1.4) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.1.4) lib/action_dispatch/journey/router.rb:50:in `block in serve'
actionpack (6.1.4) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.1.4) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.1.4) lib/action_dispatch/routing/route_set.rb:842:in `call'
warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
warden (1.2.9) lib/warden/manager.rb:34:in `catch'
warden (1.2.9) lib/warden/manager.rb:34:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/etag.rb:27:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (6.1.4) lib/action_dispatch/http/permissions_policy.rb:22:in `call'
actionpack (6.1.4) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/cookies.rb:689:in `call'
activerecord (6.1.4) lib/active_record/migration.rb:601:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.1.4) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (6.1.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
web-console (4.1.0) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.1.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (4.1.0) lib/web_console/middleware.rb:17:in `catch'
web-console (4.1.0) lib/web_console/middleware.rb:17:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.1.4) lib/rails/rack/logger.rb:37:in `call_app'
railties (6.1.4) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.1.4) lib/active_support/tagged_logging.rb:99:in `block in tagged'
activesupport (6.1.4) lib/active_support/tagged_logging.rb:37:in `tagged'
activesupport (6.1.4) lib/active_support/tagged_logging.rb:99:in `tagged'
railties (6.1.4) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.2) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/request_id.rb:26:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (6.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/static.rb:24:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
actionpack (6.1.4) lib/action_dispatch/middleware/host_authorization.rb:98:in `call'
rack-mini-profiler (2.3.2) lib/mini_profiler/profiler.rb:384:in `call'
webpacker (5.4.0) lib/webpacker/dev_server_proxy.rb:25:in `perform_request'
rack-proxy (0.7.0) lib/rack/proxy.rb:63:in `call'
railties (6.1.4) lib/rails/engine.rb:539:in `call'
puma (5.3.2) lib/puma/configuration.rb:249:in `call'
puma (5.3.2) lib/puma/request.rb:77:in `block in handle_request'
puma (5.3.2) lib/puma/thread_pool.rb:338:in `with_force_shutdown'
puma (5.3.2) lib/puma/request.rb:76:in `handle_request'
puma (5.3.2) lib/puma/server.rb:438:in `process_client'
puma (5.3.2) lib/puma/thread_pool.rb:145:in `block in spawn_thread'
Request parameters
{"position"=>"2",
"top_id"=>"2",
"bottom_id"=>"3",
"locale"=>"uk",
"id"=>"1"}
Session dump
_csrf_token: "ezdSrfAgviqG9eHEn2EE2C2Z_KBdrroo1L2Ve_MMbUE="
session_id: "a70c01f228b0e83aa5bcde846b3b09f1"
shared_key: {"with_hotel_id"=>3}
warden.user.admin_user.key: [[1], "$2a$12$f0wr.lWY0aWueOEnLx4uIO"]
Env dump
GATEWAY_INTERFACE: "CGI/1.2"
HTTP_ACCEPT: "*/*"
HTTP_ACCEPT_ENCODING: "gzip, deflate"
HTTP_ACCEPT_LANGUAGE: "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7"
HTTP_ORIGIN: "http://0.0.0.0:3000"
HTTP_VERSION: "HTTP/1.1"
HTTP_X_CSRF_TOKEN: "BlOKd2QYlj7H2vcC7GzFWxYalhfSLT9-vIkMYWrOHU2aIOhnp6e29mK1QQw2B42TllehDmYzKxbSD34I7wISEw"
ORIGINAL_SCRIPT_NAME: ""
REMOTE_ADDR: "127.0.0.1"
SERVER_NAME: "0.0.0.0"
SERVER_PROTOCOL: "HTTP/1.1"
Response headers
None
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.