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,21 +0,0 @@
1
- # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
- #
3
- # If you find yourself ignoring temporary files generated by your text editor
4
- # or operating system, you probably want to add a global ignore instead:
5
- # git config --global core.excludesfile '~/.gitignore_global'
6
-
7
- # Ignore bundler config.
8
- /.bundle
9
-
10
- # Ignore the default SQLite database.
11
- /db/*.sqlite3
12
- /db/*.sqlite3-journal
13
-
14
- # Ignore all logfiles and tempfiles.
15
- /log/*
16
- /tmp/*
17
- !/log/.keep
18
- !/tmp/.keep
19
-
20
- # Ignore Byebug command history file.
21
- .byebug_history
@@ -1,35 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- git_source(:github) do |repo_name|
4
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
5
- "https://github.com/#{repo_name}.git"
6
- end
7
-
8
-
9
- # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
10
- gem 'rails', '~> 5.0.2'
11
- # Use sqlite3 as the database for Active Record
12
- gem 'sqlite3'
13
- # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
14
- gem 'jbuilder', '~> 2.5'
15
- # Use ActiveModel has_secure_password
16
- # gem 'bcrypt', '~> 3.1.7'
17
-
18
- # Use Capistrano for deployment
19
- # gem 'capistrano-rails', group: :development
20
-
21
- # TODO: Install from rubygems.org
22
- gem 'admin_core', path: '../'
23
-
24
- group :development, :test do
25
- # Call 'byebug' anywhere in the code to stop execution and get a debugger console
26
- gem 'byebug', platform: :mri
27
- end
28
-
29
- group :development do
30
- # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
31
- gem 'web-console', '>= 3.3.0'
32
- end
33
-
34
- # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
35
- gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
@@ -1,147 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- admin_core (0.0.0)
5
- kaminari (~> 1.0)
6
- rails (>= 3.2)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actioncable (5.0.2)
12
- actionpack (= 5.0.2)
13
- nio4r (>= 1.2, < 3.0)
14
- websocket-driver (~> 0.6.1)
15
- actionmailer (5.0.2)
16
- actionpack (= 5.0.2)
17
- actionview (= 5.0.2)
18
- activejob (= 5.0.2)
19
- mail (~> 2.5, >= 2.5.4)
20
- rails-dom-testing (~> 2.0)
21
- actionpack (5.0.2)
22
- actionview (= 5.0.2)
23
- activesupport (= 5.0.2)
24
- rack (~> 2.0)
25
- rack-test (~> 0.6.3)
26
- rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
- actionview (5.0.2)
29
- activesupport (= 5.0.2)
30
- builder (~> 3.1)
31
- erubis (~> 2.7.0)
32
- rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
- activejob (5.0.2)
35
- activesupport (= 5.0.2)
36
- globalid (>= 0.3.6)
37
- activemodel (5.0.2)
38
- activesupport (= 5.0.2)
39
- activerecord (5.0.2)
40
- activemodel (= 5.0.2)
41
- activesupport (= 5.0.2)
42
- arel (~> 7.0)
43
- activesupport (5.0.2)
44
- concurrent-ruby (~> 1.0, >= 1.0.2)
45
- i18n (~> 0.7)
46
- minitest (~> 5.1)
47
- tzinfo (~> 1.1)
48
- arel (7.1.4)
49
- bindex (0.5.0)
50
- builder (3.2.3)
51
- byebug (9.0.6)
52
- concurrent-ruby (1.0.5)
53
- erubis (2.7.0)
54
- globalid (0.4.0)
55
- activesupport (>= 4.2.0)
56
- i18n (0.8.1)
57
- jbuilder (2.6.3)
58
- activesupport (>= 3.0.0, < 5.2)
59
- multi_json (~> 1.2)
60
- kaminari (1.0.1)
61
- activesupport (>= 4.1.0)
62
- kaminari-actionview (= 1.0.1)
63
- kaminari-activerecord (= 1.0.1)
64
- kaminari-core (= 1.0.1)
65
- kaminari-actionview (1.0.1)
66
- actionview
67
- kaminari-core (= 1.0.1)
68
- kaminari-activerecord (1.0.1)
69
- activerecord
70
- kaminari-core (= 1.0.1)
71
- kaminari-core (1.0.1)
72
- loofah (2.0.3)
73
- nokogiri (>= 1.5.9)
74
- mail (2.6.4)
75
- mime-types (>= 1.16, < 4)
76
- method_source (0.8.2)
77
- mime-types (3.1)
78
- mime-types-data (~> 3.2015)
79
- mime-types-data (3.2016.0521)
80
- mini_portile2 (2.1.0)
81
- minitest (5.10.1)
82
- multi_json (1.12.1)
83
- nio4r (2.0.0)
84
- nokogiri (1.7.1)
85
- mini_portile2 (~> 2.1.0)
86
- rack (2.0.1)
87
- rack-test (0.6.3)
88
- rack (>= 1.0)
89
- rails (5.0.2)
90
- actioncable (= 5.0.2)
91
- actionmailer (= 5.0.2)
92
- actionpack (= 5.0.2)
93
- actionview (= 5.0.2)
94
- activejob (= 5.0.2)
95
- activemodel (= 5.0.2)
96
- activerecord (= 5.0.2)
97
- activesupport (= 5.0.2)
98
- bundler (>= 1.3.0, < 2.0)
99
- railties (= 5.0.2)
100
- sprockets-rails (>= 2.0.0)
101
- rails-dom-testing (2.0.2)
102
- activesupport (>= 4.2.0, < 6.0)
103
- nokogiri (~> 1.6)
104
- rails-html-sanitizer (1.0.3)
105
- loofah (~> 2.0)
106
- railties (5.0.2)
107
- actionpack (= 5.0.2)
108
- activesupport (= 5.0.2)
109
- method_source
110
- rake (>= 0.8.7)
111
- thor (>= 0.18.1, < 2.0)
112
- rake (12.0.0)
113
- sprockets (3.7.1)
114
- concurrent-ruby (~> 1.0)
115
- rack (> 1, < 3)
116
- sprockets-rails (3.2.0)
117
- actionpack (>= 4.0)
118
- activesupport (>= 4.0)
119
- sprockets (>= 3.0.0)
120
- sqlite3 (1.3.13)
121
- thor (0.19.4)
122
- thread_safe (0.3.6)
123
- tzinfo (1.2.3)
124
- thread_safe (~> 0.1)
125
- web-console (3.5.0)
126
- actionview (>= 5.0)
127
- activemodel (>= 5.0)
128
- bindex (>= 0.4.0)
129
- railties (>= 5.0)
130
- websocket-driver (0.6.5)
131
- websocket-extensions (>= 0.1.0)
132
- websocket-extensions (0.1.2)
133
-
134
- PLATFORMS
135
- ruby
136
-
137
- DEPENDENCIES
138
- admin_core!
139
- byebug
140
- jbuilder (~> 2.5)
141
- rails (~> 5.0.2)
142
- sqlite3
143
- tzinfo-data
144
- web-console (>= 3.3.0)
145
-
146
- BUNDLED WITH
147
- 1.14.6
@@ -1,24 +0,0 @@
1
- # README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require_relative 'config/application'
5
-
6
- Rails.application.load_tasks
@@ -1,2 +0,0 @@
1
- //= link_tree ../images
2
- //= link_directory ../stylesheets .css
File without changes
@@ -1,15 +0,0 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
- * files in this directory. Styles in this file should be added after the last require_* statement.
11
- * It is generally better to create a new file per style scope.
12
- *
13
- *= require_tree .
14
- *= require_self
15
- */
@@ -1,4 +0,0 @@
1
- module Admin
2
- class ApplicationController < AdminCore::BaseController
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Admin
2
- class TweetsController < Admin::ApplicationController
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Admin
2
- class UsersController < Admin::ApplicationController
3
- end
4
- end
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery with: :exception
3
- end
File without changes
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,2 +0,0 @@
1
- class ApplicationJob < ActiveJob::Base
2
- end
@@ -1,35 +0,0 @@
1
- module Admin
2
- class Tweet < AdminCore::BaseResourceManager
3
- register_scopes []
4
-
5
- define_field :id, :number
6
- define_field :body, :string
7
- define_field :created_at, :date_time
8
- define_field :updated_at, :date_time
9
- define_field :user, :belongs_to
10
-
11
- register_fields_for :index, [
12
- :id,
13
- :body,
14
- :created_at,
15
- :updated_at,
16
- ]
17
-
18
- register_fields_for :new, :edit, [
19
- :body,
20
- :user,
21
- ]
22
-
23
- register_fields_for :show, [
24
- :id,
25
- :body,
26
- :created_at,
27
- :updated_at,
28
- :user,
29
- ]
30
-
31
- destroyable true
32
-
33
- define_and_register_filter :body, :string
34
- end
35
- end
@@ -1,41 +0,0 @@
1
- module Admin
2
- class User < AdminCore::BaseResourceManager
3
- register_scopes []
4
-
5
- define_field :id, :number
6
- define_field :name, :string
7
- define_field :admin, :boolean
8
- define_field :tweets_count, :number
9
- define_field :created_at, :date_time
10
- define_field :updated_at, :date_time
11
- # define_field :tweets, :has_many
12
-
13
- register_fields_for :index, [
14
- :id,
15
- :name,
16
- :admin,
17
- :tweets_count,
18
- ]
19
-
20
- register_fields_for :new, :edit, [
21
- :name,
22
- :admin,
23
- # :tweets,
24
- ]
25
-
26
- register_fields_for :show, [
27
- :id,
28
- :name,
29
- :admin,
30
- :tweets_count,
31
- :created_at,
32
- :updated_at,
33
- # :tweets,
34
- ]
35
-
36
- destroyable true
37
-
38
- define_and_register_filter :name, :string
39
- define_and_register_filter :admin, :boolean
40
- end
41
- end
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end
File without changes
@@ -1,3 +0,0 @@
1
- class Tweet < ApplicationRecord
2
- belongs_to :user, counter_cache: true
3
- end
@@ -1,3 +0,0 @@
1
- class User < ApplicationRecord
2
- has_many :tweets, dependent: :destroy
3
- end
@@ -1,64 +0,0 @@
1
- <!DOCTYPE>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
- <meta name="ROBOTS" content="NOODP">
8
- <title>AdminCore sample</title>
9
- <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
10
- <link href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.min.css" rel="stylesheet">
11
- <%= stylesheet_link_tag 'admin-core', media: 'all' %>
12
- <%= csrf_meta_tags %>
13
- </head>
14
- <!--
15
- // Header options
16
- 1. '.header-fixed' - Fixed Header
17
-
18
- // Sidebar options
19
- 1. '.sidebar-fixed' - Fixed Sidebar
20
- 2. '.sidebar-hidden' - Hidden Sidebar
21
- 3. '.sidebar-off-canvas' - Off Canvas Sidebar
22
- 4. '.sidebar-compact' - Compact Sidebar Navigation (Only icons)
23
-
24
- // Aside options
25
- 1. '.aside-menu-fixed' - Fixed Aside Menu
26
- 2. '.aside-menu-hidden' - Hidden Aside Menu
27
- 3. '.aside-menu-off-canvas' - Off Canvas Aside Menu
28
-
29
- // Footer options
30
- 1. 'footer-fixed' - Fixed footer
31
- -->
32
- <body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
33
- <%= content_tag :div, nil,
34
- id: "root",
35
- 'data-resource-managers' => AdminCore::resource_managers.to_json,
36
- 'data-sidebar' => [
37
- AdminCore::ViewObject::SidebarTitle.new("Resources"),
38
- AdminCore::resource_managers.map do |resource_manager_class|
39
- AdminCore::ViewObject::SidebarResourceLink.new(resource_manager_class)
40
- end,
41
- AdminCore::ViewObject::SidebarDropdown.new(
42
- "Dropdown",
43
- [
44
- AdminCore::ViewObject::SidebarLink.new('External Link', 'http://example.com')
45
- ],
46
- ),
47
- ].flatten.to_json
48
- %>
49
- <%= javascript_include_tag 'admin-core' %>
50
- <script>
51
- document.addEventListener("DOMContentLoaded", function () {
52
- var el = document.getElementById("root");
53
- ReactDOM.render(
54
- React.createElement(AdminCore, {
55
- siteName: "AdminCore",
56
- sidebar: JSON.parse(el.dataset.sidebar),
57
- resourceManagers: JSON.parse(el.dataset.resourceManagers),
58
- }),
59
- el
60
- );
61
- });
62
- </script>
63
- </body>
64
- </html>