admin_core 0.0.2 → 0.0.3

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 (129) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -1
  3. data/admin_core.gemspec +1 -1
  4. data/lib/admin_core.rb +34 -1
  5. data/lib/admin_core/errors.rb +6 -0
  6. data/lib/admin_core/resource_field_builder.rb +1 -11
  7. data/lib/admin_core/resource_filter/boolean.rb +2 -0
  8. data/lib/admin_core/resource_filter/number.rb +2 -0
  9. data/lib/admin_core/resource_filter/string.rb +2 -0
  10. data/lib/admin_core/resource_filter_builder.rb +1 -1
  11. data/lib/admin_core/version.rb +1 -1
  12. data/lib/generators/admin_core/resource_manager_generator.rb +4 -1
  13. data/lib/generators/admin_core/templates/admin-core.js +1047 -629
  14. metadata +2 -117
  15. data/client/.babelrc +0 -19
  16. data/client/.eslintignore +0 -3
  17. data/client/.eslintrc.yml +0 -20
  18. data/client/.flowconfig +0 -7
  19. data/client/.gitignore +0 -64
  20. data/client/.npmignore +0 -10
  21. data/client/README.md +0 -3
  22. data/client/admin-core.scss +0 -8
  23. data/client/flow-typed/npm/axios_v0.16.x.js +0 -120
  24. data/client/flow-typed/npm/classnames_v2.x.x.js +0 -16
  25. data/client/flow-typed/npm/lodash_v4.x.x.js +0 -514
  26. data/client/flow-typed/npm/react-router-dom_v4.x.x.js +0 -166
  27. data/client/flow-typed/npm/reactstrap_vx.x.x.js +0 -536
  28. data/client/package.json +0 -60
  29. data/client/src/.eslintrc.yml +0 -23
  30. data/client/src/AdminCore.jsx +0 -44
  31. data/client/src/components/Breadcrumb.jsx +0 -18
  32. data/client/src/components/Header.jsx +0 -45
  33. data/client/src/components/Pagination.jsx +0 -72
  34. data/client/src/components/ResourceFilters.jsx +0 -87
  35. data/client/src/components/ResourceForm.jsx +0 -103
  36. data/client/src/components/ResourcesCollection.jsx +0 -41
  37. data/client/src/components/Sidebar.jsx +0 -90
  38. data/client/src/decls.js +0 -119
  39. data/client/src/http-client.js +0 -18
  40. data/client/src/main.js +0 -9
  41. data/client/src/resource-field-renderer.js +0 -45
  42. data/client/src/resource-field/BelongsTo.jsx +0 -26
  43. data/client/src/resource-field/Boolean.jsx +0 -43
  44. data/client/src/resource-field/Date.jsx +0 -29
  45. data/client/src/resource-field/DateTime.jsx +0 -29
  46. data/client/src/resource-field/Enum.jsx +0 -34
  47. data/client/src/resource-field/Number.jsx +0 -28
  48. data/client/src/resource-field/String.jsx +0 -28
  49. data/client/src/resource-field/Text.jsx +0 -27
  50. data/client/src/resource-filter-renderer.js +0 -17
  51. data/client/src/resource-filter/Boolean.jsx +0 -22
  52. data/client/src/resource-filter/Number.jsx +0 -45
  53. data/client/src/resource-filter/String.jsx +0 -46
  54. data/client/src/resource-page/Base.js +0 -36
  55. data/client/src/resource-page/Edit.jsx +0 -48
  56. data/client/src/resource-page/Index.jsx +0 -141
  57. data/client/src/resource-page/New.jsx +0 -48
  58. data/client/src/resource-page/Show.jsx +0 -116
  59. data/client/webpack.config.js +0 -26
  60. data/client/yarn.lock +0 -3816
  61. data/sample/.gitignore +0 -21
  62. data/sample/Gemfile +0 -35
  63. data/sample/Gemfile.lock +0 -147
  64. data/sample/README.md +0 -24
  65. data/sample/Rakefile +0 -6
  66. data/sample/app/assets/config/manifest.js +0 -2
  67. data/sample/app/assets/images/.keep +0 -0
  68. data/sample/app/assets/stylesheets/application.css +0 -15
  69. data/sample/app/controllers/admin/application_controller.rb +0 -4
  70. data/sample/app/controllers/admin/tweets_controller.rb +0 -4
  71. data/sample/app/controllers/admin/users_controller.rb +0 -4
  72. data/sample/app/controllers/application_controller.rb +0 -3
  73. data/sample/app/controllers/concerns/.keep +0 -0
  74. data/sample/app/helpers/application_helper.rb +0 -2
  75. data/sample/app/jobs/application_job.rb +0 -2
  76. data/sample/app/models/admin/tweet.rb +0 -35
  77. data/sample/app/models/admin/user.rb +0 -41
  78. data/sample/app/models/application_record.rb +0 -3
  79. data/sample/app/models/concerns/.keep +0 -0
  80. data/sample/app/models/tweet.rb +0 -3
  81. data/sample/app/models/user.rb +0 -3
  82. data/sample/app/views/admin/application.html.erb +0 -64
  83. data/sample/app/views/layouts/application.html.erb +0 -13
  84. data/sample/bin/bundle +0 -3
  85. data/sample/bin/rails +0 -4
  86. data/sample/bin/rake +0 -4
  87. data/sample/bin/setup +0 -34
  88. data/sample/bin/update +0 -29
  89. data/sample/config.ru +0 -5
  90. data/sample/config/application.rb +0 -25
  91. data/sample/config/boot.rb +0 -3
  92. data/sample/config/database.yml +0 -25
  93. data/sample/config/environment.rb +0 -5
  94. data/sample/config/environments/development.rb +0 -42
  95. data/sample/config/environments/production.rb +0 -69
  96. data/sample/config/environments/test.rb +0 -36
  97. data/sample/config/initializers/admin_core.rb +0 -8
  98. data/sample/config/initializers/application_controller_renderer.rb +0 -6
  99. data/sample/config/initializers/backtrace_silencers.rb +0 -7
  100. data/sample/config/initializers/cookies_serializer.rb +0 -5
  101. data/sample/config/initializers/filter_parameter_logging.rb +0 -4
  102. data/sample/config/initializers/inflections.rb +0 -16
  103. data/sample/config/initializers/mime_types.rb +0 -4
  104. data/sample/config/initializers/new_framework_defaults.rb +0 -24
  105. data/sample/config/initializers/session_store.rb +0 -3
  106. data/sample/config/initializers/wrap_parameters.rb +0 -14
  107. data/sample/config/locales/en.yml +0 -23
  108. data/sample/config/routes.rb +0 -6
  109. data/sample/config/secrets.yml +0 -22
  110. data/sample/db/migrate/20170417055257_create_users.rb +0 -10
  111. data/sample/db/migrate/20170417055412_create_tweets.rb +0 -9
  112. data/sample/db/schema.rb +0 -31
  113. data/sample/db/seeds.rb +0 -7
  114. data/sample/lib/assets/.keep +0 -0
  115. data/sample/lib/tasks/.keep +0 -0
  116. data/sample/log/.keep +0 -0
  117. data/sample/public/404.html +0 -67
  118. data/sample/public/422.html +0 -67
  119. data/sample/public/500.html +0 -66
  120. data/sample/public/apple-touch-icon-precomposed.png +0 -0
  121. data/sample/public/apple-touch-icon.png +0 -0
  122. data/sample/public/bundle.min.js +0 -27
  123. data/sample/public/bundle.min.js.map +0 -1
  124. data/sample/public/favicon.ico +0 -0
  125. data/sample/public/javascripts/admin-core.js +0 -38196
  126. data/sample/public/robots.txt +0 -5
  127. data/sample/public/stylesheets/admin-core.css +0 -1
  128. data/sample/tmp/.keep +0 -0
  129. data/sample/vendor/assets/stylesheets/.keep +0 -0
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Sample</title>
5
- <%= csrf_meta_tags %>
6
-
7
- <%= stylesheet_link_tag 'application', media: 'all' %>
8
- </head>
9
-
10
- <body>
11
- <%= yield %>
12
- </body>
13
- </html>
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
5
-
6
- # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
-
9
- def system!(*args)
10
- system(*args) || abort("\n== Command #{args} failed ==")
11
- end
12
-
13
- chdir APP_ROOT do
14
- # This script is a starting point to setup your application.
15
- # Add necessary setup steps to this file.
16
-
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
20
-
21
- # puts "\n== Copying sample files =="
22
- # unless File.exist?('config/database.yml')
23
- # cp 'config/database.yml.sample', 'config/database.yml'
24
- # end
25
-
26
- puts "\n== Preparing database =="
27
- system! 'bin/rails db:setup'
28
-
29
- puts "\n== Removing old logs and tempfiles =="
30
- system! 'bin/rails log:clear tmp:clear'
31
-
32
- puts "\n== Restarting application server =="
33
- system! 'bin/rails restart'
34
- end
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'pathname'
3
- require 'fileutils'
4
- include FileUtils
5
-
6
- # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
-
9
- def system!(*args)
10
- system(*args) || abort("\n== Command #{args} failed ==")
11
- end
12
-
13
- chdir APP_ROOT do
14
- # This script is a way to update your development environment automatically.
15
- # Add necessary update steps to this file.
16
-
17
- puts '== Installing dependencies =='
18
- system! 'gem install bundler --conservative'
19
- system('bundle check') || system!('bundle install')
20
-
21
- puts "\n== Updating database =="
22
- system! 'bin/rails db:migrate'
23
-
24
- puts "\n== Removing old logs and tempfiles =="
25
- system! 'bin/rails log:clear tmp:clear'
26
-
27
- puts "\n== Restarting application server =="
28
- system! 'bin/rails restart'
29
- end
@@ -1,5 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require_relative 'config/environment'
4
-
5
- run Rails.application
@@ -1,25 +0,0 @@
1
- require_relative 'boot'
2
-
3
- require "rails"
4
- # Pick the frameworks you want:
5
- require "active_model/railtie"
6
- require "active_job/railtie"
7
- require "active_record/railtie"
8
- require "action_controller/railtie"
9
- # require "action_mailer/railtie"
10
- require "action_view/railtie"
11
- # require "action_cable/engine"
12
- # require "sprockets/railtie"
13
- # require "rails/test_unit/railtie"
14
-
15
- # Require the gems listed in Gemfile, including any gems
16
- # you've limited to :test, :development, or :production.
17
- Bundler.require(*Rails.groups)
18
-
19
- module Sample
20
- class Application < Rails::Application
21
- # Settings in config/environments/* take precedence over those specified here.
22
- # Application configuration should go into files in config/initializers
23
- # -- all .rb files in that directory are automatically loaded.
24
- end
25
- end
@@ -1,3 +0,0 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
-
3
- require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,25 +0,0 @@
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
- #
7
- default: &default
8
- adapter: sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- development:
13
- <<: *default
14
- database: db/development.sqlite3
15
-
16
- # Warning: The database defined as "test" will be erased and
17
- # re-generated from your development database when you run "rake".
18
- # Do not set this db to the same as development or production.
19
- test:
20
- <<: *default
21
- database: db/test.sqlite3
22
-
23
- production:
24
- <<: *default
25
- database: db/production.sqlite3
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require_relative 'application'
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,42 +0,0 @@
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
- if Rails.root.join('tmp/caching-dev.txt').exist?
17
- config.action_controller.perform_caching = true
18
-
19
- config.cache_store = :memory_store
20
- config.public_file_server.headers = {
21
- 'Cache-Control' => 'public, max-age=172800'
22
- }
23
- else
24
- config.action_controller.perform_caching = false
25
-
26
- config.cache_store = :null_store
27
- end
28
-
29
- # Print deprecation notices to the Rails logger.
30
- config.active_support.deprecation = :log
31
-
32
- # Raise an error on page load if there are pending migrations.
33
- config.active_record.migration_error = :page_load
34
-
35
-
36
- # Raises error for missing translations
37
- # config.action_view.raise_on_missing_translations = true
38
-
39
- # Use an evented file watcher to asynchronously detect changes in source code,
40
- # routes, locales, etc. This feature depends on the listen gem.
41
- # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
42
- end
@@ -1,69 +0,0 @@
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
- # Disable serving static files from the `/public` folder by default since
18
- # Apache or NGINX already handles this.
19
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20
-
21
-
22
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
23
- # config.action_controller.asset_host = 'http://assets.example.com'
24
-
25
- # Specifies the header that your server uses for sending files.
26
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
27
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
28
-
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # Use the lowest log level to ensure availability of diagnostic information
34
- # when problems arise.
35
- config.log_level = :debug
36
-
37
- # Prepend all log lines with the following tags.
38
- config.log_tags = [ :request_id ]
39
-
40
- # Use a different cache store in production.
41
- # config.cache_store = :mem_cache_store
42
-
43
- # Use a real queuing backend for Active Job (and separate queues per environment)
44
- # config.active_job.queue_adapter = :resque
45
- # config.active_job.queue_name_prefix = "sample_#{Rails.env}"
46
-
47
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
48
- # the I18n.default_locale when a translation cannot be found).
49
- config.i18n.fallbacks = true
50
-
51
- # Send deprecation notices to registered listeners.
52
- config.active_support.deprecation = :notify
53
-
54
- # Use default logging formatter so that PID and timestamp are not suppressed.
55
- config.log_formatter = ::Logger::Formatter.new
56
-
57
- # Use a different logger for distributed setups.
58
- # require 'syslog/logger'
59
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
60
-
61
- if ENV["RAILS_LOG_TO_STDOUT"].present?
62
- logger = ActiveSupport::Logger.new(STDOUT)
63
- logger.formatter = config.log_formatter
64
- config.logger = ActiveSupport::TaggedLogging.new(logger)
65
- end
66
-
67
- # Do not dump schema after migrations.
68
- config.active_record.dump_schema_after_migration = false
69
- end
@@ -1,36 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure public file server for tests with Cache-Control for performance.
16
- config.public_file_server.enabled = true
17
- config.public_file_server.headers = {
18
- 'Cache-Control' => 'public, max-age=3600'
19
- }
20
-
21
- # Show full error reports and disable caching.
22
- config.consider_all_requests_local = true
23
- config.action_controller.perform_caching = false
24
-
25
- # Raise exceptions instead of rendering exception templates.
26
- config.action_dispatch.show_exceptions = false
27
-
28
- # Disable request forgery protection in test environment.
29
- config.action_controller.allow_forgery_protection = false
30
-
31
- # Print deprecation notices to the stderr.
32
- config.active_support.deprecation = :stderr
33
-
34
- # Raises error for missing translations
35
- # config.action_view.raise_on_missing_translations = true
36
- end
@@ -1,8 +0,0 @@
1
- AdminCore.configure do |config|
2
- config.module_name = "Admin"
3
- end
4
-
5
- Admin::Tweet
6
- Admin::User
7
- AdminCore.register_resource_manager(Admin::User)
8
- AdminCore.register_resource_manager(Admin::Tweet)
@@ -1,6 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # ApplicationController.renderer.defaults.merge!(
4
- # http_host: 'example.org',
5
- # https: false
6
- # )
@@ -1,7 +0,0 @@
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!
@@ -1,5 +0,0 @@
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
@@ -1,4 +0,0 @@
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]
@@ -1,16 +0,0 @@
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
@@ -1,4 +0,0 @@
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
@@ -1,24 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains migration options to ease your Rails 5.0 upgrade.
4
- #
5
- # Read the Guide for Upgrading Ruby on Rails for more info on each option.
6
-
7
- # Enable per-form CSRF tokens. Previous versions had false.
8
- Rails.application.config.action_controller.per_form_csrf_tokens = true
9
-
10
- # Enable origin-checking CSRF mitigation. Previous versions had false.
11
- Rails.application.config.action_controller.forgery_protection_origin_check = true
12
-
13
- # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
14
- # Previous versions had false.
15
- ActiveSupport.to_time_preserves_timezone = true
16
-
17
- # Require `belongs_to` associations by default. Previous versions had false.
18
- Rails.application.config.active_record.belongs_to_required_by_default = true
19
-
20
- # Do not halt callback chains when a callback returns false. Previous versions had true.
21
- ActiveSupport.halt_callback_chains_on_return_false = false
22
-
23
- # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
24
- Rails.application.config.ssl_options = { hsts: { subdomains: true } }
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, key: '_sample_session'
@@ -1,14 +0,0 @@
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
@@ -1,23 +0,0 @@
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
- # To learn more, please read the Rails Internationalization guide
20
- # available at http://guides.rubyonrails.org/i18n.html.
21
-
22
- en:
23
- hello: "Hello world"