active_admin-sortable_tree 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.travis.yml +8 -0
  4. data/Gemfile +10 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +163 -0
  7. data/Rakefile +57 -0
  8. data/active_admin-sortable_tree.gemspec +30 -0
  9. data/app/assets/javascripts/active_admin/sortable.js.coffee +91 -0
  10. data/app/assets/stylesheets/active_admin/sortable.css.sass +79 -0
  11. data/bin/rails +11 -0
  12. data/gemfiles/3.2.gemfile +7 -0
  13. data/gemfiles/4.0.gemfile +10 -0
  14. data/lib/active_admin/sortable_tree.rb +4 -0
  15. data/lib/active_admin/sortable_tree/controller_actions.rb +52 -0
  16. data/lib/active_admin/sortable_tree/engine.rb +19 -0
  17. data/lib/active_admin/sortable_tree/version.rb +5 -0
  18. data/lib/active_admin/views/index_as_block_decorator.rb +30 -0
  19. data/lib/active_admin/views/index_as_sortable.rb +154 -0
  20. data/lib/activeadmin-sortable-tree.rb +1 -0
  21. data/script/rails +11 -0
  22. data/spec/dummy/README.rdoc +261 -0
  23. data/spec/dummy/Rakefile +7 -0
  24. data/spec/dummy/app/admin/category.rb +15 -0
  25. data/spec/dummy/app/admin/category_tree.rb +9 -0
  26. data/spec/dummy/app/admin/dashboard.rb +5 -0
  27. data/spec/dummy/app/assets/javascripts/active_admin.js +2 -0
  28. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  29. data/spec/dummy/app/assets/javascripts/jquery.simulate.js +314 -0
  30. data/spec/dummy/app/assets/stylesheets/active_admin.css.scss +17 -0
  31. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  32. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  33. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  34. data/spec/dummy/app/mailers/.gitkeep +0 -0
  35. data/spec/dummy/app/models/.gitkeep +0 -0
  36. data/spec/dummy/app/models/admin_user.rb +6 -0
  37. data/spec/dummy/app/models/category.rb +4 -0
  38. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  39. data/spec/dummy/config.ru +4 -0
  40. data/spec/dummy/config/application.rb +56 -0
  41. data/spec/dummy/config/boot.rb +10 -0
  42. data/spec/dummy/config/database.yml +25 -0
  43. data/spec/dummy/config/environment.rb +5 -0
  44. data/spec/dummy/config/environments/development.rb +28 -0
  45. data/spec/dummy/config/environments/production.rb +64 -0
  46. data/spec/dummy/config/environments/test.rb +32 -0
  47. data/spec/dummy/config/initializers/active_admin.rb +231 -0
  48. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/spec/dummy/config/initializers/devise.rb +256 -0
  50. data/spec/dummy/config/initializers/inflections.rb +15 -0
  51. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  52. data/spec/dummy/config/initializers/secret_token.rb +8 -0
  53. data/spec/dummy/config/initializers/session_store.rb +8 -0
  54. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/spec/dummy/config/locales/devise.en.yml +59 -0
  56. data/spec/dummy/config/locales/en.yml +5 -0
  57. data/spec/dummy/config/routes.rb +61 -0
  58. data/spec/dummy/db/migrate/20140806024135_devise_create_admin_users.rb +48 -0
  59. data/spec/dummy/db/migrate/20140806024139_create_active_admin_comments.rb +19 -0
  60. data/spec/dummy/db/migrate/20140806032156_create_categories.rb +12 -0
  61. data/spec/dummy/db/schema.rb +58 -0
  62. data/spec/dummy/lib/assets/.gitkeep +0 -0
  63. data/spec/dummy/log/.gitkeep +0 -0
  64. data/spec/dummy/public/404.html +26 -0
  65. data/spec/dummy/public/422.html +26 -0
  66. data/spec/dummy/public/500.html +25 -0
  67. data/spec/dummy/public/favicon.ico +0 -0
  68. data/spec/dummy/script/rails +6 -0
  69. data/spec/features/sortable_spec.rb +58 -0
  70. data/spec/rails_helper.rb +65 -0
  71. data/spec/spec_helper.rb +58 -0
  72. data/spec/support/wait_for_ajax.rb +19 -0
  73. data/vendor/assets/javascripts/jquery.mjs.nestedSortable.js +613 -0
  74. metadata +231 -0
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,56 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "rails/all"
4
+
5
+ Bundler.require(*Rails.groups)
6
+
7
+ require "active_admin/sortable_tree"
8
+
9
+ module Dummy
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ config.autoload_paths += %W(#{config.root}/app/models)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+ I18n.enforce_available_locales = false
33
+
34
+ # Configure the default encoding used in templates for Ruby 1.9.
35
+ config.encoding = "utf-8"
36
+
37
+ # Configure sensitive parameters which will be filtered from the log file.
38
+ config.filter_parameters += [:password]
39
+
40
+ # Enable escaping HTML in JSON.
41
+ config.active_support.escape_html_entities_in_json = true
42
+
43
+ # Use SQL instead of Active Record's schema dumper when creating the database.
44
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
45
+ # like if you have constraints or database-specific column types
46
+ # config.active_record.schema_format = :sql
47
+
48
+ # Enable the asset pipeline
49
+ config.assets.enabled = true
50
+
51
+ # Version of your assets, change this if you want to expire all your assets
52
+ config.assets.version = '1.0'
53
+ end
54
+ end
55
+
56
+ ActiveRecord::Migration.verbose = false
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,28 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+ config.eager_load = false
4
+
5
+ # In the development environment your application's code is reloaded on
6
+ # every request. This slows down response time but is perfect for development
7
+ # since you don't have to restart the web server when you make code changes.
8
+ config.cache_classes = false
9
+
10
+ # Show full error reports and disable caching
11
+ config.consider_all_requests_local = true
12
+ config.action_controller.perform_caching = false
13
+
14
+ # Don't care if the mailer can't send
15
+ config.action_mailer.raise_delivery_errors = false
16
+
17
+ # Print deprecation notices to the Rails logger
18
+ config.active_support.deprecation = :log
19
+
20
+ # Only use best-standards-support built into browsers
21
+ config.action_dispatch.best_standards_support = :builtin
22
+
23
+ # Do not compress assets
24
+ config.assets.compress = false
25
+
26
+ # Expands the lines which load the assets
27
+ config.assets.debug = true
28
+ end
@@ -0,0 +1,64 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+ config.eager_load = true
4
+
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Disable Rails's static asset server (Apache or nginx will already do this)
13
+ config.serve_static_assets = false
14
+
15
+ # Compress JavaScripts and CSS
16
+ config.assets.compress = true
17
+
18
+ # Don't fallback to assets pipeline if a precompiled asset is missed
19
+ config.assets.compile = false
20
+
21
+ # Generate digests for assets URLs
22
+ config.assets.digest = true
23
+
24
+ # Defaults to nil and saved in location specified by config.assets.prefix
25
+ # config.assets.manifest = YOUR_PATH
26
+
27
+ # Specifies the header that your server uses for sending files
28
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
29
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
30
+
31
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
32
+ # config.force_ssl = true
33
+
34
+ # See everything in the log (default is :info)
35
+ # config.log_level = :debug
36
+
37
+ # Prepend all log lines with the following tags
38
+ # config.log_tags = [ :subdomain, :uuid ]
39
+
40
+ # Use a different logger for distributed setups
41
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
42
+
43
+ # Use a different cache store in production
44
+ # config.cache_store = :mem_cache_store
45
+
46
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
47
+ # config.action_controller.asset_host = "http://assets.example.com"
48
+
49
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
50
+ # config.assets.precompile += %w( search.js )
51
+
52
+ # Disable delivery errors, bad email addresses will be ignored
53
+ # config.action_mailer.raise_delivery_errors = false
54
+
55
+ # Enable threaded mode
56
+ # config.threadsafe!
57
+
58
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
59
+ # the I18n.default_locale when a translation can not be found)
60
+ config.i18n.fallbacks = true
61
+
62
+ # Send deprecation notices to registered listeners
63
+ config.active_support.deprecation = :notify
64
+ end
@@ -0,0 +1,32 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+ config.eager_load = false
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+ config.cache_classes = true
10
+
11
+ # Configure static asset server for tests with Cache-Control for performance
12
+ config.serve_static_assets = true
13
+ config.static_cache_control = "public, max-age=3600"
14
+
15
+ # Show full error reports and disable caching
16
+ config.consider_all_requests_local = true
17
+ config.action_controller.perform_caching = false
18
+
19
+ # Raise exceptions instead of rendering exception templates
20
+ config.action_dispatch.show_exceptions = false
21
+
22
+ # Disable request forgery protection in test environment
23
+ config.action_controller.allow_forgery_protection = false
24
+
25
+ # Tell Action Mailer not to deliver emails to the real world.
26
+ # The :test delivery method accumulates sent emails in the
27
+ # ActionMailer::Base.deliveries array.
28
+ config.action_mailer.delivery_method = :test
29
+
30
+ # Print deprecation notices to the stderr
31
+ config.active_support.deprecation = :stderr
32
+ end
@@ -0,0 +1,231 @@
1
+ ActiveAdmin.setup do |config|
2
+
3
+ # == Site Title
4
+ #
5
+ # Set the title that is displayed on the main layout
6
+ # for each of the active admin pages.
7
+ #
8
+ config.site_title = "Dummy"
9
+
10
+ # Set the link url for the title. For example, to take
11
+ # users to your main site. Defaults to no link.
12
+ #
13
+ # config.site_title_link = "/"
14
+
15
+ # Set an optional image to be displayed for the header
16
+ # instead of a string (overrides :site_title)
17
+ #
18
+ # Note: Recommended image height is 21px to properly fit in the header
19
+ #
20
+ # config.site_title_image = "/images/logo.png"
21
+
22
+ # == Default Namespace
23
+ #
24
+ # Set the default namespace each administration resource
25
+ # will be added to.
26
+ #
27
+ # eg:
28
+ # config.default_namespace = :hello_world
29
+ #
30
+ # This will create resources in the HelloWorld module and
31
+ # will namespace routes to /hello_world/*
32
+ #
33
+ # To set no namespace by default, use:
34
+ # config.default_namespace = false
35
+ #
36
+ # Default:
37
+ # config.default_namespace = :admin
38
+ #
39
+ # You can customize the settings for each namespace by using
40
+ # a namespace block. For example, to change the site title
41
+ # within a namespace:
42
+ #
43
+ # config.namespace :admin do |admin|
44
+ # admin.site_title = "Custom Admin Title"
45
+ # end
46
+ #
47
+ # This will ONLY change the title for the admin section. Other
48
+ # namespaces will continue to use the main "site_title" configuration.
49
+
50
+ # == User Authentication
51
+ #
52
+ # Active Admin will automatically call an authentication
53
+ # method in a before filter of all controller actions to
54
+ # ensure that there is a currently logged in admin user.
55
+ #
56
+ # This setting changes the method which Active Admin calls
57
+ # within the controller.
58
+ config.authentication_method = :authenticate_admin_user!
59
+
60
+ # == User Authorization
61
+ #
62
+ # Active Admin will automatically call an authorization
63
+ # method in a before filter of all controller actions to
64
+ # ensure that there is a user with proper rights. You can use
65
+ # CanCanAdapter or make your own. Please refer to documentation.
66
+ # config.authorization_adapter = ActiveAdmin::CanCanAdapter
67
+
68
+ # You can customize your CanCan Ability class name here.
69
+ # config.cancan_ability_class = "Ability"
70
+
71
+ # You can specify a method to be called on unauthorized access.
72
+ # This is necessary in order to prevent a redirect loop which happens
73
+ # because, by default, user gets redirected to Dashboard. If user
74
+ # doesn't have access to Dashboard, he'll end up in a redirect loop.
75
+ # Method provided here should be defined in application_controller.rb.
76
+ # config.on_unauthorized_access = :access_denied
77
+
78
+ # == Current User
79
+ #
80
+ # Active Admin will associate actions with the current
81
+ # user performing them.
82
+ #
83
+ # This setting changes the method which Active Admin calls
84
+ # to return the currently logged in user.
85
+ config.current_user_method = :current_admin_user
86
+
87
+
88
+ # == Logging Out
89
+ #
90
+ # Active Admin displays a logout link on each screen. These
91
+ # settings configure the location and method used for the link.
92
+ #
93
+ # This setting changes the path where the link points to. If it's
94
+ # a string, the strings is used as the path. If it's a Symbol, we
95
+ # will call the method to return the path.
96
+ #
97
+ # Default:
98
+ config.logout_link_path = :destroy_admin_user_session_path
99
+
100
+ # This setting changes the http method used when rendering the
101
+ # link. For example :get, :delete, :put, etc..
102
+ #
103
+ # Default:
104
+ # config.logout_link_method = :get
105
+
106
+
107
+ # == Root
108
+ #
109
+ # Set the action to call for the root path. You can set different
110
+ # roots for each namespace.
111
+ #
112
+ # Default:
113
+ # config.root_to = 'dashboard#index'
114
+
115
+
116
+ # == Admin Comments
117
+ #
118
+ # This allows your users to comment on any resource registered with Active Admin.
119
+ #
120
+ # You can completely disable comments:
121
+ # config.allow_comments = false
122
+ #
123
+ # You can disable the menu item for the comments index page:
124
+ # config.show_comments_in_menu = false
125
+ #
126
+ # You can change the name under which comments are registered:
127
+ # config.comments_registration_name = 'AdminComment'
128
+
129
+
130
+ # == Batch Actions
131
+ #
132
+ # Enable and disable Batch Actions
133
+ #
134
+ config.batch_actions = true
135
+
136
+
137
+ # == Controller Filters
138
+ #
139
+ # You can add before, after and around filters to all of your
140
+ # Active Admin resources and pages from here.
141
+ #
142
+ # config.before_filter :do_something_awesome
143
+
144
+
145
+ # == Setting a Favicon
146
+ #
147
+ # config.favicon = '/assets/favicon.ico'
148
+
149
+
150
+ # == Register Stylesheets & Javascripts
151
+ #
152
+ # We recommend using the built in Active Admin layout and loading
153
+ # up your own stylesheets / javascripts to customize the look
154
+ # and feel.
155
+ #
156
+ # To load a stylesheet:
157
+ # config.register_stylesheet 'my_stylesheet.css'
158
+ #
159
+ # You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
160
+ # config.register_stylesheet 'my_print_stylesheet.css', :media => :print
161
+ #
162
+ # To load a javascript file:
163
+ # config.register_javascript 'my_javascript.js'
164
+
165
+
166
+ # == CSV options
167
+ #
168
+ # Set the CSV builder separator
169
+ # config.csv_options = { :col_sep => ';' }
170
+ #
171
+ # Force the use of quotes
172
+ # config.csv_options = { :force_quotes => true }
173
+
174
+
175
+ # == Menu System
176
+ #
177
+ # You can add a navigation menu to be used in your application, or configure a provided menu
178
+ #
179
+ # To change the default utility navigation to show a link to your website & a logout btn
180
+ #
181
+ # config.namespace :admin do |admin|
182
+ # admin.build_menu :utility_navigation do |menu|
183
+ # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
184
+ # admin.add_logout_button_to_menu menu
185
+ # end
186
+ # end
187
+ #
188
+ # If you wanted to add a static menu item to the default menu provided:
189
+ #
190
+ # config.namespace :admin do |admin|
191
+ # admin.build_menu :default do |menu|
192
+ # menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
193
+ # end
194
+ # end
195
+
196
+
197
+ # == Download Links
198
+ #
199
+ # You can disable download links on resource listing pages,
200
+ # or customize the formats shown per namespace/globally
201
+ #
202
+ # To disable/customize for the :admin namespace:
203
+ #
204
+ # config.namespace :admin do |admin|
205
+ #
206
+ # # Disable the links entirely
207
+ # admin.download_links = false
208
+ #
209
+ # # Only show XML & PDF options
210
+ # admin.download_links = [:xml, :pdf]
211
+ #
212
+ # end
213
+
214
+
215
+ # == Pagination
216
+ #
217
+ # Pagination is enabled by default for all resources.
218
+ # You can control the default per page count for all resources here.
219
+ #
220
+ # config.default_per_page = 30
221
+
222
+
223
+ # == Filters
224
+ #
225
+ # By default the index screen includes a “Filters” sidebar on the right
226
+ # hand side with a filter for each attribute of the registered model.
227
+ # You can enable or disable them for all resources here.
228
+ #
229
+ # config.filters = true
230
+
231
+ end