activeadmin_custom_layout 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +255 -0
- data/MIT-LICENSE +20 -0
- data/README.md +80 -0
- data/Rakefile +37 -0
- data/activeadmin_custom_layout.gemspec +35 -0
- data/app/assets/config/activeadmin_custom_layout_manifest.js +2 -0
- data/app/assets/images/activeadmin_custom_layout/.keep +0 -0
- data/app/assets/javascripts/activeadmin_custom_layout/application.js +13 -0
- data/app/assets/stylesheets/activeadmin_custom_layout/application.css +15 -0
- data/app/controllers/activeadmin_custom_layout/application_controller.rb +5 -0
- data/app/helpers/activeadmin_custom_layout/application_helper.rb +4 -0
- data/app/jobs/activeadmin_custom_layout/application_job.rb +4 -0
- data/app/mailers/activeadmin_custom_layout/application_mailer.rb +6 -0
- data/app/models/activeadmin_custom_layout/application_record.rb +5 -0
- data/app/views/layouts/activeadmin_custom_layout/application.html.erb +14 -0
- data/bin/.keep +0 -0
- data/config/routes.rb +2 -0
- data/lib/activeadmin_custom_layout.rb +7 -0
- data/lib/activeadmin_custom_layout/engine.rb +13 -0
- data/lib/activeadmin_custom_layout/helpers.rb +17 -0
- data/lib/activeadmin_custom_layout/layout/base.rb +89 -0
- data/lib/activeadmin_custom_layout/layout/header.rb +27 -0
- data/lib/activeadmin_custom_layout/layout/index.rb +43 -0
- data/lib/activeadmin_custom_layout/layout/title_bar.rb +35 -0
- data/lib/activeadmin_custom_layout/version.rb +3 -0
- data/lib/tasks/activeadmin_custom_layout_tasks.rake +4 -0
- data/test/activeadmin_custom_layout_test.rb +7 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/admin/admin_user.rb +28 -0
- data/test/dummy/app/admin/dashboard.rb +33 -0
- data/test/dummy/app/assets/config/manifest.js +5 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/active_admin.js.coffee +1 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/javascripts/cable.js +13 -0
- data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/active_admin.scss +17 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/admin_user.rb +6 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +38 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -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/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +15 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +54 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/initializers/active_admin.rb +272 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/devise.rb +274 -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/new_framework_defaults.rb +24 -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/devise.en.yml +62 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +5 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/migrate/20160919123758_devise_create_admin_users.rb +42 -0
- data/test/dummy/db/migrate/20160919123801_create_active_admin_comments.rb +19 -0
- data/test/dummy/db/schema.rb +46 -0
- data/test/dummy/db/seeds.rb +15 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -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/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/test/fixtures/admin_users.yml +11 -0
- data/test/dummy/test/models/admin_user_test.rb +7 -0
- data/test/integration/navigation_test.rb +8 -0
- data/test/test_helper.rb +20 -0
- metadata +390 -0
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -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
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Activeadmin custom layout</title>
|
5
|
+
<%= stylesheet_link_tag "activeadmin_custom_layout/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "activeadmin_custom_layout/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/bin/.keep
ADDED
File without changes
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "activeadmin_custom_layout/helpers"
|
2
|
+
|
3
|
+
# Export layout items as content_for elements
|
4
|
+
require "activeadmin_custom_layout/layout/base"
|
5
|
+
require "activeadmin_custom_layout/layout/header"
|
6
|
+
require "activeadmin_custom_layout/layout/index"
|
7
|
+
require "activeadmin_custom_layout/layout/title_bar"
|
8
|
+
|
9
|
+
module ActiveadminCustomLayout
|
10
|
+
class Engine < ::Rails::Engine
|
11
|
+
isolate_namespace ActiveadminCustomLayout
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ActiveAdmin
|
2
|
+
module ViewHelpers
|
3
|
+
module ActiveAdminApplicationHelper
|
4
|
+
|
5
|
+
def arbre_content_for( name, &block )
|
6
|
+
if block_given?
|
7
|
+
content_for name.to_sym do
|
8
|
+
Arbre::Context.new do
|
9
|
+
text_node yield
|
10
|
+
end.content
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module BasePatch
|
2
|
+
|
3
|
+
def add_classes_to_body
|
4
|
+
super
|
5
|
+
content_for :body_classes do
|
6
|
+
@body.class_names
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def build_active_admin_head
|
11
|
+
within @head do
|
12
|
+
arbre_content_for :title do
|
13
|
+
insert_tag Arbre::HTML::Title, [title, render_or_call_method_or_proc_on(self, active_admin_namespace.site_title)].compact.join(" | ")
|
14
|
+
end
|
15
|
+
|
16
|
+
active_admin_application.stylesheets.each do |style, options|
|
17
|
+
arbre_content_for :stylesheets do
|
18
|
+
text_node stylesheet_link_tag(style, options).html_safe
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
active_admin_application.javascripts.each do |path|
|
23
|
+
arbre_content_for :javascripts do
|
24
|
+
text_node(javascript_include_tag(path))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if active_admin_namespace.favicon
|
29
|
+
arbre_content_for :favicon do
|
30
|
+
text_node(favicon_link_tag(active_admin_namespace.favicon))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
active_admin_namespace.meta_tags.each do |name, content|
|
35
|
+
arbre_content_for :meta_tags do
|
36
|
+
text_node(tag(:meta, name: name, content: content))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
text_node csrf_meta_tag
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def build_unsupported_browser
|
45
|
+
arbre_content_for :unsupported_browser do
|
46
|
+
super
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_title_bar
|
51
|
+
arbre_content_for :title_bar do
|
52
|
+
super
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def build_flash_messages
|
57
|
+
arbre_content_for :flash_messages do
|
58
|
+
super
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_main_content_wrapper
|
63
|
+
arbre_content_for :main_content do
|
64
|
+
super
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def build_sidebar
|
69
|
+
arbre_content_for :sidebar do
|
70
|
+
super
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def build_footer
|
75
|
+
arbre_content_for :footer do
|
76
|
+
super
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
module ActiveAdmin
|
82
|
+
module Views
|
83
|
+
module Pages
|
84
|
+
class Base
|
85
|
+
prepend BasePatch
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HeaderPatch
|
2
|
+
def build_site_title
|
3
|
+
arbre_content_for :site_title do
|
4
|
+
super
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def build_global_navigation
|
9
|
+
arbre_content_for :global_navigation do
|
10
|
+
super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def build_utility_navigation
|
15
|
+
arbre_content_for :utility_navigation do
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module ActiveAdmin
|
22
|
+
module Views
|
23
|
+
class Header
|
24
|
+
prepend HeaderPatch
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module IndexPatch
|
2
|
+
|
3
|
+
def build_table_tools
|
4
|
+
arbre_content_for :index_table_tools do
|
5
|
+
super
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_batch_actions_selector
|
10
|
+
arbre_content_for :index_batch_actions do
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def build_scopes
|
16
|
+
arbre_content_for :index_scopes do
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_index_list
|
22
|
+
arbre_content_for :index_index_list do
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_collection
|
28
|
+
arbre_content_for :index_collection do
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
module ActiveAdmin
|
36
|
+
module Views
|
37
|
+
module Pages
|
38
|
+
class Index
|
39
|
+
prepend IndexPatch
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module TitleBarPatch
|
2
|
+
|
3
|
+
def build_titlebar_right
|
4
|
+
arbre_content_for :titlebar_right do
|
5
|
+
super
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def build_action_items
|
10
|
+
arbre_content_for :action_items do
|
11
|
+
super
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def build_breadcrumb(separator = "/")
|
16
|
+
arbre_content_for :breadcrumb do
|
17
|
+
super
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def build_title_tag
|
22
|
+
arbre_content_for :title_tag do
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
module ActiveAdmin
|
30
|
+
module Views
|
31
|
+
class TitleBar
|
32
|
+
prepend TitleBarPatch
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
ActiveAdmin.register AdminUser do
|
2
|
+
permit_params :email, :password, :password_confirmation
|
3
|
+
|
4
|
+
index do
|
5
|
+
selectable_column
|
6
|
+
id_column
|
7
|
+
column :email
|
8
|
+
column :current_sign_in_at
|
9
|
+
column :sign_in_count
|
10
|
+
column :created_at
|
11
|
+
actions
|
12
|
+
end
|
13
|
+
|
14
|
+
filter :email
|
15
|
+
filter :current_sign_in_at
|
16
|
+
filter :sign_in_count
|
17
|
+
filter :created_at
|
18
|
+
|
19
|
+
form do |f|
|
20
|
+
f.inputs "Admin Details" do
|
21
|
+
f.input :email
|
22
|
+
f.input :password
|
23
|
+
f.input :password_confirmation
|
24
|
+
end
|
25
|
+
f.actions
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
ActiveAdmin.register_page "Dashboard" do
|
2
|
+
|
3
|
+
menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
|
4
|
+
|
5
|
+
content title: proc{ I18n.t("active_admin.dashboard") } do
|
6
|
+
div class: "blank_slate_container", id: "dashboard_default_message" do
|
7
|
+
span class: "blank_slate" do
|
8
|
+
span I18n.t("active_admin.dashboard_welcome.welcome")
|
9
|
+
small I18n.t("active_admin.dashboard_welcome.call_to_action")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Here is an example of a simple dashboard with columns and panels.
|
14
|
+
#
|
15
|
+
# columns do
|
16
|
+
# column do
|
17
|
+
# panel "Recent Posts" do
|
18
|
+
# ul do
|
19
|
+
# Post.recent(5).map do |post|
|
20
|
+
# li link_to(post.title, admin_post_path(post))
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
|
26
|
+
# column do
|
27
|
+
# panel "Info" do
|
28
|
+
# para "Welcome to ActiveAdmin."
|
29
|
+
# end
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
end # content
|
33
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
#= require active_admin/base
|