rails-parts 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,16 @@ Merb parts ported to rails.
4
4
 
5
5
  As it's initial and a bit experimental implementation please note that API can change (currently it's copied from Merb)
6
6
 
7
+ == Install
8
+
9
+ Just add such line to Gemfile:
10
+
11
+ gem "rails-parts", :require => "parts"
12
+
13
+ and run:
14
+
15
+ bundle install
16
+
7
17
  == Usage
8
18
 
9
19
  Generate part class using rails generator:
@@ -22,5 +22,7 @@ module Parts
22
22
  super
23
23
  klass.helper :all
24
24
  end
25
+
26
+ ActiveSupport.run_load_hooks(:parts, self)
25
27
  end
26
28
  end
@@ -1,13 +1,28 @@
1
1
  require "parts"
2
2
  require 'rails'
3
+ begin
4
+ require "abstract_controller/railties/routes_helpers"
5
+ rescue LoadError
6
+ # not on edge :(
7
+ end
3
8
 
4
9
  module Parts
5
10
  class Railtie < Rails::Railtie
6
11
  initializer "parts.include_helpers" do |app|
7
12
  ActiveSupport.on_load(:action_controller) do
13
+ ActionView::Base.send(:include, Parts::Helpers)
8
14
  ActionController::Base.send(:include, Parts::Helpers)
9
15
  ActionController::Base.helper_method(:part)
10
16
  end
17
+
18
+ ActiveSupport.on_load(:parts) do
19
+ if app.routes.respond_to?(:mounted_helpers)
20
+ include app.routes.mounted_helpers
21
+ extend ::AbstractController::Railties::RoutesHelpers.with(app.routes)
22
+ else
23
+ include app.routes.url_helpers
24
+ end
25
+ end
11
26
  end
12
27
 
13
28
  initializer "parts.set_paths" do |app|
@@ -20,6 +35,7 @@ module Parts
20
35
  end
21
36
 
22
37
  Parts::Base.helpers_path = paths.app.helpers.to_a.first
38
+ Parts::Base.config[:assets_dir] = ActionController::Base.config.assets_dir
23
39
  end
24
40
  end
25
41
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-parts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Piotr Sarnacki
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-30 00:00:00 +02:00
18
+ date: 2010-09-23 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency