rails_modular_admin 0.4.0 → 1.0.0

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 (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -1
  3. data/Rakefile +3 -2
  4. data/app/assets/javascripts/rails_modular_admin.js +3 -0
  5. data/app/assets/stylesheets/custom-theme.scss +14 -0
  6. data/app/assets/stylesheets/rails_modular_admin.scss +1 -0
  7. data/app/assets/stylesheets/rails_modular_admin/_main.scss +1 -1
  8. data/app/helpers/rails_modular_admin_helpers.rb +5 -0
  9. data/app/views/layouts/partials/_footer.html.erb +8 -0
  10. data/lib/generators/rails_modular_admin/{USAGE → install/USAGE} +0 -0
  11. data/lib/generators/rails_modular_admin/install/install_generator.rb +19 -0
  12. data/lib/generators/rails_modular_admin/install/templates/auth.html.erb +35 -0
  13. data/lib/generators/rails_modular_admin/install/templates/custom-theme.scss +14 -0
  14. data/lib/generators/rails_modular_admin/install/templates/dashboard.html.erb +117 -0
  15. data/lib/generators/rails_modular_admin/install/templates/devise/confirmations/new.html.erb +16 -0
  16. data/lib/generators/rails_modular_admin/install/templates/devise/passwords/edit.html.erb +25 -0
  17. data/lib/generators/rails_modular_admin/install/templates/devise/passwords/new.html.erb +39 -0
  18. data/lib/generators/rails_modular_admin/install/templates/devise/registrations/edit.html.erb +43 -0
  19. data/lib/generators/rails_modular_admin/install/templates/devise/registrations/new.html.erb +29 -0
  20. data/lib/generators/rails_modular_admin/install/templates/devise/sessions/new.html.erb +73 -0
  21. data/lib/generators/rails_modular_admin/install/templates/devise/shared/_links.html.erb +25 -0
  22. data/lib/generators/rails_modular_admin/install/templates/devise/unlocks/new.html.erb +16 -0
  23. data/lib/generators/rails_modular_admin/install/templates/login.html.erb +85 -0
  24. data/lib/generators/rails_modular_admin/install/templates/partials/_footer.html.erb +8 -0
  25. data/lib/generators/rails_modular_admin/install/templates/recover.html.erb +77 -0
  26. data/lib/generators/rails_modular_admin/{templates/signup.html.erb → install/templates/register.html.erb} +0 -0
  27. data/lib/generators/rails_modular_admin/install_generator.rb +15 -8
  28. data/lib/generators/rails_modular_admin/templates/{application.html.erb → auth.html.erb} +35 -27
  29. data/lib/generators/rails_modular_admin/templates/dashboard.html.erb +99 -1432
  30. data/lib/generators/rails_modular_admin/templates/login.html.erb +1 -1
  31. data/lib/generators/rails_modular_admin/templates/partials/_footer.html.erb +8 -0
  32. data/lib/generators/rails_modular_admin/templates/recover.html.erb +1 -1
  33. data/lib/generators/rails_modular_admin/templates/register.html.erb +101 -0
  34. data/lib/generators/rails_modular_admin/views_generator.rb +21 -9
  35. data/lib/rails_modular_admin.rb +2 -1
  36. data/lib/rails_modular_admin/engine.rb +7 -4
  37. data/lib/rails_modular_admin/version.rb +1 -1
  38. metadata +40 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae03e4ade31d50a9bfb76da2a23d14cdb1f0999b
4
- data.tar.gz: cb1f5c163295f6065ec7e9a007b76a4036287f75
3
+ metadata.gz: f8619090a58e54a9c4ad4109a0a81ad698d92ee4
4
+ data.tar.gz: f0023bf0bde9f2aec191338a66af9f9f3273e149
5
5
  SHA512:
6
- metadata.gz: 2d5db9f92827e6f06528e8aabcff652c47c72c79eba93bfff0381171c6bfd572bb09da7c8256f93e062bbc41203e7fbaa0d64b1384da04f7c70cadfbfe29781b
7
- data.tar.gz: 311f4ddbed10afce11886d04f8e65cc2a88322172e7d31a52f7b7306b927142e7e62bea73bddb9a1159944584fad388816b54188b41e0b5ef02fca49529e4655
6
+ metadata.gz: db359d62b3407d1bac2e244dae14340cc2ea2981f2e059fd394a7debb74376571319236c5448ebe53f4eff2fa7ca6f091eb11f89873d3fe56fd6e8c6e95974e9
7
+ data.tar.gz: 20e4bbaeac874e06806d57235d25d6a0510a6d16aaca685b27ffc8929c4496a8140b6bfb97fbe63df22e20da18585f23cc308db58fcafc6296e5c6c9c03e95be
data/README.md CHANGED
@@ -29,12 +29,19 @@ The install generator copies over the custom theme.scss file, which you can use
29
29
  @import "custom-theme";
30
30
  @import "rails_modular_admin";
31
31
  ```
32
-
32
+ Add bootstrap, popper, and jquery to application.js and import bootstrap
33
33
  Change the variables in custom-theme.scss to change the colors in your application. Finally, add this line to your application.html.erb at the bottom (after the </body> tag and before the </html> tag). Do not add the rails_modular_admin javascripts to your application.js, because it needs to be loaded after the rest of the page for the reference block.
34
34
  ```ruby
35
35
  <%= javascript_include_tag 'rails_modular_admin' %>
36
36
  ```
37
37
 
38
+ ## Installing the Views
39
+ Rails Modular Admin includes a generator to install the commonly needed views for an administration application. To copy over the templates, run:
40
+ ```bash
41
+ rails g rails_modular_admin:<user_model>:views
42
+ ```
43
+ where <user_model> is the name of the model for which you want to install the authentication views, which is typicall just User.
44
+
38
45
  ## Development Environment
39
46
  1. Prior to packaging as a gem, make sure that yarn install has been run and that it is bundled with the gem. Otherwise, there wil be file not found errors.
40
47
 
data/Rakefile CHANGED
@@ -21,13 +21,14 @@ load 'rails/tasks/statistics.rake'
21
21
 
22
22
  load 'lib/tasks/rails_modular_admin_tasks.rake'
23
23
 
24
+
24
25
  require 'bundler/gem_tasks'
25
26
 
26
27
  require 'rake/testtask'
27
28
 
28
29
  Rake::TestTask.new(:test) do |t|
29
- t.libs << 'test'
30
- t.pattern = 'test/**/*_test.rb'
30
+ t.libs << 'spec'
31
+ t.pattern = 'spec/**/*_test.rb'
31
32
  t.verbose = false
32
33
  end
33
34
 
@@ -1,3 +1,6 @@
1
+ //= require jquery3
2
+ //= require popper
3
+ //= require bootstrap-sprockets
1
4
  //= require rails_modular_admin/vendor
2
5
  //= require rails_modular_admin/app
3
6
 
@@ -0,0 +1,14 @@
1
+ /*
2
+ * This is the file to modify for your custom theme colors. If you choose not to use one of the following options, simply comment it out or remove it.
3
+ */
4
+ $color-primary: #FF6161;
5
+
6
+ $link-color: #969696;
7
+ $link-transition: initial;
8
+ $link-decoration: underline;
9
+
10
+ $link-hover-color: #E45252;
11
+ $link-hover-decoration: underline;
12
+
13
+ $chart-color-primary: #FF8585;
14
+ $chart-color-secondary: #ccc;
@@ -1,2 +1,3 @@
1
+ @import "bootstrap";
1
2
  @import "font-awesome";
2
3
  @import "rails_modular_admin/application";
@@ -1,4 +1,4 @@
1
- @import url(http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,800,700,600);
1
+ @import url(https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,800,700,600);
2
2
 
3
3
  @import 'variables';
4
4
  @import 'bootstrap/scss/functions';
@@ -0,0 +1,5 @@
1
+ module RailsModularAdminHelpers
2
+ def active_class(link_path)
3
+ current_page?(link_path) ? "active" : ""
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ <footer class="footer">
2
+ <div class="footer-block buttons"></div>
3
+ <div class="footer-block author">
4
+ <ul>
5
+ <li>Copyright &copy; <%= Date.today.year %> <a href="https://example.com", target="_blank">Example Company</a></li>
6
+ </ul>
7
+ </div>
8
+ </footer>
@@ -0,0 +1,19 @@
1
+ require 'rails/generators/base'
2
+ module RailsModularAdmin
3
+ module Generators
4
+
5
+ class InstallGenerator < Rails::Generators::Base
6
+ desc "This install generator copies over the custom-theme.scss file for you to modify to create your custom theme."
7
+ source_root File.expand_path('templates', __dir__)
8
+
9
+ def copy_custom_theme_file
10
+ copy_file "custom-theme.scss", "app/assets/stylesheets/custom-theme.scss"
11
+ end
12
+ def copy_dashboard_layout
13
+ copy_file "dashboard.html.erb", "app/views/layouts/dashboard.html.erb"
14
+ copy_file "partials/_footer.html.erb", "app/views/layouts/partials/_footer.html.erb"
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,35 @@
1
+ <!DOCTYPE html>
2
+ <html class="no-js" lang="en">
3
+ <head>
4
+ <title>ModularAdmin - Free Dashboard Theme | HTML Version</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
+
9
+
10
+ </head>
11
+ <body >
12
+ <div class="authbody"></div>
13
+ <div class="auth">
14
+ <div class="auth-container">
15
+ <div class="card">
16
+ <header class="auth-header">
17
+ <h1 class="auth-title">
18
+
19
+ </h1>
20
+ </header>
21
+ <%= yield %>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ <!-- Reference block for JS -->
26
+ <div class="ref" id="ref">
27
+ <div class="color-primary"></div>
28
+ <div class="chart">
29
+ <div class="color-primary"></div>
30
+ <div class="color-secondary"></div>
31
+ </div>
32
+ </div>
33
+ <%= javascript_include_tag 'rails_modular_admin' %>
34
+ </body>
35
+ </html>
@@ -0,0 +1,14 @@
1
+ /*
2
+ * This is the file to modify for your custom theme colors. If you choose not to use one of the following options, simply comment it out or remove it.
3
+ */
4
+ $color-primary: #FF6161;
5
+
6
+ $link-color: #969696;
7
+ $link-transition: initial;
8
+ $link-decoration: underline;
9
+
10
+ $link-hover-color: #E45252;
11
+ $link-hover-decoration: underline;
12
+
13
+ $chart-color-primary: #FF8585;
14
+ $chart-color-secondary: #ccc;
@@ -0,0 +1,117 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="en">
3
+ <head>
4
+ <title> Rails Modular Admin </title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ </head>
10
+ <body>
11
+ <!-- Wrappers for main content -->
12
+ <div class="main-wrapper">
13
+ <div class="app" id="app">
14
+
15
+ <!-- BEGIN dashboard header -->
16
+ <header class="header">
17
+ <div class="header-block header-block-collapse d-lg-none d-xl-none">
18
+ <button class="collapse-btn" id="sidebar-collapse-btn"><i class="fa fa-bars"></i></button>
19
+ </div>
20
+ <div class="header-block header-block-search"></div>
21
+ <div class="header-block header-block-nav">
22
+ <ul class="nav-profile">
23
+ <li class="notifications new">
24
+ <a href="" data-toggle="dropdown"><i class="fa fa-bell-o"></i>
25
+ <sup><span class="counter"></span></sup>
26
+ </a>
27
+ <div class="dropdown-menu notifications-dropdown-menu">
28
+ <ul class="notifications-container">
29
+ <% if alert %>
30
+ <li>
31
+ <a href="" class="notification-item">
32
+ <div class="img-col">
33
+ <div class="img" style=""></div>
34
+ </div>
35
+ <div class="body-col">
36
+ <p><span class="accent">Alert: </span> <%= alert %></p>
37
+ </div>
38
+ </a>
39
+ </li>
40
+ <% end %>
41
+ <% if notice %>
42
+ <li>
43
+ <a href="" class="notification-item">
44
+ <div class="img-col"><div class="img" style=""></div></div>
45
+ <div class="body-col">
46
+ <p><span class="accent">Notice: </span> <%= notice %></p>
47
+ </div>
48
+ </a>
49
+ </li>
50
+ <% end %>
51
+ </ul>
52
+ <!-- <footer><ul><li><a href=""> View All </a></li></ul></footer> -->
53
+ </div>
54
+ </li>
55
+ <!-- End Alert/Notification element on top bar -->
56
+
57
+ <li class="profile dropdown">
58
+ <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
59
+ <span class="name"> </span>
60
+ </a>
61
+ <div class="dropdown-menu profile-dropdown-menu" aria-labelledby="dropdownMenu1">
62
+
63
+ <a class="dropdown-item" href="#"><i class="fa fa-user icon"></i> Profile </a>
64
+ <a class="dropdown-item" href="#"><i class="fa fa-bell icon"></i> Notifications </a>
65
+ <a class="dropdown-item" href="#"><i class="fa fa-gear icon"></i> Settings </a>
66
+ <div class="dropdown-divider"></div>
67
+ <%= link_to '<i class="fa fa-power-off icon"></i> Log Out'.html_safe, destroy_user_session_path, class: "dropdown-item", :method => :delete %>
68
+ </div>
69
+ </li>
70
+ </ul>
71
+ </div>
72
+ </header>
73
+ <!-- End dashboard header -->
74
+
75
+ <!-- BEGIN side navigation -->
76
+ <aside class="sidebar">
77
+ <div class="sidebar-container">
78
+ <div class="sidebar-header">
79
+ <div class="brand">
80
+ <div class="logo">
81
+ <span class="l l1"></span>
82
+ <span class="l l2"></span>
83
+ <span class="l l3"></span>
84
+ <span class="l l4"></span>
85
+ <span class="l l5"></span>
86
+ </div> Modular Admin </div>
87
+ </div>
88
+ <nav class="menu">
89
+ <ul class="sidebar-menu metismenu" id="sidebar-menu">
90
+ <li class=<%= active_class(root_path) %>> <%= link_to "<i class=\"fa fa-home\"></i> Dashboard".html_safe, root_path %></li>
91
+
92
+ </ul>
93
+ </nav>
94
+ </div>
95
+ </aside>
96
+ <div class="sidebar-overlay" id="sidebar-overlay"></div>
97
+ <div class="sidebar-mobile-menu-handle" id="sidebar-mobile-menu-handle"></div>
98
+ <div class="mobile-menu-handle"></div>
99
+ <!-- End side navigation -->
100
+
101
+ <%= yield %>
102
+ <%= render partial: "layouts/partials/footer" %>
103
+
104
+ <!-- Reference block for JS -->
105
+ <div class="ref" id="ref">
106
+ <div class="color-primary"></div>
107
+ <div class="chart">
108
+ <div class="color-primary"></div>
109
+ <div class="color-secondary"></div>
110
+ </div>
111
+ </div>
112
+
113
+ </div><!-- ./app -->
114
+ </div><!-- ./main-wrapper -->
115
+ <%= javascript_include_tag 'rails_modular_admin' %>
116
+ </body>
117
+ </html>
@@ -0,0 +1,16 @@
1
+ <h2>Resend confirmation instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend confirmation instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,25 @@
1
+ <h2>Change your password</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+ <%= f.hidden_field :reset_password_token %>
6
+
7
+ <div class="field">
8
+ <%= f.label :password, "New password" %><br />
9
+ <% if @minimum_password_length %>
10
+ <em>(<%= @minimum_password_length %> characters minimum)</em><br />
11
+ <% end %>
12
+ <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
13
+ </div>
14
+
15
+ <div class="field">
16
+ <%= f.label :password_confirmation, "Confirm new password" %><br />
17
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
18
+ </div>
19
+
20
+ <div class="actions">
21
+ <%= f.submit "Change my password" %>
22
+ </div>
23
+ <% end %>
24
+
25
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,39 @@
1
+ <div class="auth">
2
+ <div class="auth-container">
3
+ <div class="card">
4
+ <header class="auth-header">
5
+ <h1 class="auth-title">
6
+ <div class="logo">
7
+ <span class="l l1"></span>
8
+ <span class="l l2"></span>
9
+ <span class="l l3"></span>
10
+ <span class="l l4"></span>
11
+ <span class="l l5"></span>
12
+ </div> ModularAdmin </h1>
13
+ </header>
14
+ <div class="auth-content">
15
+ <p class="text-center">RECOVER PASSWORD</p>
16
+ <p class="text-muted text-center">
17
+ <small>Enter your email address to recover your password.</small>
18
+ </p>
19
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }, id: "reset-form") do |f| %>
20
+ <%= devise_error_messages! %>
21
+ <div class="form-group">
22
+ <label for="email1">Email</label>
23
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", id: "email1", class: "form-control underlined", placeholder: "Your email address", required: true %>
24
+ </div>
25
+ <div class="form-group">
26
+ <%= f.submit "Reset", class: "btn btn-block btn-primary" %>
27
+ </div>
28
+ <div class="form-group clearfix">
29
+ <%= render "devise/shared/links" %>
30
+ <a class="pull-left" href="login.html">return to Login</a>
31
+ <a class="pull-right" href="signup.html">Sign Up!</a>
32
+ </div>
33
+ <% end %>
34
+
35
+ </div>
36
+ </div>
37
+
38
+ </div>
39
+ </div>
@@ -0,0 +1,43 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
12
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
13
+ <% end %>
14
+
15
+ <div class="field">
16
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
17
+ <%= f.password_field :password, autocomplete: "off" %>
18
+ <% if @minimum_password_length %>
19
+ <br />
20
+ <em><%= @minimum_password_length %> characters minimum</em>
21
+ <% end %>
22
+ </div>
23
+
24
+ <div class="field">
25
+ <%= f.label :password_confirmation %><br />
26
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
27
+ </div>
28
+
29
+ <div class="field">
30
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
31
+ <%= f.password_field :current_password, autocomplete: "off" %>
32
+ </div>
33
+
34
+ <div class="actions">
35
+ <%= f.submit "Update" %>
36
+ </div>
37
+ <% end %>
38
+
39
+ <h3>Cancel my account</h3>
40
+
41
+ <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
42
+
43
+ <%= link_to "Back", :back %>
@@ -0,0 +1,29 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div class="field">
7
+ <%= f.label :email %><br />
8
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9
+ </div>
10
+
11
+ <div class="field">
12
+ <%= f.label :password %>
13
+ <% if @minimum_password_length %>
14
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
15
+ <% end %><br />
16
+ <%= f.password_field :password, autocomplete: "off" %>
17
+ </div>
18
+
19
+ <div class="field">
20
+ <%= f.label :password_confirmation %><br />
21
+ <%= f.password_field :password_confirmation, autocomplete: "off" %>
22
+ </div>
23
+
24
+ <div class="actions">
25
+ <%= f.submit "Sign up" %>
26
+ </div>
27
+ <% end %>
28
+
29
+ <%= render "devise/shared/links" %>