express_admin 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +37 -0
- data/Rakefile +32 -0
- data/app/assets/fonts/app_express.eot +0 -0
- data/app/assets/fonts/app_express.svg +21 -0
- data/app/assets/fonts/app_express.ttf +0 -0
- data/app/assets/fonts/app_express.woff +0 -0
- data/app/assets/fonts/ionicons.eot +0 -0
- data/app/assets/fonts/ionicons.svg +1899 -0
- data/app/assets/fonts/ionicons.ttf +0 -0
- data/app/assets/fonts/ionicons.woff +0 -0
- data/app/assets/javascripts/express_admin/admin.js +30 -0
- data/app/assets/javascripts/express_admin/dataTables/dataTables.foundation.js +183 -0
- data/app/assets/javascripts/express_admin/dataTables/jquery.dataTables.js +14382 -0
- data/app/assets/javascripts/express_admin/utility.js +30 -0
- data/app/assets/javascripts/express_admin.js +7 -0
- data/app/assets/stylesheets/dataTables/dataTables.foundation.css.erb +217 -0
- data/app/assets/stylesheets/express_admin/components/_empty_state.sass +10 -0
- data/app/assets/stylesheets/express_admin/components/_megadropdown.sass +71 -0
- data/app/assets/stylesheets/express_admin/express_icons.sass +56 -0
- data/app/assets/stylesheets/express_admin/foundation_and_overrides.scss +1443 -0
- data/app/assets/stylesheets/express_admin/globals/_mixins.sass +9 -0
- data/app/assets/stylesheets/express_admin/globals/_typography.sass +30 -0
- data/app/assets/stylesheets/express_admin/globals/_variables.sass +16 -0
- data/app/assets/stylesheets/express_admin/plugins/_dataTables.sass +118 -0
- data/app/assets/stylesheets/express_admin/plugins/_select2.sass +91 -0
- data/app/assets/stylesheets/express_admin/screen.sass +47 -0
- data/app/assets/stylesheets/express_admin/sections/_devise.sass +42 -0
- data/app/assets/stylesheets/express_admin/sections/_header.sass +98 -0
- data/app/assets/stylesheets/express_admin/sections/_main_content.sass +63 -0
- data/app/assets/stylesheets/express_admin/sections/_sidebar.sass +42 -0
- data/app/assets/stylesheets/express_admin/shared/_alerts.sass +45 -0
- data/app/assets/stylesheets/express_admin/shared/_breadcrumbs.sass +3 -0
- data/app/assets/stylesheets/express_admin/shared/_buttons.sass +33 -0
- data/app/assets/stylesheets/express_admin/shared/_forms.sass +99 -0
- data/app/assets/stylesheets/express_admin/shared/_labels.sass +16 -0
- data/app/assets/stylesheets/express_admin/shared/_loading.sass +2 -0
- data/app/assets/stylesheets/express_admin/shared/_media_object.sass +23 -0
- data/app/assets/stylesheets/express_admin/shared/_messages.sass +12 -0
- data/app/assets/stylesheets/express_admin/shared/_navigation.sass +20 -0
- data/app/assets/stylesheets/express_admin/shared/_progress.sass +3 -0
- data/app/assets/stylesheets/express_admin/shared/_reveal.sass +20 -0
- data/app/assets/stylesheets/express_admin/shared/_tables.sass +75 -0
- data/app/assets/stylesheets/express_admin/shared/_tabs.sass +25 -0
- data/app/assets/stylesheets/express_admin/shared/_widgets.sass +57 -0
- data/app/assets/stylesheets/express_admin.css +9 -0
- data/app/assets/stylesheets/ionicons/ionicons.css.sass +1873 -0
- data/app/components/express_admin/addon_sidebar_component.rb +47 -0
- data/app/components/express_admin/flash_message_component.rb +19 -0
- data/app/components/express_admin/main_region.rb +9 -0
- data/app/components/express_admin/mega_menu_component.rb +68 -0
- data/app/components/express_admin/page_header_component.rb +39 -0
- data/app/components/express_admin/setting_form.rb +45 -0
- data/app/components/express_admin/sidebar_region.rb +11 -0
- data/app/components/express_admin/smart_form.rb +70 -0
- data/app/components/express_admin/smart_table.rb +97 -0
- data/app/components/express_admin/widget_box.rb +22 -0
- data/app/helpers/express_admin/admin_helper.rb +104 -0
- data/app/helpers/express_admin/module_settings_helper.rb +53 -0
- data/app/views/express_admin/dashboard/show.html.et +6 -0
- data/app/views/layouts/express_admin/admin.html.et +31 -0
- data/app/views/layouts/express_admin/external.html.et +15 -0
- data/app/views/shared/express_admin/_messages.html.et +1 -0
- data/app/views/shared/express_admin/_navigation_bar.html.et +20 -0
- data/app/views/shared/express_admin/_navigation_bar_profile.html.et +8 -0
- data/app/views/shared/express_admin/_title.html.et +8 -0
- data/config/initializers/gravatar_image_tag.rb +4 -0
- data/lib/express_admin/engine.rb +52 -0
- data/lib/express_admin/menu.rb +62 -0
- data/lib/express_admin/version.rb +3 -0
- data/lib/express_admin.rb +4 -0
- data/lib/generators/express_admin/install/USAGE +23 -0
- data/lib/generators/express_admin/install/install_generator.rb +97 -0
- data/lib/generators/express_admin/install/templates/assets/javascripts/application.js +1 -0
- data/lib/generators/express_admin/install/templates/assets/stylesheets/application.css +5 -0
- data/lib/generators/express_admin/install/templates/config/menu.yml.erb +3 -0
- data/lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb +34 -0
- data/lib/generators/express_admin/install/templates/install/USAGE +8 -0
- data/lib/generators/express_admin/install/templates/install/installer.rb.erb +10 -0
- data/lib/generators/express_admin/install/templates/install/installer_test.rb.erb +16 -0
- data/lib/generators/express_admin/install/templates/views/layouts/admin.html.et +1 -0
- data/lib/generators/express_admin/scaffold/scaffold_generator.rb +135 -0
- data/lib/generators/express_admin/scaffold/templates/controller/controller.rb +14 -0
- data/lib/generators/express_admin/scaffold/templates/index.html.et.erb +10 -0
- data/lib/generators/express_admin/scaffold/templates/model/model.rb +4 -0
- data/lib/generators/express_admin/scaffold/templates/show.html.et.erb +10 -0
- data/lib/tasks/express_admin_tasks.rake +4 -0
- data/test/bin/run +1 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/demo.js +2 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/assets/stylesheets/demo.css.scss +3 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/controllers/demo_controller.rb +8 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/helpers/demo_helper.rb +2 -0
- data/test/dummy/app/views/demo/show.html.et +2 -0
- data/test/dummy/app/views/demo/sign_in.html.et +30 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +43 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +7 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/schema.rb +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +3847 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/controllers/demo_controller_test.rb +9 -0
- data/test/dummy/test/helpers/demo_helper_test.rb +4 -0
- data/test/fixtures/engine.rb +5 -0
- data/test/fixtures/express_admin/test_menu.yml +12 -0
- data/test/fixtures/routes.rb +2 -0
- data/test/generators_test_helper.rb +32 -0
- data/test/lib/express_admin/menu_test.rb +18 -0
- data/test/lib/generators/express_admin/install_generator_test.rb +72 -0
- data/test/lib/generators/express_admin/scaffold_generator_test.rb +67 -0
- data/test/test_helper.rb +18 -0
- data/vendor/assets/images/dataTables/Sorting icons.psd +0 -0
- data/vendor/assets/images/dataTables/back_disabled.png +0 -0
- data/vendor/assets/images/dataTables/back_enabled.png +0 -0
- data/vendor/assets/images/dataTables/back_enabled_hover.png +0 -0
- data/vendor/assets/images/dataTables/favicon.ico +0 -0
- data/vendor/assets/images/dataTables/forward_disabled.png +0 -0
- data/vendor/assets/images/dataTables/forward_enabled.png +0 -0
- data/vendor/assets/images/dataTables/forward_enabled_hover.png +0 -0
- data/vendor/assets/images/dataTables/sort_asc.png +0 -0
- data/vendor/assets/images/dataTables/sort_asc_disabled.png +0 -0
- data/vendor/assets/images/dataTables/sort_both.png +0 -0
- data/vendor/assets/images/dataTables/sort_desc.png +0 -0
- data/vendor/assets/images/dataTables/sort_desc_disabled.png +0 -0
- data/vendor/assets/javascripts/jquery.loadingdotdotdot.js +82 -0
- metadata +432 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/404.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/422.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
63
|
+
</div>
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
65
|
+
</div>
|
66
|
+
</body>
|
67
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Rails
|
2
|
+
class << self
|
3
|
+
remove_possible_method :root
|
4
|
+
def root
|
5
|
+
@root ||= Pathname.new(File.expand_path('tmp'))
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module GeneratorsTestHelper
|
11
|
+
def self.included(base)
|
12
|
+
base.class_eval do
|
13
|
+
destination Rails.root
|
14
|
+
setup :prepare_destination
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def copy_routes
|
19
|
+
routes = File.expand_path('test/fixtures/routes.rb')
|
20
|
+
destination = File.join(destination_root, 'config')
|
21
|
+
FileUtils.mkdir_p(destination)
|
22
|
+
FileUtils.cp File.expand_path(routes), File.expand_path(destination)
|
23
|
+
end
|
24
|
+
|
25
|
+
def copy_engine
|
26
|
+
engine = File.expand_path('test/fixtures/engine.rb')
|
27
|
+
destination = File.join(destination_root, 'lib/tmp')
|
28
|
+
FileUtils.mkdir_p(destination)
|
29
|
+
FileUtils.cp File.expand_path(engine), File.expand_path(destination)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module ExpressAdmin
|
4
|
+
|
5
|
+
class MenuTest < ActiveSupport::TestCase
|
6
|
+
# test "Menu.[] accepts module name and returns the module's menu" do
|
7
|
+
# menu = ExpressAdmin::Menu['express_admin']
|
8
|
+
# assert_equal 'Dashboard', menu.title
|
9
|
+
# end
|
10
|
+
|
11
|
+
test "Menu.from() accepts path and returns a menu from the yaml" do
|
12
|
+
menu = ExpressAdmin::Menu.from 'test/fixtures/express_admin/test_menu.yml'
|
13
|
+
assert_equal 'Big Menu', menu.title
|
14
|
+
assert_equal 3, menu.items.size
|
15
|
+
assert_equal 'express_admin.baz_path', menu.items.last.path
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/express_admin/install/install_generator'
|
3
|
+
require 'generators_test_helper'
|
4
|
+
|
5
|
+
class ExpressAdmin::Generators::InstallGeneratorTest < Rails::Generators::TestCase
|
6
|
+
include GeneratorsTestHelper
|
7
|
+
tests ExpressAdmin::Generators::InstallGenerator
|
8
|
+
setup :copy_engine
|
9
|
+
|
10
|
+
def test_install_on_invoke
|
11
|
+
run_generator
|
12
|
+
|
13
|
+
assert_file 'app/controllers/tmp/admin/admin_controller.rb' do |content|
|
14
|
+
assert_match /module Tmp/, content
|
15
|
+
assert_match /class AdminController < ApplicationController/, content
|
16
|
+
assert_match /before_filter :authenticate_user! if defined\?\(Devise\)/, content
|
17
|
+
assert_match /layout "tmp\/admin"/, content
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_file 'app/views/layouts/tmp/admin.html.et' do |content|
|
21
|
+
assert_match /render\(template: 'layouts\/express_admin\/admin'\)/, content
|
22
|
+
end
|
23
|
+
|
24
|
+
assert_file 'lib/generators/tmp/install/install_generator.rb'
|
25
|
+
assert_file 'lib/generators/tmp/install/USAGE'
|
26
|
+
assert_directory 'lib/generators/tmp/install/templates'
|
27
|
+
assert_file 'test/lib/generators/tmp/install/install_generator_test.rb'
|
28
|
+
|
29
|
+
assert_file 'app/assets/javascripts/tmp/admin/application.js' do |content|
|
30
|
+
assert_match /\/\/= require_tree \./, content
|
31
|
+
end
|
32
|
+
|
33
|
+
assert_file 'app/assets/stylesheets/tmp/admin/application.css' do |content|
|
34
|
+
assert_match /\*= require express_admin/, content
|
35
|
+
end
|
36
|
+
|
37
|
+
assert_file 'config/menu.yml'
|
38
|
+
|
39
|
+
assert_file 'lib/tmp/engine.rb' do |content|
|
40
|
+
assert_match /require \'express_admin\'/, content
|
41
|
+
assert_match /Tmp::Engine.config.tmp_mount_point = \'\/\'/, content
|
42
|
+
assert_match /include ::ExpressAdmin::Menu::Loader/, content
|
43
|
+
|
44
|
+
assert_match "initializer :assets do |config|", content
|
45
|
+
assert_match "engine_assets_path = File.join(File.dirname(__FILE__), '..', '..', 'app', 'assets')", content
|
46
|
+
assert_match "all_assets = Dir.glob File.join(engine_assets_path, 'stylesheets', '**', '*.css*')", content
|
47
|
+
assert_match "all_assets += Dir.glob File.join(engine_assets_path, 'javascripts', '**', '*.js*')", content
|
48
|
+
assert_match 'all_assets.each {|path| path.gsub!("#{engine_assets_path}/stylesheets/", \'\')}', content
|
49
|
+
assert_match 'all_assets.each {|path| path.gsub!("#{engine_assets_path}/javascripts/", \'\')}', content
|
50
|
+
assert_match "Rails.application.config.assets.precompile += all_assets", content
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_install_on_revoke
|
55
|
+
run_generator [], behavior: :revoke
|
56
|
+
|
57
|
+
assert_no_file 'app/controllers/tmp/admin_controller.rb'
|
58
|
+
|
59
|
+
assert_no_file 'app/views/layouts/tmp/admin.html.et'
|
60
|
+
|
61
|
+
assert_no_file 'lib/generators/tmp/install/install_generator.rb'
|
62
|
+
assert_no_file 'lib/generators/tmp/install/USAGE'
|
63
|
+
assert_no_directory 'lib/generators/tmp/install/templates'
|
64
|
+
assert_no_file 'test/lib/generators/tmp/install/install_generator_test.rb'
|
65
|
+
|
66
|
+
assert_no_file 'app/assets/javascripts/tmp/admin/application.js'
|
67
|
+
|
68
|
+
assert_no_file 'app/assets/stylesheets/tmp/admin/application.css'
|
69
|
+
|
70
|
+
assert_no_file 'config/menu.yml'
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'generators/express_admin/scaffold/scaffold_generator'
|
3
|
+
require 'generators_test_helper'
|
4
|
+
|
5
|
+
class ExpressAdmin::Generators::ScaffoldGeneratorTest < Rails::Generators::TestCase
|
6
|
+
include GeneratorsTestHelper
|
7
|
+
setup :copy_routes
|
8
|
+
|
9
|
+
tests ExpressAdmin::Generators::ScaffoldGenerator
|
10
|
+
arguments %w(agent first_name:string last_name:string age:integer address:integer)
|
11
|
+
|
12
|
+
def test_scaffold_on_invoke
|
13
|
+
run_generator
|
14
|
+
|
15
|
+
assert_file "app/models/agent.rb", /^class Agent < ActiveRecord::Base/
|
16
|
+
|
17
|
+
# TODO:
|
18
|
+
assert_migration "db/migrate/create_agents.rb"
|
19
|
+
|
20
|
+
# View
|
21
|
+
assert_file "app/views/admin/agents/index.html.et"
|
22
|
+
|
23
|
+
# Controller
|
24
|
+
assert_file "app/controllers/admin/agents_controller.rb" do |content|
|
25
|
+
assert_match(/module Admin/, content)
|
26
|
+
assert_match(/class AgentsController < AdminController/, content)
|
27
|
+
|
28
|
+
assert_match(/defaults resource_class: Agent/, content)
|
29
|
+
assert_match(/def agent_params()/, content)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Routes
|
33
|
+
assert_file "config/routes.rb" do |content|
|
34
|
+
assert_match(/Dummy::Engine.routes.draw/, content)
|
35
|
+
assert_match(/namespace :admin do/, content)
|
36
|
+
assert_match(/resources :agents/, content)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_scaffold_on_revoke
|
41
|
+
run_generator ["Agent"], behavior: :revoke
|
42
|
+
|
43
|
+
# Model
|
44
|
+
assert_no_file "app/models/dummy/agent.rb"
|
45
|
+
|
46
|
+
# View
|
47
|
+
assert_no_file "app/views/dummy/admin/agents/index.html.et"
|
48
|
+
|
49
|
+
# Controller
|
50
|
+
assert_no_file "app/controllers/dummy/admin/agents_controller.rb"
|
51
|
+
|
52
|
+
# Route
|
53
|
+
assert_file "config/routes.rb" do |route|
|
54
|
+
assert_no_match(/resources :agents/, route)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_scaffold_twice
|
59
|
+
run_generator ["blog", "title: string"]
|
60
|
+
run_generator ["picture", "url: string"]
|
61
|
+
|
62
|
+
assert_file "config/routes.rb" do |content|
|
63
|
+
assert_match(/resources :blogs/, content)
|
64
|
+
assert_match(/resources :pictures/, content)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
require "minitest/rails/capybara"
|
7
|
+
|
8
|
+
Rails.backtrace_cleaner.remove_silencers!
|
9
|
+
|
10
|
+
# Load support files
|
11
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
+
|
13
|
+
# Load fixtures from the engine
|
14
|
+
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
15
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
16
|
+
end
|
17
|
+
|
18
|
+
Rails.application.load_generators
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,82 @@
|
|
1
|
+
(function($) {
|
2
|
+
|
3
|
+
$.Loadingdotdotdot = function(el, options) {
|
4
|
+
|
5
|
+
var base = this;
|
6
|
+
|
7
|
+
base.$el = $(el);
|
8
|
+
|
9
|
+
base.$el.data("Loadingdotdotdot", base);
|
10
|
+
|
11
|
+
base.dotItUp = function($element, maxDots, dots) {
|
12
|
+
if (dots == maxDots) {
|
13
|
+
$element.find("span").addClass('dot')
|
14
|
+
}
|
15
|
+
else {
|
16
|
+
for (i = 0; i < dots + 1; i++) {
|
17
|
+
$($element.find("span")[i]).removeClass('dot')
|
18
|
+
}
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
base.stopInterval = function() {
|
23
|
+
clearInterval(base.theInterval);
|
24
|
+
};
|
25
|
+
|
26
|
+
base.init = function() {
|
27
|
+
|
28
|
+
if ( typeof( speed ) === "undefined" || speed === null ) speed = 300;
|
29
|
+
if ( typeof( maxDots ) === "undefined" || maxDots === null ) maxDots = 3;
|
30
|
+
|
31
|
+
base.speed = speed;
|
32
|
+
base.maxDots = maxDots - 1;
|
33
|
+
|
34
|
+
base.options = $.extend({},$.Loadingdotdotdot.defaultOptions, options);
|
35
|
+
|
36
|
+
base.dotsSpan = "";
|
37
|
+
dots = 0;
|
38
|
+
|
39
|
+
for(i = 0; i < base.maxDots; i++)
|
40
|
+
{
|
41
|
+
base.dotsSpan += "<span class='dot'>.</span>"
|
42
|
+
}
|
43
|
+
|
44
|
+
base.$el.html("<span>" + base.options.word + "<em>." + base.dotsSpan + "</em></span>");
|
45
|
+
|
46
|
+
base.$dots = base.$el.find("em");
|
47
|
+
base.$loadingText = base.$el.find("span");
|
48
|
+
|
49
|
+
|
50
|
+
base.theInterval = setInterval(function() {
|
51
|
+
dots = ++dots % (base.maxDots + 1);
|
52
|
+
base.dotItUp(base.$dots, base.maxDots, dots);
|
53
|
+
}, base.options.speed);
|
54
|
+
|
55
|
+
};
|
56
|
+
|
57
|
+
base.init();
|
58
|
+
|
59
|
+
};
|
60
|
+
|
61
|
+
$.Loadingdotdotdot.defaultOptions = {
|
62
|
+
speed: 300,
|
63
|
+
maxDots: 3,
|
64
|
+
word: "Loading"
|
65
|
+
};
|
66
|
+
|
67
|
+
$.fn.Loadingdotdotdot = function(options) {
|
68
|
+
|
69
|
+
if (typeof(options) == "string") {
|
70
|
+
var safeGuard = $(this).data('Loadingdotdotdot');
|
71
|
+
if (safeGuard) {
|
72
|
+
safeGuard.stopInterval();
|
73
|
+
}
|
74
|
+
} else {
|
75
|
+
return this.each(function(){
|
76
|
+
(new $.Loadingdotdotdot(this, options));
|
77
|
+
});
|
78
|
+
}
|
79
|
+
|
80
|
+
};
|
81
|
+
|
82
|
+
})(jQuery);
|