tkh_admin_panel 0.0.6 → 0.0.7

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.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
 
4
4
 
5
+
6
+ ## 0.0.7
7
+
8
+ * Added a switch_to_admin_layout controller extended instance method
9
+
10
+
5
11
  ## 0.0.6
6
12
 
7
13
  * Removed _admin_sidebar.html.erb dependency by having a placeholder template in this gem
data/README.md CHANGED
@@ -4,7 +4,7 @@ This is a Rails engine with an admin panel layout, assets and basic functionalit
4
4
 
5
5
  Primarily developed for Ten Thousand Hours but we are happy to share if anybody finds it useful.
6
6
 
7
- Please note that this gem is still in its embryonic phase. I'm just getting started.
7
+ Please note that this gem is still in its infancy. I'm just getting started.
8
8
 
9
9
  ## Installation
10
10
 
@@ -33,11 +33,9 @@ You need an authentication system with the current_user helper method
33
33
 
34
34
  ## Usage
35
35
 
36
- In your controller(s):
36
+ In your controller's relevant methods:
37
37
 
38
- $ render layout: 'admin'
39
-
40
- ... for whichever actions you want to use this layout
38
+ switch_to_admin_layout
41
39
 
42
40
 
43
41
  ## Contributing
@@ -0,0 +1,11 @@
1
+ module TkhAdminPanelActionControllerExtension
2
+ def self.included(base)
3
+ base.send(:include, InstanceMethods)
4
+ end
5
+
6
+ module InstanceMethods
7
+ def switch_to_admin_layout
8
+ render layout: 'admin'
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module TkhAdminPanel
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -1,11 +1,19 @@
1
1
  require "tkh_admin_panel/version"
2
2
  require 'bootstrap-sass'
3
3
  require 'simple_form'
4
+ require 'tkh_admin_panel/tkh_admin_panel_action_controller_extension'
4
5
 
5
6
  module TkhAdminPanel
6
7
  class Engine < ::Rails::Engine
7
8
  initializer "TkhAdminPanel precompile hook", :group => :all do |app|
8
9
  app.config.assets.precompile += ['admin.js', 'admin.css']
9
10
  end
11
+
12
+ # to extend the application_controller in the host app
13
+ initializer 'tkh_admin_panel.controller' do |app|
14
+ ActiveSupport.on_load(:action_controller) do
15
+ include TkhAdminPanelActionControllerExtension
16
+ end
17
+ end
10
18
  end
11
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_admin_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-29 00:00:00.000000000 Z
12
+ date: 2012-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -85,6 +85,7 @@ files:
85
85
  - lib/generators/tkh_admin_panel/install/install_generator.rb
86
86
  - lib/generators/tkh_admin_panel/install/templates/_admin_sidebar.html.erb
87
87
  - lib/tkh_admin_panel.rb
88
+ - lib/tkh_admin_panel/tkh_admin_panel_action_controller_extension.rb
88
89
  - lib/tkh_admin_panel/version.rb
89
90
  - public/.DS_Store
90
91
  - public/favicon.ico