express_admin 1.7.31 → 1.7.32

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
  SHA1:
3
- metadata.gz: 842b9bb39a8cef50e485543dbe62fa800b429a9f
4
- data.tar.gz: 34d241abc792f0698d075ab0c40c9d8e3ced9fa0
3
+ metadata.gz: 2b7203cd11047e5af24b9b0b5e18712dc795a31b
4
+ data.tar.gz: d38502cbb43733b0148b3d6a83853fb7ffb473c8
5
5
  SHA512:
6
- metadata.gz: 927340d470ff5c607855802a79d882186923fba06189bc2a6fe30c6f06968eeebb2ba503685f21e340a24e17962c934c0cbf9321916688117cb36b9291436fba
7
- data.tar.gz: 5e87335613d2676cd2f01222f82a6d3b4b0db110efb1d4514b75a80482e759ebab813ffaf1e86a1b89b4597836a04141b8e5ded1d967f7ad5a3aec4858f5ddda
6
+ metadata.gz: e8a44e05cf7bec13d68307f375234f18cff805bc37924525e0ccfc0849ade392cca1f06f3ad291a08f9ab50f3eb3631b90d9b6ff2c71a8827674a9e17ebb6315
7
+ data.tar.gz: 3e20299dc4a5a07c4b6a2d1974404a2202cf59fe66a289844cee901ea4e0acb94a74c4cceee2d7dfa27cd19d3897f68b2972bcd06f7ec90a6db456ae8d2fe7ee
@@ -0,0 +1 @@
1
+ ExpressAdmin.initialize_current_user!
data/lib/express_admin.rb CHANGED
@@ -3,6 +3,11 @@ require "express_admin/engine"
3
3
  require "express_admin/routes"
4
4
  require "express_admin/commands"
5
5
  require "express_admin/commandable"
6
+ require "express_admin/current_user"
6
7
 
7
8
  module ExpressAdmin
9
+ def self.initialize_current_user!
10
+ ActionController::Base::send(:include, ExpressAdmin::CurrentUser)
11
+ puts "Added ExpressAdmin::CurrentUser to ActionController::Base"
12
+ end
8
13
  end
@@ -0,0 +1,25 @@
1
+ require 'request_store'
2
+
3
+ module ExpressAdmin
4
+ module CurrentUser
5
+ def self.included(base)
6
+ base.class_eval do
7
+ include InstanceMethods
8
+
9
+ before_action do
10
+ set_current_user
11
+ end
12
+ end
13
+ end
14
+
15
+ module InstanceMethods
16
+ def set_current_user
17
+ if defined? Devise
18
+ # This allows `current_user` (if defined) to be accessible
19
+ # outside a controller.
20
+ RequestStore[:current_user] = self.try(:current_user)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module ExpressAdmin
2
- VERSION = "1.7.31"
2
+ VERSION = "1.7.32"
3
3
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: express_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.31
4
+ version: 1.7.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Talcott Smith
@@ -480,8 +480,8 @@ files:
480
480
  - app/views/shared/express_admin/_navigation_bar.html.et
481
481
  - app/views/shared/express_admin/_navigation_bar_profile.html.et
482
482
  - app/views/shared/express_admin/_title.html.et
483
- - config/initializers/current_user.rb
484
483
  - config/initializers/gravatar_image_tag.rb
484
+ - config/initializers/initialize_current_user.rb
485
485
  - config/initializers/kaminari.rb
486
486
  - config/initializers/postgresql_trigram.rb
487
487
  - config/initializers/tinymce-rails.rb
@@ -492,6 +492,7 @@ files:
492
492
  - lib/express_admin.rb
493
493
  - lib/express_admin/commandable.rb
494
494
  - lib/express_admin/commands.rb
495
+ - lib/express_admin/current_user.rb
495
496
  - lib/express_admin/engine.rb
496
497
  - lib/express_admin/menu.rb
497
498
  - lib/express_admin/routes.rb
@@ -1,7 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- if defined? Devise
3
- before_filter do
4
- RequestStore[:current_user] = current_user
5
- end
6
- end
7
- end