admin_core 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.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.gitignore +53 -0
- data/.rspec +2 -0
- data/.rubocop.yml +27 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +3 -0
- data/README.md +48 -0
- data/Rakefile +31 -0
- data/admin_core.gemspec +32 -0
- data/client/.babelrc +19 -0
- data/client/.eslintignore +3 -0
- data/client/.eslintrc.yml +20 -0
- data/client/.flowconfig +7 -0
- data/client/.gitignore +64 -0
- data/client/README.md +3 -0
- data/client/admin-core.scss +8 -0
- data/client/flow-typed/npm/axios_v0.16.x.js +120 -0
- data/client/flow-typed/npm/classnames_v2.x.x.js +16 -0
- data/client/flow-typed/npm/lodash_v4.x.x.js +514 -0
- data/client/flow-typed/npm/react-router-dom_v4.x.x.js +166 -0
- data/client/flow-typed/npm/reactstrap_vx.x.x.js +536 -0
- data/client/package.json +60 -0
- data/client/src/.eslintrc.yml +23 -0
- data/client/src/AdminCore.jsx +44 -0
- data/client/src/components/Breadcrumb.jsx +18 -0
- data/client/src/components/Header.jsx +45 -0
- data/client/src/components/Pagination.jsx +72 -0
- data/client/src/components/ResourceFilters.jsx +87 -0
- data/client/src/components/ResourceForm.jsx +103 -0
- data/client/src/components/ResourcesCollection.jsx +41 -0
- data/client/src/components/Sidebar.jsx +90 -0
- data/client/src/decls.js +119 -0
- data/client/src/http-client.js +18 -0
- data/client/src/main.js +9 -0
- data/client/src/resource-field/BelongsTo.jsx +26 -0
- data/client/src/resource-field/Boolean.jsx +43 -0
- data/client/src/resource-field/Date.jsx +29 -0
- data/client/src/resource-field/DateTime.jsx +29 -0
- data/client/src/resource-field/Enum.jsx +34 -0
- data/client/src/resource-field/Number.jsx +28 -0
- data/client/src/resource-field/String.jsx +28 -0
- data/client/src/resource-field/Text.jsx +27 -0
- data/client/src/resource-field-renderer.js +45 -0
- data/client/src/resource-filter/Boolean.jsx +22 -0
- data/client/src/resource-filter/Number.jsx +45 -0
- data/client/src/resource-filter/String.jsx +46 -0
- data/client/src/resource-filter-renderer.js +17 -0
- data/client/src/resource-page/Base.js +36 -0
- data/client/src/resource-page/Edit.jsx +48 -0
- data/client/src/resource-page/Index.jsx +141 -0
- data/client/src/resource-page/New.jsx +48 -0
- data/client/src/resource-page/Show.jsx +116 -0
- data/client/webpack.config.js +26 -0
- data/client/yarn.lock +3816 -0
- data/lib/admin_core/base_controller.rb +114 -0
- data/lib/admin_core/base_resource_manager.rb +24 -0
- data/lib/admin_core/configuration.rb +20 -0
- data/lib/admin_core/engine.rb +6 -0
- data/lib/admin_core/errors.rb +17 -0
- data/lib/admin_core/resource_field/base.rb +69 -0
- data/lib/admin_core/resource_field/belongs_to.rb +38 -0
- data/lib/admin_core/resource_field/boolean.rb +18 -0
- data/lib/admin_core/resource_field/date.rb +18 -0
- data/lib/admin_core/resource_field/date_time.rb +18 -0
- data/lib/admin_core/resource_field/enum.rb +26 -0
- data/lib/admin_core/resource_field/number.rb +18 -0
- data/lib/admin_core/resource_field/string.rb +18 -0
- data/lib/admin_core/resource_field/text.rb +23 -0
- data/lib/admin_core/resource_field_builder.rb +48 -0
- data/lib/admin_core/resource_filter/base.rb +63 -0
- data/lib/admin_core/resource_filter/boolean.rb +17 -0
- data/lib/admin_core/resource_filter/number.rb +25 -0
- data/lib/admin_core/resource_filter/string.rb +27 -0
- data/lib/admin_core/resource_filter_builder.rb +37 -0
- data/lib/admin_core/resource_manager/buildable.rb +42 -0
- data/lib/admin_core/resource_manager/convert.rb +95 -0
- data/lib/admin_core/resource_manager/has_many_fields.rb +71 -0
- data/lib/admin_core/resource_manager/permission.rb +35 -0
- data/lib/admin_core/resource_manager/searchable.rb +57 -0
- data/lib/admin_core/resource_page/base.rb +17 -0
- data/lib/admin_core/resource_page/edit.rb +22 -0
- data/lib/admin_core/resource_page/index.rb +52 -0
- data/lib/admin_core/resource_page/new.rb +26 -0
- data/lib/admin_core/resource_page/show.rb +22 -0
- data/lib/admin_core/resource_router.rb +58 -0
- data/lib/admin_core/resource_search.rb +22 -0
- data/lib/admin_core/rspec/matchers.rb +18 -0
- data/lib/admin_core/rspec/resource_field_spec_helper.rb +54 -0
- data/lib/admin_core/version.rb +11 -0
- data/lib/admin_core/view_object/sidebar_dropdown.rb +21 -0
- data/lib/admin_core/view_object/sidebar_link.rb +24 -0
- data/lib/admin_core/view_object/sidebar_resource_link.rb +23 -0
- data/lib/admin_core/view_object/sidebar_title.rb +18 -0
- data/lib/admin_core.rb +69 -0
- data/lib/generators/admin_core/install_generator.rb +39 -0
- data/lib/generators/admin_core/resource_manager_generator.rb +166 -0
- data/lib/generators/admin_core/templates/admin-core.css +1 -0
- data/lib/generators/admin_core/templates/admin-core.js +38196 -0
- data/lib/generators/admin_core/templates/controller.rb.erb +4 -0
- data/lib/generators/admin_core/templates/initializer.rb.erb +3 -0
- data/lib/generators/admin_core/templates/resource_manager.rb.erb +33 -0
- data/lib/generators/admin_core/templates/view.html.erb +58 -0
- data/sample/.gitignore +21 -0
- data/sample/Gemfile +35 -0
- data/sample/Gemfile.lock +147 -0
- data/sample/README.md +24 -0
- data/sample/Rakefile +6 -0
- data/sample/app/assets/config/manifest.js +2 -0
- data/sample/app/assets/images/.keep +0 -0
- data/sample/app/assets/stylesheets/application.css +15 -0
- data/sample/app/controllers/admin/application_controller.rb +4 -0
- data/sample/app/controllers/admin/tweets_controller.rb +4 -0
- data/sample/app/controllers/admin/users_controller.rb +4 -0
- data/sample/app/controllers/application_controller.rb +3 -0
- data/sample/app/controllers/concerns/.keep +0 -0
- data/sample/app/helpers/application_helper.rb +2 -0
- data/sample/app/jobs/application_job.rb +2 -0
- data/sample/app/models/admin/tweet.rb +35 -0
- data/sample/app/models/admin/user.rb +41 -0
- data/sample/app/models/application_record.rb +3 -0
- data/sample/app/models/concerns/.keep +0 -0
- data/sample/app/models/tweet.rb +3 -0
- data/sample/app/models/user.rb +3 -0
- data/sample/app/views/admin/application.html.erb +64 -0
- data/sample/app/views/layouts/application.html.erb +13 -0
- data/sample/bin/bundle +3 -0
- data/sample/bin/rails +4 -0
- data/sample/bin/rake +4 -0
- data/sample/bin/setup +34 -0
- data/sample/bin/update +29 -0
- data/sample/config/application.rb +25 -0
- data/sample/config/boot.rb +3 -0
- data/sample/config/database.yml +25 -0
- data/sample/config/environment.rb +5 -0
- data/sample/config/environments/development.rb +42 -0
- data/sample/config/environments/production.rb +69 -0
- data/sample/config/environments/test.rb +36 -0
- data/sample/config/initializers/admin_core.rb +8 -0
- data/sample/config/initializers/application_controller_renderer.rb +6 -0
- data/sample/config/initializers/backtrace_silencers.rb +7 -0
- data/sample/config/initializers/cookies_serializer.rb +5 -0
- data/sample/config/initializers/filter_parameter_logging.rb +4 -0
- data/sample/config/initializers/inflections.rb +16 -0
- data/sample/config/initializers/mime_types.rb +4 -0
- data/sample/config/initializers/new_framework_defaults.rb +24 -0
- data/sample/config/initializers/session_store.rb +3 -0
- data/sample/config/initializers/wrap_parameters.rb +14 -0
- data/sample/config/locales/en.yml +23 -0
- data/sample/config/routes.rb +6 -0
- data/sample/config/secrets.yml +22 -0
- data/sample/config.ru +5 -0
- data/sample/db/migrate/20170417055257_create_users.rb +10 -0
- data/sample/db/migrate/20170417055412_create_tweets.rb +9 -0
- data/sample/db/schema.rb +31 -0
- data/sample/db/seeds.rb +7 -0
- data/sample/lib/assets/.keep +0 -0
- data/sample/lib/tasks/.keep +0 -0
- data/sample/log/.keep +0 -0
- data/sample/public/404.html +67 -0
- data/sample/public/422.html +67 -0
- data/sample/public/500.html +66 -0
- data/sample/public/apple-touch-icon-precomposed.png +0 -0
- data/sample/public/apple-touch-icon.png +0 -0
- data/sample/public/bundle.min.js +27 -0
- data/sample/public/bundle.min.js.map +1 -0
- data/sample/public/favicon.ico +0 -0
- data/sample/public/javascripts/admin-core.js +38196 -0
- data/sample/public/robots.txt +5 -0
- data/sample/public/stylesheets/admin-core.css +1 -0
- data/sample/tmp/.keep +0 -0
- data/sample/vendor/assets/stylesheets/.keep +0 -0
- metadata +368 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module <%= configuration.module_name %>
|
|
2
|
+
class <%= class_name %> < AdminCore::BaseResourceManager
|
|
3
|
+
register_scopes []
|
|
4
|
+
|
|
5
|
+
<% attributes.each do |attribute| -%>
|
|
6
|
+
<%= attribute.define_field %>
|
|
7
|
+
<% end -%>
|
|
8
|
+
|
|
9
|
+
register_fields_for :index, [
|
|
10
|
+
<% attributes.select(&:field_implemented?).take(4).each do |attribute| -%>
|
|
11
|
+
<%= attribute.register_name %>
|
|
12
|
+
<% end -%>
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
register_fields_for :new, :edit, [
|
|
16
|
+
<% attributes.select(&:form?).each do |attribute| -%>
|
|
17
|
+
<%= attribute.register_name %>
|
|
18
|
+
<% end -%>
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
register_fields_for :show, [
|
|
22
|
+
<% attributes.each do |attribute| -%>
|
|
23
|
+
<%= attribute.register_name %>
|
|
24
|
+
<% end -%>
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
destroyable true
|
|
28
|
+
|
|
29
|
+
<% attributes.select(&:filter_implemented?).each do |attribute| -%>
|
|
30
|
+
<%= attribute.define_and_register_filter %>
|
|
31
|
+
<% end -%>
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
].flatten.to_json
|
|
42
|
+
%>
|
|
43
|
+
<%= javascript_include_tag 'admin-core' %>
|
|
44
|
+
<script>
|
|
45
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
46
|
+
var el = document.getElementById("root");
|
|
47
|
+
ReactDOM.render(
|
|
48
|
+
React.createElement(AdminCore, {
|
|
49
|
+
siteName: "AdminCore",
|
|
50
|
+
sidebar: JSON.parse(el.dataset.sidebar),
|
|
51
|
+
resourceManagers: JSON.parse(el.dataset.resourceManagers),
|
|
52
|
+
}),
|
|
53
|
+
el
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
</script>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
data/sample/.gitignore
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
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
|
data/sample/Gemfile
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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]
|
data/sample/Gemfile.lock
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
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
|
data/sample/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
* ...
|
data/sample/Rakefile
ADDED
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
*/
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
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>
|
data/sample/bin/bundle
ADDED
data/sample/bin/rails
ADDED
data/sample/bin/rake
ADDED
data/sample/bin/setup
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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
|
data/sample/bin/update
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
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
|