lotus_admin 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f317d0e84d10ab899a19609c0e03378afb506fab67024def6db274083e7a3cc6
4
- data.tar.gz: 7aa186d47a96b63045c87c6c7d2a4e76db95b412f7e8acb38b709f3b6baf0819
3
+ metadata.gz: 0c9e4993cb32ec7a89ecade49298a80692670bc6e8153621ff8b7a3cd45e0228
4
+ data.tar.gz: 7dcb22bdec0562583224701e9ec891c06da97e3f07abdc2b4200babdc371a6e7
5
5
  SHA512:
6
- metadata.gz: 5c73a2575a6b9beca6f25d9345282d46a444709b3656ccdf91a4b430284417e42510cd4d5f503536aaf6016fb3aec20a7b23b2a96f0ed24a81bc80c6262cbef6
7
- data.tar.gz: 8f1604d2da4ef998d6d5f09f95d12aad05b151fc0a138fcc50d8c5cd3e7ce51c9da5a4ca013a92a75dc19d1aa34080e653cfdfb2ab46c12b3964936acd208785
6
+ metadata.gz: beb934c43516b3df224028237c5e9be65ffe0860ef29e44d401b32115cd6ba691fb23e592a04f7ad26e114a9967fbc4388c883856e1a5e757166a4134bb9548d
7
+ data.tar.gz: 38d23815c520035b15a1a87dc55447d008bcc88bf0666865846444bc366a56443bebfa5f262144030c2a9b794f4067ee9b650d9c734791ded083ece367f502c2
data/README.md CHANGED
@@ -37,7 +37,7 @@ $ bundle
37
37
  Add to your routes
38
38
  ```ruby
39
39
  # config/routes.rb
40
- mount LotusAdmin::Engine, at: 'admin'
40
+ LotusAdmin.router.install(self, at: 'admin')
41
41
  ```
42
42
 
43
43
  Seed an administrator account, optional.
@@ -2,6 +2,9 @@ module LotusAdmin::DeviseControllers
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
+ helper LotusAdmin::ApplicationHelper
6
+ helper LotusAdmin::FormHelpers
7
+
5
8
  layout 'lotus_admin/devise'
6
9
  end
7
10
  end
@@ -2,9 +2,6 @@
2
2
  - if controller_name != 'sessions'
3
3
  = link_to "Log in", new_session_path(resource_name)
4
4
  %br/
5
- - if devise_mapping.registerable? && controller_name != 'registrations'
6
- = link_to "Sign up", new_registration_path(resource_name)
7
- %br/
8
5
  - if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
9
6
  = link_to "Forgot your password?", new_password_path(resource_name)
10
7
  %br/
@@ -14,7 +14,7 @@
14
14
  Edit My Profile
15
15
 
16
16
  %li
17
- = link_to destroy_administrator_session_path, data: { method: :delete } do
17
+ = link_to destroy_session_path(current_administrator), data: { method: :delete } do
18
18
  %i.zmdi.zmdi-time-restore
19
19
  Logout
20
20
 
data/config/routes.rb CHANGED
@@ -1,11 +1,9 @@
1
1
  LotusAdmin::Engine.routes.draw do
2
- devise_for :administrators, class_name: LotusAdmin.configuration.user_class_name
3
-
4
2
  authenticate :administrator do
5
3
  resources :users
6
4
  resource :profile, only: [:edit, :update]
7
5
 
8
- LotusAdmin.install_routes!(self)
6
+ LotusAdmin.router.resources(self)
9
7
 
10
8
  root to: 'dashboard#show'
11
9
  end
@@ -4,11 +4,7 @@ module LotusAdmin
4
4
  attr_accessor :action_mailer_default_sender_address
5
5
 
6
6
  def routes(&block)
7
- routing_options.push(block)
8
- end
9
-
10
- def routing_options
11
- @routing_options ||= []
7
+ LotusAdmin.router.define(&block)
12
8
  end
13
9
 
14
10
  def filter_search_btn_css_classes
@@ -27,11 +23,5 @@ module LotusAdmin
27
23
  def user_class
28
24
  @user_class ||= user_class_name.constantize
29
25
  end
30
-
31
- def install_routes!(router)
32
- routing_options.each do |routes|
33
- router.instance_eval(&routes)
34
- end
35
- end
36
26
  end
37
27
  end
@@ -0,0 +1,45 @@
1
+ module LotusAdmin
2
+ class Router
3
+ def install(router, at: 'admin')
4
+ router.devise_for :administrators, devise_config
5
+
6
+ router.mount LotusAdmin::Engine, at: at
7
+ end
8
+
9
+ def resources(router)
10
+ resource_routes.each do |routes|
11
+ router.instance_eval(&routes)
12
+ end
13
+ end
14
+
15
+ def define(&block)
16
+ resource_routes.push(block)
17
+ end
18
+
19
+ def resource_routes
20
+ @resource_routes ||= []
21
+ end
22
+
23
+ private
24
+
25
+ def devise_config
26
+ {
27
+ class_name: user_class_name,
28
+ skip: :registrations,
29
+ controllers: devise_controllers
30
+ }
31
+ end
32
+
33
+ def devise_controllers
34
+ {
35
+ confirmations: 'lotus_admin/confirmations',
36
+ sessions: 'lotus_admin/sessions',
37
+ passwords: 'lotus_admin/passwords'
38
+ }
39
+ end
40
+
41
+ def user_class_name
42
+ LotusAdmin.configuration.user_class_name
43
+ end
44
+ end
45
+ end
@@ -1,3 +1,3 @@
1
1
  module LotusAdmin
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
data/lib/lotus_admin.rb CHANGED
@@ -19,6 +19,7 @@ require 'kaminari'
19
19
  require 'ransack'
20
20
 
21
21
  require 'lotus_admin/configuration'
22
+ require 'lotus_admin/router'
22
23
 
23
24
  module LotusAdmin
24
25
  module_function
@@ -31,7 +32,7 @@ module LotusAdmin
31
32
  @configuration ||= Configuration.new
32
33
  end
33
34
 
34
- def install_routes!(router)
35
- configuration.install_routes!(router)
35
+ def router
36
+ @router ||= Router.new
36
37
  end
37
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotus_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Millsaps-Brewer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-19 00:00:00.000000000 Z
11
+ date: 2020-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -435,6 +435,7 @@ files:
435
435
  - lib/lotus_admin.rb
436
436
  - lib/lotus_admin/configuration.rb
437
437
  - lib/lotus_admin/engine.rb
438
+ - lib/lotus_admin/router.rb
438
439
  - lib/lotus_admin/version.rb
439
440
  - lib/tasks/lotus_admin_tasks.rake
440
441
  - lib/templates/erb/scaffold/_form.html.erb